[server] Add resource-based KV leader replica capacity control#3614
Open
swuferhong wants to merge 1 commit into
Open
[server] Add resource-based KV leader replica capacity control#3614swuferhong wants to merge 1 commit into
swuferhong wants to merge 1 commit into
Conversation
68680f1 to
725b611
Compare
beryllw
reviewed
Jul 8, 2026
| DropDatabaseResponse response = new DropDatabaseResponse(); | ||
| metadataManager.dropDatabase( | ||
| request.getDatabaseName(), request.isIgnoreIfNotExists(), request.isCascade()); | ||
| if (request.isCascade()) { |
Contributor
There was a problem hiding this comment.
Thanks for the change! One concern about rebuildCurrentCount(metadataManager) in dropDatabase: it rescans all databases/tables, but admin operations run concurrently on the coordinator. If another request drops a database mid-scan, listTables() throws DatabaseNotExistException, which propagates out and fails this dropDatabase request — even with ignoreIfNotExists=true.
This is what fails the Rust IT test_error_database_already_exist in CI: its drop_database(..., cascade=true) gets a DatabaseNotExist error for a different database (test_create_database) that a parallel test was dropping at the same time.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Linked issue: close #3613
Add
tabletServerresource reporting and a coordinator-sideKvLeaderReplicaCapacityManagerto protect clusters from creating too many KV leader replicas.TabletServersnow report optional CPU and memory information during registration. The coordinator deriveskvLeaderReplicaCapacityfrom livetabletServermemory andkv.leader-replica.memory-reserved, tracks the current KV leader replica count in memory, rebuilds it on coordinator leadership startup, and checks/reserves capacity when creating KV tables or partitions.The capacity limit is disabled unless more than half of live tablet servers report memory. Unknown-memory
TabletServersuse the average known memory when the limit is enabled.Also add dynamic config support, metrics, RPC error mapping, serde compatibility, auto-partition accounting, and tests for resource probing, capacity calculation, manual create/drop, and auto partition create/drop.
Brief change log
Tests
API and Format
Documentation