From 2ab5f7dd5416f33b265aadaf477ccb9f87caa6d7 Mon Sep 17 00:00:00 2001 From: Wenjun Ruan Date: Fri, 21 Jun 2024 15:58:48 +0800 Subject: [PATCH] Increase zk connect timeout (#16180) --- .../src/main/resources/application.yaml | 10 +++++----- .../src/main/resources/application.yaml | 4 ++-- .../dao/repository/impl/CommandDaoImplTest.java | 6 ++++-- .../src/main/resources/application.yaml | 10 +++++----- .../server/master/runner/queue/DelayEntryTest.java | 2 +- .../zookeeper/ZookeeperRegistryProperties.java | 12 ++++++------ .../src/main/resources/application.yaml | 10 +++++----- .../src/main/resources/application.yaml | 10 +++++----- 8 files changed, 33 insertions(+), 31 deletions(-) diff --git a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application.yaml b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application.yaml index 6fbcc04feb..927cbc3c2c 100644 --- a/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application.yaml +++ b/dolphinscheduler-alert/dolphinscheduler-alert-server/src/main/resources/application.yaml @@ -82,12 +82,12 @@ registry: namespace: dolphinscheduler connect-string: localhost:2181 retry-policy: - base-sleep-time: 60ms - max-sleep: 300ms + base-sleep-time: 1s + max-sleep: 3s max-retries: 5 - session-timeout: 30s - connection-timeout: 9s - block-until-connected: 600ms + session-timeout: 60s + connection-timeout: 15s + block-until-connected: 15s digest: ~ metrics: diff --git a/dolphinscheduler-api/src/main/resources/application.yaml b/dolphinscheduler-api/src/main/resources/application.yaml index 79a8439274..9b0e94d644 100644 --- a/dolphinscheduler-api/src/main/resources/application.yaml +++ b/dolphinscheduler-api/src/main/resources/application.yaml @@ -120,8 +120,8 @@ registry: namespace: dolphinscheduler connect-string: localhost:2181 retry-policy: - base-sleep-time: 60ms - max-sleep: 300ms + base-sleep-time: 1s + max-sleep: 3s max-retries: 5 session-timeout: 60s connection-timeout: 15s diff --git a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/repository/impl/CommandDaoImplTest.java b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/repository/impl/CommandDaoImplTest.java index 7743a8b8a1..1897ad7fa2 100644 --- a/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/repository/impl/CommandDaoImplTest.java +++ b/dolphinscheduler-dao/src/test/java/org/apache/dolphinscheduler/dao/repository/impl/CommandDaoImplTest.java @@ -35,6 +35,7 @@ import org.apache.dolphinscheduler.dao.repository.CommandDao; import org.apache.commons.lang3.RandomUtils; import java.util.List; +import java.util.stream.Collectors; import org.junit.jupiter.api.RepeatedTest; import org.springframework.beans.factory.annotation.Autowired; @@ -62,9 +63,9 @@ class CommandDaoImplTest extends BaseDaoTest { // Generate commandSize commands int id = 0; for (int j = 0; j < commandSize; j++) { + id += idStep; Command command = generateCommand(CommandType.START_PROCESS, 0); command.setId(id); - id += idStep; commandDao.insert(command); } @@ -75,7 +76,8 @@ class CommandDaoImplTest extends BaseDaoTest { ", idStep: " + idStep + ", fetchSize: " + fetchSize + ", total command size: " + commandSize + - ", total commands: " + commandDao.queryAll()); + ", total commands: " + + commandDao.queryAll().stream().map(Command::getId).collect(Collectors.toList())); assertThat(commands.size()) .isEqualTo(commandDao.queryAll() .stream() diff --git a/dolphinscheduler-master/src/main/resources/application.yaml b/dolphinscheduler-master/src/main/resources/application.yaml index 9183074a6f..da1e986928 100644 --- a/dolphinscheduler-master/src/main/resources/application.yaml +++ b/dolphinscheduler-master/src/main/resources/application.yaml @@ -74,12 +74,12 @@ registry: namespace: dolphinscheduler connect-string: localhost:2181 retry-policy: - base-sleep-time: 60ms - max-sleep: 300ms + base-sleep-time: 1s + max-sleep: 3s max-retries: 5 - session-timeout: 30s - connection-timeout: 9s - block-until-connected: 600ms + session-timeout: 60s + connection-timeout: 15s + block-until-connected: 15s digest: ~ master: diff --git a/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/queue/DelayEntryTest.java b/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/queue/DelayEntryTest.java index bb7651b82c..00cf782e18 100644 --- a/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/queue/DelayEntryTest.java +++ b/dolphinscheduler-master/src/test/java/org/apache/dolphinscheduler/server/master/runner/queue/DelayEntryTest.java @@ -29,7 +29,7 @@ class DelayEntryTest { void getDelay() { DelayEntry delayEntry = new DelayEntry<>(5_000L, "Item"); assertThat(delayEntry.getDelay(TimeUnit.NANOSECONDS)) - .isWithin(500) + .isWithin(TimeUnit.NANOSECONDS.convert(500, TimeUnit.MILLISECONDS)) .of(TimeUnit.NANOSECONDS.convert(5_000L, TimeUnit.MILLISECONDS)); } } diff --git a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistryProperties.java b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistryProperties.java index 7f48139a92..208fb8fc83 100644 --- a/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistryProperties.java +++ b/dolphinscheduler-registry/dolphinscheduler-registry-plugins/dolphinscheduler-registry-zookeeper/src/main/java/org/apache/dolphinscheduler/plugin/registry/zookeeper/ZookeeperRegistryProperties.java @@ -101,16 +101,16 @@ class ZookeeperRegistryProperties implements Validator { private String connectString; private RetryPolicy retryPolicy = new RetryPolicy(); private String digest; - private Duration sessionTimeout = Duration.ofSeconds(30); - private Duration connectionTimeout = Duration.ofSeconds(9); - private Duration blockUntilConnected = Duration.ofMillis(600); + private Duration sessionTimeout = Duration.ofSeconds(60); + private Duration connectionTimeout = Duration.ofSeconds(15); + private Duration blockUntilConnected = Duration.ofSeconds(15); @Data public static final class RetryPolicy { - private Duration baseSleepTime = Duration.ofMillis(60); - private int maxRetries; - private Duration maxSleep = Duration.ofMillis(300); + private Duration baseSleepTime = Duration.ofSeconds(1); + private int maxRetries = 3; + private Duration maxSleep = Duration.ofSeconds(3); } } diff --git a/dolphinscheduler-standalone-server/src/main/resources/application.yaml b/dolphinscheduler-standalone-server/src/main/resources/application.yaml index 4f2a33660c..906fc42085 100644 --- a/dolphinscheduler-standalone-server/src/main/resources/application.yaml +++ b/dolphinscheduler-standalone-server/src/main/resources/application.yaml @@ -85,12 +85,12 @@ registry: namespace: dolphinscheduler connect-string: localhost:2181 retry-policy: - base-sleep-time: 60ms - max-sleep: 300ms + base-sleep-time: 1s + max-sleep: 3s max-retries: 5 - session-timeout: 30s - connection-timeout: 9s - block-until-connected: 600ms + session-timeout: 60s + connection-timeout: 15s + block-until-connected: 15s digest: ~ security: diff --git a/dolphinscheduler-worker/src/main/resources/application.yaml b/dolphinscheduler-worker/src/main/resources/application.yaml index 8252b4e44a..e6434e4f9d 100644 --- a/dolphinscheduler-worker/src/main/resources/application.yaml +++ b/dolphinscheduler-worker/src/main/resources/application.yaml @@ -31,12 +31,12 @@ registry: namespace: dolphinscheduler connect-string: localhost:2181 retry-policy: - base-sleep-time: 60ms - max-sleep: 300ms + base-sleep-time: 1s + max-sleep: 3s max-retries: 5 - session-timeout: 30s - connection-timeout: 9s - block-until-connected: 600ms + session-timeout: 60s + connection-timeout: 15s + block-until-connected: 15s digest: ~ worker: