You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "rpuch (via GitHub)" <gi...@apache.org> on 2023/12/22 12:01:06 UTC

[PR] IGNITE-21138 Complete client-side handshake future with NodeStoppingException if rejecting a handshake due to stopping [ignite-3]

rpuch opened a new pull request, #2985:
URL: https://github.com/apache/ignite-3/pull/2985

   https://issues.apache.org/jira/browse/IGNITE-21138
   
   Thank you for submitting the pull request.
   
   To streamline the review process of the patch and ensure better code quality
   we ask both an author and a reviewer to verify the following:
   
   ### The Review Checklist
   - [ ] **Formal criteria:** TC status, codestyle, mandatory documentation. Also make sure to complete the following:  
   \- There is a single JIRA ticket related to the pull request.  
   \- The web-link to the pull request is attached to the JIRA ticket.  
   \- The JIRA ticket has the Patch Available state.  
   \- The description of the JIRA ticket explains WHAT was made, WHY and HOW.  
   \- The pull request title is treated as the final commit message. The following pattern must be used: IGNITE-XXXX Change summary where XXXX - number of JIRA issue.
   - [ ] **Design:** new code conforms with the design principles of the components it is added to.
   - [ ] **Patch quality:** patch cannot be split into smaller pieces, its size must be reasonable.
   - [ ] **Code quality:** code is clean and readable, necessary developer documentation is added if needed.
   - [ ] **Tests code quality:** test set covers positive/negative scenarios, happy/edge cases. Tests are effective in terms of execution time and resources.
   
   ### Notes
   - [Apache Ignite Coding Guidelines](https://cwiki.apache.org/confluence/display/IGNITE/Java+Code+Style+Guide)


-- 
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: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-21138 Complete client-side handshake future with NodeStoppingException if rejecting a handshake due to stopping [ignite-3]

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2985:
URL: https://github.com/apache/ignite-3/pull/2985#discussion_r1435520740


##########
modules/network/src/main/java/org/apache/ignite/internal/network/recovery/RecoveryClientHandshakeManager.java:
##########
@@ -271,7 +272,12 @@ private void handleStaleServerId(HandshakeStartMessage msg) {
                 .message(message)
                 .build();
 
-        sendHandshakeRejectedMessage(rejectionMessage, message);
+        ChannelFuture sendFuture = channel.writeAndFlush(new OutNetworkObject(rejectionMessage, emptyList(), false));
+
+        NettyUtils.toCompletableFuture(sendFuture).whenComplete((unused, ex) -> {
+            // Ignoring ex as it's more important to tell the client about the rejection reason.
+            localHandshakeCompleteFuture.completeExceptionally(new HandshakeException(message));
+        });

Review Comment:
   Maybe lines 275-280 and 291-296 should be separated into a separate method, they look very similar.



##########
modules/network/src/main/java/org/apache/ignite/internal/network/recovery/RecoveryServerHandshakeManager.java:
##########
@@ -231,7 +232,12 @@ private void handleStaleClientId(HandshakeStartResponseMessage msg) {
                 .message(message)
                 .build();
 
-        sendHandshakeRejectedMessage(rejectionMessage, message);
+        ChannelFuture sendFuture = channel.writeAndFlush(new OutNetworkObject(rejectionMessage, emptyList(), false));
+
+        NettyUtils.toCompletableFuture(sendFuture).whenComplete((unused, throwable) -> {
+            // Ignoring ex as the most important thing here is to complete the future with the correct exception.
+            handshakeCompleteFuture.completeExceptionally(new HandshakeException(message));
+        });

Review Comment:
   This is also very similar to sections of code in the neighboring class, maybe we can select a separate auxiliary method so as not to duplicate 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: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-21138 Complete client-side handshake future with NodeStoppingException if rejecting a handshake due to stopping [ignite-3]

Posted by "rpuch (via GitHub)" <gi...@apache.org>.
rpuch commented on code in PR #2985:
URL: https://github.com/apache/ignite-3/pull/2985#discussion_r1435570488


##########
modules/network/src/main/java/org/apache/ignite/internal/network/recovery/RecoveryServerHandshakeManager.java:
##########
@@ -337,18 +323,20 @@ private void onHandshakeRejectedMessage(HandshakeRejectedMessage msg) {
         }
     }
 
-    private void sendHandshakeRejectedMessage(HandshakeRejectedMessage rejectionMessage, String reason) {
-        ChannelFuture sendFuture = channel.writeAndFlush(new OutNetworkObject(rejectionMessage, emptyList(), false));
+    private void rejectHandshakeDueToLosingClinch(RecoveryDescriptor descriptor) {
+        String localErrorMessage = "Failed to acquire recovery descriptor during handshake, it is held by: "
+                + descriptor.holderDescription();
 
-        NettyUtils.toCompletableFuture(sendFuture).whenComplete((unused, throwable) -> {
-            if (throwable != null) {
-                handshakeCompleteFuture.completeExceptionally(
-                        new HandshakeException("Failed to send handshake rejected message: " + throwable.getMessage(), throwable)
-                );
-            } else {
-                handshakeCompleteFuture.completeExceptionally(new HandshakeException(reason));
-            }
-        });
+        LOG.debug(localErrorMessage);

Review Comment:
   It is checked inside; also, handshakes happen seldom, we won't have any performance hit due to creating of an empty array each time.



-- 
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: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-21138 Complete client-side handshake future with NodeStoppingException if rejecting a handshake due to stopping [ignite-3]

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill merged PR #2985:
URL: https://github.com/apache/ignite-3/pull/2985


-- 
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: notifications-unsubscribe@ignite.apache.org

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


Re: [PR] IGNITE-21138 Complete client-side handshake future with NodeStoppingException if rejecting a handshake due to stopping [ignite-3]

Posted by "tkalkirill (via GitHub)" <gi...@apache.org>.
tkalkirill commented on code in PR #2985:
URL: https://github.com/apache/ignite-3/pull/2985#discussion_r1435566577


##########
modules/network/src/main/java/org/apache/ignite/internal/network/recovery/RecoveryServerHandshakeManager.java:
##########
@@ -337,18 +323,20 @@ private void onHandshakeRejectedMessage(HandshakeRejectedMessage msg) {
         }
     }
 
-    private void sendHandshakeRejectedMessage(HandshakeRejectedMessage rejectionMessage, String reason) {
-        ChannelFuture sendFuture = channel.writeAndFlush(new OutNetworkObject(rejectionMessage, emptyList(), false));
+    private void rejectHandshakeDueToLosingClinch(RecoveryDescriptor descriptor) {
+        String localErrorMessage = "Failed to acquire recovery descriptor during handshake, it is held by: "
+                + descriptor.holderDescription();
 
-        NettyUtils.toCompletableFuture(sendFuture).whenComplete((unused, throwable) -> {
-            if (throwable != null) {
-                handshakeCompleteFuture.completeExceptionally(
-                        new HandshakeException("Failed to send handshake rejected message: " + throwable.getMessage(), throwable)
-                );
-            } else {
-                handshakeCompleteFuture.completeExceptionally(new HandshakeException(reason));
-            }
-        });
+        LOG.debug(localErrorMessage);

Review Comment:
   Maybe LOG.isDebugEnabled() ?



-- 
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: notifications-unsubscribe@ignite.apache.org

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