mochengqian commented on PR #932: URL: https://github.com/apache/dubbo-go-pixiu/pull/932#issuecomment-4569880037
@Similarityoung 你这个观察是对的——动态 SetEndpoint 不该跟静态 assemble 共用 "rename to `-2`" 规则。Nacos / SpringCloud `OnUpdateServiceInstance` 本质是"同一实例的信息变了",当前实现会让每次 address 变更都新增一个 `-N` 槽,picker 同时往新旧地址打流量。`TestClusterManager_SetEndpointExplicitSameIDDifferentAddressAppendsSuffix` 把这个错行为锁成了契约,是我上一轮接受 reviewer "不要静默丢配置" 的诉求时加的——没看到它跟动态 update 语义直接冲突,这是我的疏忽。 ## 已经在本 PR 内修了(commit 27653093) **决策层** (`resolveSetEndpointSlotByID`):显式 ID 命中 + 内容不同 → **Replace at slot**,不再 append `-2`。 **runtime 层** (`replaceEndpointAt`):按地址是否变了分两条: | update 场景 | 行为 | endpoint 数 | |---|---|---| | 同 ID,address 变 | 停老地址 healthcheck → 替换槽 → 重建 snapshot → 起新地址 healthcheck | 始终 1 | | 同 ID,address 不变,metadata / LLMMeta 变 | 替换槽 + 重建 snapshot(healthcheck 不动,**runtime 健康状态从上一份 snapshot 继承**——已知 unhealthy 的实例不会因 metadata flip 被误判 healthy)| 始终 1 | 测试锁住:`...OverwritesInPlace`、`...MetadataOnlyChangeInheritsHealth`、`...AddressChangeRestartsHealthcheck`(用新加的 `healthCheckerAddresses` helper 验证 checker map key 真的从老地址翻到新地址,防 goroutine 泄漏)、`...RepeatedUpdatesDoNotGrowEndpoints`(模拟 SpringCloud 连发 100 次 OnUpdate 不累积)、`...RebuildsConsistentHash`(老地址出环,新地址入环)、`...CertsDirChangeReplacesWithoutHealthcheckRestart`(锁住 socketAddressContentEqual 跟 GetAddress 的故意差异)。 ## 没动的部分 empty-ID + hash collision 路径仍是 suffix-append。这条路径的 caller 等于明说 "我没声明实例身份",静态 YAML 风格的去重在那里是对的——你这次的批评(ID = 身份)恰好不适用于 "调用方根本没给 ID" 的情况。 ## 关于 "ID 应作为身份,冲突 hard-fail" 方向我同意,但属于 breaking change(存量 YAML 里有重复 ID 的部署会启动失败),不该夹带在 snapshot PR 里悄悄落地。已开 #949 走 RFC 流程,标题前缀 `RFC:` —— **不会标 `contribute welcome`**,先把方向、迁移窗口、版本节奏对齐再谈实现。欢迎你在那条 issue 里继续推动。 ## 顺带 你这次抓到的 "unified helper 错抽象"(`resolveSetEndpointSlot` 试图统一两条本质不同的语义)让我决定 audit 一下文件里其他类似的 helper,看有没有同款问题。已开 #950,标了 `chore` + `good first issue` + `contribute welcome`,任何人都可以接。 谢谢这条 review,把回归点抓出来了。 -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
