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

keith-turner pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/accumulo.git


The following commit(s) were added to refs/heads/main by this push:
     new 829a0e329c improves BadCompactionServiceConfigIT (#6657)
829a0e329c is described below

commit 829a0e329cc3f9d94928fbdce7088c745c94b39d
Author: Keith Turner <[email protected]>
AuthorDate: Wed Nov 18 10:51:05 2026 -0500

    improves BadCompactionServiceConfigIT (#6657)
    
    BadCompactionServiceConfigIT was waiting for bad compaction config to be
    fixed before starting a compaction. Modified the test to start a
    compaction and then fix the config.  Compactions should start working
    once the config is fixed and if they do not this should be considered a
    bug.
---
 .../compaction/BadCompactionServiceConfigIT.java   | 27 +++++++++++++++++-----
 1 file changed, 21 insertions(+), 6 deletions(-)

diff --git 
a/test/src/main/java/org/apache/accumulo/test/compaction/BadCompactionServiceConfigIT.java
 
b/test/src/main/java/org/apache/accumulo/test/compaction/BadCompactionServiceConfigIT.java
index 2a7723e116..c3dbce90ed 100644
--- 
a/test/src/main/java/org/apache/accumulo/test/compaction/BadCompactionServiceConfigIT.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/compaction/BadCompactionServiceConfigIT.java
@@ -20,6 +20,7 @@ package org.apache.accumulo.test.compaction;
 
 import static 
org.apache.accumulo.core.Constants.DEFAULT_COMPACTION_SERVICE_NAME;
 import static 
org.apache.accumulo.core.metrics.Metric.COMPACTION_USER_SVC_ERRORS;
+import static org.apache.accumulo.core.metrics.Metric.MANAGER_USER_TGW_ERRORS;
 import static org.junit.jupiter.api.Assertions.assertEquals;
 
 import java.util.Collections;
@@ -31,6 +32,7 @@ import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.Future;
 import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.concurrent.atomic.AtomicLong;
 import java.util.stream.Collectors;
 import java.util.stream.IntStream;
 
@@ -106,6 +108,10 @@ public class BadCompactionServiceConfigIT extends 
AccumuloClusterHarness {
     cfg.setProperty(Property.GENERAL_MICROMETER_FACTORY, clazzList);
     Map<String,String> sysProps = 
Map.of(TestStatsDRegistryFactory.SERVER_HOST, "127.0.0.1",
         TestStatsDRegistryFactory.SERVER_PORT, 
Integer.toString(sink.getPort()));
+    // The bad compaction config will cause a long delay in assigning 
compaction coordination unless
+    // the following are set to less time.
+    cfg.setProperty(Property.COMPACTION_COORDINATOR_ASSIGNMENT_MIN, "100ms");
+    cfg.setProperty(Property.COMPACTION_COORDINATOR_ASSIGNMENT_MAX, "1s");
     cfg.setSystemProperties(sysProps);
   }
 
@@ -140,6 +146,7 @@ public class BadCompactionServiceConfigIT extends 
AccumuloClusterHarness {
           if (shutdownTailer.get()) {
             break;
           }
+
           if (s.startsWith(COMPACTION_USER_SVC_ERRORS.getName())) {
             Metric m = TestStatsDSink.parseStatsDMetric(s);
             Integer value = Integer.parseInt(m.getValue());
@@ -199,8 +206,6 @@ public class BadCompactionServiceConfigIT extends 
AccumuloClusterHarness {
         }
       });
 
-      Wait.waitFor(() -> serviceMisconfigured.get() == false);
-
       List<IteratorSetting> iterators =
           Collections.singletonList(new IteratorSetting(100, 
EverythingFilter.class));
       client.tableOperations().compact(table,
@@ -211,6 +216,7 @@ public class BadCompactionServiceConfigIT extends 
AccumuloClusterHarness {
         assertEquals(0, scanner.stream().count());
       }
 
+      Wait.waitFor(() -> serviceMisconfigured.get() == false);
       fixerFuture.get();
 
       // misconfigure the service, test how going from good config to bad 
config works. The test
@@ -235,11 +241,12 @@ public class BadCompactionServiceConfigIT extends 
AccumuloClusterHarness {
           throw new RuntimeException(e);
         }
       });
-      Wait.waitFor(() -> serviceMisconfigured.get() == false);
 
       client.tableOperations().compact(table,
           new CompactionConfig().setIterators(iterators).setWait(true));
 
+      Wait.waitFor(() -> serviceMisconfigured.get() == false);
+
       // Verify compaction ran.
       try (var scanner = client.createScanner(table)) {
         assertEquals(0, scanner.stream().count());
@@ -257,6 +264,7 @@ public class BadCompactionServiceConfigIT extends 
AccumuloClusterHarness {
 
     final AtomicBoolean shutdownTailer = new AtomicBoolean(false);
     final AtomicBoolean serviceMisconfigured = new AtomicBoolean(false);
+    final AtomicLong tabletErrors = new AtomicLong(0);
     final Thread thread = Threads.createNonCriticalThread("metric-tailer", () 
-> {
       while (!shutdownTailer.get()) {
         List<String> statsDMetrics = sink.getLines();
@@ -264,6 +272,12 @@ public class BadCompactionServiceConfigIT extends 
AccumuloClusterHarness {
           if (shutdownTailer.get()) {
             break;
           }
+
+          if (s.startsWith(MANAGER_USER_TGW_ERRORS.getName())) {
+            Metric m = TestStatsDSink.parseStatsDMetric(s);
+            tabletErrors.set(Long.parseLong(m.getValue()));
+          }
+
           if (s.startsWith(COMPACTION_USER_SVC_ERRORS.getName())) {
             Metric m = TestStatsDSink.parseStatsDMetric(s);
             Integer value = Integer.parseInt(m.getValue());
@@ -296,6 +310,7 @@ public class BadCompactionServiceConfigIT extends 
AccumuloClusterHarness {
       client.instanceOperations().setProperty(CSP + "cs1.planner.opts.groups", 
value);
 
       Wait.waitFor(() -> serviceMisconfigured.get() == false);
+      Wait.waitFor(() -> tabletErrors.get() > 0);
 
       // Add splits so that the tserver logs can manually be inspected to 
ensure they are not
       // spammed. Not sure how to check this automatically.
@@ -335,9 +350,6 @@ public class BadCompactionServiceConfigIT extends 
AccumuloClusterHarness {
         }
       });
 
-      Wait.waitFor(() -> fixerFuture.isDone());
-      fixerFuture.get();
-
       List<IteratorSetting> iterators =
           Collections.singletonList(new IteratorSetting(100, 
EverythingFilter.class));
       client.tableOperations().compact(table,
@@ -348,6 +360,9 @@ public class BadCompactionServiceConfigIT extends 
AccumuloClusterHarness {
         assertEquals(0, scanner.stream().count());
       }
 
+      fixerFuture.get();
+      Wait.waitFor(() -> tabletErrors.get() == 0);
+
     } finally {
       shutdownTailer.set(true);
       thread.join();

Reply via email to