You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@accumulo.apache.org by "keith-turner (via GitHub)" <gi...@apache.org> on 2024/08/07 21:40:53 UTC

Re: [PR] Added Eventual Scan test in ComprehensiveIT [accumulo]

keith-turner commented on code in PR #4754:
URL: https://github.com/apache/accumulo/pull/4754#discussion_r1707956179


##########
test/src/main/java/org/apache/accumulo/test/ComprehensiveIT.java:
##########
@@ -133,6 +152,50 @@ public static void teardown() {
     SharedMiniClusterBase.stopMiniCluster();
   }
 
+  @Test
+  public void testEventualScan() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+
+      String table = getUniqueNames(1)[0];
+      client.tableOperations().create(table);
+
+      // Start Scan Server
+      getCluster().getClusterControl().start(ServerType.SCAN_SERVER);
+
+      // generate 100 rows of data
+      write(client, table, generateMutations(0, 100, tr -> true));
+
+      // need flush table so that eventual scan can see it.
+      client.tableOperations().flush(table);
+
+      Thread.sleep(10000);

Review Comment:
   This flush call starts the flush but does not wait for it.  There is another flush call where you can optionally wait.  Could call that and set wait to true and drop the sleep.



##########
test/src/main/java/org/apache/accumulo/test/ComprehensiveIT.java:
##########
@@ -133,6 +152,50 @@ public static void teardown() {
     SharedMiniClusterBase.stopMiniCluster();
   }
 
+  @Test
+  public void testEventualScan() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+
+      String table = getUniqueNames(1)[0];
+      client.tableOperations().create(table);
+
+      // Start Scan Server
+      getCluster().getClusterControl().start(ServerType.SCAN_SERVER);
+
+      // generate 100 rows of data
+      write(client, table, generateMutations(0, 100, tr -> true));
+
+      // need flush table so that eventual scan can see it.
+      client.tableOperations().flush(table);
+
+      Thread.sleep(10000);
+
+      // should see all data that was flushed in eventual scan
+      verifyData(client, table, AUTHORIZATIONS, generateKeys(0, 100),
+          scanner -> scanner.setConsistencyLevel(EVENTUAL));
+
+      // should not see data with col vis set
+      verifyData(client, table, Authorizations.EMPTY, generateKeys(0, 100, tr -> tr.vis.isEmpty()),
+          scanner -> scanner.setConsistencyLevel(EVENTUAL));
+
+      // write some more rows after 100 and verfy those are not seen by eventual scan until table is
+      // flushed.
+      write(client, table, generateMutations(100, 200, tr -> true));
+      verifyData(client, table, AUTHORIZATIONS, generateKeys(0, 100),
+          scanner -> scanner.setConsistencyLevel(EVENTUAL));
+
+      // need flush table so that eventual scan can see it.
+      client.tableOperations().flush(table);
+
+      Thread.sleep(10000);
+
+      verifyData(client, table, AUTHORIZATIONS, generateKeys(0, 200),
+          scanner -> scanner.setConsistencyLevel(EVENTUAL));
+
+      getCluster().getClusterControl().stop(ServerType.SCAN_SERVER);

Review Comment:
   Could put this in a finally block adding it to the existing try.



##########
test/src/main/java/org/apache/accumulo/test/ComprehensiveIT.java:
##########
@@ -133,6 +152,50 @@ public static void teardown() {
     SharedMiniClusterBase.stopMiniCluster();
   }
 
+  @Test
+  public void testEventualScan() throws Exception {
+    try (AccumuloClient client = Accumulo.newClient().from(getClientProps()).build()) {
+
+      String table = getUniqueNames(1)[0];
+      client.tableOperations().create(table);
+
+      // Start Scan Server
+      getCluster().getClusterControl().start(ServerType.SCAN_SERVER);
+
+      // generate 100 rows of data
+      write(client, table, generateMutations(0, 100, tr -> true));
+
+      // need flush table so that eventual scan can see it.
+      client.tableOperations().flush(table);
+
+      Thread.sleep(10000);
+
+      // should see all data that was flushed in eventual scan
+      verifyData(client, table, AUTHORIZATIONS, generateKeys(0, 100),
+          scanner -> scanner.setConsistencyLevel(EVENTUAL));
+
+      // should not see data with col vis set
+      verifyData(client, table, Authorizations.EMPTY, generateKeys(0, 100, tr -> tr.vis.isEmpty()),
+          scanner -> scanner.setConsistencyLevel(EVENTUAL));
+
+      // write some more rows after 100 and verfy those are not seen by eventual scan until table is
+      // flushed.
+      write(client, table, generateMutations(100, 200, tr -> true));
+      verifyData(client, table, AUTHORIZATIONS, generateKeys(0, 100),
+          scanner -> scanner.setConsistencyLevel(EVENTUAL));
+
+      // need flush table so that eventual scan can see it.
+      client.tableOperations().flush(table);
+
+      Thread.sleep(10000);

Review Comment:
   Can also call the flush with wait here and drop the sleep.



-- 
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: notifications-unsubscribe@accumulo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org