Skip to content

Commit

Permalink
revert Coordinator logic
Browse files Browse the repository at this point in the history
  • Loading branch information
soosinha committed Aug 18, 2023
1 parent 0908348 commit d1a1e05
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 631 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public class CoordinationState {

// persisted state
private final PersistedState persistedState;
private final PersistedState remotePersistedState;

// transient state
private VoteCollection joinVotes;
Expand All @@ -76,7 +75,7 @@ public class CoordinationState {
private VotingConfiguration lastPublishedConfiguration;
private VoteCollection publishVotes;

public CoordinationState(DiscoveryNode localNode, PersistedState persistedState, ElectionStrategy electionStrategy, PersistedState remotePersistedState) {
public CoordinationState(DiscoveryNode localNode, PersistedState persistedState, ElectionStrategy electionStrategy) {
this.localNode = localNode;

// persisted state
Expand All @@ -90,7 +89,6 @@ public CoordinationState(DiscoveryNode localNode, PersistedState persistedState,
this.lastPublishedVersion = 0L;
this.lastPublishedConfiguration = persistedState.getLastAcceptedState().getLastAcceptedConfiguration();
this.publishVotes = new VoteCollection();
this.remotePersistedState = remotePersistedState;
}

public long getCurrentTerm() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
import org.opensearch.cluster.coordination.ClusterFormationFailureHelper.ClusterFormationState;
import org.opensearch.cluster.coordination.CoordinationMetadata.VotingConfigExclusion;
import org.opensearch.cluster.coordination.CoordinationMetadata.VotingConfiguration;
import org.opensearch.cluster.coordination.CoordinationState.PersistedState;
import org.opensearch.cluster.coordination.CoordinationState.VoteCollection;
import org.opensearch.cluster.coordination.FollowersChecker.FollowerCheckRequest;
import org.opensearch.cluster.coordination.JoinHelper.InitialJoinAccumulator;
Expand Down Expand Up @@ -182,7 +181,6 @@ public class Coordinator extends AbstractLifecycleComponent implements Discovery
private JoinHelper.JoinAccumulator joinAccumulator;
private Optional<CoordinatorPublication> currentPublication = Optional.empty();
private final NodeHealthService nodeHealthService;
private final Supplier<CoordinationState.PersistedState> remotePersistedStateSupplier;

/**
* @param nodeName The name of the node, used to name the {@link java.util.concurrent.ExecutorService} of the {@link SeedHostsResolver}.
Expand All @@ -203,8 +201,7 @@ public Coordinator(
Random random,
RerouteService rerouteService,
ElectionStrategy electionStrategy,
NodeHealthService nodeHealthService,
Supplier<CoordinationState.PersistedState> remotePersistedStateSupplier
NodeHealthService nodeHealthService
) {
this.settings = settings;
this.transportService = transportService;
Expand Down Expand Up @@ -289,7 +286,6 @@ public Coordinator(
joinHelper::logLastFailedJoinAttempt
);
this.nodeHealthService = nodeHealthService;
this.remotePersistedStateSupplier = remotePersistedStateSupplier;
this.localNodeCommissioned = true;
}

Expand Down Expand Up @@ -825,7 +821,7 @@ boolean publicationInProgress() {
protected void doStart() {
synchronized (mutex) {
CoordinationState.PersistedState persistedState = persistedStateSupplier.get();
coordinationState.set(new CoordinationState(getLocalNode(), persistedState, electionStrategy, remotePersistedStateSupplier.get()));
coordinationState.set(new CoordinationState(getLocalNode(), persistedState, electionStrategy));
peerFinder.setCurrentTerm(getCurrentTerm());
configuredHostsResolver.start();
final ClusterState lastAcceptedState = coordinationState.get().getLastAcceptedState();
Expand Down Expand Up @@ -1312,10 +1308,6 @@ assert getLocalNode().equals(clusterState.getNodes().get(getLocalNode().getId())
leaderChecker.setCurrentNodes(publishNodes);
followersChecker.setCurrentNodes(publishNodes);
lagDetector.setTrackedNodes(publishNodes);

PersistedState remotePersistedState = remotePersistedStateSupplier.get();
assert remotePersistedState != null : "Remote state has not been initialized";
remotePersistedState.setLastAcceptedState(clusterState);
publication.start(followersChecker.getFaultyNodes());
}
} catch (Exception e) {
Expand Down

This file was deleted.

Loading

0 comments on commit d1a1e05

Please sign in to comment.