smengcl opened a new pull request, #11669: URL: https://github.com/apache/ozone/pull/11669
Generated-by: Claude Code (Opus 5.5) ## What changes were proposed in this pull request? `OMSnapshotPurgeRequest#validateAndUpdateCache` purges the snapshots in a request one at a time, updating the snapshotInfoTable cache and the in-memory `SnapshotChainManager` for each. If a later snapshot in the same request throws, earlier updates are not rolled back, and nothing is written to the DB because the response is not OK (HDDS-11452). Most failures at that point already terminate OM: a plain `IOException` maps to `INTERNAL_ERROR` or `METADATA_ERROR`, which `OzoneManagerStateMachine#processResponse` treats as fatal. The exception is `OMException` `FILE_NOT_FOUND` from `SnapshotUtils#getNextSnapshot`, thrown when the snapshot chain has a next snapshot missing from snapshotInfoTable. OM then keeps running with a cache and chain that no longer match the DB. This change reports an `OMException` as `INTERNAL_ERROR` once the request has started updating the cache or chain, so OM terminates and rebuilds the chain from the DB on restart. Failures before any update keep their original status. There is no protobuf, DB layout or upgrade change, and the DB writes are unchanged (a failed purge writes nothing either way). This does not make the request atomic; HDDS-11452 stays open for that. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17270 ## How was this patch tested? Added `testFailureAfterPartialPurgeIsInternalError` to `TestOMSnapshotPurgeRequestAndResponse`. It purges `[s3, s1]` while s2 is in the chain but missing from snapshotInfoTable, and expects `INTERNAL_ERROR`; a single snapshot purge that fails before any update still gets `FILE_NOT_FOUND`. The partial case fails without the fix. All 29 tests in the class pass locally. 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
