CRZbulabula commented on code in PR #16647:
URL: https://github.com/apache/iotdb/pull/16647#discussion_r2499498840


##########
iotdb-protocol/thrift-confignode/src/main/thrift/confignode.thrift:
##########
@@ -2051,13 +2066,6 @@ service IConfigNodeRPCService {
    */
   TShowAIDevicesResp showAIDevices()

Review Comment:
   Remove these useless interfaces.



##########
iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/service/thrift/ConfigNodeRPCServiceProcessor.java:
##########
@@ -648,6 +650,48 @@ public TSStatus operatePermission(final TAuthorizerReq 
req) {
             req.getNewUsername()));
   }
 
+  @Override
+  public TGetAINodeLocationResp getAINodeLocation() throws TException {
+    final TGetAINodeLocationResp resp = new TGetAINodeLocationResp();
+    final TSStatus status = new TSStatus();
+    try {
+      final List<TAINodeConfiguration> registeredAINodes =
+          configManager.getNodeManager().getRegisteredAINodes();
+
+      if (registeredAINodes == null || registeredAINodes.isEmpty()) {
+        
status.setCode(TSStatusCode.NO_REGISTERED_AI_NODE_ERROR.getStatusCode());
+        status.setMessage("No registered AINode found");
+        resp.setStatus(status);
+        return resp;
+      }
+
+      final TAINodeConfiguration cfg = registeredAINodes.get(0);
+      final TAINodeLocation loc = (cfg == null) ? null : cfg.getLocation();

Review Comment:
   No need further judge



##########
iotdb-protocol/thrift-confignode/src/main/thrift/confignode.thrift:
##########
@@ -659,6 +659,16 @@ struct TAINodeInfo {
   4: required i32 internalPort
 }
 
+// ----------- New messages -----------
+struct TGetAINodeLocationReq {
+  1: optional string deviceId
+}

Review Comment:
   Remove this



##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/execution/config/executor/ClusterConfigTaskExecutor.java:
##########
@@ -371,6 +380,47 @@
 
 public class ClusterConfigTaskExecutor implements IConfigTaskExecutor {
 
+  private static final AtomicReference<TEndPoint> CACHED_AINODE = new 
AtomicReference<>();

Review Comment:
   Maintain the `CACHED_AINODE` either in `AINodeClient` or in 
`AINodeClientManager`.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to