-
Notifications
You must be signed in to change notification settings - Fork 14k
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
KAFKA-17498: Reduce the number of remote calls when serving LIST_OFFSETS request #17132
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @kamalcph for the PR. Please resolve the conflicts.
57e9bd8
to
2daef27
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this and apologies for the delayed review!
2daef27
to
96f6b49
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. Overall LGTM. Please also update the javadoc of findOffsetByTimestamp
. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Just a minor comment. Thanks for the patch.
7bf3026
to
de3cd25
Compare
de3cd25
to
c8f8130
Compare
@@ -698,14 +700,24 @@ public Optional<FileRecords.TimestampAndOffset> findOffsetByTimestamp(TopicParti | |||
&& rlsMetadata.endOffset() >= startingOffset | |||
&& isRemoteSegmentWithinLeaderEpochs(rlsMetadata, unifiedLog.logEndOffset(), epochWithOffsets) | |||
&& rlsMetadata.state().equals(RemoteLogSegmentState.COPY_SEGMENT_FINISHED)) { | |||
return lookupTimestamp(rlsMetadata, timestamp, startingOffset); | |||
// cache to avoid race conditions | |||
List<LogSegment> segmentsCopy = new ArrayList<>(unifiedLog.logSegments()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Raised an edge case here where we may miss returning the right segment while searching for the target timestamp. This can happen when the search operation moves from remote segments to local segments search but the local segment is moved to remote storage and deleted from local segments successfully before it is searched successfully.
Thanks @kamalcph for raising the KAFKA-17637 as we discussed offline. This can be taken up in a follow-up PR.
If the index to be fetched exists locally, then avoid fetching the remote indexes to serve the LIST_OFFSETS request.
Committer Checklist (excluded from commit message)