You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2022/05/27 02:06:29 UTC
[iotdb] branch rewriteTool updated: sort time partition dir (#6041)
This is an automated email from the ASF dual-hosted git repository.
xiangweiwei pushed a commit to branch rewriteTool
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rewriteTool by this push:
new fb00126fef sort time partition dir (#6041)
fb00126fef is described below
commit fb00126fef784271f7a7d9e4f0ec2a6a83b35da1
Author: 周沛辰 <45...@users.noreply.github.com>
AuthorDate: Fri May 27 10:06:25 2022 +0800
sort time partition dir (#6041)
---
rewriteBadFile/pom.xml | 4 ++--
.../src/main/java/org/apache/iotdb/TsFileValidationTool.java | 10 +++++++---
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/rewriteBadFile/pom.xml b/rewriteBadFile/pom.xml
index 7953a5e9e5..77b9ead6b9 100644
--- a/rewriteBadFile/pom.xml
+++ b/rewriteBadFile/pom.xml
@@ -56,7 +56,7 @@
</plugins>
</build>
<properties>
- <maven.compiler.source>11</maven.compiler.source>
- <maven.compiler.target>11</maven.compiler.target>
+ <maven.compiler.source>8</maven.compiler.source>
+ <maven.compiler.target>8</maven.compiler.target>
</properties>
</project>
diff --git a/rewriteBadFile/src/main/java/org/apache/iotdb/TsFileValidationTool.java b/rewriteBadFile/src/main/java/org/apache/iotdb/TsFileValidationTool.java
index 863c3c41ef..58c02f359c 100644
--- a/rewriteBadFile/src/main/java/org/apache/iotdb/TsFileValidationTool.java
+++ b/rewriteBadFile/src/main/java/org/apache/iotdb/TsFileValidationTool.java
@@ -120,9 +120,13 @@ public class TsFileValidationTool {
if (!checkIsDirectory(dataRegionDir)) {
continue;
}
- // get time partition dir
- File[] timePartitionDirs = dataRegionDir.listFiles();
- for (File timePartitionDir : Objects.requireNonNull(timePartitionDirs)) {
+ // 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 : timePartitionDirs) {
if (!checkIsDirectory(timePartitionDir)) {
continue;
}