Repository navigation
Fix CSM planning of invalid vector names, invalid quotas and Dead replica during resharding - #11528
Merged
Merged
Conversation
`CreateCollectionOperation::new` and the create-vector-name handler validate vector names before an operation is proposed, but a committed entry does not have to come through either of them. The state machine accepted such an entry, segment creation then rejected the name, and the failed action became a service error, so consensus retried the entry forever. Validate explicitly named dense and sparse vectors in `plan_create_collection` and the vector name in `plan_create_named_vector`, with the same `validate_vector_name` rules and `BadInput` errors as the API path. The unnamed vector of a `Single` config stays valid. Co-Authored-By: Claude Opus 5.5 <[email protected]>
The API validates a quota config before it is proposed, but a committed `SetQuotaConfig` entry does not have to come through it. The state machine emitted `SetQuotaConfig` for any config, quota storage then rejected the invalid one, and the failed action became a service error, so consensus retried the entry forever. Move the quota store's validation onto `QuotaConfig::ensure_valid`, and call it from `plan_set_quota_config`, which now returns a result. An invalid config is rejected as `BadRequest` naming the invalid fields, the same error quota storage returns, including while quotas are disabled. A valid config equal to the current one still emits `SetQuotaConfig`, because applying it also clears recorded exceeded-quota flags. Co-Authored-By: Claude Opus 5.5 <[email protected]>
`plan_set_shard_replica_state` collects the transfers related to the replica, then plans their aborts one by one against the planned state. Aborting a resharding transfer aborts resharding, which unregisters the other transfers related to it and, when resharding up, drops the new shard. Planning a later transfer from the collected list then returned `BadRequest` for the missing transfer and rejected the whole operation. The retained handler skips a transfer that is no longer registered. Skip it in planning too, and return once the shard is gone, as the resharding branch above already does. Otherwise the final `SetReplicaState` would target the dropped shard. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This comment was marked as low quality.
This comment was marked as low quality.
…ning Move the empty sparse name and dense/sparse name uniqueness checks from `CreateCollectionOperation::new` into `CreateCollection::validate_vector_names`, so the consensus planner rejects them as `BadInput` too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Returning as soon as a resharding abort dropped the shard skipped the remaining collected transfers. An ordinary transfer of the dropped shard, such as a replication sent by the scale-up target, is not related to resharding, so it stayed registered. The retained handler aborts it and only then fails its final write to the dropped shard. Finish the loop and skip just the final `SetReplicaState`. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
timvisee
approved these changes
Nov 13, 2026
generall
pushed a commit
that referenced
this pull request
Nov 13, 2026
…lica during resharding (#11528) Co-authored-by: Tim Visee <[email protected]> Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Three consensus state machine fixes for committed entries that the planner handled differently
from the retained handlers:
..) inCreateCollectionandCreateNamedVectoras
BadInputduring planning. ForCreateCollection, also reject an empty sparsevector name and a name used by both a dense and a sparse vector. Before, segment
creation failed, and consensus retried the entry forever.
SetQuotaConfigas
BadRequestduring planning. Before, quota storage failed, and consensus retriedthe entry forever.
unregistered, but still abort every other collected transfer (e.g. an ordinary
replication of the dropped shard). If the shard was dropped, skip the final Dead write.
Before, planning rejected the operation with
BadRequestfor a missing transfer.Commits:
Prompt (first two commits)
CSM Small Fixes: Implementation Prompt
Implement two missing CSM planner validations and submit them with the existing
Dead-replica fix in one PR targeting
dev, for the first CSM release.The compatibility baseline is rolling upgrades from v1.20.0.
Branch and Scope
The local, unpushed branch is
csm-small-fixes.It was already renamed from
csm-scale-up-target-dead-corner-case.At prompt creation it points to
42c78c9520, based ondevat9f2a173e61.The main checkout is on
devatddbe2fb9c3; inspect actual status before switching.Preserve unrelated changes and untracked files.
The branch already contains finding 6's 19-line fix in
plan_set_shard_replica_state:skip transfers removed by earlier planned aborts, and return accumulated actions
if an abort dropped the target shard. Preserve that fix.
It makes CSM reach v1.20.0's eventual persisted state without its obsolete final Dead write.
The investigation recorded 313 passing storage tests, clean clippy, and formatting;
those results do not validate the new changes you will make.
Add only these two fixes:
Do not implement the deferred peer-removal, collection-update, or duplicate resharding
Start compatibility changes. Do not broaden this into a general validation audit.
No consensus wire-format change or general planner result refactor is needed.
Read applicable repository instructions, including
CLAUDE.md,.github/review-rules.md, and the contribution requirements before editing.Use the
dev,qdrant-dev, andrustskills if available.Finding 1: Vector Names
This concerns a vector named
..inside a collection, not a collection named...v1.20.0 rejects the name before proposal. A committed operation can bypass that API check:
CSM currently accepts it, segment creation rejects it, and the action failure becomes
ServiceError. Consensus then retries the invalid entry indefinitely.Planning must return a user error before producing actions.
Use the existing
common::validation::validate_vector_namerules.Validate explicitly supplied dense and sparse vector names in
plan_create_collection,and the supplied name in
plan_create_named_vector.Preserve valid unnamed-vector behavior: the existing validator accepts the empty name,
and
VectorsConfig::Singlehas an implicit unnamed vector.Do not invent stricter name rules or change existing sparse-name/schema constraints.
Inspect these sources:
lib/common/common/src/validation.rs:validate_vector_namelib/storage/src/content_manager/collection_meta_ops.rs:CreateCollectionOperation::newalready validates dense and sparse map keyslib/storage/src/content_manager/consensus_state_machine/state/plan.rs:plan_create_collectionandplan_create_named_vectorsrc/actix/api/vector_name_api.rs: named-vector request validationlib/collection/src/collection/vector_name_schema.rs: existing schema validationReuse the validator and existing user-error conventions.
A small shared helper is acceptable if it avoids duplicating the same name checks.
Do not call the entire operation constructor or add unrelated derived validation
to the planner merely to reuse these checks.
Verify that the chosen rules agree with v1.20.0; do not introduce a version gate
for checks already enforced by that baseline's API and storage paths.
Add focused tests in the existing CSM operation test modules:
..and.Construct or deserialize operations directly in invalid-input tests,
bypassing API and constructor validation. Otherwise the tests do not exercise the gap.
Cover the planner's use of validation; do not duplicate the validator's full test suite.
Finding 7: Quota Configuration
v1.20.0 rejects invalid quotas as user errors.
CSM currently emits
SetQuotaConfigwithout checking validity;quota storage rejects it and consensus retries the action failure as
ServiceError.The API already rejects these requests, so this is planner hardening for committed entries.
Inspect these sources:
lib/shard/src/quota/config.rs:QuotaConfigand itsValidateruleslib/shard/src/quota/manager/store.rs: storage validation and error handlinglib/storage/src/content_manager/consensus_state_machine/state/plan.rs:plan_set_quota_configlib/storage/src/content_manager/consensus_state_machine/mod.rs:dispatch of
ConsensusOperations::SetQuotaConfiglib/storage/src/content_manager/consensus_state_machine/tests/ops/quota.rsValidate with the existing
QuotaConfigrules before emitting the action.Change
plan_set_quota_configfromActionstoStorageResult<Actions>and propagate the result through its callers. Map invalid input to a user error,
using existing error conventions and identifying the invalid field.
Do not introduce new quota constraints or duplicate the range definitions.
Preserve these semantics:
as storage validation already does
SetQuotaConfig,because applying it also clears recorded exceeded-quota flags
Add focused operation tests for invalid limits/margin, valid boundaries,
and unchanged state on rejection. Preserve the existing repeated-config test.
Ensure invalid operations reach CSM directly, bypassing REST validation.
Validation
Run focused new tests first, then the storage suite and applicable repository checks:
If a shared helper changes another crate, test that crate as well.
Follow repository guidance for affected feature-gated code.
Distinguish environmental failures and unrelated baseline failures from regressions;
record exact commands and results without claiming unrun checks passed.
Keep each new commit focused and independently buildable with its applicable checks.
The existing Dead-replica scenario tests were deliberately removed from its commit.
Do not recreate that investigation as part of this small validation change.
Preserve the fix and run the existing storage coverage on the combined branch.
PR and Release Tracking
Push
csm-small-fixesand open one PR againstdevcontaining all three fixes.Follow the PR template and AI-attribution requirements in
docs/CONTRIBUTING.md.Describe the concrete failure and resulting behavior for each fix,
and report validation results. Keep the description understandable without these
local investigation documents; do not cite inaccessible reports as the explanation.
The user has requested merging these fixes as a single PR.
Merge after required CI and reviews pass, following repository policy.
Do not bypass protections or failing checks; report any pending requirement.
Update the local tracking files
consensus/csm-release.md,consensus/plan.md,and
consensus/csm-release-4-dead-replica-decision.mdwith the actual commits,PR, validation, and merge status. Mark findings 1 and 7 implemented only after the code
exists, and mark fixes released or merged only when that actually happens.
The
consensus/directory is currently untracked local investigation material;keep it and unrelated untracked files out of the code PR.
Finish with a concise summary of the changes, tests, PR link, and any remaining release work.
New Feature Submissions:
cargo +nightly fmt --allcommand prior to submission?cargo clippy --workspace --all-featurescommand? (without--all-features)Changes to Core Features:
🤖 Generated with Claude Code