Skip to content

fix(inkless:consolidation): reject follower reads below the cross-tier earliest [KC-332] - #720

Merged
ivanyu merged 2 commits into
mainfrom
svv/ts-unification-follower-reads
Jul 28, 2026
Merged

fix(inkless:consolidation): reject follower reads below the cross-tier earliest [KC-332]#720
ivanyu merged 2 commits into
mainfrom
svv/ts-unification-follower-reads

Conversation

@viktorsomogyi

Copy link
Copy Markdown
Contributor

Followers keep a stale local logStartOffset (frozen at the seal) after a switch, so an older consumer routed there could read logically-deleted records. Consult the control-plane cross-tier earliest and reject such fetches with OFFSET_OUT_OF_RANGE (fail-open when unavailable). Adds unit tests.

@viktorsomogyi
viktorsomogyi requested a review from ivanyu July 23, 2026 08:28
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-follower-reads branch from 52cf871 to 8a1d7f2 Compare July 23, 2026 09:59
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-reclaim-floor branch from 86e3b1a to a6f0a03 Compare July 23, 2026 15:37
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-follower-reads branch from 8a1d7f2 to 9a10866 Compare July 23, 2026 15:39
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-reclaim-floor branch 2 times, most recently from bbca8b1 to f6c0f80 Compare July 23, 2026 15:47
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-follower-reads branch from 9a10866 to 8a6d2c9 Compare July 23, 2026 15:49
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-reclaim-floor branch from f6c0f80 to e3f351d Compare July 24, 2026 12:17
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-follower-reads branch from 8a6d2c9 to 0982191 Compare July 24, 2026 12:17
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-reclaim-floor branch from e3f351d to 5079dcd Compare July 24, 2026 13:07
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-follower-reads branch 3 times, most recently from 771e660 to dda940f Compare July 27, 2026 10:37
Base automatically changed from svv/ts-unification-reclaim-floor to main July 28, 2026 08:50
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-follower-reads branch from dda940f to 96ef5b2 Compare July 28, 2026 08:52
@viktorsomogyi
viktorsomogyi marked this pull request as ready for review July 28, 2026 08:53
@viktorsomogyi
viktorsomogyi requested review from Copilot and jeqo July 28, 2026 09:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens the consolidating diskless-topic fetch path by preventing consumer fetches routed to follower replicas from reading offsets below the authoritative (control-plane) cross-tier earliest offset, avoiding exposure of logically-deleted records after classic→diskless switches.

Changes:

  • Add a follower-only guard in ReplicaManager.fetchMessages to return OFFSET_OUT_OF_RANGE when a consumer fetch offset is below the cross-tier earliest (fail-open when unresolved).
  • Add unit tests covering follower/leader behavior, modern vs older consumers (client metadata), and fail-open behavior when the earliest cannot be resolved.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
core/src/main/scala/kafka/server/ReplicaManager.scala Adds the cross-tier-earliest guard for consumer fetches routed to follower replicas during consolidation.
core/src/test/scala/unit/kafka/server/ReplicaManagerInklessTest.scala Adds unit tests validating rejection/allow rules and fail-open behavior for the new guard.

Comment thread core/src/main/scala/kafka/server/ReplicaManager.scala
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-follower-reads branch from 96ef5b2 to 8ecdaa8 Compare July 28, 2026 10:02
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-follower-reads branch from 8ecdaa8 to 762c659 Compare July 28, 2026 10:41
giuseppelillo
giuseppelillo previously approved these changes Jul 28, 2026
@giuseppelillo
giuseppelillo enabled auto-merge (squash) July 28, 2026 12:47
@jeqo
jeqo disabled auto-merge July 28, 2026 12:48
@jeqo

jeqo commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

@viktorsomogyi check

Commits must have verified signatures.

@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-follower-reads branch from 762c659 to 692f42e Compare July 28, 2026 12:51
@viktorsomogyi

Copy link
Copy Markdown
Contributor Author

@jeqo sorry for that, fixed it now

ivanyu
ivanyu previously approved these changes Jul 28, 2026
…r earliest [KC-332]

Followers keep a stale local logStartOffset (frozen at the seal) after a switch,
so an older consumer routed there could read logically-deleted records. Consult
the control-plane cross-tier earliest and reject such fetches with
OFFSET_OUT_OF_RANGE (fail-open when unavailable). Adds unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>
@viktorsomogyi

Copy link
Copy Markdown
Contributor Author

Looking at the test failures already. First they didn't appear on my local branch, just after rebasing it on main, so it's probably brought in by a change that affected similar parts.

@viktorsomogyi
viktorsomogyi dismissed stale reviews from ivanyu and giuseppelillo via ed0554d July 28, 2026 13:46
@viktorsomogyi
viktorsomogyi force-pushed the svv/ts-unification-follower-reads branch from 692f42e to ed0554d Compare July 28, 2026 13:46
@viktorsomogyi

Copy link
Copy Markdown
Contributor Author

@jeqo @ivanyu fixed the test failures, PTAL

@viktorsomogyi
viktorsomogyi requested a review from ivanyu July 28, 2026 13:47
@ivanyu
ivanyu merged commit 685033e into main Jul 28, 2026
6 checks passed
@ivanyu
ivanyu deleted the svv/ts-unification-follower-reads branch July 28, 2026 15:07
giuseppelillo pushed a commit that referenced this pull request Jul 29, 2026
…r earliest [KC-332] (#720)

* fix(inkless:consolidation): reject follower reads below the cross-tier earliest [KC-332]

Followers keep a stale local logStartOffset (frozen at the seal) after a switch,
so an older consumer routed there could read logically-deleted records. Consult
the control-plane cross-tier earliest and reject such fetches with
OFFSET_OUT_OF_RANGE (fail-open when unavailable). Adds unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fixup(inkless:consolidation): mock ReplicaManager for tests

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
giuseppelillo pushed a commit that referenced this pull request Jul 30, 2026
…r earliest [KC-332] (#720)

* fix(inkless:consolidation): reject follower reads below the cross-tier earliest [KC-332]

Followers keep a stale local logStartOffset (frozen at the seal) after a switch,
so an older consumer routed there could read logically-deleted records. Consult
the control-plane cross-tier earliest and reject such fetches with
OFFSET_OUT_OF_RANGE (fail-open when unavailable). Adds unit tests.

Co-authored-by: Cursor <cursoragent@cursor.com>

* fixup(inkless:consolidation): mock ReplicaManager for tests

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
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.

5 participants