keith-turner commented on code in PR #6075:
URL: https://github.com/apache/accumulo/pull/6075#discussion_r2729280160
##########
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:
> I think all of the testing added in this PR will need to be removed in
main when https://github.com/apache/accumulo/pull/6040 is merged up to main.
Want to keep a subset of the testing. Still want to test that iterators are
applied in the expected order, can drop testing of duplicate priorities.
--
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]