You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ca...@apache.org on 2022/11/15 12:23:31 UTC
[iotdb] branch master updated: [IOTDB-4704] Modified sync data node retry wait (#7982)
This is an automated email from the ASF dual-hosted git repository.
caogaofei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new a46e565a5d [IOTDB-4704] Modified sync data node retry wait (#7982)
a46e565a5d is described below
commit a46e565a5d0ec255eb50b447c9e0871a242fdb8a
Author: Caideyipi <87...@users.noreply.github.com>
AuthorDate: Tue Nov 15 20:23:25 2022 +0800
[IOTDB-4704] Modified sync data node retry wait (#7982)
---
.../client/sync/SyncDataNodeClientPool.java | 22 ++++++++++++++++------
1 file changed, 16 insertions(+), 6 deletions(-)
diff --git a/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncDataNodeClientPool.java b/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncDataNodeClientPool.java
index caa8528b4c..61625cc603 100644
--- a/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncDataNodeClientPool.java
+++ b/confignode/src/main/java/org/apache/iotdb/confignode/client/sync/SyncDataNodeClientPool.java
@@ -63,7 +63,7 @@ public class SyncDataNodeClientPool {
public TSStatus sendSyncRequestToDataNodeWithRetry(
TEndPoint endPoint, Object req, DataNodeRequestType requestType) {
- Throwable lastException = null;
+ Throwable lastException = new TException();
for (int retry = 0; retry < DEFAULT_RETRY_NUM; retry++) {
try (SyncDataNodeInternalServiceClient client = clientManager.borrowClient(endPoint)) {
return executeSyncRequest(requestType, client, req);
@@ -74,8 +74,10 @@ public class SyncDataNodeClientPool {
requestType,
endPoint,
e.getMessage(),
- retry);
- doRetryWait(retry);
+ retry + 1);
+ if (retry != DEFAULT_RETRY_NUM - 1) {
+ doRetryWait(retry);
+ }
}
}
LOGGER.error("{} failed on DataNode {}", requestType, endPoint, lastException);
@@ -96,8 +98,10 @@ public class SyncDataNodeClientPool {
requestType,
endPoint,
e.getMessage(),
- retry);
- doRetryWait(retry);
+ retry + 1);
+ if (retry != retryNum - 1) {
+ doRetryWait(retry);
+ }
}
}
LOGGER.error("{} failed on DataNode {}", requestType, endPoint, lastException);
@@ -145,7 +149,13 @@ public class SyncDataNodeClientPool {
private void doRetryWait(int retryNum) {
try {
- TimeUnit.MILLISECONDS.sleep(100L * (long) Math.pow(2, retryNum));
+ if (retryNum < 3) {
+ TimeUnit.MILLISECONDS.sleep(800L);
+ } else if (retryNum < 5) {
+ TimeUnit.MILLISECONDS.sleep(100L * (long) Math.pow(2, retryNum));
+ } else {
+ TimeUnit.MILLISECONDS.sleep(3200L);
+ }
} catch (InterruptedException e) {
LOGGER.error("Retry wait failed.", e);
}