Repository navigation
[type: bug] Fix stale config cleanup on REFRESH/MYSELF events (#6875) - #7011
zhang-arvin wants to merge 0 commit into
Conversation
Aias00
left a comment
There was a problem hiding this comment.
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 nameBut 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).
308b7d7 to
5935927
Compare
|
Thanks for the review @Aias00! Fixed:
Please take another look. |
Aias00
left a comment
There was a problem hiding this comment.
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 howpublishConfigkeys 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.
|
@zhang-arvin pls fix conflict |
|
Rebased onto latest master, conflicts resolved |
57d77c4 to
f7602e3
Compare
|
@Aias00 conflict fixed — rebased onto latest master, thanks! |
Closes #6875