This is an automated email from the ASF dual-hosted git repository.
rong pushed a commit to branch rc/1.3.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/rc/1.3.3 by this push:
new c81d36b2ed7 AINode: Fix restart functionality and enhance error
clarity (#13424) (#13469)
c81d36b2ed7 is described below
commit c81d36b2ed775328d6acc6bbc32c34952b39729e
Author: YangCaiyin <[email protected]>
AuthorDate: Wed Sep 11 11:03:37 2024 +0800
AINode: Fix restart functionality and enhance error clarity (#13424)
(#13469)
* add restart support in confignode for ainode
* add exception handling for ainode
(cherry picked from commit 2a015fc4ed80014ab60a4b4b56831128788d58c1)
---
.../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 2ac49494acd..7e6740b94a4 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
@@ -24,6 +24,7 @@ import org.apache.iotdb.commons.exception.IoTDBException;
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;
@@ -152,6 +153,8 @@ public class ErrorHandlingUtils {
((IoTDBException) t.getCause()).getErrorCode(),
rootCause.getMessage());
}
return RpcUtils.getStatus(TSStatusCode.SEMANTIC_ERROR,
rootCause.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());
}