You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by lt...@apache.org on 2021/03/10 13:01:04 UTC

[iotdb] branch fix_1194 created (now 6ca6a82)

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

lta pushed a change to branch fix_1194
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at 6ca6a82  fix a bug of checking time partition in DeviceTimeIndex

This branch includes the following new commits:

     new 6ca6a82  fix a bug of checking time partition in DeviceTimeIndex

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: fix a bug of checking time partition in DeviceTimeIndex

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

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

commit 6ca6a82f287742018286b187c906cf08771dbc72
Author: lta <li...@163.com>
AuthorDate: Wed Mar 10 21:00:28 2021 +0800

    fix a bug of checking time partition in DeviceTimeIndex
---
 .../storagegroup/timeindex/DeviceTimeIndex.java    | 32 +++++++++-------------
 1 file changed, 13 insertions(+), 19 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/timeindex/DeviceTimeIndex.java b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/timeindex/DeviceTimeIndex.java
index c5ce7b8..90341b0 100644
--- a/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/timeindex/DeviceTimeIndex.java
+++ b/server/src/main/java/org/apache/iotdb/db/engine/storagegroup/timeindex/DeviceTimeIndex.java
@@ -19,14 +19,6 @@
 
 package org.apache.iotdb.db.engine.storagegroup.timeindex;
 
-import org.apache.iotdb.db.engine.StorageEngine;
-import org.apache.iotdb.db.exception.PartitionViolationException;
-import org.apache.iotdb.db.rescon.CachedStringPool;
-import org.apache.iotdb.db.utils.FilePathUtils;
-import org.apache.iotdb.db.utils.SerializeUtils;
-import org.apache.iotdb.tsfile.utils.RamUsageEstimator;
-import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
-
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -36,6 +28,13 @@ import java.util.Map;
 import java.util.Map.Entry;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
+import org.apache.iotdb.db.engine.StorageEngine;
+import org.apache.iotdb.db.exception.PartitionViolationException;
+import org.apache.iotdb.db.rescon.CachedStringPool;
+import org.apache.iotdb.db.utils.FilePathUtils;
+import org.apache.iotdb.db.utils.SerializeUtils;
+import org.apache.iotdb.tsfile.utils.RamUsageEstimator;
+import org.apache.iotdb.tsfile.utils.ReadWriteIOUtils;
 
 public class DeviceTimeIndex implements ITimeIndex {
 
@@ -244,8 +243,8 @@ public class DeviceTimeIndex implements ITimeIndex {
   @Override
   public long getTimePartitionWithCheck(String tsfilePath) throws PartitionViolationException {
     long partitionId = -1;
-    for (Long startTime : startTimes) {
-      long p = StorageEngine.getTimePartition(startTime);
+    for (int index : deviceToIndex.values()) {
+      long p = StorageEngine.getTimePartition(startTimes[index]);
       if (partitionId == -1) {
         partitionId = p;
       } else {
@@ -253,15 +252,10 @@ public class DeviceTimeIndex implements ITimeIndex {
           throw new PartitionViolationException(tsfilePath);
         }
       }
-    }
-    for (Long endTime : endTimes) {
-      long p = StorageEngine.getTimePartition(endTime);
-      if (partitionId == -1) {
-        partitionId = p;
-      } else {
-        if (partitionId != p) {
-          throw new PartitionViolationException(tsfilePath);
-        }
+
+      p = StorageEngine.getTimePartition(endTimes[index]);
+      if (partitionId != p) {
+        throw new PartitionViolationException(tsfilePath);
       }
     }
     if (partitionId == -1) {