Skip to content

[ISSUE #6831] Fix stale entries accumulating during common multi-data refresh - #6958

Open
yykaue wants to merge 4 commits into
apache:masterfrom
yykaue:fix-6831-replace-multi-refresh
Open

[ISSUE #6831] Fix stale entries accumulating during common multi-data refresh#6958
yykaue wants to merge 4 commits into
apache:masterfrom
yykaue:fix-6831-replace-multi-refresh

Conversation

@yykaue

@yykaue yykaue commented Aug 20, 2026

Copy link
Copy Markdown
Contributor

Closes #6831

This PR fixes the stale configuration issue in AbstractNodeDataChangedListener.onCommonMultiChanged().

For REFRESH events, the listener now:

  • Handles REFRESH separately from additive events.
  • Removes configuration nodes that are no longer present in the refreshed data.
  • Replaces each plugin's ID list with the latest list instead of merging it with the old one.
  • Adds a regression test covering stale selector cleanup across multiple plugins.

This prevents deleted selector, rule, proxy-selector, and discovery-upstream entries from remaining in Nacos, Apollo, or Polaris.

@Aias00, could you please help review this PR? Thanks!

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

Summary

Fixes #6831 — during a REFRESH of common multi-data (e.g. selectors), stale entries accumulated because the REFRESH branch did nothing (empty break).

  • onCommonMultiChanged now handles REFRESH by re-publishing each changed item and calling a new refreshChangedMapToList, which:
    • reads the existing *POINT_LIST node,
    • removes the still-present ids (oldNodeList.removeAll(listIds)),
    • deletes the config nodes for any id no longer present,
    • republishes the list with the current ids.
  • This mirrors the existing putChangedMapToList / delChangedMapToList helpers and keeps the *_LIST index in sync with the actual data on refresh.

Verification

  • DefaultNodeConstants.JOIN_POINT / POINT_LIST are existing constants already used by sibling methods in the same class.
  • New AbstractNodeDataChangedListenerTest.testOnSelectorChangedRefreshReplacesPluginSelectorIds seeds two plugins with [RETAINED, STALE] ids, issues a REFRESH with [RETAINED] + a new ADDED for plugin 1, and asserts: plugin-1 list becomes [RETAINED, ADDED], plugin-2 list becomes [RETAINED], and both STALE data nodes are deleted. This is exactly the stale-entry cleanup the PR intends.

Conclusion

Clean fix for a real stale-cache bug, with a focused regression test. Approving.

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

Labels

None yet

Projects

None yet

2 participants