lugency commented on code in PR #1695:
URL: https://github.com/apache/ratis/pull/1695#discussion_r4607240766
##########
ratis-server/src/test/java/org/apache/ratis/server/impl/LeaderElectionTests.java:
##########
@@ -281,6 +291,102 @@ public void testTransferLeader() throws Exception {
}
}
+ @Test
+ public void testRetryCacheCompletesAfterLeaderTransfer() throws Exception {
+ try (final MiniRaftCluster cluster = newCluster(3)) {
+ cluster.start();
+ waitForLeader(cluster);
+ // Give peer connections time to recover from connection failures during
startup.
+ TimeDuration.valueOf(3, TimeUnit.SECONDS).sleep();
Review Comment:
[org.apache.ratis.grpc.TestLeaderElectionWithGrpc-output.txt](https://github.com/user-attachments/files/34999857/org.apache.ratis.grpc.TestLeaderElectionWithGrpc-output.txt)
I reproduced this locally without the sleep and enabled gRPC debug logging.
During cluster startup, s0’s connections to s1 and s2 were refused. Both
outbound channels entered TRANSIENT_FAILURE, with reconnects scheduled about
949 ms and 1032 ms later.
s1 was elected leader, and the test immediately requested a transfer to s0.
About 600 ms into the backoff, s0 tried to request votes from both peers. Both
RPCs failed with UNAVAILABLE, and s1 was elected again in term 3. The sleep
gave those channels time to reconnect. With the simpler test you suggested, we
can remove it.
--
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]