Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v22.3.x] kafka: return lowest offset if requested epoch is lower than local log #9297

Merged
merged 2 commits into from
Mar 8, 2023

Conversation

andrwng
Copy link
Contributor

@andrwng andrwng commented Mar 7, 2023

Backport of #9264 and #9304

CONFLICTS:

  • exposes log() in cluster/partition.h for tests
  • test body conflicted with test missing in branch

If reading from tiered storage is disabled, we would previously return an offset -1 if the epoch queried fell below the start of our local log.

This doesn't match what happens in Kafka, which returns the next available offset in a higher epoch. This behavior is matched by our lookup when reading from cloud storage.

This patch updates the Kafka handler to return the start offset of our local log if the requested term falls below the local log's beginning.

(cherry picked from commit 350c8ec)

Backports Required

  • none - not a bug fix
  • none - this is a backport
  • none - issue does not exist in previous branches
  • none - papercut/not impactful enough to backport
  • v23.1.x
  • v22.3.x
  • v22.2.x

Release Notes

Bug Fixes

  • Fixed a bug that would cause Redpanda to return an invalid offset when consuming from a term that falls below the beginning of the local log when tiered storage is disabled.

CONFLICTS:
- exposes log() in cluster/partition.h for tests
- test body conflicted with test missing in branch

If reading from tiered storage is disabled, we would previously return
an offset -1 if the epoch queried fell below the start of our local log.

This doesn't match what happens in Kafka, which returns the next
available offset in a higher epoch. This behavior is matched by our
lookup when reading from cloud storage.

This patch updates the Kafka handler to return the start offset of our
local log if the requested term falls below the local log's beginning.

(cherry picked from commit 350c8ec)
@andrwng andrwng changed the title kafka: return lowest offset if requested epoch is lower than local log [v22.3.x] kafka: return lowest offset if requested epoch is lower than local log Mar 7, 2023
This test case didn't always actually wait to become leader. Instead, it
waited for the leaders table to be populated.
@andrwng
Copy link
Contributor Author

andrwng commented Mar 8, 2023

CI failure was #9319

@andrwng andrwng merged commit afb66bd into redpanda-data:v22.3.x Mar 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants