kevinrr888 commented on code in PR #6075:
URL: https://github.com/apache/accumulo/pull/6075#discussion_r2729327837


##########
test/src/main/java/org/apache/accumulo/test/functional/CompactionIT.java:
##########
@@ -988,6 +989,54 @@ public void testMigrationCancelCompaction() throws 
Exception {
     }
   }
 
+  @Test
+  public void testIteratorOrder() throws Exception {
+    String[] names = getUniqueNames(2);
+    try (AccumuloClient c = 
Accumulo.newClient().from(getClientProps()).build()) {
+
+      // create a table with minor compaction iterators configured to ensure 
those iterators are
+      // applied in the correct order
+      NewTableConfiguration ntc = new NewTableConfiguration()
+          .attachIterator(AppendingIterator.configure(50, "x"), 
EnumSet.of(IteratorScope.minc))
+          .attachIterator(AppendingIterator.configure(100, "a"), 
EnumSet.of(IteratorScope.minc));
+      c.tableOperations().create(names[0], ntc);
+
+      // create a table with major compaction iterators configured to ensure 
those iterators are
+      // applied in the correct order
+      NewTableConfiguration ntc2 = new NewTableConfiguration()
+          .attachIterator(AppendingIterator.configure(50, "x"), 
EnumSet.of(IteratorScope.majc))
+          .attachIterator(AppendingIterator.configure(100, "a"), 
EnumSet.of(IteratorScope.majc));
+      c.tableOperations().create(names[1], ntc2);
+
+      try (var writer = c.createBatchWriter(names[0]);
+          var writer2 = c.createBatchWriter(names[1])) {
+        Mutation m = new Mutation("r1");
+        m.put("", "", "base:");
+        writer.addMutation(m);
+        writer2.addMutation(m);
+      }
+
+      try (var mincScanner = c.createScanner(names[0]);
+          var majcScanner = c.createScanner(names[1])) {
+        // iterators should not be applied yet
+        assertEquals("base:", 
mincScanner.iterator().next().getValue().toString());
+        assertEquals("base:", 
majcScanner.iterator().next().getValue().toString());
+
+        c.tableOperations().flush(names[0], null, null, true);
+        assertEquals("base:xa", 
mincScanner.iterator().next().getValue().toString());
+        assertEquals("base:", 
majcScanner.iterator().next().getValue().toString());
+
+        List<IteratorSetting> iters = List.of(AppendingIterator.configure(70, 
"m"),
+            AppendingIterator.configure(50, "b"), 
AppendingIterator.configure(100, "c"));
+        c.tableOperations().compact(names[1],
+            new 
CompactionConfig().setWait(true).setFlush(true).setIterators(iters));

Review Comment:
   Okay, that sounds good. I thought this was mostly for testing dup priorities 
and there was testing elsewhere for expected ordering, but maybe there is no 
such testing...



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

Reply via email to