Skip to content

[type: bug] Fix stale config cleanup on REFRESH/MYSELF events (#6875) - #7011

Closed
zhang-arvin wants to merge 0 commit into
apache:masterfrom
zhang-arvin:fix/6875-stale-cleanup
Closed

zhang-arvin wants to merge 0 commit into
apache:masterfrom
zhang-arvin:fix/6875-stale-cleanup

Conversation

@zhang-arvin

Copy link
Copy Markdown
Contributor

Closes #6875

@Aias00 Aias00 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.

Review: Fix stale config cleanup on REFRESH/MYSELF events (#6874)

Verdict: REQUEST CHANGES

What's correct

Removing the faulty guard configDataNames.size() > changedList.size() is the right call — with equal cardinality the stale entries were never cleaned, so this condition must go.

Problem: the cleanup still won't actually delete the stale nodes

delConfig is still called with the bare name:

configDataNames.removeAll(changeNames);
configDataNames.forEach(this::delConfig);   // bare name

But every publish used the prefixed key:

changedList.forEach(changedData -> publishConfig(configKeyPrefix + mapperToKey.apply(changedData), changedData));

So delConfig(name) targets a different key than what publishConfig wrote (configKeyPrefix + name). The stale config nodes therefore remain in the registry. The size-guard removal alone does not achieve the PR's stated goal of "stale config cleanup on REFRESH/MYSELF".

Overlap / duplication

This is essentially the same one-line fix already delivered (and approved) in #7014, which additionally corrects delConfig to receive the full key (configKeyPrefix + staleName), matching publishConfig. Please consolidate: either align this PR with #7014 (add the prefixed-key fix) or close it in favor of #7014.

Required change

configDataNames.removeAll(changeNames);
configDataNames.forEach(name -> delConfig(configKeyPrefix + name));

(or reuse the same helper already introduced in #7014). Once the delConfig key matches the published key, the stale entries will be removed as intended.

Conclusion

The guard removal is correct, but as written the PR does not fix stale cleanup because of the key mismatch, and it duplicates #7014. Requesting changes until the delConfig key is corrected (or the PR is consolidated with #7014).

@zhang-arvin

Copy link
Copy Markdown
Contributor Author

Thanks for the review @Aias00! Fixed:

  • Fixed delConfig to use prefixed key (configKeyPrefix + name) in stale config cleanup

Please take another look.

Aias00
Aias00 previously approved these changes Sep 3, 2026

@Aias00 Aias00 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.

Re-review: [type: bug] Fix stale config cleanup on REFRESH/MYSELF events (#6875)

Re-reviewed at head 5935927. My previous REQUEST_CHANGES pointed out that onCommonChanged removed stale config nodes via configDataNames.forEach(this::delConfig), passing the bare data name, while publishConfig writes under the configKeyPrefix + name key — so the stale nodes were never actually deleted. That is now fixed:

  • Line 13: configDataNames.forEach(name -> delConfig(configKeyPrefix + name)); — the full key (prefix + name) is now passed, matching how publishConfig keys the data. Stale config nodes are correctly removed on REFRESH/MYSELF.
  • The redundant configDataNames.size() > changedList.size() guard is removed (line 10), so cleanup runs whenever there are leftover registered names, which is the intended behavior.

Verified against the head file: every delConfig call site (AbstractNodeDataChangedListener lines 126, 136, 225, 251, 264, 278) now uses the configKeyPrefix + ... form — no bare-name path remains.

Note: the same fix is also present in #7022 (which combines this with the fault-tolerance NPE fixes). This PR is correct on its own; consider coordinating/closing duplicates with #7022 to avoid merge conflicts, but it is safe to approve.

Approving.

@Aias00

Aias00 commented Sep 4, 2026

Copy link
Copy Markdown
Contributor

@zhang-arvin pls fix conflict

@zhang-arvin

Copy link
Copy Markdown
Contributor Author

Rebased onto latest master, conflicts resolved

@zhang-arvin

Copy link
Copy Markdown
Contributor Author

@Aias00 conflict fixed — rebased onto latest master, thanks!

This branch was previously deployed

1 inactive deployment
github-pages — f7602e32 Deployed Sep 6, 2026 by Aias00 via deploy #755
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] AbstractNodeDataChangedListener.onCommonChanged REFRESH stale-removal guarded by size> instead of diff — stale entries persist when |old|<=|new|

2 participants