Repository navigation
Fix bool index reload as immutable on appendable segments - #8785
Merged
Merged
Conversation
timvisee
approved these changes
Apr 24, 2026
Comment on lines
+475
to
+485
| // `MutableBoolIndex` and `ImmutableBoolIndex` share the same on-disk | ||
| // format; stored mutability picks which in-memory wrapper to build. | ||
| match mutability { | ||
| IndexMutability::Immutable => { | ||
| ImmutableBoolIndex::open(&dir, id_tracker.deleted_point_bitslice())? | ||
| .map(BoolIndex::Immutable) | ||
| } | ||
| IndexMutability::Mutable => { | ||
| MutableBoolIndex::open(&dir, create_if_missing)?.map(BoolIndex::Mmap) | ||
| } | ||
| } |
Member
There was a problem hiding this comment.
Key change is here.
The null index PR definitely needs the same treatment.
I'm not so sure about the numeric index PR, because it handles immutable state differently:
qdrant/lib/segment/src/index/field_index/numeric_index/mod.rs
Lines 194 to 202 in ff74a7b
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.
Fixes a regression introduced by #8625 that prevents Qdrant from starting when a collection has a bool payload index.
Symptom
ERROR collection::collection_manager::collection_updater: Update operation failed: Service internal error: Can't add values to immutable bool indexTriggered on WAL replay during startup, on any appendable segment with a bool payload index; regardless of whether the index was created before or after #8625.
Root cause
BoolIndex::get_storage_type()returnsStorageType::Mmapfor bothMutableBoolIndexandImmutableBoolIndex(they share the same on-disk format).The persisted index type for a bool index on an appendable segment is therefore
{ mutability: Mutable, storage_type: Mmap }.On reload,
StructPayloadIndex::selector_with_typedispatches purely onstorage_type.After #8625,
IndexSelector::Mmap+bool_newunconditionally opens anImmutableBoolIndex— ignoring the storedmutability.Any subsequent
add_manycall (e.g. WAL replay) hits the"Can't add values to immutable bool index"error arm.Fix
bool_newnow takes anIndexMutabilityparameter and branches on it in theMmaparm:Mutable→MutableBoolIndex::open→BoolIndex::MmapImmutable→ImmutableBoolIndex::open→BoolIndex::ImmutableCallers pass:
new_index_with_type(reload):index_type.mutabilityfrom confignew_index(fresh migration): derived from selector —Mmap→Immutable,Gridstore→MutableSince the on-disk format is shared, existing segments load unchanged; only the in-memory wrapper differs.
Test
Added
test_bool_index_appendable_reopen_accepts_updatesinlib/segment/tests/integration/payload_index_test.rs.It builds an appendable
StructPayloadIndexwith a bool-indexed field, drops it, reopens it, and performs an update. Fails against pre-fix code with the exact error from the report; passes with the fix.