This is an automated email from the ASF dual-hosted git repository.
krathbun 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 862b6e51f2 (trivial) removes some hardcoded fate values (#5243)
862b6e51f2 is described below
commit 862b6e51f233958c5bff8c08fbc5625c267fac1e
Author: Kevin Rathbun <[email protected]>
AuthorDate: Mon Jan 13 09:41:46 2025 -0500
(trivial) removes some hardcoded fate values (#5243)
Removes some hardcoded values used by Fate and Fate tests.
---
.../main/java/org/apache/accumulo/core/fate/Fate.java | 16 ++++++++++++----
.../main/java/org/apache/accumulo/test/fate/FateIT.java | 12 ++++++------
2 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/core/src/main/java/org/apache/accumulo/core/fate/Fate.java
b/core/src/main/java/org/apache/accumulo/core/fate/Fate.java
index de6e7073ec..ac57917629 100644
--- a/core/src/main/java/org/apache/accumulo/core/fate/Fate.java
+++ b/core/src/main/java/org/apache/accumulo/core/fate/Fate.java
@@ -79,6 +79,9 @@ public class Fate<T> {
private final ExecutorService deadResCleanerExecutor;
private static final EnumSet<TStatus> FINISHED_STATES = EnumSet.of(FAILED,
SUCCESSFUL, UNKNOWN);
+ public static final Duration INITIAL_DELAY = Duration.ofSeconds(3);
+ private static final Duration DEAD_RES_CLEANUP_DELAY = Duration.ofMinutes(3);
+ private static final Duration POOL_WATCHER_DELAY = Duration.ofSeconds(30);
private final AtomicBoolean keepRunning = new AtomicBoolean(true);
private final TransferQueue<FateId> workQueue;
@@ -457,7 +460,7 @@ public class Fate<T> {
idleCountHistory.add(workQueue.getWaitingConsumerCount());
}
}
- }, 3, 30, SECONDS));
+ }, INITIAL_DELAY.toSeconds(), getPoolWatcherDelay().toSeconds(), SECONDS));
this.transactionExecutor = pool;
ScheduledExecutorService deadResCleanerExecutor = null;
@@ -466,8 +469,9 @@ public class Fate<T> {
// reservations held by dead processes, if they exist.
deadResCleanerExecutor =
ThreadPools.getServerThreadPools().createScheduledExecutorService(1,
store.type() + "-dead-reservation-cleaner-pool");
- ScheduledFuture<?> deadReservationCleaner =
deadResCleanerExecutor.scheduleWithFixedDelay(
- new DeadReservationCleaner(), 3,
getDeadResCleanupDelay().toSeconds(), SECONDS);
+ ScheduledFuture<?> deadReservationCleaner =
+ deadResCleanerExecutor.scheduleWithFixedDelay(new
DeadReservationCleaner(),
+ INITIAL_DELAY.toSeconds(), getDeadResCleanupDelay().toSeconds(),
SECONDS);
ThreadPools.watchCriticalScheduledTask(deadReservationCleaner);
}
this.deadResCleanerExecutor = deadResCleanerExecutor;
@@ -477,7 +481,11 @@ public class Fate<T> {
}
public Duration getDeadResCleanupDelay() {
- return Duration.ofMinutes(3);
+ return DEAD_RES_CLEANUP_DELAY;
+ }
+
+ public Duration getPoolWatcherDelay() {
+ return POOL_WATCHER_DELAY;
}
// get a transaction id back to the requester before doing any work
diff --git a/test/src/main/java/org/apache/accumulo/test/fate/FateIT.java
b/test/src/main/java/org/apache/accumulo/test/fate/FateIT.java
index e7b3e073c9..292bc477f0 100644
--- a/test/src/main/java/org/apache/accumulo/test/fate/FateIT.java
+++ b/test/src/main/java/org/apache/accumulo/test/fate/FateIT.java
@@ -238,7 +238,7 @@ public abstract class FateIT extends SharedMiniClusterBase
implements FateTestRu
try {
// Wait for the transaction runner to be scheduled.
- Thread.sleep(3000);
+ Thread.sleep(Fate.INITIAL_DELAY.toMillis() * 2);
callStarted = new CountDownLatch(1);
finishCall = new CountDownLatch(1);
@@ -295,7 +295,7 @@ public abstract class FateIT extends SharedMiniClusterBase
implements FateTestRu
try {
// Wait for the transaction runner to be scheduled.
- Thread.sleep(3000);
+ Thread.sleep(Fate.INITIAL_DELAY.toMillis() * 2);
callStarted = new CountDownLatch(1);
finishCall = new CountDownLatch(1);
@@ -330,7 +330,7 @@ public abstract class FateIT extends SharedMiniClusterBase
implements FateTestRu
try {
// Wait for the transaction runner to be scheduled.
- Thread.sleep(3000);
+ Thread.sleep(Fate.INITIAL_DELAY.toMillis() * 2);
callStarted = new CountDownLatch(1);
finishCall = new CountDownLatch(1);
@@ -365,7 +365,7 @@ public abstract class FateIT extends SharedMiniClusterBase
implements FateTestRu
try {
// Wait for the transaction runner to be scheduled.
- Thread.sleep(3000);
+ Thread.sleep(Fate.INITIAL_DELAY.toMillis() * 2);
callStarted = new CountDownLatch(1);
finishCall = new CountDownLatch(1);
@@ -402,7 +402,7 @@ public abstract class FateIT extends SharedMiniClusterBase
implements FateTestRu
try {
// Wait for the transaction runner to be scheduled.
- Thread.sleep(3000);
+ Thread.sleep(Fate.INITIAL_DELAY.toMillis() * 2);
DeferredTestRepo.executedCalls.set(0);
// Initialize the repo to have a delay of 30 seconds
@@ -479,7 +479,7 @@ public abstract class FateIT extends SharedMiniClusterBase
implements FateTestRu
try {
// Wait for the transaction runner to be scheduled.
- Thread.sleep(3000);
+ Thread.sleep(Fate.INITIAL_DELAY.toMillis() * 2);
List<String> expectedUndoOrder = List.of("OP3", "OP2", "OP1");
/*