Skip to content

Commit 6dfe53d

Browse files
authored
Introduce Legislator, the liveness layer (elastic#13)
1 parent ee69c4b commit 6dfe53d

File tree

5 files changed

+1064
-9
lines changed

5 files changed

+1064
-9
lines changed

core/src/main/java/org/elasticsearch/discovery/zen2/ConsensusState.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ public long getCurrentTerm() {
8484
return currentTerm;
8585
}
8686

87+
boolean canHandleClientValue() {
88+
return electionWon && publishPermitted;
89+
}
90+
8791
public boolean isQuorumInCurrentConfiguration(NodeCollection votes) {
8892
final HashSet<String> intersection = new HashSet<>(committedState.getVotingNodes().nodes.keySet());
8993
intersection.retainAll(votes.nodes.keySet());
@@ -157,7 +161,7 @@ public Optional<PublishRequest<T>> handleVote(DiscoveryNode sourceNode, Vote vot
157161
"current last accepted term " + lastAcceptedTerm);
158162
}
159163

160-
logger.debug("handleVote: adding vote {} from [{}] for election at slot {}", vote, sourceNode.getId(), firstUncommittedSlot());
164+
logger.debug("handleVote: adding vote {} from [{}] for election at slot {}", vote, sourceNode, firstUncommittedSlot());
161165
joinVotes.add(sourceNode);
162166

163167
electionWon = isQuorumInCurrentConfiguration(joinVotes);
@@ -233,7 +237,7 @@ public Optional<ApplyCommit> handlePublishResponse(DiscoveryNode sourceNode, Pub
233237
}
234238

235239
logger.trace("handlePublishResponse: accepted publish response for slot [{}] and term [{}] from [{}]",
236-
publishResponse.getSlot(), publishResponse.getTerm(), sourceNode.getId());
240+
publishResponse.getSlot(), publishResponse.getTerm(), sourceNode);
237241
publishVotes.add(sourceNode);
238242
if (isQuorumInCurrentConfiguration(publishVotes)) {
239243
logger.trace("handlePublishResponse: value committed for slot [{}] and term [{}]",

0 commit comments

Comments
 (0)