This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch elasticity
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/elasticity by this push:
     new c058bc5e9b fixes race condition in test (#3818)
c058bc5e9b is described below

commit c058bc5e9b3b4d6add85f48aab181c3d7e1b9674
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Thu Oct 5 16:57:03 2023 -0400

    fixes race condition in test (#3818)
---
 .../org/apache/accumulo/test/ScanServerIT.java     | 30 +++++++++++++---------
 1 file changed, 18 insertions(+), 12 deletions(-)

diff --git a/test/src/main/java/org/apache/accumulo/test/ScanServerIT.java 
b/test/src/main/java/org/apache/accumulo/test/ScanServerIT.java
index 7fe25848b8..8d815b96a7 100644
--- a/test/src/main/java/org/apache/accumulo/test/ScanServerIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/ScanServerIT.java
@@ -290,35 +290,41 @@ public class ScanServerIT extends SharedMiniClusterBase {
 
       final List<Future<?>> futures = new ArrayList<>();
       final ExecutorService executor = Executors.newFixedThreadPool(4);
-      try (Scanner scanner = client.createScanner(tableName, 
Authorizations.EMPTY);
-          BatchScanner bscanner = client.createBatchScanner(tableName, 
Authorizations.EMPTY)) {
-        scanner.setRange(new Range());
+      try (Scanner eventualScanner = client.createScanner(tableName, 
Authorizations.EMPTY);
+          Scanner immediateScanner = client.createScanner(tableName, 
Authorizations.EMPTY);
+          BatchScanner eventualBScanner =
+              client.createBatchScanner(tableName, Authorizations.EMPTY);
+          BatchScanner immediateBScanner =
+              client.createBatchScanner(tableName, Authorizations.EMPTY)) {
+        eventualScanner.setRange(new Range());
+        immediateScanner.setRange(new Range());
 
         // Confirm that the ScanServer will not complete the scan
-        scanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        eventualScanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
         futures.add(executor.submit(() -> 
assertTimeoutPreemptively(Duration.ofSeconds(30), () -> {
-          Iterables.size(scanner);
+          Iterables.size(eventualScanner);
         })));
 
         // Confirm that the TabletServer will not complete the scan
-        scanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        immediateScanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
         futures.add(executor.submit(() -> 
assertTimeoutPreemptively(Duration.ofSeconds(30), () -> {
-          Iterables.size(scanner);
+          Iterables.size(immediateScanner);
         })));
 
         // Test the BatchScanner
-        bscanner.setRanges(Collections.singleton(new Range()));
+        eventualBScanner.setRanges(Collections.singleton(new Range()));
+        immediateBScanner.setRanges(Collections.singleton(new Range()));
 
         // Confirm that the ScanServer will not complete the scan
-        bscanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
+        eventualBScanner.setConsistencyLevel(ConsistencyLevel.EVENTUAL);
         futures.add(executor.submit(() -> 
assertTimeoutPreemptively(Duration.ofSeconds(30), () -> {
-          Iterables.size(bscanner);
+          Iterables.size(eventualBScanner);
         })));
 
         // Confirm that the TabletServer will not complete the scan
-        bscanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
+        immediateBScanner.setConsistencyLevel(ConsistencyLevel.IMMEDIATE);
         futures.add(executor.submit(() -> 
assertTimeoutPreemptively(Duration.ofSeconds(30), () -> {
-          Iterables.size(bscanner);
+          Iterables.size(immediateBScanner);
         })));
 
         UtilWaitThread.sleep(30_000);

Reply via email to