This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 4f101d8acf [IOTDB-3246]Improve Validation tool (#6066)
4f101d8acf is described below

commit 4f101d8acf13d4a4ad2f0bbae737547cf56efc96
Author: 周沛辰 <[email protected]>
AuthorDate: Mon May 30 15:37:00 2022 +0800

    [IOTDB-3246]Improve Validation tool (#6066)
---
 .../iotdb/db/tools/validate/TsFileValidationTool.java       | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/tools/validate/TsFileValidationTool.java
 
b/server/src/main/java/org/apache/iotdb/db/tools/validate/TsFileValidationTool.java
index d69d31c061..5be1417c99 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/tools/validate/TsFileValidationTool.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/tools/validate/TsFileValidationTool.java
@@ -122,8 +122,12 @@ public class TsFileValidationTool {
           if (!checkIsDirectory(dataRegionDir)) {
             continue;
           }
-          // get time partition dir
-          File[] timePartitionDirs = dataRegionDir.listFiles();
+          // get time partition dirs and sort them
+          List<File> timePartitionDirs =
+              Arrays.asList(Objects.requireNonNull(dataRegionDir.listFiles()));
+          timePartitionDirs.sort(
+              (f1, f2) ->
+                  Long.compareUnsigned(Long.parseLong(f1.getName()), 
Long.parseLong(f2.getName())));
           for (File timePartitionDir : 
Objects.requireNonNull(timePartitionDirs)) {
             if (!checkIsDirectory(timePartitionDir)) {
               continue;
@@ -390,7 +394,10 @@ public class TsFileValidationTool {
         }
       } catch (Throwable e) {
         logger.error("Meet errors in reading file {} , skip it.", 
tsFile.getAbsolutePath(), e);
-        printBoth("-- Meet errors in reading file " + 
tsFile.getAbsolutePath());
+        printBoth(
+            "-- Meet errors in reading file "
+                + tsFile.getAbsolutePath()
+                + ", tsfile may be corrupted.");
       }
     }
   }

Reply via email to