[Client] Support bounded log scanning - #4545
Open
yangshangqing95 wants to merge 1 commit into
Open
yangshangqing95 wants to merge 1 commit into
yangshangqing95 wants to merge 1 commit into
Conversation
Author
|
Hi @fresh-borzoni @polyzos , would appreciate it if you could take a look at this PR when you have time, thx. |
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
The runtime change is intentionally small, a significant portion of this PR is test coverage for boundary conditions, compatibility, remote reads, retention, and Arrow resource ownership.
Purpose
Linked issue: close #4544
This PR adds a bounded range scan capability to
LogScanner, allowing callers to subscribe to a bucket within an exclusive offset range:Design
Each subscribed bucket keeps its own stopping offset. The client:
stoppingOffset;finishedBuckets();start >= stop;EARLIEST_OFFSET;For an explicit starting offset, the client can enforce the range directly.
For
EARLIEST_OFFSET, the client additionally needs to know the physical offset to which the server resolved theEARLIESTrequest. This PR therefore adds the optionalresolved_earliest_offsetfield to the fetch response.Server changes are limited to reporting the resolved EARLIEST offset. Enforcing the stopping offset on the server and migrating connectors are outside this PR.
Why not use
log_start_offset?log_start_offsetmay eventually be a natural source for this information, but using it in this PR would significantly broaden the scope.Its complete client/server semantics are not currently established across the relevant fetch paths, and the server still does not consistently populate it with the physical log start offset. Defining and enabling that behavior deserves a separate and more detailed design discussion because it can affect existing fetch, retention, remote-log, and compatibility semantics.
There is also a difference:
log_start_offsetdescribes a property/boundary of the log;resolved_earliest_offsetdescribes how a particularEARLIESTfetch request was resolved.Keeping the latter as an optional request specific response field also allows a new client to distinguish:
For a successful fetch response to an EARLIEST_OFFSET request:
This lets bounded
EARLIESTscans fail explicitly against an older server instead of silently making an incorrect range decision.If
log_start_offsetgets well defined and consistently implemented in the future, and is sufficient for boundedEARLIESTresolution, the implementation can be consolidated in a follow-up. That broader protocol/storage design is intentionally not part of this PR.Brief change log
subscribeBounded(...)APIs toLogScanner.resolved_earliest_offsetto fetch responses for EARLIEST resolution.Tests
Added/updated unit and integration coverage for:
start == stop,start > stop, andstop == 0;EARLIEST_OFFSETresolution before, at, and beyond the stopping offset;EARLIESTresolution propagation;EARLIEST;LogScannerimplementations using the existing subscription APIs;API and Format
This PR adds new API surface but does not change the existing unbounded
LogScannerAPIs.The bounded subscription methods are added as default interface methods so existing
LogScannerimplementations remain compatible. Implementations that do not support bounded scans continue to work and reject the new operation withUnsupportedOperationException.Existing unbounded Log Table public API behavior is intentionally preserved.
The fetch protocol adds:
This is an additive optional protobuf field:
EARLIEST_OFFSETrequire the server to report the resolved starting offset unless the range can be completed locally, such as whenstoppingOffset == 0. If the required metadata is absent, polling fails withUnsupportedOperationException.Documentation
The new bounded subscription semantics are documented in the
LogScannerAPI, including:[startingOffset, stoppingOffset)semantics;EARLIEST_OFFSET.