[ 
https://issues.apache.org/jira/browse/RATIS-1538?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17498993#comment-17498993
 ] 

Tsz-wo Sze commented on RATIS-1538:
-----------------------------------

[~Nicholas Niu], why peers could be empty?  We should add an assertion in 
RaftClientImpl as below for failing it.
{code}
@@ -148,6 +149,7 @@ public final class RaftClientImpl implements RaftClient { 
   RaftClientImpl(ClientId clientId, RaftGroup group, RaftPeerId leaderId, 
RaftPeer primaryDataStreamServer,
       RaftClientRpc clientRpc, RaftProperties properties, RetryPolicy 
retryPolicy) {
+    Preconditions.assertTrue(!group.getPeers().isEmpty(), () -> "The peers 
list is empty in " + group);
     this.clientId = clientId;
     this.peers.set(group.getPeers());
{code}


> DataStreamManagement#startTransaction prevent accidental assertion errors
> -------------------------------------------------------------------------
>
>                 Key: RATIS-1538
>                 URL: https://issues.apache.org/jira/browse/RATIS-1538
>             Project: Ratis
>          Issue Type: Sub-task
>            Reporter: GuoHao
>            Priority: Major
>         Attachments: image-2022-02-26-10-19-19-880.png
>
>
> DataStreamManagement#startTransaction prevent accidental assertion errors
>  
> DataStreamManagement#startTransaction calls AsyncImpl#sendForward, which 
> sends a message to the leader, which may be null
>  
> !image-2022-02-26-10-19-19-880.png!
>  
>  
>  
>  
>  
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to