This is an automated email from the ASF dual-hosted git repository. tanxinyu pushed a commit to branch fix_confignode_restart_ainode_error_cp in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit b8deec2a083c1b5344dafc7e380252dacb20071b Author: Potato <[email protected]> AuthorDate: Fri Sep 20 15:11:22 2024 +0800 Fix AINode status error after ConfigNode Leader restarts #13547 Signed-off-by: OneSizeFitQuorum <[email protected]> --- .../iotdb/confignode/manager/load/cache/LoadCache.java | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java index 8fe7233809d..137a8b7f63e 100644 --- a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java +++ b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/load/cache/LoadCache.java @@ -19,6 +19,7 @@ package org.apache.iotdb.confignode.manager.load.cache; +import org.apache.iotdb.common.rpc.thrift.TAINodeConfiguration; import org.apache.iotdb.common.rpc.thrift.TConfigNodeLocation; import org.apache.iotdb.common.rpc.thrift.TConsensusGroupId; import org.apache.iotdb.common.rpc.thrift.TConsensusGroupType; @@ -98,7 +99,8 @@ public class LoadCache { public void initHeartbeatCache(IManager configManager) { initNodeHeartbeatCache( configManager.getNodeManager().getRegisteredConfigNodes(), - configManager.getNodeManager().getRegisteredDataNodes()); + configManager.getNodeManager().getRegisteredDataNodes(), + configManager.getNodeManager().getRegisteredAINodes()); initRegionGroupHeartbeatCache( configManager.getClusterSchemaManager().getDatabaseNames().stream() .collect( @@ -110,7 +112,8 @@ public class LoadCache { /** Initialize the nodeCacheMap when the ConfigNode-Leader is switched. */ private void initNodeHeartbeatCache( List<TConfigNodeLocation> registeredConfigNodes, - List<TDataNodeConfiguration> registeredDataNodes) { + List<TDataNodeConfiguration> registeredDataNodes, + List<TAINodeConfiguration> registeredAINodes) { final int CURRENT_NODE_ID = ConfigNodeHeartbeatCache.CURRENT_NODE_ID; nodeCacheMap.clear(); @@ -136,6 +139,13 @@ public class LoadCache { int dataNodeId = dataNodeConfiguration.getLocation().getDataNodeId(); createNodeHeartbeatCache(NodeType.DataNode, dataNodeId); }); + + // Init AiNodeHeartbeatCache + registeredAINodes.forEach( + aiNodeConfiguration -> { + int aiNodeId = aiNodeConfiguration.getLocation().getAiNodeId(); + createNodeHeartbeatCache(NodeType.AINode, aiNodeId); + }); } /**
