Github user milleruntime commented on a diff in the pull request:
https://github.com/apache/accumulo/pull/159#discussion_r108471232
--- Diff:
core/src/test/java/org/apache/accumulo/core/iterators/system/ColumnFamilySkippingIteratorTest.java
---
@@ -236,4 +237,45 @@ public void test3() throws Exception {
// System.out.println(ci.getCount());
}
+
+ private static class CloseTestIter extends SortedMapIterator {
+
+ int closeCallCount = 0;
+
+ public CloseTestIter(SortedMap<Key,Value> map) {
+ super(map);
+ }
+
+ @Override
+ public void close() {
+ System.out.println("Closing inner CloseIterator.");
+ closeCallCount++;
+ }
+ }
+
+ public void testClose() throws Exception {
+ TreeMap<Key,Value> tm = new TreeMap<>();
+ put(tm, "r1", "cf1", "cq1", 5, "v1");
+ put(tm, "r1", "cf1", "cq3", 5, "v2");
+ put(tm, "r2", "cf1", "cq1", 5, "v3");
+ put(tm, "r2", "cf2", "cq4", 5, "v4");
+ put(tm, "r2", "cf2", "cq5", 5, "v5");
+ put(tm, "r3", "cf3", "cq6", 5, "v6");
+
+ CloseTestIter closeIter = new CloseTestIter(tm);
+ ColumnFamilySkippingIterator cfi = new
ColumnFamilySkippingIterator(closeIter);
+
+ assertEquals(0, closeIter.closeCallCount);
+ HashSet<ByteSequence> colfams = new HashSet<>();
+ colfams.add(new ArrayByteSequence("cf2"));
+ cfi.seek(new Range(), colfams, true);
+ testAndCallnext(cfi, "r2", "cf2", "cq4", 5, "v4");
+ testAndCallnext(cfi, "r2", "cf2", "cq5", 5, "v5");
+ assertFalse(cfi.hasTop());
+
+ System.out.println("Closing ColumnFamilySkippingIterator");
+ cfi.close();
--- End diff --
It looks that way but its testing whether the close gets propagated to the
underlying iterator. If the CFSKI had a noop like the MultiIterator the test
would fail.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---