You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by su...@apache.org on 2020/12/01 02:44:57 UTC

[iotdb] branch jira-1035 created (now 213110b)

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

sunzesong pushed a change to branch jira-1035
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 213110b  [IOTDB-1035] Fix bug in getDeviceTimeseriesMetadata when querying non-exist device

This branch includes the following new commits:

     new 213110b  [IOTDB-1035] Fix bug in getDeviceTimeseriesMetadata when querying non-exist device

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



[iotdb] 01/01: [IOTDB-1035] Fix bug in getDeviceTimeseriesMetadata when querying non-exist device

Posted by su...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

sunzesong pushed a commit to branch jira-1035
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 213110b1b17fe694f1a5f66a66bf32a7fc80fe0c
Author: samperson1997 <sz...@mails.tsinghua.edu.cn>
AuthorDate: Tue Dec 1 10:44:24 2020 +0800

    [IOTDB-1035] Fix bug in getDeviceTimeseriesMetadata when querying non-exist device
---
 .../apache/iotdb/tsfile/read/TsFileSequenceReader.java | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
index 16f932e..432b70b 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/read/TsFileSequenceReader.java
@@ -601,7 +601,7 @@ public class TsFileSequenceReader implements AutoCloseable {
   private List<TimeseriesMetadata> getDeviceTimeseriesMetadata(String device) throws IOException {
     MetadataIndexNode metadataIndexNode = tsFileMetaData.getMetadataIndex();
     Pair<MetadataIndexEntry, Long> metadataIndexPair = getMetadataAndEndOffset(
-        metadataIndexNode, device, MetadataIndexNodeType.INTERNAL_DEVICE, false);
+        metadataIndexNode, device, MetadataIndexNodeType.INTERNAL_DEVICE, true);
     if (metadataIndexPair == null) {
       return Collections.emptyList();
     }
@@ -634,17 +634,15 @@ public class TsFileSequenceReader implements AutoCloseable {
    */
   private Pair<MetadataIndexEntry, Long> getMetadataAndEndOffset(MetadataIndexNode metadataIndex,
       String name, MetadataIndexNodeType type, boolean exactSearch) throws IOException {
-    Pair<MetadataIndexEntry, Long> childIndexEntry = metadataIndex
-        .getChildIndexEntry(name, exactSearch);
-    if (childIndexEntry == null) {
-      return null;
-    }
     if (!metadataIndex.getNodeType().equals(type)) {
-      return childIndexEntry;
+      return metadataIndex.getChildIndexEntry(name, exactSearch);
+    } else {
+      Pair<MetadataIndexEntry, Long> childIndexEntry = metadataIndex
+          .getChildIndexEntry(name, false);
+      ByteBuffer buffer = readData(childIndexEntry.left.getOffset(), childIndexEntry.right);
+      return getMetadataAndEndOffset(MetadataIndexNode.deserializeFrom(buffer), name, type,
+          false);
     }
-    ByteBuffer buffer = readData(childIndexEntry.left.getOffset(), childIndexEntry.right);
-    return getMetadataAndEndOffset(MetadataIndexNode.deserializeFrom(buffer), name, type,
-        exactSearch);
   }
 
   /**