Caideyipi commented on code in PR #16233:
URL: https://github.com/apache/iotdb/pull/16233#discussion_r3680713271


##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/meta/PipeTaskMeta.java:
##########
@@ -80,42 +81,43 @@ public void setLeaderNodeId(final int leaderNodeId) {
     this.leaderNodeId.set(leaderNodeId);
   }
 
-  public synchronized Iterable<PipeRuntimeException> getExceptionMessages() {
-    return new ArrayList<>(exceptionMessages);
+  public synchronized Optional<PipeRuntimeException> getLastException() {
+    final Iterator<PipeRuntimeException> iterator = lastException.iterator();
+    return iterator.hasNext() ? Optional.of(iterator.next()) : 
Optional.empty();
   }
 
-  public synchronized String getExceptionMessagesString() {
-    return exceptionMessages.toString();
+  public synchronized String getExceptionMessage() {
+    return lastException.toString();
   }
 
-  public synchronized void trackExceptionMessage(final PipeRuntimeException 
exceptionMessage) {
+  public synchronized void trackException(final PipeRuntimeException 
exceptionMessage) {
     // Only keep the newest exception message to avoid excess rpc payload and
     // show pipe response
     // Here we still keep the map form to allow compatibility with legacy 
versions
-    exceptionMessages.clear();
-    exceptionMessages.add(exceptionMessage);
+    lastException.clear();

Review Comment:
   Kept the existing exception serialization and restored the user-facing 
column names to ExceptionMessage / exception_message for compatibility. 
TPipeInfo.exceptionMessage and existing SHOW PIPES / information_schema clients 
therefore keep the same contract; this PR only adds the separate 
SuggestedAction column.



##########
iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/pipe/agent/task/PipeTaskAgent.java:
##########
@@ -174,6 +172,13 @@ protected TPushPipeMetaRespExceptionMessage 
handleSinglePipeMetaChangesInternal(
 
   private void executeSinglePipeMetaChanges(final PipeMeta metaFromCoordinator)
       throws IllegalPathException {
+    // Never record any exceptions passed by the configNode
+    metaFromCoordinator
+        .getRuntimeMeta()
+        .getConsensusGroupId2TaskMetaMap()
+        .values()
+        .forEach(PipeTaskMeta::clearExceptionMessages);

Review Comment:
   Agreed. This behavior is intentionally preserved: coordinator-provided 
exceptions are cleared before applying the metadata so they cannot overwrite 
the DataNode's locally tracked latest exception.



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