From 42844460af7821fe77b38c43c09bc0df4baed65a Mon Sep 17 00:00:00 2001 From: wudi <676366545@qq.com> Date: Mon, 2 Dec 2024 14:18:15 +0800 Subject: [PATCH] update --- .../apache/doris/flink/sink/writer/LabelGenerator.java | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/flink-doris-connector/src/main/java/org/apache/doris/flink/sink/writer/LabelGenerator.java b/flink-doris-connector/src/main/java/org/apache/doris/flink/sink/writer/LabelGenerator.java index 225446859..d80315f55 100644 --- a/flink-doris-connector/src/main/java/org/apache/doris/flink/sink/writer/LabelGenerator.java +++ b/flink-doris-connector/src/main/java/org/apache/doris/flink/sink/writer/LabelGenerator.java @@ -55,9 +55,8 @@ public String generateTableLabel(long chkId) { Preconditions.checkState(tableIdentifier != null); String label = String.format("%s_%s_%s_%s", labelPrefix, tableIdentifier, subtaskId, chkId); - String uuid = UUID.randomUUID().toString().replace("-", ""); if (!enable2PC) { - label = label + "_" + uuid; + label = label + "_" + UUID.randomUUID(); } if (LABEL_PATTERN.matcher(label).matches()) { @@ -69,14 +68,14 @@ public String generateTableLabel(long chkId) { // In 2pc, replace uuid with the table name. This will cause some txns to fail to be // aborted when aborting. // Later, the label needs to be stored in the state and aborted through label - return String.format("%s_%s_%s_%s", labelPrefix, uuid, subtaskId, chkId); + return String.format("%s_%s_%s_%s", labelPrefix, UUID.randomUUID(), subtaskId, chkId); } else { - return String.format("%s_%s_%s_%s", labelPrefix, subtaskId, chkId, uuid); + return String.format("%s_%s_%s_%s", labelPrefix, subtaskId, chkId, UUID.randomUUID()); } } public String generateBatchLabel(String table) { - String uuid = UUID.randomUUID().toString().replace("-", ""); + String uuid = UUID.randomUUID().toString(); String label = String.format("%s_%s_%s", labelPrefix, table, uuid); if (!LABEL_PATTERN.matcher(label).matches()) { return labelPrefix + "_" + uuid;