qian0817 commented on code in PR #673:
URL: https://github.com/apache/ratis/pull/673#discussion_r917827035


##########
ratis-proto/src/main/proto/Raft.proto:
##########
@@ -28,6 +28,7 @@ message RaftPeerProto {
   string dataStreamAddress = 4; // address of the data stream server
   string clientAddress = 5; // address of the client RPC server
   string adminAddress = 6; // address of the admin RPC server
+  optional RaftPeerRole startupRole=7; // peer start up role

Review Comment:
   fix.



##########
ratis-common/src/main/java/org/apache/ratis/protocol/RaftPeer.java:
##########
@@ -133,10 +136,24 @@ public Builder setPriority(int priority) {
       return this;
     }
 
+    public Builder setStartupRole(RaftProtos.RaftPeerRole startupRole) {
+      if (startupRole != RaftProtos.RaftPeerRole.FOLLOWER
+          && startupRole != RaftProtos.RaftPeerRole.LISTENER) {
+        throw new IllegalArgumentException(
+            "At startup the role can only be set to FOLLOWER or LISTENER, the 
current value is " +
+                startupRole);
+      }
+      this.startupRole = startupRole;
+      return this;
+    }
+
     public RaftPeer build() {
+      if (startupRole == null) {

Review Comment:
   fix.



-- 
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]

Reply via email to