Use per-source progress markers to distinguish a fresh source document from an index that has not applied its latest update.
Index watermarks: measure what the retriever has actually seen
Define freshness at the serving boundary
A document's edited-at timestamp says when its source changed, not when lexical, vector and metadata indexes became ready to serve that change. Track source event offsets and the highest contiguous offset applied to each serving component. A gap matters: processing event 94 while event 93 failed does not make 94 a safe watermark. Expose the minimum ready offset across components required for the query. Incremental ingestion supplies the event ordering and retry contract behind that marker.
Give queries a required freshness
A historical how-to question may tolerate a short index delay; an access-revocation or active incident question may not. Express the requirement as a source offset, snapshot token or bounded age tied to a documented source clock. If the serving watermark is behind, wait only within the request budget, then use an explicit stale-answer policy: return a labeled older snapshot, query an authoritative live source, or abstain. Do not quietly answer from stale evidence while presenting it as current. Abstention is the correct result when freshness is required and cannot be established.
Keep deletes in the same progress model
Deletion and permission revocation are not ordinary updates. A vector may linger after the document disappears from the source; a cache can still hold its snippet. Track a revocation watermark for every serving path that could expose the material and require it to reach the requested offset. Quarantine or deny a known revoked document immediately, even if rebuilding the full index takes longer. Deletion controls must cover the source, index and caches, not just a database flag.
Measure lag by source and slice
An average ingestion delay hides one stuck partition. Report p95 and maximum lag, oldest unapplied event age, contiguous watermark and count of failed events by source. The query trace should show the freshness requirement and the watermarks actually used. Alert on lag that threatens the service target, not merely on high queue depth. A queue can be empty while a poison event is parked in a dead-letter path and the watermark is frozen. Traces connect stale answers to the precise lagging component.
Test races with a fixed answer contract
Replay an update, a delete and a permission withdrawal while lexical and vector ingestion advance at different rates. Ask the same question before and after each watermark crosses the required offset. The answer may change only when a coherent serving view is ready; it must never reveal a revoked passage. Include event retries and out-of-order delivery. Snapshot consistency chooses a coherent generation once each component advertises progress.
Worked contract
from dataclasses import dataclass
@dataclass(frozen=True)
class IndexProgress:
component: str
source_offset: int
visible_offset: int
revocation_offset: int
def ready_for_answer(progress: list[IndexProgress], required_offset: int,
must_cover_revocations: bool = True) -> bool:
if not progress or required_offset < 0:
return False
return all(state.visible_offset >= required_offset
and (not must_cover_revocations
or state.revocation_offset >= required_offset)
for state in progress)
components = [IndexProgress("lexical", 93, 93, 93),
IndexProgress("vector", 93, 92, 93)]
assert not ready_for_answer(components, 93)
assert ready_for_answer(components, 92)
components[1] = IndexProgress("vector", 93, 93, 93)
assert ready_for_answer(components, 93)Performance and operating cost
A readiness check scans S serving components in O(S) time and O(1) extra space. Maintaining contiguous watermarks takes durable offset tracking and retry state per partition. A strict freshness target can increase latency or abstention when one component lags; measure those effects against the value of a current answer. Never trade away revocation checks to improve an apparent freshness score.
Common Mistakes
- Using source edited-at time as proof that the vector index has applied an update.
- Advancing a watermark past an unprocessed event gap.
- Treating a delete as complete when a cached passage can still be served.
- Reporting only average lag while one partition is stuck.
Validation drill
Simulate 37 ordered source events with two dropped updates and one revocation. Record each component watermark and verify exactly when a current answer becomes eligible.
