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

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


The following commit(s) were added to refs/heads/2.1 by this push:
     new 6501f755c4 adds IT to verify external compactions can interrupt 
threads (#5412)
6501f755c4 is described below

commit 6501f755c4e24edba0d45d06715fbd0e9f0fb189
Author: Keith Turner <ktur...@apache.org>
AuthorDate: Wed Mar 19 11:59:27 2025 -0400

    adds IT to verify external compactions can interrupt threads (#5412)
    
    fixes #5401
---
 .../test/compaction/ExternalCompaction_2_IT.java   | 44 ++++++++++++++++++++++
 1 file changed, 44 insertions(+)

diff --git 
a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_2_IT.java
 
b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_2_IT.java
index 9b0a94efae..117a46bb5a 100644
--- 
a/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_2_IT.java
+++ 
b/test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_2_IT.java
@@ -38,6 +38,7 @@ import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.junit.jupiter.api.Assertions.fail;
 
 import java.util.Collections;
+import java.util.List;
 import java.util.Set;
 import java.util.SortedSet;
 import java.util.TreeSet;
@@ -48,6 +49,8 @@ import org.apache.accumulo.compactor.Compactor;
 import org.apache.accumulo.coordinator.CompactionCoordinator;
 import org.apache.accumulo.core.client.Accumulo;
 import org.apache.accumulo.core.client.AccumuloClient;
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.client.admin.CompactionConfig;
 import org.apache.accumulo.core.compaction.thrift.TCompactionState;
 import org.apache.accumulo.core.compaction.thrift.TExternalCompactionList;
 import org.apache.accumulo.core.conf.Property;
@@ -60,6 +63,7 @@ import 
org.apache.accumulo.harness.MiniClusterConfigurationCallback;
 import org.apache.accumulo.harness.SharedMiniClusterBase;
 import org.apache.accumulo.minicluster.ServerType;
 import org.apache.accumulo.miniclusterImpl.MiniAccumuloConfigImpl;
+import org.apache.accumulo.test.functional.SlowIterator;
 import org.apache.hadoop.conf.Configuration;
 import org.apache.hadoop.io.Text;
 import org.junit.jupiter.api.AfterEach;
@@ -301,6 +305,46 @@ public class ExternalCompaction_2_IT extends 
SharedMiniClusterBase {
     }
   }
 
+  @Test
+  public void testDeleteTableCancelsSleepingExternalCompaction() throws 
Exception {
+    
getCluster().getClusterControl().startCoordinator(CompactionCoordinator.class);
+    getCluster().getClusterControl().startCompactors(Compactor.class, 1, 
QUEUE4);
+
+    String table1 = this.getUniqueNames(1)[0];
+    try (AccumuloClient client =
+        Accumulo.newClient().from(getCluster().getClientProperties()).build()) 
{
+
+      createTable(client, table1, "cs4");
+      TableId tid = getCluster().getServerContext().getTableId(table1);
+      writeData(client, table1);
+
+      // The purpose of this test to ensure the sleeping thread is 
interrupted. The only way the
+      // compactor can cancel this compaction is if it interrupts the sleeping 
thread.
+      IteratorSetting iteratorSetting = new IteratorSetting(100, 
SlowIterator.class);
+      // Sleep so long that the test would timeout if the thread is not 
interrupted.
+      SlowIterator.setSleepTime(iteratorSetting, 600000);
+      SlowIterator.setSeekSleepTime(iteratorSetting, 600000);
+      SlowIterator.sleepUninterruptibly(iteratorSetting, false);
+
+      client.tableOperations().compact(table1,
+          new 
CompactionConfig().setIterators(List.of(iteratorSetting)).setWait(false));
+
+      // Wait for the compaction to start by waiting for 1 external compaction 
column
+      Set<ExternalCompactionId> ecids =
+          
waitForCompactionStartAndReturnEcids(getCluster().getServerContext(), tid);
+
+      // Confirm that this ECID shows up in RUNNING set
+      int matches = confirmCompactionRunning(getCluster().getServerContext(), 
ecids);
+      assertTrue(matches > 0);
+
+      client.tableOperations().delete(table1);
+
+      confirmCompactionCompleted(getCluster().getServerContext(), ecids,
+          TCompactionState.CANCELLED);
+
+    }
+  }
+
   @Test
   public void testDeleteTableCancelsExternalCompaction() throws Exception {
     
getCluster().getClusterControl().startCoordinator(CompactionCoordinator.class);

Reply via email to