Expand description
Compaction Isolation
This module provides per-shard compaction queues that allow background index rebuilding without blocking readers.
§Problem
Global compaction blocks all shards:
- Lock contention during CSR rebuild
- Readers stall waiting for compaction
- Unpredictable latency spikes
§Solution
Per-shard compaction with version-based isolation:
- Each shard has independent compaction queue
- Build new CSR/AoSoA in background
- Atomic pointer swap when ready
- Old version kept until readers drain (epoch-based reclamation)
§Invariants
- Readers never block on compaction
- Writers queue updates for next compaction cycle
- At most one compaction per shard at a time
- Compaction preserves search correctness
Structs§
- Compaction
Config - Compaction configuration.
- Compaction
Queue - Compaction queue manager for multiple shards.
- Compaction
Result - Result of a compaction operation.
- Compaction
Stats - Compaction statistics.
- Compaction
Task - Compaction task for a shard.
- Compaction
Worker - Background compaction worker.
- Mock
Compaction Executor - Simple in-memory compaction executor for testing.
- Reader
Guard - Guard that tracks reader lifetime.
- Shard
Compaction State - Per-shard compaction state.
Enums§
- Compaction
Priority - Compaction priority levels.
Traits§
- Compaction
Executor - Trait for compaction executor.