alex-plekhanov commented on code in PR #11637:
URL: https://github.com/apache/ignite/pull/11637#discussion_r1838227248


##########
modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java:
##########
@@ -929,29 +933,30 @@ private boolean pingNode(TcpDiscoveryNode node) {
                         reconCnt++;
 
                         if (!openedSock && reconCnt == 2) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Was unable to open the " +
-                                "socket at all. Cause: " + e.getMessage());
+                            logPingError(errMsgPrefix + "Was unable to open 
the socket at all. " +
+                                    "Cause: " + e.getMessage(), logError);
 
                             break;
                         }
 
                         if 
(IgniteSpiOperationTimeoutHelper.checkFailureTimeoutReached(e)
                             && (spi.failureDetectionTimeoutEnabled() || 
timeout != 0)) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Reached the timeout " +
-                                (timeout == 0 ? spi.failureDetectionTimeout() 
: timeout) + "ms. Cause: " + e.getMessage());
+                            logPingError(errMsgPrefix + "Reached the timeout " 
+
+                                    (timeout == 0 ? 
spi.failureDetectionTimeout() : timeout) +
+                                    "ms. Cause: " + e.getMessage(), logError);
 
                             break;
                         }
                         else if (!spi.failureDetectionTimeoutEnabled() && 
reconCnt == spi.getReconnectCount()) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Reached the reconnection " +
-                                "count " + spi.getReconnectCount() + ". Cause: 
" + e.getMessage());
+                            logPingError(errMsgPrefix + "Reached the 
reconnection count spi.getReconnectCount(). " +
+                                    "Cause: " + e.getMessage(), logError);

Review Comment:
   Wrong indent



##########
modules/core/src/test/java/org/apache/ignite/spi/discovery/tcp/TcpDiscoverySelfTest.java:
##########
@@ -2201,6 +2211,23 @@ public void testDuplicatedDiscoveryDataRemoved() throws 
Exception {
      */
     @Test
     public void testFailedNodeRestoreConnection() throws Exception {
+        checkRestoreConnection(false);
+
+        setLoggerDebugLevel();
+
+        checkRestoreConnection(true);
+    }
+
+    /** @throws Exception If failed.*/
+    private void checkRestoreConnection(boolean logMsgExpected) throws 
Exception {
+        testLog = new ListeningTestLogger(log);
+
+        LogListener lsnr = LogListener
+                .matches(Pattern.compile("Failed to ping node \\[.*\\]\\. 
Reached the timeout"))
+                .build();

Review Comment:
   Wrong indent



##########
modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java:
##########
@@ -929,29 +933,30 @@ private boolean pingNode(TcpDiscoveryNode node) {
                         reconCnt++;
 
                         if (!openedSock && reconCnt == 2) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Was unable to open the " +
-                                "socket at all. Cause: " + e.getMessage());
+                            logPingError(errMsgPrefix + "Was unable to open 
the socket at all. " +
+                                    "Cause: " + e.getMessage(), logError);
 
                             break;
                         }
 
                         if 
(IgniteSpiOperationTimeoutHelper.checkFailureTimeoutReached(e)
                             && (spi.failureDetectionTimeoutEnabled() || 
timeout != 0)) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Reached the timeout " +
-                                (timeout == 0 ? spi.failureDetectionTimeout() 
: timeout) + "ms. Cause: " + e.getMessage());
+                            logPingError(errMsgPrefix + "Reached the timeout " 
+
+                                    (timeout == 0 ? 
spi.failureDetectionTimeout() : timeout) +
+                                    "ms. Cause: " + e.getMessage(), logError);
 
                             break;
                         }
                         else if (!spi.failureDetectionTimeoutEnabled() && 
reconCnt == spi.getReconnectCount()) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Reached the reconnection " +
-                                "count " + spi.getReconnectCount() + ". Cause: 
" + e.getMessage());
+                            logPingError(errMsgPrefix + "Reached the 
reconnection count spi.getReconnectCount(). " +
+                                    "Cause: " + e.getMessage(), logError);
 
                             break;
                         }
 
                         if (spi.isNodeStopping0()) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Current node is " +
-                                "stopping. Cause: " + e.getMessage());
+                            logPingError(errMsgPrefix + "Current node is 
stopping. " +
+                                    "Cause: " + e.getMessage(), logError);

Review Comment:
   Wrong indent



##########
modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java:
##########
@@ -929,29 +933,30 @@ private boolean pingNode(TcpDiscoveryNode node) {
                         reconCnt++;
 
                         if (!openedSock && reconCnt == 2) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Was unable to open the " +
-                                "socket at all. Cause: " + e.getMessage());
+                            logPingError(errMsgPrefix + "Was unable to open 
the socket at all. " +
+                                    "Cause: " + e.getMessage(), logError);

Review Comment:
   Wrong indent



##########
modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java:
##########
@@ -912,9 +914,11 @@ private boolean pingNode(TcpDiscoveryNode node) {
                         return t;
                     }
                     catch (IOException | IgniteCheckedException e) {
+                        String errMsgPrefix = "Failed to ping node [nodeId=" + 
nodeId + ", address=" + addr + "]. ";
+
                         if (nodeId != null && !nodeAlive(nodeId)) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Node has left or is " +
-                                "leaving topology. Cause: " + e.getMessage());
+                            logPingError(errMsgPrefix + "Node has left or is 
leaving topology. " +
+                                    "Cause: " + e.getMessage(), logError);

Review Comment:
   Wrong indent



##########
modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java:
##########
@@ -929,29 +933,30 @@ private boolean pingNode(TcpDiscoveryNode node) {
                         reconCnt++;
 
                         if (!openedSock && reconCnt == 2) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Was unable to open the " +
-                                "socket at all. Cause: " + e.getMessage());
+                            logPingError(errMsgPrefix + "Was unable to open 
the socket at all. " +
+                                    "Cause: " + e.getMessage(), logError);
 
                             break;
                         }
 
                         if 
(IgniteSpiOperationTimeoutHelper.checkFailureTimeoutReached(e)
                             && (spi.failureDetectionTimeoutEnabled() || 
timeout != 0)) {
-                            log.warning("Failed to ping node [nodeId=" + 
nodeId + "]. Reached the timeout " +
-                                (timeout == 0 ? spi.failureDetectionTimeout() 
: timeout) + "ms. Cause: " + e.getMessage());
+                            logPingError(errMsgPrefix + "Reached the timeout " 
+
+                                    (timeout == 0 ? 
spi.failureDetectionTimeout() : timeout) +
+                                    "ms. Cause: " + e.getMessage(), logError);

Review Comment:
   Wrong indent



##########
modules/core/src/main/java/org/apache/ignite/spi/discovery/tcp/ServerImpl.java:
##########
@@ -7296,7 +7309,8 @@ private InetSocketAddress 
checkConnection(TcpDiscoveryNode node, int timeout) {
 
                             try {
                                 if (liveAddrHolder.get() == null) {
-                                    UUID id = pingNode(addr, node.id(), null, 
timeoutHelper.nextTimeoutChunk(perAddrTimeout)).get1();
+                                    UUID id = pingNode(addr, node.id(), null, 
timeoutHelper.nextTimeoutChunk(perAddrTimeout),
+                                            true).get1();

Review Comment:
   Wrong indent



-- 
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-unsubscr...@ignite.apache.org

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

Reply via email to