OneSizeFitsQuorum commented on code in PR #1327:
URL: https://github.com/apache/ratis/pull/1327#discussion_r2623647038
##########
ratis-server/src/main/java/org/apache/ratis/server/impl/LeaderElection.java:
##########
@@ -306,23 +306,31 @@ public String toString() {
private final boolean skipPreVote;
private final ConfAndTerm round0;
- LeaderElection(RaftServerImpl server, boolean force) {
- this(ServerInterface.get(server), force);
+ static LeaderElection newInstance(RaftServerImpl server, boolean force) {
+ return newInstance(ServerInterface.get(server), force);
}
- LeaderElection(ServerInterface server, boolean force) {
- this.name = ServerStringUtils.generateUnifiedName(server.getMemberId(),
getClass()) + COUNT.incrementAndGet();
+ static LeaderElection newInstance(ServerInterface server, boolean force) {
+ String name =
ServerStringUtils.generateUnifiedName(server.getMemberId(),
LeaderElection.class)
+ + COUNT.incrementAndGet();
+ try {
+ // increase term of the candidate in advance if it's forced to election
+ final ConfAndTerm round0 = force ? server.initElection(Phase.ELECTION)
: null;
Review Comment:
Fixed
--
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]