|
19 | 19 | package org.elasticsearch.cluster.coordination;
|
20 | 20 |
|
21 | 21 | import com.carrotsearch.randomizedtesting.RandomizedContext;
|
| 22 | + |
22 | 23 | import org.apache.logging.log4j.CloseableThreadContext;
|
23 | 24 | import org.apache.logging.log4j.LogManager;
|
24 | 25 | import org.apache.logging.log4j.Logger;
|
|
90 | 91 | import static org.elasticsearch.cluster.coordination.CoordinationStateTests.clusterState;
|
91 | 92 | import static org.elasticsearch.cluster.coordination.CoordinationStateTests.setValue;
|
92 | 93 | import static org.elasticsearch.cluster.coordination.CoordinationStateTests.value;
|
| 94 | +import static org.elasticsearch.cluster.coordination.Coordinator.PUBLISH_TIMEOUT_SETTING; |
93 | 95 | import static org.elasticsearch.cluster.coordination.Coordinator.Mode.CANDIDATE;
|
94 | 96 | import static org.elasticsearch.cluster.coordination.Coordinator.Mode.FOLLOWER;
|
95 | 97 | import static org.elasticsearch.cluster.coordination.Coordinator.Mode.LEADER;
|
96 |
| -import static org.elasticsearch.cluster.coordination.Coordinator.PUBLISH_TIMEOUT_SETTING; |
97 | 98 | import static org.elasticsearch.cluster.coordination.CoordinatorTests.Cluster.DEFAULT_DELAY_VARIABILITY;
|
98 | 99 | import static org.elasticsearch.cluster.coordination.ElectionSchedulerFactory.ELECTION_BACK_OFF_TIME_SETTING;
|
99 | 100 | import static org.elasticsearch.cluster.coordination.ElectionSchedulerFactory.ELECTION_DURATION_SETTING;
|
@@ -1101,6 +1102,9 @@ class Cluster {
|
1101 | 1102 | private final Set<String> blackholedNodes = new HashSet<>();
|
1102 | 1103 | private final Map<Long, ClusterState> committedStatesByVersion = new HashMap<>();
|
1103 | 1104 |
|
| 1105 | + private final Function<DiscoveryNode, PersistedState> defaultPersistedStateSupplier = localNode -> new MockPersistedState(0L, |
| 1106 | + clusterState(0L, 0L, localNode, VotingConfiguration.EMPTY_CONFIG, VotingConfiguration.EMPTY_CONFIG, 0L)); |
| 1107 | + |
1104 | 1108 | Cluster(int initialNodeCount) {
|
1105 | 1109 | this(initialNodeCount, true);
|
1106 | 1110 | }
|
@@ -1533,9 +1537,7 @@ class ClusterNode {
|
1533 | 1537 | private ClusterStateApplyResponse clusterStateApplyResponse = ClusterStateApplyResponse.SUCCEED;
|
1534 | 1538 |
|
1535 | 1539 | ClusterNode(int nodeIndex, boolean masterEligible) {
|
1536 |
| - this(nodeIndex, createDiscoveryNode(nodeIndex, masterEligible), |
1537 |
| - localNode -> new MockPersistedState(0L, |
1538 |
| - clusterState(0L, 0L, localNode, VotingConfiguration.EMPTY_CONFIG, VotingConfiguration.EMPTY_CONFIG, 0L))); |
| 1540 | + this(nodeIndex, createDiscoveryNode(nodeIndex, masterEligible), defaultPersistedStateSupplier); |
1539 | 1541 | }
|
1540 | 1542 |
|
1541 | 1543 | ClusterNode(int nodeIndex, DiscoveryNode localNode, Function<DiscoveryNode, PersistedState> persistedStateSupplier) {
|
|
0 commit comments