smengcl commented on code in PR #12036:
URL: https://github.com/apache/ozone/pull/12036#discussion_r4557162382
##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/diff/TestMergeJoinSnapDiffWriter.java:
##########
@@ -270,6 +272,29 @@ void testFsoPathResolutionAndOrdering(boolean ordering)
throws Exception {
}
}
+ @ParameterizedTest
+ @ValueSource(booleans = {true, false})
+ void testRenameIntoDeletedDirectoryReportsDeleteOfSource(boolean ordering)
throws Exception {
+ byte[] sig = signature("s");
+ try (SnapDiffJobStore store = newStore(true)) {
+ // From: file "a" and directory "b" under the bucket, and file 302 whose
parent 400 has no edge.
+ // To: both files moved under "b", which is deleted before its children
are purged, so "b" has no to edge.
+ store.putFromEdge(BUCKET_OBJECT_ID, 300L, nameBytes("b"));
+ store.putOldList(300L, entry(BUCKET_OBJECT_ID, "b", true, sig));
+ store.putOldList(301L, entry(BUCKET_OBJECT_ID, "a", false, sig));
+ store.putNewList(301L, entry(300L, "a", false, sig));
+ store.putOldList(302L, entry(400L, "c", false, sig));
+ store.putNewList(302L, entry(300L, "c", false, sig));
+ store.flushWrites();
+
+ List<DiffReportEntry> entries = runWriteReportWithManager(store,
BUCKET_OBJECT_ID, true,
+ mockManagerWithRealDeleteRetention(), ordering);
+ assertThat(entries).containsExactlyInAnyOrder(
Review Comment:
The fix looks right to me. Could we add two more rows to this test so it
also pins the behavior next to the new branch?
1. A file moved into a directory that still exists (with a to edge),
expecting it to stay a `RENAME`. Right now this test only has rows whose target
cannot resolve, so it does not show that only those rows turn into `DELETE`.
2. A file whose source parent is deleted as well (the `mv /c/a /b/a`, `rm -r
/b`, `rm -r /c` case from the description), expecting `DELETE c/a` and `DELETE
c`, with `DELETE c/a` first when `ordering` is true. This is the one previously
correct report that changes, and the ordering is only described in the PR text
for now.
--
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]