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

ejttianyu pushed a commit to branch fix_tsfile_tool
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git

commit 09afa96948c01fd4d7a43a132dcc0934e59a33c4
Author: EJTTianyu <[email protected]>
AuthorDate: Tue May 19 11:21:17 2020 +0800

    fix tsfile tool
---
 .../apache/iotdb/db/tools/IoTDBDataDirViewer.java    | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java 
b/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java
index 262de5f..68c2857 100644
--- a/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java
+++ b/server/src/main/java/org/apache/iotdb/db/tools/IoTDBDataDirViewer.java
@@ -100,13 +100,29 @@ public class IoTDBDataDirViewer {
     File[] files = storageGroup.listFiles();
     if (files == null) {
       throw new IOException(
-          "Irregular data dir structure.There should be tsfiles under "
+          "Irregular data dir structure.There should be timeInterval 
directories under "
               + "the storage group directory " + storageGroup.getName());
     }
     List<File> fileList = Arrays.asList(files);
     fileList.sort(((o1, o2) -> o1.getName().compareTo(o2.getName())));
     for (File file : files) {
       printlnBoth(pw, "|  |  |--" + file.getName());
+      printFilesInTimeInterval(file, pw);
+    }
+  }
+
+  private static void printFilesInTimeInterval(File timeInterval, PrintWriter 
pw)
+      throws IOException {
+    File[] files = timeInterval.listFiles();
+    if (files == null) {
+      throw new IOException(
+          "Irregular data dir structure.There should be tsfiles under "
+              + "the timeInterval directories directory " + 
timeInterval.getName());
+    }
+    List<File> fileList = Arrays.asList(files);
+    fileList.sort(((o1, o2) -> o1.getName().compareTo(o2.getName())));
+    for (File file : files) {
+      printlnBoth(pw, "|  |  |  |--" + file.getName());
 
       // To print the content if it is a tsfile.resource
       if (file.getName().endsWith(".tsfile.resource")) {
@@ -123,7 +139,7 @@ public class IoTDBDataDirViewer {
     SortedSet<String> keys = new 
TreeSet<>(resource.getStartTimeMap().keySet());
     for (String device : keys) {
       printlnBoth(pw,
-          String.format("|  |  |  |--device %s, start time %d (%s), end time 
%d (%s)", device,
+          String.format("|  |  |  |  |--device %s, start time %d (%s), end 
time %d (%s)", device,
               resource.getStartTimeMap().get(device), DatetimeUtils
                   
.convertMillsecondToZonedDateTime(resource.getStartTimeMap().get(device)),
               resource.getEndTimeMap().get(device), DatetimeUtils

Reply via email to