keith-turner commented on code in PR #4816:
URL: https://github.com/apache/accumulo/pull/4816#discussion_r1727785544
##########
test/src/main/java/org/apache/accumulo/test/IteratorEnvIT.java:
##########
@@ -222,6 +243,49 @@ private void testScan(String tableName,
}
}
+ private void testRFileScan(Class<? extends
SortedKeyValueIterator<Key,Value>> iteratorClass)
+ throws Exception {
+ LocalFileSystem fs = FileSystem.getLocal(new Configuration());
+ String rFilePath = createRFile(fs);
+ IteratorSetting is = new IteratorSetting(1, iteratorClass);
+
+ try (Scanner scanner =
RFile.newScanner().from(rFilePath).withFileSystem(fs)
+ .withTableProperties(getTableConfig().getProperties()).build()) {
+ scanner.addScanIterator(is);
+ var unused = scanner.iterator();
+ }
+ }
+
+ public void testOfflineScan(String tableName,
+ Class<? extends SortedKeyValueIterator<Key,Value>> iteratorClass) throws
Exception {
+ writeData(tableName);
+ TableId tableId = getServerContext().getTableId(tableName);
+ getServerContext().tableOperations().offline(tableName, true);
+ IteratorSetting is = new IteratorSetting(1, iteratorClass);
+ is.addOption("expected.table.id",
+ getServerContext().tableOperations().tableIdMap().get(tableName));
+
+ try (OfflineScanner scanner =
+ new OfflineScanner(getServerContext(), tableId, new Authorizations()))
{
+ scanner.addScanIterator(is);
+ var unused = scanner.iterator();
+ }
+ }
+
+ public void testClientSideScan(String tableName,
+ Class<? extends SortedKeyValueIterator<Key,Value>> iteratorClass) throws
Exception {
+ writeData(tableName);
+ IteratorSetting is = new IteratorSetting(1, iteratorClass);
+ is.addOption("expected.table.id",
+ getServerContext().tableOperations().tableIdMap().get(tableName));
+
+ try (Scanner scanner = client.createScanner(tableName);
+ var clientIterScanner = new ClientSideIteratorScanner(scanner)) {
+ clientIterScanner.addScanIterator(is);
+ var unused = clientIterScanner.iterator();
Review Comment:
This may be a preexisting problem with this test, not sure. It seems like
there is no positive confirmation that the init code was actually called. If
there was a bug and the init method on the iterator was never called then the
checks that happen in init would never be done. One possible way to solve this
is to filter data based on config passed to init. Then if we read the data and
see it was filtered we know the init method was called. If this is a
preexisting problem with the test we can open a follow on issue if that seems
cleaner.
--
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]