cyforkk opened a new pull request, #16407:
URL: https://github.com/apache/dubbo/pull/16407
Fixes #16381
## What is the purpose of the change
When two `RegistryConfig` instances have different explicit ids (e.g. `zk1`,
`zk2`) but the same address, the previous dedup logic incorrectly treated the
second one as a duplicate of the first and dropped it. This caused
`IllegalStateException: Registry not found: zk2` when later resolving the
reference's registry id.
The root cause is that `AbstractConfig.equals()` intentionally ignores the
`id` field, so the dedup check in `addConfig()` and `findConfigByValue()` could
not distinguish configs that the user explicitly identified as different.
## Brief changelog
- In `AbstractConfigManager.addConfig()` fast-path check: skip the early
return when the existing config has a different explicit id than the new config.
- In `AbstractConfigManager.findConfigByValue()`: exclude matches where both
configs have non-null, different explicit ids.
- Add helper `hasDifferentExplicitId()` to encapsulate the comparison.
- Add regression tests in `ConfigManagerTest`:
- `testRegistryConfigWithDifferentIdsSameAddress`: two registries with
different ids and same address are both retained.
- `testRegistryConfigWithSameIdSameAddress`: same-id registries are still
deduplicated (override).
## Verifying this change
- `ConfigManagerTest`: 21 tests passed (including 2 new regression tests).
--
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]