smengcl commented on code in PR #12013:
URL: https://github.com/apache/ozone/pull/12013#discussion_r4637084659


##########
hadoop-ozone/ozone-manager/src/test/java/org/apache/hadoop/ozone/om/snapshot/diff/TestMergeJoinSnapDiffWriter.java:
##########
@@ -353,6 +354,46 @@ void testDependencyOrderingFallsBackWhenOverLimit() throws 
Exception {
     }
   }
 
+  @Test
+  void testDependencyOrderingFallsBackOnCycle() throws Exception {
+    byte[] sig = signature("s");
+    SnapDiffJobStore store = spy(newStore(true));
+    try (SnapDiffJobStore ignored = store) {
+      // Files a and b swap names: each RENAME frees the path the other one 
takes.
+      store.putNewList(301L, entry(BUCKET_OBJECT_ID, "b", false, sig));
+      store.putOldList(301L, entry(BUCKET_OBJECT_ID, "a", false, sig));
+      store.putNewList(302L, entry(BUCKET_OBJECT_ID, "a", false, sig));
+      store.putOldList(302L, entry(BUCKET_OBJECT_ID, "b", false, sig));
+      store.flushWrites();
+
+      Pair<Long, String> reportMeta = 
writeReport(mockManagerPassthroughDeletes(), store,
+          BUCKET_OBJECT_ID, true, true, null);

Review Comment:
   nit: the latest commit fixes the progress on the cycle path (it now ends at 
1.0, not 0.9), but no test checks it, since every `writeReport` call in this 
class passes `null` for `reportProgress`.
   
   Could we pass a recording consumer here, for example `List<Double> progress 
= new ArrayList<>()` with `progress::add`, and assert 
`assertThat(progress).last().isEqualTo(1.0)`?
   
   That would keep the fix from slipping back if the progress calls move around 
again.



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