SaketaChalamchala commented on code in PR #12036:
URL: https://github.com/apache/ozone/pull/12036#discussion_r4567285698


##########
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:
   Thanks for the review @smengcl 
   
   1. `testFsoPathResolutionAndOrdering` moves object `202` from `parent1` to 
`parent2`. `parent2` has a to-edge (`putToEdge` for object `201`). For both 
orderings the report keeps `RENAME parent1/child -> parent2/child`. That is the 
row that must stay a rename when the target directory is still present.
   2. Updated `testRenameIntoDeletedDirectoryReportsDeleteOfSource` to cover 
this scenario. 



-- 
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]

Reply via email to