You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ca...@apache.org on 2022/11/27 05:50:19 UTC
[iotdb] branch beyyes/fix_slot updated: perfect process in getSchemaPartition
This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a commit to branch beyyes/fix_slot
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/beyyes/fix_slot by this push:
new 5d7e1681ea perfect process in getSchemaPartition
5d7e1681ea is described below
commit 5d7e1681ea2bca9c8d730c20fd2ea889b56a7161
Author: Beyyes <cg...@foxmail.com>
AuthorDate: Sun Nov 27 13:49:58 2022 +0800
perfect process in getSchemaPartition
---
.../iotdb/confignode/manager/ConfigManager.java | 38 ++++++++++++----------
1 file changed, 21 insertions(+), 17 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
index 484c7727e8..6b074f834c 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/manager/ConfigManager.java
@@ -485,26 +485,30 @@ public class ConfigManager implements IManager {
Map<String, Set<TSeriesPartitionSlot>> partitionSlotsMap = new HashMap<>();
List<PartialPath> relatedPaths = patternTree.getAllPathPatterns();
List<String> allStorageGroups = getClusterSchemaManager().getStorageGroupNames();
+ List<PartialPath> allStorageGroupPaths = new ArrayList<>();
+ for (String storageGroup : allStorageGroups) {
+ try {
+ allStorageGroupPaths.add(new PartialPath(storageGroup));
+ } catch (IllegalPathException e) {
+ throw new RuntimeException(e);
+ }
+ }
Map<String, Boolean> scanAllRegions = new HashMap<>();
for (PartialPath path : relatedPaths) {
- for (String storageGroup : allStorageGroups) {
- try {
- PartialPath storageGroupPath = new PartialPath(storageGroup);
- if (path.overlapWith(storageGroupPath.concatNode(MULTI_LEVEL_PATH_WILDCARD))
- && !scanAllRegions.containsKey(storageGroup)) {
- List<TSeriesPartitionSlot> relatedSlot = calculateRelatedSlot(path, storageGroupPath);
- if (relatedSlot.isEmpty()) {
- scanAllRegions.put(storageGroup, true);
- partitionSlotsMap.put(storageGroup, new HashSet<>());
- } else {
- partitionSlotsMap
- .computeIfAbsent(storageGroup, k -> new HashSet<>())
- .addAll(relatedSlot);
- }
+ for (int i = 0; i < allStorageGroups.size(); i++) {
+ String storageGroup = allStorageGroups.get(i);
+ PartialPath storageGroupPath = allStorageGroupPaths.get(i);
+ if (path.overlapWith(storageGroupPath.concatNode(MULTI_LEVEL_PATH_WILDCARD))
+ && !scanAllRegions.containsKey(storageGroup)) {
+ List<TSeriesPartitionSlot> relatedSlot = calculateRelatedSlot(path, storageGroupPath);
+ if (relatedSlot.isEmpty()) {
+ scanAllRegions.put(storageGroup, true);
+ partitionSlotsMap.put(storageGroup, new HashSet<>());
+ } else {
+ partitionSlotsMap
+ .computeIfAbsent(storageGroup, k -> new HashSet<>())
+ .addAll(relatedSlot);
}
- } catch (IllegalPathException e) {
- // this line won't be reached in general
- throw new RuntimeException(e);
}
}
}