luoluoyuyu commented on code in PR #16233:
URL: https://github.com/apache/iotdb/pull/16233#discussion_r3309371785
##########
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:
clear then add enforces a single last exception. If SHOW PIPES now exposes
last_exception as a structured column, consider whether getExceptionMessage()
(Set toString) should be updated or deprecated for user-facing output.
##########
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:
Clearing exceptions when applying meta from the coordinator prevents old
CN-reported errors from overwriting the true last error on the DataNode after
restart. Matches the do-not-auto-clear behavior for operators.
--
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]