This is an automated email from the ASF dual-hosted git repository.

rong pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new 5eb80f5319f Pipe: Reduce the frequency of printing logs when 
AirGapConnector connection fails (#14949) (#14973)
5eb80f5319f is described below

commit 5eb80f5319fe2a398205281177f7134348808d70
Author: Zhenyu Luo <[email protected]>
AuthorDate: Thu Feb 27 16:35:24 2025 +0800

    Pipe: Reduce the frequency of printing logs when AirGapConnector connection 
fails (#14949) (#14973)
    
    (cherry picked from commit b638a70a4cc8de3ed33cc42bae12f9e259d61518)
---
 .../connector/protocol/IoTDBAirGapConnector.java    | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/protocol/IoTDBAirGapConnector.java
 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/protocol/IoTDBAirGapConnector.java
index c44461903d4..01fcd45ffba 100644
--- 
a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/protocol/IoTDBAirGapConnector.java
+++ 
b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/protocol/IoTDBAirGapConnector.java
@@ -43,7 +43,9 @@ import java.net.Socket;
 import java.net.SocketException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.zip.CRC32;
 
 import static 
org.apache.iotdb.commons.pipe.config.constant.PipeConnectorConstant.CONNECTOR_AIR_GAP_E_LANGUAGE_ENABLE_DEFAULT_VALUE;
@@ -94,6 +96,8 @@ public abstract class IoTDBAirGapConnector extends 
IoTDBConnector {
   // The air gap connector does not use clientManager thus we put handshake 
type here
   protected boolean supportModsIfIsDataNodeReceiver = true;
 
+  private final Map<TEndPoint, Long> failLogTimes = new HashMap<>();
+
   @Override
   public void customize(
       final PipeParameters parameters, final PipeConnectorRuntimeConfiguration 
configuration)
@@ -176,12 +180,19 @@ public abstract class IoTDBAirGapConnector extends 
IoTDBConnector {
         socket.setKeepAlive(true);
         sockets.set(i, socket);
         LOGGER.info("Successfully connected to target server ip: {}, port: 
{}.", ip, port);
+        failLogTimes.remove(nodeUrls.get(i));
       } catch (final Exception e) {
-        LOGGER.warn(
-            "Failed to connect to target server ip: {}, port: {}, because: {}. 
Ignore it.",
-            ip,
-            port,
-            e.getMessage());
+        final TEndPoint endPoint = nodeUrls.get(i);
+        final long currentTimeMillis = System.currentTimeMillis();
+        final Long lastFailLogTime = failLogTimes.get(endPoint);
+        if (lastFailLogTime == null || currentTimeMillis - lastFailLogTime > 
60000) {
+          failLogTimes.put(endPoint, currentTimeMillis);
+          LOGGER.warn(
+              "Failed to connect to target server ip: {}, port: {}, because: 
{}. Ignore it.",
+              ip,
+              port,
+              e.getMessage());
+        }
         continue;
       }
 

Reply via email to