Replace ad-hoc timestamp index guard with dedicated staleness check in isSegmentStale#18310
Merged
gortiz merged 1 commit intoApr 28, 2026
Conversation
…n isSegmentStale The previous fix (apache#18294) added a narrow guard inside the "column deleted" branch to suppress false positives when a timestamp index is removed. This was incomplete: - Removing a timestamp index should mark the segment stale (so SegmentPreProcessor can clean up the orphaned $col$GRANULARITY columns), but the old guard silently skipped them. - Adding a new granularity or configuring a timestamp index for the first time was misreported as "column added" instead of a dedicated timestamp index reason. - Existing derived columns in the segment could trigger spurious "range index changed" verdicts on every reload because applyTimestampIndex injects them into the range index config. This commit replaces the guard with a dedicated feature-level check (following the StarTree and MultiColumnText pattern). Before the generic per-column loop: 1. Compare the set of $col$GRANULARITY columns expected by the current table config against those physically present in the segment. Any mismatch returns "timestamp index changed", correctly covering add/remove/granularity changes. 2. The generic "column added" check now excludes $col$GRANULARITY columns (handled by step 1). 3. The per-column loop skips all $col$GRANULARITY columns entirely, preventing false positives on "column deleted" and "range index changed". Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
2 tasks
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #18310 +/- ##
============================================
- Coverage 63.61% 63.60% -0.01%
Complexity 1659 1659
============================================
Files 3246 3246
Lines 197514 197522 +8
Branches 30580 30580
============================================
- Hits 125644 125633 -11
- Misses 61823 61840 +17
- Partials 10047 10049 +2
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
gortiz
approved these changes
Apr 28, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
SegmentPreProcessorcan clean up the orphaned$col$GRANULARITYcolumns — the old guard silently skipped them."column added"rather than a dedicated timestamp index reason. Existing derived columns in the segment could also trigger spurious"range index changed"verdicts on every reload.$col$GRANULARITYcolumns expected by the current table config against those present in the segment. Any mismatch returns"timestamp index changed"."column added"check now excludes$col$GRANULARITYcolumns (covered by the dedicated check), and the per-column loop skips them entirely to prevent false positives on"column deleted"and"range index changed".Test plan
"timestamp index changed"withisStale() == truefor the add/remove/granularity-added/granularity-removed cases.testTimestampIndexNoChangecontinues to assert not stale../mvnw -pl pinot-core -am -Dtest=BaseTableDataManagerNeedRefreshTest -Dsurefire.failIfNoSpecifiedTests=false test— all 42 tests pass.🤖 Generated with Claude Code