You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2021/09/29 03:46:07 UTC

[GitHub] [iotdb] wangchao316 commented on a change in pull request #4054: [IOTDB-1758] sync-tool, empty uuid file cause tool can not auto-recovery

wangchao316 commented on a change in pull request #4054:
URL: https://github.com/apache/iotdb/pull/4054#discussion_r718129971



##########
File path: server/src/main/java/org/apache/iotdb/db/sync/sender/transfer/SyncClient.java
##########
@@ -339,27 +339,44 @@ public void confirmIdentity() throws SyncConnectionException {
 
   /** UUID marks the identity of sender for receiver. */
   private String getOrCreateUUID(File uuidFile) throws IOException {
-    String uuid;
     if (!uuidFile.getParentFile().exists()) {
       uuidFile.getParentFile().mkdirs();
     }
-    if (!uuidFile.exists()) {
-      try (FileOutputStream out = new FileOutputStream(uuidFile)) {
-        uuid = generateUUID();
-        out.write(uuid.getBytes());
-      } catch (IOException e) {
-        logger.error("Cannot insert UUID to file {}", uuidFile.getPath());
-        throw new IOException(e);
+
+    boolean hasCreatNewUuidFile = false;
+    for (int i = 0; i < 2; i++) {
+      if (!uuidFile.exists()) {

Review comment:
       hi , why use for 2 twice?
   




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org