enforce retention at query time#6581
Conversation
There was a problem hiding this comment.
💡 Codex Review
https://github.com/quickwit-oss/quickwit/blob/fc10cac5909b232c3ed02720237cc7df5c3c88bb/quickwit-search/src/root.rs#L1284-L1288
Bypass metadata counts for retained partial splits
Keeping splits whose range crosses (or lacks) the retention cutoff is only correct if the leaf search applies the new cutoff filter. For a count-only MatchAll request, search_partial_hits_phase still takes the metadata fast path and returns metadata.num_docs for these retained splits, so documents older than the retention period are counted instead of filtered out. This affects indexes with a retention policy whenever a split straddles the cutoff or has no time_range.
https://github.com/quickwit-oss/quickwit/blob/fc10cac5909b232c3ed02720237cc7df5c3c88bb/quickwit-search/src/leaf.rs#L1508-L1510
Exclude documents exactly at the retention cutoff
When a document timestamp is exactly now - retention_period, start_timestamp is inclusive, so setting it to cutoff keeps that document. The existing retention executor computes the same cutoff and selects splits with time_range_end <= cutoff for deletion, so a not-yet-GCed split containing boundary timestamps will still be returned by query-time retention even though the retention job would remove it. Please make the query-time cutoff use the same exclusive boundary.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Description
enforce retention at query time, so that documents which are out of retention but not yet garbage collected don't show in results
How was this PR tested?
unit test, integration test