luoluoyuyu commented on code in PR #16233:
URL: https://github.com/apache/iotdb/pull/16233#discussion_r3309335381
##########
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:
`trackException` 每次 `clear()` 再 `add()`,配合 Set 结构保证**仅保留最新一条**,符合 PR 目标。
**注意**:`getLastException()` 用 `iterator().next()` 取一条,与 Set 语义一致;但
`getExceptionMessage()` 仍 `lastException.toString()`,展示格式可能不友好(Set 的
toString)。若 `SHOW PIPES` 已改为结构化 `last_exception` 列,建议同步改
`getExceptionMessage()` 或标记 deprecated。
##########
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:
从 coordinator 应用 meta 时**一律** `clearExceptionMessages()`,避免 CN 侧历史异常在 DN
重启/同步时覆盖本地真实最后异常 —— 这是「不清理用户可见异常」的关键一环,👍
**请确认**:用户主动 `DROP PIPE` 或 pipe 成功后,是否仍需要某条路径清理
`last_exception`?当前设计似乎是「仅在新异常到来时覆盖」,符合 PR 描述,建议在 release note 写明。
--
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]