Skip to content

Commit 7f9f734

Browse files
committed
Fix ExternalCompaction_1_IT.testPartialCompaction failure
The test was timing out because it never started running compactions created by the test method. Instead, the compactor process was running compactions created by the previous test method because the previous test created a table with a lot of files, started a user compaction, then cancelled the user compaction. The recent changes in apache#5026 caused a bunch of system compactions to be generated for the table. The two test methods share the same compaction queue, so the compactor was busy running the system compactions. To fix this issue I backported a property added in apache#3955 that makes the compactor cancel check method time configurable and I deleted the table in the test method that created a lot of files. Closes apache#5052
1 parent ed4d914 commit 7f9f734

File tree

4 files changed

+18
-3
lines changed

4 files changed

+18
-3
lines changed

core/src/main/java/org/apache/accumulo/core/conf/Property.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1466,6 +1466,12 @@ public enum Property {
14661466
@Experimental
14671467
COMPACTOR_PREFIX("compactor.", null, PropertyType.PREFIX,
14681468
"Properties in this category affect the behavior of the accumulo compactor server.", "2.1.0"),
1469+
COMPACTOR_CANCEL_CHECK_INTERVAL("compactor.cancel.check.interval", "5m",
1470+
PropertyType.TIMEDURATION,
1471+
"Interval at which Compactors will check to see if the currently executing compaction"
1472+
+ " should be cancelled. This checks for situations like was the tablet deleted (split "
1473+
+ " and merge do this), was the table deleted, was a user compaction canceled, etc.",
1474+
"2.1.4"),
14691475
@Experimental
14701476
COMPACTOR_MIN_JOB_WAIT_TIME("compactor.wait.time.job.min", "1s", PropertyType.TIMEDURATION,
14711477
"The minimum amount of time to wait between checks for the next compaction job, backing off"

server/compactor/src/main/java/org/apache/accumulo/compactor/Compactor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
package org.apache.accumulo.compactor;
2020

2121
import static java.nio.charset.StandardCharsets.UTF_8;
22-
import static java.util.concurrent.TimeUnit.MINUTES;
2322
import static org.apache.accumulo.core.util.UtilWaitThread.sleepUninterruptibly;
2423

2524
import java.io.IOException;
@@ -154,7 +153,6 @@ public String getQueueName() {
154153

155154
private static final Logger LOG = LoggerFactory.getLogger(Compactor.class);
156155
private static final long TIME_BETWEEN_GC_CHECKS = 5000;
157-
private static final long TIME_BETWEEN_CANCEL_CHECKS = MINUTES.toMillis(5);
158156

159157
private static final long TEN_MEGABYTES = 10485760;
160158

@@ -701,7 +699,8 @@ public void run() {
701699
var schedExecutor = ThreadPools.getServerThreadPools()
702700
.createGeneralScheduledExecutorService(getConfiguration());
703701
startGCLogger(schedExecutor);
704-
startCancelChecker(schedExecutor, TIME_BETWEEN_CANCEL_CHECKS);
702+
startCancelChecker(schedExecutor,
703+
getConfiguration().getTimeInMillis(Property.COMPACTOR_CANCEL_CHECK_INTERVAL));
705704

706705
LOG.info("Compactor started, waiting for work");
707706
try {

test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompactionTestUtils.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ public static void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuratio
233233
cfg.setProperty(Property.COMPACTION_COORDINATOR_DEAD_COMPACTOR_CHECK_INTERVAL, "5s");
234234
cfg.setProperty(Property.COMPACTION_COORDINATOR_TSERVER_COMPACTION_CHECK_INTERVAL, "3s");
235235
cfg.setProperty(Property.COMPACTION_COORDINATOR_THRIFTCLIENT_PORTSEARCH, "true");
236+
cfg.setProperty(Property.COMPACTOR_CANCEL_CHECK_INTERVAL, "5s");
236237
cfg.setProperty(Property.COMPACTOR_PORTSEARCH, "true");
237238
cfg.setProperty(Property.GENERAL_THREADPOOL_SIZE, "10");
238239
cfg.setProperty(Property.MANAGER_FATE_THREADPOOL_SIZE, "10");

test/src/main/java/org/apache/accumulo/test/compaction/ExternalCompaction_1_IT.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -619,6 +619,15 @@ public void testGetActiveCompactions() throws Exception {
619619

620620
client.tableOperations().cancelCompaction(table1);
621621
t.join();
622+
623+
// This test created a lot of files (bw.flush in a loop) which will
624+
// cause system compactions to be started for this table because
625+
// it will be over the max number of files for the tablets. Without
626+
// deleting the table, this test method will end and another may start
627+
// using the same compaction queue, causing the next test method to
628+
// possibly time out.
629+
client.tableOperations().delete(table1);
630+
622631
}
623632
}
624633

0 commit comments

Comments
 (0)