Skip to content

Commit

Permalink
Eliminating initial delay of CoordinationDiagnosticsService#beginPoll…
Browse files Browse the repository at this point in the history
…ingClusterFormationInfo for integration tests (#89001)
  • Loading branch information
masseyke authored Aug 1, 2022
1 parent 524543e commit 352a688
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.elasticsearch.cluster.node.DiscoveryNode;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.service.ClusterService;
import org.elasticsearch.core.TimeValue;
import org.elasticsearch.test.ESIntegTestCase;
import org.elasticsearch.test.disruption.BlockClusterStateProcessing;
import org.elasticsearch.threadpool.Scheduler;
Expand Down Expand Up @@ -69,6 +70,7 @@ public void testBlockClusterStateProcessingOnOneNode() throws Exception {
diagnosticsOnBlockedNode.clusterFormationResponses = nodeToClusterFormationStateMap;
diagnosticsOnBlockedNode.clusterFormationInfoTasks = cancellables;

diagnosticsOnBlockedNode.remoteRequestInitialDelay = TimeValue.ZERO;
diagnosticsOnBlockedNode.beginPollingClusterFormationInfo(
nodesWithoutBlockedNode,
nodeToClusterFormationStateMap::put,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,13 @@ public class CoordinationDiagnosticsService implements ClusterStateListener {
// Non-private for testing
volatile ConcurrentMap<DiscoveryNode, ClusterFormationStateOrException> clusterFormationResponses = null;

/**
* This is the amount of time that we wait before scheduling a remote request to gather diagnostic information. It is not
* user-configurable, but is non-final so that integration tests don't have to waste 10 seconds.
*/
// Non-private for testing
TimeValue remoteRequestInitialDelay = new TimeValue(10, TimeUnit.SECONDS);

private static final Logger logger = LogManager.getLogger(CoordinationDiagnosticsService.class);

/**
Expand Down Expand Up @@ -804,7 +811,7 @@ private Scheduler.Cancellable fetchClusterFormationInfo(
connectionListener
);
}
}, new TimeValue(10, TimeUnit.SECONDS), ThreadPool.Names.SAME);
}, remoteRequestInitialDelay, ThreadPool.Names.SAME);
}

// Non-private for testing
Expand Down

0 comments on commit 352a688

Please sign in to comment.