jt2594838 commented on code in PR #13296:
URL: https://github.com/apache/iotdb/pull/13296#discussion_r1731073827


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/tools/validate/TsFileOverlapValidationAndRepairTool.java:
##########
@@ -82,42 +82,76 @@ private static boolean 
confirmMoveOverlapFilesToUnsequenceSpace() {
     return "y".equals(input);
   }
 
-  private static void moveOverlapFilesToUnsequenceSpace(Set<File> toMoveFiles) 
{
-    for (File f : toMoveFiles) {
-      if (!f.exists()) {
-        System.out.println(f.getAbsolutePath() + "is not exist in repairing");
-        continue;
-      }
-      String filePath = f.getAbsolutePath();
-      String replaceStr = File.separator + "sequence" + File.separator;
-      String replaceToStr = File.separator + "unsequence" + File.separator;
-      int sequenceDirIndex = filePath.indexOf(replaceStr);
-      if (sequenceDirIndex == -1) {
-        continue;
-      }
-      String moveToPath =
-          filePath.substring(0, sequenceDirIndex)
-              + replaceToStr
-              + filePath.substring(sequenceDirIndex + replaceStr.length());
-      File targetFile = new File(moveToPath);
-      File targetParentFile = targetFile.getParentFile();
-      if (targetParentFile.exists()) {
-        targetParentFile.mkdirs();
-      }
-      boolean success = f.renameTo(targetFile);
-      if (!success) {
-        System.out.println("Failed to repair " + f.getAbsolutePath());
-      }
-      System.out.println("Repair file " + targetFile.getName());
+  private static void moveOverlapFilesToUnsequenceSpace(Set<TsFileResource> 
toMoveResources)
+      throws IOException {
+    for (TsFileResource resource : toMoveResources) {
+      moveSeqResourceToUnsequenceDir(resource);
     }
   }
 
+  private static void moveSeqResourceToUnsequenceDir(TsFileResource resource) 
throws IOException {
+    if (!resource.tsFileExists()) {
+      System.out.println(resource.getTsFile().getAbsolutePath() + " is not 
exist when repairing");

Review Comment:
   is not exist -> does not exist



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to