DomGarguilo commented on code in PR #4051:
URL: https://github.com/apache/accumulo/pull/4051#discussion_r1422890948


##########
test/src/main/java/org/apache/accumulo/test/ScanConsistencyIT.java:
##########
@@ -104,69 +150,97 @@ public void testConcurrentScanConsistency() throws 
Exception {
     // getClusterControl().stopAllServers(ServerType.GARBAGE_COLLECTOR);
 
     var executor = Executors.newCachedThreadPool();
-    try (AccumuloClient client = 
Accumulo.newClient().from(getClientProps()).build()) {
-      client.tableOperations().create(table);
+    client.tableOperations().create(table);
 
-      TestContext testContext = new TestContext(client, table, 
getCluster().getFileSystem(),
-          getCluster().getTemporaryPath().toString());
+    TestContext testContext = new TestContext(client, table, fileSystem, 
tmpDir);
 
-      List<Future<WriteStats>> writeTasks = new ArrayList<>();
-      List<Future<ScanStats>> scanTasks = new ArrayList<>();
+    List<Future<WriteStats>> writeTasks = new ArrayList<>();
+    List<Future<ScanStats>> scanTasks = new ArrayList<>();
 
-      Random random = new Random();
+    Random random = new Random();
 
-      int numWriteTask = random.nextInt(10) + 1;
-      int numsScanTask = random.nextInt(10) + 1;
+    int numWriteTask = random.nextInt(10) + 1;
+    int numsScanTask = random.nextInt(10) + 1;
 
-      for (int i = 0; i < numWriteTask; i++) {
-        writeTasks.add(executor.submit(new WriteTask(testContext)));
-      }
+    for (int i = 0; i < numWriteTask; i++) {
+      writeTasks.add(executor.submit(new WriteTask(testContext)));
+    }
 
-      for (int i = 0; i < numsScanTask; i++) {
-        scanTasks.add(executor.submit(new ScanTask(testContext)));
-      }
+    for (int i = 0; i < numsScanTask; i++) {
+      scanTasks.add(executor.submit(new ScanTask(testContext)));
+    }
 
-      var tableOpsTask = executor.submit(new TableOpsTask(testContext));
+    var tableOpsTask = executor.submit(new TableOpsTask(testContext));
 
-      // let the concurrent mayhem run for a bit
-      Thread.sleep(60000);
+    // let the concurrent mayhem run for a bit
+    Thread.sleep(60000);
 
-      // let the threads know to exit
-      testContext.keepRunning.set(false);
+    // let the threads know to exit
+    testContext.keepRunning.set(false);
 
-      for (Future<WriteStats> writeTask : writeTasks) {
-        var stats = writeTask.get();
-        log.debug(String.format("Wrote:%,d Bulk imported:%,d Deleted:%,d Bulk 
deleted:%,d",
-            stats.written, stats.bulkImported, stats.deleted, 
stats.bulkDeleted));
-        assertTrue(stats.written + stats.bulkImported > 0);
-        assertTrue(stats.deleted + stats.bulkDeleted > 0);
-      }
+    for (Future<WriteStats> writeTask : writeTasks) {
+      var stats = writeTask.get();
+      log.debug(String.format("Wrote:%,d Bulk imported:%,d Deleted:%,d Bulk 
deleted:%,d",
+          stats.written, stats.bulkImported, stats.deleted, 
stats.bulkDeleted));
+      checkTrue(stats.written + stats.bulkImported > 0);
+      checkTrue(stats.deleted + stats.bulkDeleted > 0);
+    }
 
-      for (Future<ScanStats> scanTask : scanTasks) {
-        var stats = scanTask.get();
-        log.debug(String.format("Scanned:%,d verified:%,d", stats.scanned, 
stats.verified));
-        assertTrue(stats.verified > 0);
-        // These scans were running concurrently with writes, so a scan will 
see more data than what
-        // was written before the scan started.
-        assertTrue(stats.scanned > stats.verified);
-      }
+    for (Future<ScanStats> scanTask : scanTasks) {
+      var stats = scanTask.get();
+      log.debug(String.format("Scanned:%,d verified:%,d", stats.scanned, 
stats.verified));
+      checkTrue(stats.verified > 0);
+      // These scans were running concurrently with writes, so a scan will see 
more data than what
+      // was written before the scan started.
+      checkTrue(stats.scanned > stats.verified);
+    }
+
+    log.debug(tableOpsTask.get());
+
+    var stats1 = scanData(testContext, random, new Range(), false);
+    var stats2 = scanData(testContext, random, new Range(), true);
+    var stats3 = batchScanData(testContext, new Range());
+    log.debug(

Review Comment:
   When running this test standalone, it would be nice to see these logs at the 
`info` level instead of `debug`. Its not much of a hassle to move my instance 
to display the debug logs, bug when I do they get drowned out by a bunch of 
other debug logs.
   
   I know these logs were not added in this PR but they could be changed since 
its related to the new context that this code is run.



##########
test/src/main/java/org/apache/accumulo/test/ScanConsistencyIT.java:
##########
@@ -79,12 +79,58 @@
 public class ScanConsistencyIT extends AccumuloClusterHarness {
 
   private static final Logger log = 
LoggerFactory.getLogger(ScanConsistencyIT.class);
+  private static boolean inTestingContext;
+
+  public static void main(String[] args) {
+    /**
+     * @formatter:off
+     * Note: In order to run main,
+     * 1) Build the project
+     * 2) Copy the accumulo test jar (in /test/target/) to your accumulo 
installation's
+     * lib directory*
+     * Now, this can be run with
+     * "accumulo org.apache.accumulo.test.ScanConsistencyIT <props-file> 
<tmp-dir> <table>"
+     *      <props-file>: An accumulo client properties file
+     *      <tmp-dir>: tmpDir field for the TestContext object
+     *      <table>: The name of the table to be created
+     * *Ensure the test jar is in lib before the tablet servers start. Restart 
tablet
+     * servers if necessary.
+     * @formatter:on
+     */
+    if (args.length == 3) {
+      inTestingContext = false;
+      final String propsFile = args[0];
+      final String tmpDir = args[1];
+      final String table = args[2];
+
+      try {
+        AccumuloClient client = Accumulo.newClient().from(propsFile).build();

Review Comment:
   ```suggestion
         try {
           AccumuloClient client = Accumulo.newClient().from(propsFile).build();
   ```
   Can move `client` into the try-with-resources block so it is closed 
automatically.



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