Skip to content

[v25.2.x] partition/timequery: Fix tiered storage timequery bug#28870

Closed
vbotbuildovich wants to merge 3 commits into
redpanda-data:v25.2.xfrom
vbotbuildovich:backport-pr-28642-v25.2.x-525
Closed

[v25.2.x] partition/timequery: Fix tiered storage timequery bug#28870
vbotbuildovich wants to merge 3 commits into
redpanda-data:v25.2.xfrom
vbotbuildovich:backport-pr-28642-v25.2.x-525

Conversation

@vbotbuildovich

Copy link
Copy Markdown
Collaborator

Backport of PR #28642

This change refactors timequery logic to fix a rare bug where a
timequery would return no result despite an offset matching the
timestamp existing in cloud storage and local storage.

The bug is observed in the tiered storage model test when querying
timestamps corresponding to offsets in the final, active segment of the
log of a partition with tiered storage enabled and with aggressive
cleanup settings. The partition gets into a state where the local log is
truncated up to the high watermark, but the active segment remains.
Querying for a timestamp within the bounds of the active segment
meant that the timestamp was after the start timestamp for the local
log, which comes from the base timestamp of the only segment, but the
start offset of the log was after the max offset set by the timequery,
which is the HWM and comes from the Kafka handler. This caused the
timequery to return no result, incorrectly, without checking local or
cloud storage.

The refactor fixes the bug and hopefully cleans up the logic a bit.
Regression test included.

(cherry picked from commit 1f4ee6c)
It can happen that a timequery hits an empty local log and its max
offset is before the min offset, which is clamped to the start of the
log. This will fail translation. This change adds extra early returns to
local and cloud timequeries to handle this special case pre-translation.

(cherry picked from commit d6b9adf)
@vbotbuildovich vbotbuildovich added this to the v25.2.x-next milestone Dec 5, 2025
@vbotbuildovich vbotbuildovich added the kind/backport PRs targeting a stable branch label Dec 5, 2025
@wdberkeley

Copy link
Copy Markdown
Contributor

Needed some manual fixup and found it easier to open a new PR: #28898

@wdberkeley wdberkeley closed this Dec 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/redpanda kind/backport PRs targeting a stable branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants