hongzhi-gao commented on code in PR #18081:
URL: https://github.com/apache/iotdb/pull/18081#discussion_r3526103711
##########
integration-test/src/test/java/org/apache/iotdb/confignode/it/regionmigration/pass/commit/IoTDBMigrateMultiRegionForIoTV1IT.java:
##########
@@ -170,6 +176,71 @@ public void multiRegionMigrateTest() throws Exception {
}
}
+ private Map<Integer, Set<Integer>> ensureDataNodeHostsMultipleRegions(
+ Statement statement,
+ SyncConfigNodeIServiceClient client,
+ Map<Integer, Set<Integer>> regionMap)
+ throws Exception {
+ if (hasDataNodeHostingMultipleRegions(regionMap)) {
+ return regionMap;
+ }
+ List<Integer> regionIds = new ArrayList<>(regionMap.keySet());
+ Assert.assertTrue("Need at least two regions to colocate",
regionIds.size() >= 2);
+
+ int firstRegion = regionIds.get(0);
+ int secondRegion = regionIds.get(1);
+ int targetDataNode = regionMap.get(secondRegion).iterator().next();
+ if (regionMap.get(firstRegion).contains(targetDataNode)) {
+ targetDataNode = regionMap.get(firstRegion).iterator().next();
+ regionGroupExpand(statement, client, secondRegion, targetDataNode);
Review Comment:
We pick Region2's DataNode, then check if Region1 is already there. If not,
extend Region1 to that node (the usual case); if yes, extend Region2 instead.
With RF=1, the latter is defensive — colocated regions return early.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]