This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a commit to branch beyyes/master1
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/beyyes/master1 by this push:
new 32cdef0f30 perfect addRegionNewLocation, removeRegionOldLocation in
StorageGroupPartitionTable
32cdef0f30 is described below
commit 32cdef0f30f98e61178e75a1b015299f10be288b
Author: Beyyes <[email protected]>
AuthorDate: Sat Nov 5 22:37:51 2022 +0800
perfect addRegionNewLocation, removeRegionOldLocation in
StorageGroupPartitionTable
---
.../confignode/persistence/partition/PartitionInfo.java | 4 ++--
.../persistence/partition/StorageGroupPartitionTable.java | 12 ++++++------
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
index 82a461375a..6d2ca47e58 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/PartitionInfo.java
@@ -481,8 +481,8 @@ public class PartitionInfo implements SnapshotProcessor {
TDataNodeLocation oldNode = req.getOldNode();
TDataNodeLocation newNode = req.getNewNode();
storageGroupPartitionTables
- .values()
- .forEach(s -> s.updateRegionLocation(regionId, oldNode, newNode));
+ .values().stream().filter(sgPartitionTable ->
sgPartitionTable.containRegion(regionId))
+ .forEach(sgPartitionTable ->
sgPartitionTable.updateRegionLocation(regionId, oldNode, newNode));
return status;
}
diff --git
a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/StorageGroupPartitionTable.java
b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/StorageGroupPartitionTable.java
index 5e98a80c3d..dd2e859e7e 100644
---
a/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/StorageGroupPartitionTable.java
+++
b/confignode/src/main/java/org/apache/iotdb/confignode/persistence/partition/StorageGroupPartitionTable.java
@@ -432,11 +432,12 @@ public class StorageGroupPartitionTable {
private void addRegionNewLocation(TConsensusGroupId regionId,
TDataNodeLocation node) {
RegionGroup regionGroup = regionGroupMap.get(regionId);
if (regionGroup == null) {
- LOGGER.warn("Cannot find RegionGroup in addRegionNewLocation for region
{}", regionId);
+ LOGGER.warn("Cannot find RegionGroup for region {} when
addRegionNewLocation in {}", regionId, storageGroupName);
return;
}
if (regionGroup.getReplicaSet().getDataNodeLocations().contains(node)) {
- LOGGER.info("Node is already in region locations, node: {}, region: {}",
node, regionId);
+ LOGGER.info("Node is already in region locations when
addRegionNewLocation in {}, node: {}, region: {}",
+ storageGroupName, node, regionId);
return;
}
regionGroup.getReplicaSet().getDataNodeLocations().add(node);
@@ -445,14 +446,13 @@ public class StorageGroupPartitionTable {
private void removeRegionOldLocation(TConsensusGroupId regionId,
TDataNodeLocation node) {
RegionGroup regionGroup = regionGroupMap.get(regionId);
if (regionGroup == null) {
- LOGGER.warn("Cannot find RegionGroup in removeRegionOldLocation for
region {}", regionId);
+ LOGGER.warn("Cannot find RegionGroup for region {} when
removeRegionOldLocation in {}", regionId, storageGroupName);
return;
}
if (!regionGroup.getReplicaSet().getDataNodeLocations().contains(node)) {
LOGGER.info(
- "Node is not in region locations, no need to remove it, node: {},
region: {}",
- node,
- regionId);
+ "Node is not in region locations when removeRegionOldLocation in {},
no need to remove it, node: {}, region: {}",
+ storageGroupName, node, regionId);
return;
}
regionGroup.getReplicaSet().getDataNodeLocations().remove(node);