This is an automated email from the ASF dual-hosted git repository.
rong 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 2a015fc4ed8 AINode: Fix restart functionality and enhance error
clarity (#13424)
2a015fc4ed8 is described below
commit 2a015fc4ed80014ab60a4b4b56831128788d58c1
Author: YangCaiyin <[email protected]>
AuthorDate: Fri Sep 6 14:49:58 2024 +0800
AINode: Fix restart functionality and enhance error clarity (#13424)
* add restart support in confignode for ainode
* add exception handling for ainode
---
.../manager/node/ClusterNodeStartUtils.java | 26 ++++++++++++++++++++++
.../apache/iotdb/db/utils/ErrorHandlingUtils.java | 3 +++
2 files changed, 29 insertions(+)
diff --git
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/ClusterNodeStartUtils.java
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/ClusterNodeStartUtils.java
index 877696cd0d9..4f00eefb825 100644
---
a/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/ClusterNodeStartUtils.java
+++
b/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/manager/node/ClusterNodeStartUtils.java
@@ -260,6 +260,14 @@ public class ClusterNodeStartUtils {
configManager.getNodeManager().getRegisteredConfigNodes());
}
break;
+ case AINode:
+ if (nodeLocation instanceof TAINodeLocation) {
+ matchedNodeLocation =
+ matchRegisteredAINode(
+ (TAINodeLocation) nodeLocation,
+ configManager.getNodeManager().getRegisteredAINodes());
+ }
+ break;
case DataNode:
default:
if (nodeLocation instanceof TDataNodeLocation) {
@@ -432,6 +440,24 @@ public class ClusterNodeStartUtils {
return null;
}
+ /**
+ * Check if there exists a registered AINode who has the same index of the
given one.
+ *
+ * @param aiNodeLocation The given AINode
+ * @param registeredAINodes Registered AINodes
+ * @return The AINodeLocation who has the same index of the given one, null
otherwise.
+ */
+ public static TAINodeLocation matchRegisteredAINode(
+ TAINodeLocation aiNodeLocation, List<TAINodeConfiguration>
registeredAINodes) {
+ for (TAINodeConfiguration registeredAINode : registeredAINodes) {
+ if (registeredAINode.getLocation().getAiNodeId() ==
aiNodeLocation.getAiNodeId()) {
+ return registeredAINode.getLocation();
+ }
+ }
+
+ return null;
+ }
+
/**
* Check if there exists a registered DataNode who has the same index of the
given one.
*
diff --git
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
index 163f179b57c..b232ea74bbc 100644
---
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
+++
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/utils/ErrorHandlingUtils.java
@@ -25,6 +25,7 @@ import
org.apache.iotdb.commons.exception.IoTDBRuntimeException;
import org.apache.iotdb.db.exception.BatchProcessException;
import org.apache.iotdb.db.exception.QueryInBatchStatementException;
import org.apache.iotdb.db.exception.StorageGroupNotReadyException;
+import org.apache.iotdb.db.exception.ainode.ModelException;
import org.apache.iotdb.db.exception.query.QueryProcessException;
import org.apache.iotdb.db.exception.query.QueryTimeoutRuntimeException;
import org.apache.iotdb.db.exception.sql.SemanticException;
@@ -157,6 +158,8 @@ public class ErrorHandlingUtils {
return RpcUtils.getStatus(TSStatusCode.SEMANTIC_ERROR,
rootCause.getMessage());
} else if (t instanceof IoTDBRuntimeException) {
return RpcUtils.getStatus(((IoTDBRuntimeException) t).getErrorCode(),
t.getMessage());
+ } else if (t instanceof ModelException) {
+ return RpcUtils.getStatus(((ModelException) t).getStatusCode(),
rootCause.getMessage());
} else if (t instanceof MemoryNotEnoughException) {
return RpcUtils.getStatus(TSStatusCode.QUOTA_MEM_QUERY_NOT_ENOUGH,
rootCause.getMessage());
}