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

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new bfc8d2a91b [INLONG-8749][Manager] Support configuring whether to 
initialize node state during startup (#8750)
bfc8d2a91b is described below

commit bfc8d2a91b211c7b5d84c49caed37f4f6a163c41
Author: fuweng11 <[email protected]>
AuthorDate: Thu Aug 17 20:05:01 2023 +0800

    [INLONG-8749][Manager] Support configuring whether to initialize node state 
during startup (#8750)
---
 .../apache/inlong/manager/service/heartbeat/HeartbeatManager.java | 8 +++++++-
 .../manager-web/src/main/resources/application-dev.properties     | 3 +++
 .../manager-web/src/main/resources/application-prod.properties    | 3 +++
 .../manager-web/src/main/resources/application-test.properties    | 3 +++
 4 files changed, 16 insertions(+), 1 deletion(-)

diff --git 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/heartbeat/HeartbeatManager.java
 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/heartbeat/HeartbeatManager.java
index 894a2df0a1..291218ecd5 100644
--- 
a/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/heartbeat/HeartbeatManager.java
+++ 
b/inlong-manager/manager-service/src/main/java/org/apache/inlong/manager/service/heartbeat/HeartbeatManager.java
@@ -95,6 +95,9 @@ public class HeartbeatManager implements 
AbstractHeartbeatManager {
     @Value("${cluster.heartbeat.interval:30}")
     private Long heartbeatIntervalFactor;
 
+    @Value("${reset.nodeStatus.enabled:false}")
+    private Boolean resetNodeStatusEnabled;
+
     /**
      * Check whether the configuration information carried in the heartbeat 
has been updated
      *
@@ -115,7 +118,10 @@ public class HeartbeatManager implements 
AbstractHeartbeatManager {
     public void init() {
         // When the manager restarts, set the heartbeat timeout state of all 
nodes
         // and wait for the heartbeat report of the corresponding node
-        clusterNodeMapper.updateStatus(null, 
NodeStatus.HEARTBEAT_TIMEOUT.getStatus(), NodeStatus.NORMAL.getStatus());
+        if (resetNodeStatusEnabled) {
+            clusterNodeMapper.updateStatus(null, 
NodeStatus.HEARTBEAT_TIMEOUT.getStatus(),
+                    NodeStatus.NORMAL.getStatus());
+        }
         long expireTime = heartbeatInterval() * heartbeatIntervalFactor;
         Scheduler evictScheduler = 
Scheduler.forScheduledExecutorService(Executors.newSingleThreadScheduledExecutor());
         heartbeatCache = Caffeine.newBuilder()
diff --git 
a/inlong-manager/manager-web/src/main/resources/application-dev.properties 
b/inlong-manager/manager-web/src/main/resources/application-dev.properties
index 9e77553ac5..69d051a771 100644
--- a/inlong-manager/manager-web/src/main/resources/application-dev.properties
+++ b/inlong-manager/manager-web/src/main/resources/application-dev.properties
@@ -89,6 +89,9 @@ sort.enable.zookeeper=false
 # cluster node timeout interval of heartbeat unit: second, the interval 
multiplied by 5 represents the true heartbeat timeout interval
 cluster.heartbeat.interval=6
 
+# Whether to reset the cluster node status
+reset.nodeStatus.enabled=false
+
 # If turned on, synchronizing change the source status when the agent 
heartbeat times out
 source.update.enabled=false
 source.update.before.seconds=60
diff --git 
a/inlong-manager/manager-web/src/main/resources/application-prod.properties 
b/inlong-manager/manager-web/src/main/resources/application-prod.properties
index c3bb35f3ce..7e99baff71 100644
--- a/inlong-manager/manager-web/src/main/resources/application-prod.properties
+++ b/inlong-manager/manager-web/src/main/resources/application-prod.properties
@@ -88,6 +88,9 @@ sort.enable.zookeeper=false
 # cluster node timeout interval of heartbeat unit: second, the interval 
multiplied by 5 represents the true heartbeat timeout interval
 cluster.heartbeat.interval=6
 
+# Whether to reset the cluster node status
+reset.nodeStatus.enabled=false
+
 # If turned on, synchronizing change the source status when the agent 
heartbeat times out
 source.update.enabled=false
 source.update.before.seconds=60
diff --git 
a/inlong-manager/manager-web/src/main/resources/application-test.properties 
b/inlong-manager/manager-web/src/main/resources/application-test.properties
index 9e77553ac5..69d051a771 100644
--- a/inlong-manager/manager-web/src/main/resources/application-test.properties
+++ b/inlong-manager/manager-web/src/main/resources/application-test.properties
@@ -89,6 +89,9 @@ sort.enable.zookeeper=false
 # cluster node timeout interval of heartbeat unit: second, the interval 
multiplied by 5 represents the true heartbeat timeout interval
 cluster.heartbeat.interval=6
 
+# Whether to reset the cluster node status
+reset.nodeStatus.enabled=false
+
 # If turned on, synchronizing change the source status when the agent 
heartbeat times out
 source.update.enabled=false
 source.update.before.seconds=60

Reply via email to