This is an automated email from the ASF dual-hosted git repository.
tanxinyu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new fe7b3a4dff2 [IOTDB-6125] Fix DataPartition allocation bug when insert
big batch data (#10938)
fe7b3a4dff2 is described below
commit fe7b3a4dff2568296ae519c1f8becc4b8f3dcbe0
Author: YongzaoDan <[email protected]>
AuthorDate: Wed Aug 23 14:17:17 2023 +0800
[IOTDB-6125] Fix DataPartition allocation bug when insert big batch data
(#10938)
---
.../it/partition/IoTDBAutoRegionGroupExtensionIT.java | 16 ++++++----------
.../confignode/manager/partition/PartitionManager.java | 14 ++++++--------
2 files changed, 12 insertions(+), 18 deletions(-)
diff --git
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBAutoRegionGroupExtensionIT.java
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBAutoRegionGroupExtensionIT.java
index a80b7628615..8d0f0f2c03e 100644
---
a/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBAutoRegionGroupExtensionIT.java
+++
b/integration-test/src/test/java/org/apache/iotdb/confignode/it/partition/IoTDBAutoRegionGroupExtensionIT.java
@@ -161,14 +161,12 @@ public class IoTDBAutoRegionGroupExtensionIT {
}
// The number of SchemaRegionGroups should not less than the
testMinSchemaRegionGroupNum
- TShowRegionResp showRegionReq =
+ TShowRegionResp resp =
client.showRegion(
new
TShowRegionReq().setConsensusGroupType(TConsensusGroupType.SchemaRegion));
- Assert.assertEquals(
- TSStatusCode.SUCCESS_STATUS.getStatusCode(),
showRegionReq.getStatus().getCode());
+ Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(),
resp.getStatus().getCode());
Map<String, AtomicInteger> regionCounter = new ConcurrentHashMap<>();
- showRegionReq
- .getRegionInfoList()
+ resp.getRegionInfoList()
.forEach(
regionInfo ->
regionCounter
@@ -179,14 +177,12 @@ public class IoTDBAutoRegionGroupExtensionIT {
(sg, regionCount) -> Assert.assertTrue(regionCount.get() >=
testMinSchemaRegionGroupNum));
// The number of DataRegionGroups should not less than the
testMinDataRegionGroupNum
- showRegionReq =
+ resp =
client.showRegion(
new
TShowRegionReq().setConsensusGroupType(TConsensusGroupType.DataRegion));
- Assert.assertEquals(
- TSStatusCode.SUCCESS_STATUS.getStatusCode(),
showRegionReq.getStatus().getCode());
+ Assert.assertEquals(TSStatusCode.SUCCESS_STATUS.getStatusCode(),
resp.getStatus().getCode());
regionCounter.clear();
- showRegionReq
- .getRegionInfoList()
+ resp.getRegionInfoList()
.forEach(
regionInfo ->
regionCounter
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
index 32f6fe7512b..e07fbf155f8 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/partition/PartitionManager.java
@@ -584,12 +584,12 @@ public class PartitionManager {
Math.min(
unassignedPartitionSlotsCount, minRegionGroupNum -
allocatedRegionGroupCount);
allotmentMap.put(database, delta);
- }
- // 2. The average number of partitions held by each Region will be
greater than the
- // expected average number after the partition allocation is completed
- if (allocatedRegionGroupCount < maxRegionGroupNum
+ } else if (allocatedRegionGroupCount < maxRegionGroupNum
&& slotCount / allocatedRegionGroupCount > maxSlotCount /
maxRegionGroupNum) {
+ // 2. The average number of partitions held by each Region will be
greater than the
+ // expected average number after the partition allocation is completed.
+
// The delta is equal to the smallest integer solution that satisfies
the inequality:
// slotCount / (allocatedRegionGroupCount + delta) < maxSlotCount /
maxRegionGroupNum
int delta =
@@ -602,13 +602,11 @@ public class PartitionManager {
slotCount * maxRegionGroupNum / maxSlotCount
- allocatedRegionGroupCount)));
allotmentMap.put(database, delta);
- continue;
- }
- // 3. All RegionGroups in the specified Database are disabled currently
- if (allocatedRegionGroupCount
+ } else if (allocatedRegionGroupCount
== filterRegionGroupThroughStatus(database,
RegionGroupStatus.Disabled).size()
&& allocatedRegionGroupCount < maxRegionGroupNum) {
+ // 3. All RegionGroups in the specified Database are disabled currently
allotmentMap.put(database, 1);
}
}