SaketaChalamchala opened a new pull request, #12036: URL: https://github.com/apache/ozone/pull/12036
Found by TLA+ model checking and code review of the OM optimized snapshot diff paths under [HDDS-15926](https://issues.apache.org/jira/browse/HDDS-15926), on commit https://github.com/apache/ozone/commit/d3b75c75bf9ad475551202477c3a21a3f4b968b7. The patch is generated with Specula (Claude Opus 5.5). ## What changes were proposed in this pull request? The optimized FSO snapshot diff drops a file or directory that was moved under a directory deleted before its children were purged. The object stays in `fileTable` or `directoryTable` until directory deep clean, so the merge join sees the same object id on both sides and classifies it as `RENAME`. The target parent is already gone from `directoryTable`, so the to-snapshot path does not resolve. `MergeJoinSnapDiffWriter` stored a null report entry and then discarded it. The persisted report was only `DELETE` of the deleted directory. Replaying it onto the from-snapshot keeps the moved object, and a moved directory keeps its whole subtree. The legacy diff reports `DELETE` of the old path for the same shape. In the `RENAME` branch of `resolveReportEntries`, a row whose source path resolves and whose target path does not is now written as `DELETE` of the source path. Rows where neither path resolves are still dropped. Dependency ordering needs no separate change: the graph takes the type from the report entry, so the ordered report treats the row as a delete. This covers both ways the target directory can be missing: * The directory already existed in the from-snapshot (`mv /a /b/a`, then `rm -r /b`). The report is `DELETE a` and `DELETE b`. `DELETE b` does not remove `/a` on replay, because `/a` was not under `/b` in the from-snapshot. * The directory was created only between the snapshots and then deleted. It is in neither directory table, so it has no diff entry. The report is `DELETE` of the old path only. If the source parent is deleted as well (`mv /c/a /b/a`, `rm -r /b`, `rm -r /c`), the report also contains `DELETE c/a` next to `DELETE c`, ordered before it. That matches the legacy diff. If the moved object was also modified, a `MODIFY` of the old path is still emitted beside the `DELETE`. ## What is the link to the Apache JIRA https://issues.apache.org/jira/browse/HDDS-17744 ## How was this patch tested? New Unit Test added. * `TestMergeJoinSnapDiffWriter#testRenameIntoDeletedDirectoryReportsDeleteOfSource` builds the from-snapshot directory `/b`, moves `/a` under it, and leaves `/b` with no to-snapshot edge. For both report orderings the report is `DELETE a` and `DELETE b`. An object whose from-parent has no edge is omitted. -- 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]
