perfloop-agent opened a new pull request, #24336: URL: https://github.com/apache/kafka/pull/24336
Unclean-shutdown recovery can empty a valid log segment and delete later unflushed segments when writing a producer-state snapshot fails. A storage failure should stop recovery rather than be interpreted as record corruption. PR #17042 widened the recovery fallback from `InvalidOffsetException` to include `IOException` during the Scala-to-Java migration. Restrict the catch in `LogLoader.recoverLog` to `InvalidOffsetException` again. Storage errors then escape through the existing startup path to `LogManager.loadLogs`, which reports the directory offline instead of loading a truncated log. Corrupt records and invalid offsets retain their existing truncation paths. Recovery-point calculation and the clean-shutdown path are unchanged. The regression test in `storage/src/test/java/org/apache/kafka/storage/internals/log/LogLoaderTest.java` opens two persisted segments and makes the first recovery snapshot write fail by placing a directory at its file path. It invokes unclean startup at recovery point zero, checks both log files against their original bytes, and requires the storage error to propagate. This covers both truncation of the recovered segment and deletion of a later segment. Existing recovery tests cover corrupt tails, rebuilt indexes, producer snapshots and recovery checkpoints. -- 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]
