Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,9 @@
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;
Expand Down Expand Up @@ -94,6 +96,8 @@ public String toString() {
// 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)
Expand Down Expand Up @@ -176,12 +180,19 @@ public void handshake() throws Exception {
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;
}

Expand Down
Loading