This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/dev/1.3 by this push:
new 5108d576a4d [To dev/1.3] Optimized the error log for database
inconsistency when adjusting max region group num & Ignore the
DatabaseNotExistsException for adjustMaxRegionGroupNum when querying
dataRegionGroupCount (#15008)
5108d576a4d is described below
commit 5108d576a4d25579781031880c5cd1cc09ad1ae9
Author: Caideyipi <[email protected]>
AuthorDate: Mon Mar 10 11:39:30 2025 +0800
[To dev/1.3] Optimized the error log for database inconsistency when
adjusting max region group num & Ignore the DatabaseNotExistsException for
adjustMaxRegionGroupNum when querying dataRegionGroupCount (#15008)
---
.../manager/schema/ClusterSchemaManager.java | 99 +++++++++++-----------
.../persistence/schema/ClusterSchemaInfo.java | 8 +-
2 files changed, 56 insertions(+), 51 deletions(-)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/schema/ClusterSchemaManager.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/schema/ClusterSchemaManager.java
index 994fc83ffe7..56fabd6aa53 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/schema/ClusterSchemaManager.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/schema/ClusterSchemaManager.java
@@ -480,59 +480,62 @@ public class ClusterSchemaManager {
continue;
}
+ // Adjust maxSchemaRegionGroupNum for each Database.
+ // All Databases share the DataNodes equally.
+ // The allocated SchemaRegionGroups will not be shrunk.
+ final int allocatedSchemaRegionGroupCount;
try {
- // Adjust maxSchemaRegionGroupNum for each Database.
- // All Databases share the DataNodes equally.
- // The allocated SchemaRegionGroups will not be shrunk.
- int allocatedSchemaRegionGroupCount;
- try {
- allocatedSchemaRegionGroupCount =
- getPartitionManager()
- .getRegionGroupCount(databaseSchema.getName(),
TConsensusGroupType.SchemaRegion);
- } catch (DatabaseNotExistsException e) {
- // ignore the pre deleted database
- continue;
- }
+ allocatedSchemaRegionGroupCount =
+ getPartitionManager()
+ .getRegionGroupCount(databaseSchema.getName(),
TConsensusGroupType.SchemaRegion);
+ } catch (final DatabaseNotExistsException e) {
+ // ignore the pre deleted database
+ continue;
+ }
- int maxSchemaRegionGroupNum =
- calcMaxRegionGroupNum(
- databaseSchema.getMinSchemaRegionGroupNum(),
- SCHEMA_REGION_PER_DATA_NODE,
- dataNodeNum,
- databaseNum,
- databaseSchema.getSchemaReplicationFactor(),
- allocatedSchemaRegionGroupCount);
- LOGGER.info(
- "[AdjustRegionGroupNum] The maximum number of SchemaRegionGroups
for Database: {} is adjusted to: {}",
- databaseSchema.getName(),
- maxSchemaRegionGroupNum);
-
- // Adjust maxDataRegionGroupNum for each Database.
- // All Databases share the DataNodes equally.
- // The allocated DataRegionGroups will not be shrunk.
- int allocatedDataRegionGroupCount =
+ final int maxSchemaRegionGroupNum =
+ calcMaxRegionGroupNum(
+ databaseSchema.getMinSchemaRegionGroupNum(),
+ SCHEMA_REGION_PER_DATA_NODE,
+ dataNodeNum,
+ databaseNum,
+ databaseSchema.getSchemaReplicationFactor(),
+ allocatedSchemaRegionGroupCount);
+ LOGGER.info(
+ "[AdjustRegionGroupNum] The maximum number of SchemaRegionGroups for
Database: {} is adjusted to: {}",
+ databaseSchema.getName(),
+ maxSchemaRegionGroupNum);
+
+ // Adjust maxDataRegionGroupNum for each Database.
+ // All Databases share the DataNodes equally.
+ // The allocated DataRegionGroups will not be shrunk.
+ final int allocatedDataRegionGroupCount;
+ try {
+ allocatedDataRegionGroupCount =
getPartitionManager()
.getRegionGroupCount(databaseSchema.getName(),
TConsensusGroupType.DataRegion);
- int maxDataRegionGroupNum =
- calcMaxRegionGroupNum(
- databaseSchema.getMinDataRegionGroupNum(),
- DATA_REGION_PER_DATA_NODE == 0
- ? CONF.getDataRegionPerDataNodeProportion()
- : DATA_REGION_PER_DATA_NODE,
- DATA_REGION_PER_DATA_NODE == 0 ? totalCpuCoreNum : dataNodeNum,
- databaseNum,
- databaseSchema.getDataReplicationFactor(),
- allocatedDataRegionGroupCount);
- LOGGER.info(
- "[AdjustRegionGroupNum] The maximum number of DataRegionGroups for
Database: {} is adjusted to: {}",
- databaseSchema.getName(),
- maxDataRegionGroupNum);
-
- adjustMaxRegionGroupNumPlan.putEntry(
- databaseSchema.getName(), new Pair<>(maxSchemaRegionGroupNum,
maxDataRegionGroupNum));
- } catch (DatabaseNotExistsException e) {
- LOGGER.warn("Adjust maxRegionGroupNum failed because Database doesn't
exist", e);
+ } catch (final DatabaseNotExistsException e) {
+ // ignore the pre deleted database
+ continue;
}
+
+ final int maxDataRegionGroupNum =
+ calcMaxRegionGroupNum(
+ databaseSchema.getMinDataRegionGroupNum(),
+ DATA_REGION_PER_DATA_NODE == 0
+ ? CONF.getDataRegionPerDataNodeProportion()
+ : DATA_REGION_PER_DATA_NODE,
+ DATA_REGION_PER_DATA_NODE == 0 ? totalCpuCoreNum : dataNodeNum,
+ databaseNum,
+ databaseSchema.getDataReplicationFactor(),
+ allocatedDataRegionGroupCount);
+ LOGGER.info(
+ "[AdjustRegionGroupNum] The maximum number of DataRegionGroups for
Database: {} is adjusted to: {}",
+ databaseSchema.getName(),
+ maxDataRegionGroupNum);
+
+ adjustMaxRegionGroupNumPlan.putEntry(
+ databaseSchema.getName(), new Pair<>(maxSchemaRegionGroupNum,
maxDataRegionGroupNum));
}
try {
getConsensusManager().write(adjustMaxRegionGroupNumPlan);
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java
index 90dbf1a08e4..c5c60afbb26 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/schema/ClusterSchemaInfo.java
@@ -414,9 +414,11 @@ public class ClusterSchemaInfo implements
SnapshotProcessor {
databaseSchema.setMaxDataRegionGroupNum(entry.getValue().getRight());
}
result.setCode(TSStatusCode.SUCCESS_STATUS.getStatusCode());
- } catch (MetadataException e) {
- LOGGER.error(ERROR_NAME, e);
- result.setCode(TSStatusCode.DATABASE_NOT_EXIST.getStatusCode());
+ } catch (final MetadataException e) {
+ LOGGER.info(
+ "Database inconsistency detected when adjusting max region group
count, message: {}, will be corrected by the following adjusting plans",
+ e.getMessage());
+ result.setCode(e.getErrorCode()).setMessage(e.getMessage());
} finally {
databaseReadWriteLock.writeLock().unlock();
}