Caideyipi commented on PR #17780:
URL: https://github.com/apache/iotdb/pull/17780#issuecomment-4562888526
Findings
- P1: TopicMeta 的新尾部字段破坏旧格式兼容。deserialize(InputStream) 用
inputStream.available() 判断是否还有 owner
字段,但 TopicMeta 在 snapshot 里是连续写入的;旧版本数据没有 owner flag,多个 topic 时这里会把下一个
topic
的首字节当成 owner flag 消费,导致后续反序列化错位。ByteBuffer.hasRemaining() 在旧
procedure/plan
列表里也有同类问题。见 TopicMeta.java#L260
(https://github.com/apache/iotdb/blob/76f2a882411ba790f7db290740f0232a1e5c4022/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/subscription/meta/topic/TopicMeta.java#L260)
和 TopicMetaKeeper.java#L112
(https://github.com/apache/iotdb/blob/76f2a882411ba790f7db290740f0232a1e5c4022/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/subscription/meta/topic/TopicMetaKeeper.java#L112)。建议改成版本化或长度前缀格式,或只从
config 属性恢复 owner,不在非自描述对象尾部追加可选字段。
- P1: owner epoch 单调性没有在真实元数据替换路径上保证。transferOwner() 只在同一个对象上检查递增,但
AlterTopicPlan /
metadata replace 路径直接 remove + add 新 TopicMeta,新对象从 -1 初始化,所以较小 epoch
也能覆盖当前 epoch,使旧
owner 重新合法。见 TopicMeta.java#L135
(https://github.com/apache/iotdb/blob/76f2a882411ba790f7db290740f0232a1e5c4022/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/subscription/meta/topic/TopicMeta.java#L135)
和 SubscriptionInfo.java#L340
(https://github.com/apache/iotdb/blob/76f2a882411ba790f7db290740f0232a1e5c4022/iotdb-core/confignode/src/main/java/org/apache/iotdb/confignode/persistence/subscription/SubscriptionInfo.java#L340)。建议在
ConfigNode alter/handle meta change 时对比 existing owner epoch 并拒绝回退。
- P2: 新增的 owner status code 没有接入客户端错误分类。1913-1916 会落到 default,变成 generic
critical
exception;heartbeat 还会把 provider 标成 unavailable,导致 stale owner
场景反复重连/重试且错误信息不稳定。见
TSStatusCode.java#L319
(https://github.com/apache/iotdb/blob/76f2a882411ba790f7db290740f0232a1e5c4022/iotdb-client/service-rpc/src/main/java/org/apache/iotdb/rpc/TSStatusCode.java#L319)、AbstractSubscriptionProvider.java#L445
(https://github.com/apache/iotdb/blob/76f2a882411ba790f7db290740f0232a1e5c4022/iotdb-client/subscription/src/main/java/org/apache/iotdb/session/subscription/consumer/base/AbstractSubscriptionProvider.java#L445)。建议显式处理
owner fenced/required/lease expired,映射成明确的不可重试业务异常。
--
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]