Skip to content

enforce retention at query time#6581

Open
trinity-1686a wants to merge 1 commit into
mainfrom
trinity.pointard/query-enforce-retention
Open

enforce retention at query time#6581
trinity-1686a wants to merge 1 commit into
mainfrom
trinity.pointard/query-enforce-retention

Conversation

@trinity-1686a

Copy link
Copy Markdown
Contributor

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

@trinity-1686a trinity-1686a requested a review from a team as a code owner July 7, 2026 14:42

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

https://github.com/quickwit-oss/quickwit/blob/fc10cac5909b232c3ed02720237cc7df5c3c88bb/quickwit-search/src/root.rs#L1284-L1288
P1 Badge 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
P2 Badge 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".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant