Skip to content

[ISSUE #16381] Retain registry configs with different explicit ids - #16407

Open
cyforkk wants to merge 1 commit into
apache:3.3from
cyforkk:fix/16381-registry-config-dedup-by-id
Open

[ISSUE #16381] Retain registry configs with different explicit ids#16407
cyforkk wants to merge 1 commit into
apache:3.3from
cyforkk:fix/16381-registry-config-dedup-by-id

Conversation

@cyforkk

@cyforkk cyforkk commented Jul 31, 2026

Copy link
Copy Markdown

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).

When two RegistryConfig instances have different explicit ids but the same
address, the previous dedup logic (which uses equals() that ignores id)
incorrectly treated the second one as a duplicate of the first and dropped
it, causing "Registry not found" when later looking up by the second id.

Fix by treating configs with different explicit ids as distinct in both the
fast-path check in addConfig() and the findConfigByValue() lookup.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov-commenter

codecov-commenter commented Jul 31, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 60.88%. Comparing base (3a30432) to head (0e660ef).

Additional details and impacted files
@@            Coverage Diff            @@
##                3.3   #16407   +/-   ##
=========================================
  Coverage     60.87%   60.88%           
- Complexity    11766    11769    +3     
=========================================
  Files          1953     1953           
  Lines         89273    89278    +5     
  Branches      13473    13474    +1     
=========================================
+ Hits          54346    54356   +10     
+ Misses        29333    29329    -4     
+ Partials       5594     5593    -1     
Flag Coverage Δ
integration-tests-java21 32.14% <57.14%> (+<0.01%) ⬆️
integration-tests-java8 32.20% <57.14%> (-0.01%) ⬇️
samples-tests-java21 32.14% <57.14%> (-0.06%) ⬇️
samples-tests-java8 29.72% <57.14%> (-0.08%) ⬇️
unit-tests-java11 59.13% <100.00%> (+0.01%) ⬆️
unit-tests-java17 58.59% <100.00%> (-0.05%) ⬇️
unit-tests-java21 58.61% <100.00%> (+<0.01%) ⬆️
unit-tests-java25 58.56% <100.00%> (-0.01%) ⬇️
unit-tests-java8 59.12% <100.00%> (-0.03%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@LI123456mo LI123456mo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @cyforkk , this PR #16382 already fixes the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] removing the so-called registry config duplication leads to exception

3 participants