You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ro...@apache.org on 2024/05/08 16:36:40 UTC
(iotdb) branch sync-huge-tsfile-v2 created (now 185d6417049)
This is an automated email from the ASF dual-hosted git repository.
rong pushed a change to branch sync-huge-tsfile-v2
in repository https://gitbox.apache.org/repos/asf/iotdb.git
at 185d6417049 Pipe: globally adjust timeout when syncing huge tsfiles
This branch includes the following new commits:
new 185d6417049 Pipe: globally adjust timeout when syncing huge tsfiles
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(iotdb) 01/01: Pipe: globally adjust timeout when syncing huge tsfiles
Posted by ro...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch sync-huge-tsfile-v2
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit 185d6417049f50fa641fc6dbfc5c823351e019cd
Author: Steve Yurong Su <ro...@apache.org>
AuthorDate: Thu May 9 00:36:32 2024 +0800
Pipe: globally adjust timeout when syncing huge tsfiles
---
.../pipe/connector/client/IoTDBClientManager.java | 17 ++++++++++-------
.../pipe/connector/client/IoTDBSyncClientManager.java | 2 +-
2 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/client/IoTDBClientManager.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/client/IoTDBClientManager.java
index bb1f0062363..a3643a2c10c 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/client/IoTDBClientManager.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/client/IoTDBClientManager.java
@@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory;
import java.net.SocketTimeoutException;
import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
public abstract class IoTDBClientManager {
@@ -42,7 +43,8 @@ public abstract class IoTDBClientManager {
protected boolean supportModsIfIsDataNodeReceiver = true;
private static final int MAX_CONNECTION_TIMEOUT_MS = 24 * 60 * 60 * 1000; // 1 day
- protected int connectionTimeout = PipeConfig.getInstance().getPipeConnectorTransferTimeoutMs();
+ protected static final AtomicInteger CONNECTION_TIMEOUT_MS =
+ new AtomicInteger(PipeConfig.getInstance().getPipeConnectorTransferTimeoutMs());
protected IoTDBClientManager(List<TEndPoint> endPointList, boolean useLeaderCache) {
this.endPointList = endPointList;
@@ -59,17 +61,18 @@ public abstract class IoTDBClientManager {
int newConnectionTimeout;
try {
newConnectionTimeout =
- Math.min(Math.toIntExact(connectionTimeout * 2L), MAX_CONNECTION_TIMEOUT_MS);
+ Math.min(
+ Math.toIntExact(CONNECTION_TIMEOUT_MS.get() * 2L), MAX_CONNECTION_TIMEOUT_MS);
} catch (ArithmeticException arithmeticException) {
newConnectionTimeout = MAX_CONNECTION_TIMEOUT_MS;
}
- if (newConnectionTimeout != connectionTimeout) {
- connectionTimeout = newConnectionTimeout;
+ if (newConnectionTimeout != CONNECTION_TIMEOUT_MS.get()) {
+ CONNECTION_TIMEOUT_MS.set(newConnectionTimeout);
LOGGER.info(
"Pipe connection timeout is adjusted to {} ms ({} mins)",
- connectionTimeout,
- connectionTimeout / 60000.0);
+ newConnectionTimeout,
+ newConnectionTimeout / 60000.0);
}
return;
}
@@ -77,6 +80,6 @@ public abstract class IoTDBClientManager {
}
public int getConnectionTimeout() {
- return connectionTimeout;
+ return CONNECTION_TIMEOUT_MS.get();
}
}
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/client/IoTDBSyncClientManager.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/client/IoTDBSyncClientManager.java
index a29d7bdb0a2..667313e1976 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/client/IoTDBSyncClientManager.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/connector/client/IoTDBSyncClientManager.java
@@ -193,7 +193,7 @@ public abstract class IoTDBSyncClientManager extends IoTDBClientManager implemen
resp.getStatus());
} else {
clientAndStatus.setRight(true);
- client.setTimeout(connectionTimeout);
+ client.setTimeout(CONNECTION_TIMEOUT_MS.get());
LOGGER.info(
"Handshake success. Target server ip: {}, port: {}",
client.getIpAddress(),