KAFKA-20148: Wait for remote log task completion before cleanup - #23025
Open
lh0156 wants to merge 1 commit into
Open
KAFKA-20148: Wait for remote log task completion before cleanup#23025lh0156 wants to merge 1 commit into
lh0156 wants to merge 1 commit into
Conversation
Ensure a remote log task has finished its in-flight execution before partition cleanup continues. A cancelled expiration task also skips its pending log-start-offset update, preventing stale retention results from racing with remote storage disablement. Generated-by: OpenAI Codex (GPT-5)
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.
Problem
When remote storage is disabled, partition tasks are cancelled while an expiration run may still be scanning remote metadata. The scan can then publish a stale log-start-offset update after cancellation, racing with partition cleanup.
Solution
stopPartitionscontinues cleanup.Testing
testExpirationDoesNotAdvanceLogStartOffsetAfterCancellationfailed against the baseline because the cancelled task advanced the offset to100../gradlew :storage:test --tests org.apache.kafka.server.log.remote.storage.RemoteLogManagerTest.testExpirationDoesNotAdvanceLogStartOffsetAfterCancellation --no-build-cache --console=plain./gradlew :storage:test --tests org.apache.kafka.server.log.remote.storage.RemoteLogManagerTest --no-build-cache --console=plain./gradlew :storage:checkstyleTest :storage:spotlessCheck :storage:spotbugsMain --no-build-cache --console=plain:storage:checkcompleted 1,252 tests with one timeout inTransactionsWithTieredStoreTest.testFailureToFenceEpochWithTV1; the same test passed when rerun in isolation, so the result is recorded as local parallel-test variability rather than a changed-path failure.Fixes KAFKA-20148