Artificial Intelligence
VERIFIED FIXES

Vector DB returns deleted documents and stale IDs after nightly compaction and shard rebalance

Environment

Environment

Self-hosted sharded vector database cluster used for RAG (embeddings + vector search). Nightly compaction and shard rebalance jobs run during off-peak hours. Source authoritative documents live in an external document store and ingestion pipeline issues deletes/updates.

Symptoms

Symptoms

Search queries return document IDs that were deleted hours earlier and passages that no longer match the authoritative store. RAG responses cite text that should have been removed; similarity scores remain high for stale entries. Problem appears cluster-wide after nightly maintenance.

Observations

Observations

Restarting vector DB nodes doesn't remove stale hits. Manual reindex of one shard temporarily resolved results for queries hitting that shard, but stale results reappeared after the next compaction/rebalance window. Compaction job logs report completion; ingestion pipeline shows deletes applied. No evident disk I/O errors in host logs.

Already attempted

Already attempted

Restarted cluster nodes, paused ingestion, triggered manual compaction and single-shard reindex. Temporary fixes affect only some queries; stale results reappear after full rebalance. Backups/snapshots exist but issue persists across restarts.

Question

Question

What could cause deleted vectors and stale document IDs to reappear after compaction/rebalance? How can I recover consistent search results without losing data and prevent recurrence?

COMMUNITY RESPONSES

Verified community troubleshooting

1 reply
0
jonasfixar Answer
user
Posted 4w ago • 0 confirmations

Stop compaction/rebalance and pause ingestion first to avoid creating more inconsistent state. The fastest reliable recovery is a full reindex from your authoritative document store into a fresh index (run on a separate cluster or namespace). Verify by running known queries and comparing hits to the source store. Once validated, cut over traffic and keep the old cluster snapshot for rollback. This avoids guessing at metadata fixes and ensures all tombstones/deletes are correctly applied. Remember to keep nightly jobs paused until you confirm a fix or vendor patch.

Showing 1 of 1 community responses
AI DIAGNOSTICS

Incident analysis

Updated 4w ago• Trouble ID

Most likely causes

Compaction or shard-rebalance bug that leaves stale segment pointers or fails to apply tombstones across target nodes 85%
Race between ingestion delete operations and compaction leading to incomplete tombstone propagation 60%
Client-side query cache returning stale IDs even after backend fixed state 30%

Summary

Symptoms are consistent with an index/metadata inconsistency: compaction or shard rebalancer left stale pointers to segments that should have been tombstoned, so deleted vectors remain searchable. A race between delete/tombstone application and compaction/rebalance can leave orphaned vector references. Less likely causes include client-side caching or storage-level corruption, but the cluster-wide recurrence after the maintenance window points at the compaction/rebalance pipeline.

Suggested Fixes

Diagnostic step 1
Immediately pause scheduled compaction and shard-rebalance jobs and stop ingestion to prevent further divergence.
Diagnostic step 2
Take consistent snapshots/backups of current index files and metadata from all nodes for forensic analysis before further changes.
Diagnostic step 3
Perform a full reindex of the affected collections: rebuild indexes from the authoritative document store into a clean cluster or into a new index namespace, then switch traffic to the rebuilt index after validating results.

Continue troubleshooting

Matched from the title, description and tags