SteveYurongSu commented on code in PR #12217:
URL: https://github.com/apache/iotdb/pull/12217#discussion_r1538818361


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java:
##########
@@ -1062,11 +1136,81 @@ public TPushTopicMetaResp 
pushSingleTopicMeta(TPushSingleTopicMetaReq req) {
     }
   }
 
+  @Override
+  public TPushTopicMetaResp pushMultiTopicMeta(TPushMultiTopicMetaReq req) {
+    boolean hasException = false;
+    // If there is any exception, we use the size of exceptionMessages to 
record the fail index
+    List<TPushTopicMetaRespExceptionMessage> exceptionMessages = new 
ArrayList<>();
+    try {
+      if (req.isSetTopicNamesToDrop()) {
+        for (String topicNameToDrop : req.getTopicNamesToDrop()) {
+          TPushTopicMetaRespExceptionMessage message =
+              SubscriptionAgent.topic().handleDropTopic(topicNameToDrop);
+          exceptionMessages.add(message);
+          if (message != null) {
+            // If there is any exception, skip the remaining topics
+            hasException = true;
+            break;
+          }
+        }
+      } else if (req.isSetTopicMetas()) {
+        for (ByteBuffer byteBuffer : req.getTopicMetas()) {
+          final TopicMeta topicMeta = TopicMeta.deserialize(byteBuffer);
+          TPushTopicMetaRespExceptionMessage message =
+              
SubscriptionAgent.topic().handleSingleTopicMetaChanges(topicMeta);
+          exceptionMessages.add(message);
+          if (message != null) {
+            // If there is any exception, skip the remaining pipes
+            hasException = true;
+            break;
+          }
+        }
+      } else {
+        throw new Exception("Invalid TPushMultiTopicMetaReq");
+      }
+
+      return hasException
+          ? new TPushTopicMetaResp()
+              .setStatus(new 
TSStatus(TSStatusCode.TOPIC_PUSH_META_ERROR.getStatusCode()))
+              .setExceptionMessages(exceptionMessages)
+          : new TPushTopicMetaResp()
+              .setStatus(new 
TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()));
+    } catch (Exception e) {
+      LOGGER.error("Error occurred when pushing multi topic meta", e);

Review Comment:
   ```suggestion
         LOGGER.warn("Error occurred when pushing multi topic meta", e);
   ```



-- 
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