adityamukho commented on code in PR #6694:
URL: https://github.com/apache/ignite-3/pull/6694#discussion_r2401941662
##########
modules/network/src/main/java/org/apache/ignite/internal/network/recovery/RecoveryInitiatorHandshakeManager.java:
##########
@@ -438,7 +436,10 @@ private void
onHandshakeRejectedMessage(HandshakeRejectedMessage msg) {
if (msg.reason() == HandshakeRejectionReason.CLINCH) {
giveUpClinch();
} else {
- localHandshakeCompleteFuture.completeExceptionally(new
HandshakeException(msg.message()));
+ Exception ex = msg.reason() == HandshakeRejectionReason.STOPPING
+ ? new RecipientLeftException(msg.message())
+ : new HandshakeException(msg.message());
Review Comment:
Should this snippet be de-duplicated?
##########
modules/network/src/test/java/org/apache/ignite/internal/network/recovery/RecoveryInitiatorHandshakeManagerTest.java:
##########
@@ -334,4 +335,24 @@ void failsHandshakeIfAcceptorClusterIdDiffersFromOurs() {
assertThat(recoveryDescriptor.holder(), is(nullValue()));
}
+
+ @Test
+ void
gettingHandshakeRejectedMessageWithReasonStoppingCausesHandshakeToBeFinishedWithRecipientLeftException()
{
+ RecoveryInitiatorHandshakeManager manager =
initiatorHandshakeManager(LOWER_ID);
+
+ CompletableFuture<NettySender> localHandshakeFuture =
manager.localHandshakeFuture();
+ CompletionStage<NettySender> finalHandshakeFuture =
manager.finalHandshakeFuture();
+
+
manager.onMessage(handshakeRejectedMessageWithReason(HandshakeRejectionReason.STOPPING));
+
+ assertWillThrowFast(localHandshakeFuture,
RecipientLeftException.class);
+ assertWillThrowFast(finalHandshakeFuture.toCompletableFuture(),
RecipientLeftException.class);
+ }
+
+ private static HandshakeRejectedMessage
handshakeRejectedMessageWithReason(HandshakeRejectionReason reason) {
+ return MESSAGE_FACTORY.handshakeRejectedMessage()
+ .message("Rejected")
+ .reasonString(reason.toString())
+ .build();
+ }
Review Comment:
This too looks like it could be de-duplicated.
--
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]