Files
qdrant/lib/segment
Andrey VasnetsovandClaude Fable 5 921f5a512b Allocate a single slot per operation in append-only mutations (#9804)
* Fuse CoW point move into a single destination write

The CoW arm of apply_points_with_conditional_move wrote a moved point in
three SegmentEntry steps: upsert_point_raw, update_vectors,
set_full_payload. With append_only_mutations enabled every step clones
the whole point to a fresh internal id, so one moved point burned three
slots (the first holding an empty point for plain upserts, which clear
raw_vectors) and left two immediately-dead clones behind, tripling the
id-tracker changelog and vector writes.

Add SegmentEntry::upsert_moved_point, which writes raw vectors, the
decoded overlay, and the payload in one operation — allocating exactly
one slot — and use it on the CoW move path.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Mutate same-operation slots in place in append-only mode

With append_only_mutations enabled, every mutation of an existing point
clones it to a fresh internal id. Shard-level updates decompose one
point write into several SegmentEntry steps (upsert_with_payload issues
upsert_point plus set_full_payload/clear_payload), so a single upsert
burned one slot per step, leaving a chain of immediately-dead clones.

A slot whose version already equals op_num was written by an earlier
step of the current operation. It cannot be durable yet — the segment
write lock is held across the whole operation, so no flush (and no
read-only follower) can have observed it, and versions flush last so a
crash discards it and WAL replay re-applies the whole operation.
Mutate such slots in place: one operation now allocates exactly one
slot regardless of how many steps it decomposes into.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

* Stamp payload storage version in write_point_parts

overwrite_payload mutates payload storage, but the fused write never
bumped version_tracker's payload version — the old CoW path did, via
set_full_payload. The segment manifest would stamp payload files with a
stale version, letting a partial snapshot skip payload storage that
contains the moved point's row, so the restored id tracker would point
at an offset with no payload.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-04 11:17:01 +02:00
..
2024-06-21 23:35:19 +02:00