You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@ratis.apache.org by GitBox <gi...@apache.org> on 2022/09/09 03:52:45 UTC

[GitHub] [ratis] szetszwo commented on a diff in pull request #739: RATIS-1702. Make listener reject leader election

szetszwo commented on code in PR #739:
URL: https://github.com/apache/ratis/pull/739#discussion_r966598250


##########
ratis-server/src/main/java/org/apache/ratis/server/impl/VoteContext.java:
##########
@@ -131,6 +132,9 @@ RaftPeer recognizeCandidate(long candidateTerm) {
    * See Section 5.4.1 Election restriction
    */
   boolean decideVote(RaftPeer candidate, TermIndex candidateLastEntry) {
+    if (impl.getRole().getCurrentRole() == RaftProtos.RaftPeerRole.LISTENER) {
+      return reject("The server " + impl.getId() + " is listener and should not participate in elections");

Review Comment:
   @codings-dan , thanks a lot for working on this!  The id is already printed inside `reject(..)`.  How about changing the message to the following?
   ```java
    return reject("this server is a listener, who is a non-voting member");
   ```
   



-- 
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: issues-unsubscribe@ratis.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org