Skip to content

fix(compactor): skip retention scans for zero retention#21756

Open
u-kai wants to merge 1 commit intografana:mainfrom
u-kai:fix/retention-period-zero-scan-all-tables
Open

fix(compactor): skip retention scans for zero retention#21756
u-kai wants to merge 1 commit intografana:mainfrom
u-kai:fix/retention-period-zero-scan-all-tables

Conversation

@u-kai
Copy link
Copy Markdown

@u-kai u-kai commented May 3, 2026

What this PR does / why we need it:

This fixes retention scan planning so a retention period of 0 is treated as disabled when computing
the latest retention start time.

Which issue(s) this PR fixes:
Fixes #21755

Special notes for your reviewer:

Checklist

  • Reviewed the CONTRIBUTING.md guide (required)
  • Documentation added
  • Tests updated
  • Title matches the required conventional commits format, see here
  • Changes that require user attention or interaction to upgrade are documented in docs/sources/setup/upgrade/_index.md
  • If the change is deprecating or removing a configuration option, update the deprecated-config.yaml and deleted-config.yaml files respectively in the tools/deprecated-config-checker directory. Example PR

Note

Medium Risk
Changes how retention cutoffs are computed when retention is set to 0, which can affect whether index tables are scanned for deletions and could unintentionally skip/perform scans if miscomputed.

Overview
Treats retention periods of 0 (or non-positive) as retention disabled when planning compactor retention scans.

findLatestRetentionStartTime now ignores non-positive stream retention values, avoids computing negative cutoffs when defaults/users have retention disabled, and records per-tenant disabled retention as 0 so IntervalMayHaveExpiredChunks won’t fall back to default retention.

Expands unit tests to cover zero-retention combinations for default, stream-level, and per-tenant retention, including ensuring disabled per-tenant retention does not trigger index scans.

Reviewed by Cursor Bugbot for commit a3a2d30. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: u-kai <76635578+u-kai@users.noreply.github.com>
@u-kai u-kai requested a review from a team as a code owner May 3, 2026 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

retention_period: 0 causes compactor to scan all historical tables, leading to memory growth

1 participant