dlmarion commented on code in PR #3983:
URL: https://github.com/apache/accumulo/pull/3983#discussion_r1406094731
##########
minicluster/src/main/java/org/apache/accumulo/miniclusterImpl/MiniAccumuloClusterControl.java:
##########
@@ -150,20 +150,28 @@ private static TExternalCompactionList
getRunningCompactions(ClientContext conte
@Override
public synchronized void startCoordinator(Class<? extends
CompactionCoordinator> coordinator)
throws IOException {
+
+ final int maxTries = 10;
+ int retryCount = 0;
+ long retryDelay = 1000;
+
if (coordinatorProcess == null) {
coordinatorProcess = cluster
._exec(coordinator, ServerType.COMPACTION_COORDINATOR, new
HashMap<>()).getProcess();
// Wait for coordinator to start
TExternalCompactionList metrics = null;
- while (metrics == null) {
+ while (metrics == null && retryCount++ < maxTries) {
try {
metrics = getRunningCompactions(cluster.getServerContext());
} catch (TException e) {
log.debug(
- "Error getting running compactions from coordinator, message: "
+ e.getMessage());
- UtilWaitThread.sleep(250);
+ "Error getting running compactions from coordinator, will retry
in {} message: {}",
+ retryDelay, e.getMessage());
+ UtilWaitThread.sleep(retryDelay);
+ retryDelay = (long) (retryDelay * 1.2); // max delay ~ 10 seconds.
Review Comment:
Curious if changing the `duration` parameter of `Wait.waitFor(Condition,
duration)` to a `Supplier<Long>` would allow you to implement a backoff in the
Supplier and then just call `Wait.waitFor` here.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]