FrankYang0529 opened a new pull request, #17248: URL: https://github.com/apache/kafka/pull/17248
## Why - `ListOffsets` with `MAX_TIMESTAMP` is expected to return the offset of the record carrying the largest timestamp in the partition. - With tiered storage enabled, the lookup previously scanned only **local** log segments and ignored segments already uploaded to remote storage. - As a result, when the record with the maximum timestamp resides in a remote segment, the request returned a wrong offset. ## How - `UnifiedLog#findOffsetByTimestamp` (MAX_TIMESTAMP branch): extract the local max-timestamp lookup into a lazy supplier. When remote storage is enabled and the log is non-empty, route through the async `asyncOffsetRead` path (handing it the local supplier) and return an async future holder; otherwise return the local result directly. - `RemoteLogManager#findOffsetByTimestamp`: add a dedicated MAX_TIMESTAMP path that scans all remote segments for the partition (no epoch/offset filtering) and selects the one with the highest `maxTimestampMs` (ties broken by higher `endOffset`). If that segment overlaps the local log, the local copy is preferred; otherwise the remote segment is looked up. Regular timestamp lookups keep the existing epoch-based logic. - `RemoteLogOffsetReader#call`: for MAX_TIMESTAMP, compute both the remote and local candidates and merge them, keeping the higher timestamp (ties broken by higher offset). Regular lookups still fall back to local only when remote returns nothing. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
