You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by xi...@apache.org on 2023/01/31 15:18:06 UTC

[iotdb] branch geely_car updated (35355c351b -> 84af179d1f)

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

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


 discard 35355c351b add isAllPartitionsExist judgement
 discard b6b295da89 print dataPartitionQueryParams
 discard b4ab0a22b8 Merge branch 'geely_car' of https://github.com/apache/iotdb into geely_car
 discard 3c7bcb9dc4 Formatting getOrCreatePartitionTable logs
 discard 74bf6f8c26 recover SessionExample
 discard a6fe4094a7 print DataPartitionMap in datanode
 discard a42f19adaf add log
     new 84af179d1f fix the bug that timePartition cannot be found sometimes

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (35355c351b)
            \
             N -- N -- N   refs/heads/geely_car (84af179d1f)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

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.


Summary of changes:
 .../iotdb/confignode/manager/ConfigManager.java    | 90 ++--------------------
 .../manager/partition/PartitionManager.java        |  6 +-
 .../iotdb/commons/partition/DataPartition.java     | 26 ++-----
 .../commons/partition/DataPartitionQueryParam.java | 11 ---
 .../mpp/plan/analyze/ClusterPartitionFetcher.java  | 48 ++++++++----
 5 files changed, 48 insertions(+), 133 deletions(-)


[iotdb] 01/01: fix the bug that timePartition cannot be found sometimes

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

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

commit 84af179d1fd0e4674a2501b1509a5c49a4d63564
Author: Jinrui.Zhang <xi...@gmail.com>
AuthorDate: Tue Jan 31 23:17:42 2023 +0800

    fix the bug that timePartition cannot be found sometimes
---
 .../java/org/apache/iotdb/db/conf/IoTDBConfig.java |  2 +-
 .../mpp/plan/analyze/ClusterPartitionFetcher.java  | 45 ++++++++++++++++------
 2 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
index e5092a0b1f..c44a1b81dc 100644
--- a/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
+++ b/server/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java
@@ -875,7 +875,7 @@ public class IoTDBConfig {
    * series partition
    */
   private String seriesPartitionExecutorClass =
-      "org.apache.iotdb.commons.partition.executor.hash.APHashExecutor";
+      "org.apache.iotdb.commons.partition.executor.hash.BKDRHashExecutor";
 
   /** The number of series partitions in a database */
   private int seriesPartitionSlotNum = 10000;
diff --git a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java
index 029c878114..117dc169ed 100644
--- a/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java
+++ b/server/src/main/java/org/apache/iotdb/db/mpp/plan/analyze/ClusterPartitionFetcher.java
@@ -58,9 +58,11 @@ import java.io.IOException;
 import java.nio.ByteBuffer;
 import java.util.ArrayList;
 import java.util.HashMap;
+import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 public class ClusterPartitionFetcher implements IPartitionFetcher {
 
@@ -260,9 +262,8 @@ public class ClusterPartitionFetcher implements IPartitionFetcher {
     if (null == dataPartition) {
       try (ConfigNodeClient client =
           configNodeClientManager.borrowClient(ConfigNodeInfo.configNodeRegionId)) {
-        TDataPartitionTableResp dataPartitionTableResp =
-            client.getOrCreateDataPartitionTable(
-                constructDataPartitionReq(splitDataPartitionQueryParams));
+        TDataPartitionReq req = constructDataPartitionReq(splitDataPartitionQueryParams);
+        TDataPartitionTableResp dataPartitionTableResp = client.getOrCreateDataPartitionTable(req);
 
         if (dataPartitionTableResp.getStatus().getCode()
             == TSStatusCode.SUCCESS_STATUS.getStatusCode()) {
@@ -346,6 +347,22 @@ public class ClusterPartitionFetcher implements IPartitionFetcher {
     }
   }
 
+  private static class ComplexTimeSlotList {
+    Set<TTimePartitionSlot> timeSlotList;
+    boolean needLeftAll;
+    boolean needRightAll;
+
+    private ComplexTimeSlotList() {
+      timeSlotList = new HashSet<>();
+      needLeftAll = false;
+      needRightAll = false;
+    }
+
+    private void putTimeSlot(List<TTimePartitionSlot> slotList) {
+      timeSlotList.addAll(slotList);
+    }
+  }
+
   private TDataPartitionReq constructDataPartitionReq(
       Map<String, List<DataPartitionQueryParam>> sgNameToQueryParamsMap) {
     Map<String, Map<TSeriesPartitionSlot, TTimeSlotList>> partitionSlotsMap = new HashMap<>();
@@ -353,16 +370,22 @@ public class ClusterPartitionFetcher implements IPartitionFetcher {
         sgNameToQueryParamsMap.entrySet()) {
       // for each sg
       Map<TSeriesPartitionSlot, TTimeSlotList> deviceToTimePartitionMap = new HashMap<>();
+
+      Map<TSeriesPartitionSlot, ComplexTimeSlotList> seriesSlotTimePartitionMap = new HashMap<>();
+
       for (DataPartitionQueryParam queryParam : entry.getValue()) {
-        TTimeSlotList timePartitionSlotList =
-            new TTimeSlotList(
-                queryParam.getTimePartitionSlotList(),
-                queryParam.isNeedLeftAll(),
-                queryParam.isNeedRightAll());
-        deviceToTimePartitionMap.put(
-            partitionExecutor.getSeriesPartitionSlot(queryParam.getDevicePath()),
-            timePartitionSlotList);
+        seriesSlotTimePartitionMap
+            .computeIfAbsent(
+                partitionExecutor.getSeriesPartitionSlot(queryParam.getDevicePath()),
+                k -> new ComplexTimeSlotList())
+            .putTimeSlot(queryParam.getTimePartitionSlotList());
       }
+      seriesSlotTimePartitionMap.forEach(
+          (k, v) ->
+              deviceToTimePartitionMap.put(
+                  k,
+                  new TTimeSlotList(
+                      new ArrayList<>(v.timeSlotList), v.needLeftAll, v.needRightAll)));
       partitionSlotsMap.put(entry.getKey(), deviceToTimePartitionMap);
     }
     return new TDataPartitionReq(partitionSlotsMap);