You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/11/28 03:19:59 UTC

[iotdb] branch fix_split_data_bug created (now 0a11a6336e)

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

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


      at 0a11a6336e fix data inserted into incorrect data region

This branch includes the following new commits:

     new 0a11a6336e fix data inserted into incorrect data region

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 data inserted into incorrect data region

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

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

commit 0a11a6336e8587eda041c9e4c4deff2f933b4497
Author: HTHou <hh...@outlook.com>
AuthorDate: Mon Nov 28 11:18:33 2022 +0800

    fix data inserted into incorrect data region
---
 .../org/apache/iotdb/commons/partition/DataPartition.java   | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java b/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
index c9c4514cc5..2d35b2a40b 100644
--- a/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
+++ b/node-commons/src/main/java/org/apache/iotdb/commons/partition/DataPartition.java
@@ -91,10 +91,15 @@ public class DataPartition extends Partition {
     TSeriesPartitionSlot seriesPartitionSlot = calculateDeviceGroupId(deviceName);
     // IMPORTANT TODO: (xingtanzjr) need to handle the situation for write operation that there are
     // more than 1 Regions for one timeSlot
-    return dataPartitionMap.get(storageGroup).get(seriesPartitionSlot).entrySet().stream()
-        .filter(entry -> timePartitionSlotList.contains(entry.getKey()))
-        .flatMap(entry -> entry.getValue().stream())
-        .collect(Collectors.toList());
+    List<TRegionReplicaSet> dataRegionReplicaSets = new ArrayList<>();
+    Map<TSeriesPartitionSlot, Map<TTimePartitionSlot, List<TRegionReplicaSet>>>
+        dataBasePartitionMap = dataPartitionMap.get(storageGroup);
+    Map<TTimePartitionSlot, List<TRegionReplicaSet>> slotReplicaSetMap =
+        dataBasePartitionMap.get(seriesPartitionSlot);
+    for (TTimePartitionSlot timePartitionSlot : timePartitionSlotList) {
+      dataRegionReplicaSets.addAll(slotReplicaSetMap.get(timePartitionSlot));
+    }
+    return dataRegionReplicaSets;
   }
 
   public TRegionReplicaSet getDataRegionReplicaSetForWriting(