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


##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/protocol/thrift/impl/DataNodeInternalRPCServiceImpl.java:
##########
@@ -1034,10 +1038,80 @@ public TPushPipeMetaResp 
pushSinglePipeMeta(TPushSinglePipeMetaReq req) {
     }
   }
 
+  @Override
+  public TPushPipeMetaResp pushMultiPipeMeta(TPushMultiPipeMetaReq req) {
+    boolean hasException = false;
+    // If there is any exception, we use the size of exceptionMessages to 
record the fail index
+    List<TPushPipeMetaRespExceptionMessage> exceptionMessages = new 
ArrayList<>();
+    try {
+      if (req.isSetPipeNamesToDrop()) {
+        for (String pipeNameToDrop : req.getPipeNamesToDrop()) {
+          TPushPipeMetaRespExceptionMessage message =
+              PipeAgent.task().handleDropPipe(pipeNameToDrop);
+          exceptionMessages.add(message);
+          if (message != null) {
+            // If there is any exception, skip the remaining pipes
+            hasException = true;
+            break;
+          }
+        }
+      } else if (req.isSetPipeMetas()) {
+        for (ByteBuffer byteBuffer : req.getPipeMetas()) {
+          final PipeMeta pipeMeta = PipeMeta.deserialize(byteBuffer);
+          TPushPipeMetaRespExceptionMessage message =
+              PipeAgent.task().handleSinglePipeMetaChanges(pipeMeta);
+          exceptionMessages.add(message);
+          if (message != null) {
+            // If there is any exception, skip the remaining pipes
+            hasException = true;
+            break;
+          }
+        }
+      } else {
+        throw new Exception("Invalid TPushMultiPipeMetaReq");
+      }
+
+      return hasException
+          ? new TPushPipeMetaResp()
+              .setStatus(new 
TSStatus(TSStatusCode.PIPE_PUSH_META_ERROR.getStatusCode()))
+              .setExceptionMessages(exceptionMessages)
+          : new TPushPipeMetaResp()
+              .setStatus(new 
TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()));
+    } catch (Exception e) {
+      LOGGER.error("Error occurred when pushing multi pipe meta", e);
+      return new TPushPipeMetaResp()
+          .setStatus(new 
TSStatus(TSStatusCode.PIPE_PUSH_META_ERROR.getStatusCode()))
+          .setExceptionMessages(exceptionMessages);
+    }
+  }
+
+  @Override
+  public TPushTopicMetaResp pushTopicMeta(TPushTopicMetaReq req) {
+    final List<TopicMeta> topicMetas = new ArrayList<>();
+    for (ByteBuffer byteBuffer : req.getTopicMetas()) {
+      topicMetas.add(TopicMeta.deserialize(byteBuffer));
+    }
+    try {
+      TPushTopicMetaRespExceptionMessage exceptionMessage =
+          SubscriptionAgent.topic().handleTopicMetaChanges(topicMetas);
+
+      return exceptionMessage == null
+          ? new TPushTopicMetaResp()
+              .setStatus(new 
TSStatus(TSStatusCode.SUCCESS_STATUS.getStatusCode()))
+          : new TPushTopicMetaResp()
+              .setStatus(new 
TSStatus(TSStatusCode.TOPIC_PUSH_META_ERROR.getStatusCode()))
+              
.setExceptionMessages(Collections.singletonList(exceptionMessage));
+    } catch (Exception e) {
+      LOGGER.error("Error occurred when pushing topic meta", e);

Review Comment:
   ```suggestion
         LOGGER.warn("Error occurred when pushing 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