You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/08/19 14:46:14 UTC

[GitHub] [iotdb] MrQuansy commented on a diff in pull request #7066: [IOTDB-4152]Fix tablet split by time partition error

MrQuansy commented on code in PR #7066:
URL: https://github.com/apache/iotdb/pull/7066#discussion_r950266976


##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertTabletNode.java:
##########
@@ -236,48 +236,42 @@ public List<WritePlanNode> splitByPartition(Analysis analysis) {
       // generate a new times and values
       locs = entry.getValue();
       // Avoid using system arraycopy when there is no need to split
-      if (splitMap.size() == 1) {
+      if (splitMap.size() == 1 && locs.size() == 1) {

Review Comment:
   Why add "locs.size()==1"?



##########
server/src/main/java/org/apache/iotdb/db/mpp/plan/planner/plan/node/write/InsertTabletNode.java:
##########
@@ -236,48 +236,42 @@ public List<WritePlanNode> splitByPartition(Analysis analysis) {
       // generate a new times and values
       locs = entry.getValue();
       // Avoid using system arraycopy when there is no need to split
-      if (splitMap.size() == 1) {
+      if (splitMap.size() == 1 && locs.size() == 1) {
         setRange(locs);
         setDataRegionReplicaSet(entry.getKey());
         result.add(this);
         return result;
       }
-      int count = 0;
-      for (int i = 0; i < locs.size(); i += 2) {
-        int start = locs.get(i);
-        int end = locs.get(i + 1);
-        count += end - start;
-      }
-      long[] subTimes = new long[count];
-      int destLoc = 0;
-      Object[] values = initTabletValues(dataTypes.length, count, dataTypes);
-      BitMap[] bitMaps = this.bitMaps == null ? null : initBitmaps(dataTypes.length, count);
       for (int i = 0; i < locs.size(); i += 2) {
         int start = locs.get(i);
         int end = locs.get(i + 1);
+        int count = end - start;
+        long[] subTimes = new long[count];
+        int destLoc = 0;
+        Object[] values = initTabletValues(dataTypes.length, count, dataTypes);
+        BitMap[] bitMaps = this.bitMaps == null ? null : initBitmaps(dataTypes.length, count);

Review Comment:
   This will create more than one insert tablet node of a same target replicaset. We merge there nodes into one node before.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: reviews-unsubscribe@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org