Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ignore the DatabaseNotExistsException for adjustMaxRegionGroupNum when querying dataRegionGroupCount #14669

Merged
merged 2 commits into from
Jan 13, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -490,59 +490,62 @@ public synchronized void adjustMaxRegionGroupNum() {
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.
final int allocatedSchemaRegionGroupCount;
try {
allocatedSchemaRegionGroupCount =
getPartitionManager()
.getRegionGroupCount(databaseSchema.getName(), TConsensusGroupType.SchemaRegion);
} catch (final 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;
}

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 =
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);
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));
} catch (final DatabaseNotExistsException e) {
LOGGER.warn("Adjust maxRegionGroupNum failed because Database doesn't exist", 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);
Expand Down
Loading