Skip to content

Fix RegionGroup limits for same-name tree and table databases - #18990

Open
d-wang-commit wants to merge 1 commit into
apache:masterfrom
d-wang-commit:fix-region-group-limits-for-same-name-tree-and-table-databases
Open

d-wang-commit wants to merge 1 commit into
apache:masterfrom
d-wang-commit:fix-region-group-limits-for-same-name-tree-and-table-databases

Conversation

@d-wang-commit

Copy link
Copy Markdown
Contributor

Description

When tree database root.pg and table database pg coexist, their MTree entries share the internal path root.pg. Merging schemas by that path overwrites the table schema, leaving its maximum RegionGroup counts stale and undercounting databases when calculating other databases' limits.

Key the lookup by TDatabaseSchema.name so both databases participate in adjustment. Explicitly exclude both audit database names during deletion to preserve the existing filtering behavior with the corrected keys.

Tests

  • UT: ClusterSchemaManagerTest#testAdjustMaxRegionGroupNumWithMixedModels applies the real adjustment plan and checks both maximum RegionGroup counts for every database as the database count grows from one to three (12 -> 6 -> 4). ConfigManagerDatabaseDeletionTest covers table audit database deletion filtering.
  • Validation: Both targeted UTs passed after rebasing onto upstream/master.
  • IT: No integration test additions or changes; no IT run for this revision.

Side effects and risks

Correcting the database count may decrease other databases' calculated limits, while preserving already allocated RegionGroups. No serialization or protocol changes.


This PR has:

  • been self-reviewed.
  • added comments explaining the "why" and the intent of the code wherever would not be obvious for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths.

Key changed/added classes (or packages if there are too many classes) in this PR
  • ClusterSchemaInfo: retain both database models in schema lookups.
  • ConfigManager: preserve audit database filtering.
  • ClusterSchemaManagerTest: verify actual mixed-model limit recalculation and database counting.
  • ConfigManagerDatabaseDeletionTest: cover table audit database deletion filtering.

Use schema names to retain both models and count every database.
Preserve audit database filtering and add focused unit coverage.

@CRZbulabula CRZbulabula left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants