lh0156 opened a new pull request, #23025: URL: https://github.com/apache/kafka/pull/23025
### 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 - Serialize each remote-log task execution with its cancellation completion path. - Interrupt the scheduled future and wait for any in-flight execution before `stopPartitions` continues cleanup. - Make cancellation take precedence over a pending expiration log-start-offset update. ### Testing - RED: `testExpirationDoesNotAdvanceLogStartOffsetAfterCancellation` failed against the baseline because the cancelled task advanced the offset to `100`. - GREEN: the regression test passes after the fix. - `./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` - Full `:storage:check` completed 1,252 tests with one timeout in `TransactionsWithTieredStoreTest.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 -- 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]
