Aias00 opened a new issue, #7457: URL: https://github.com/apache/shenyu/issues/7457
## Is there an existing issue for this? - [x] I searched open and closed issues. ## Current Behavior Admin emits a namespace-scoped full REFRESH with an empty list, but node/path-based config-center listeners ignore it. Stale entries remain in the config center instead of converging to the empty Admin state. `DataChangedEventDispatcher` forwards the explicit namespace to three-argument listener methods. Their default implementations discard the namespace and invoke two-argument methods. The node listener returns immediately for empty lists; the path listener does no work and skips selector/rule subtree deletion when the list is empty. ## Expected Behavior A full refresh for a supplied namespace must reconcile the covered group to empty, without removing another namespace's data. Empty snapshots are meaningful and cannot rely on extracting namespace/plugin identity from a first row. ## Steps To Reproduce 1. Use Nacos/Apollo/Polaris or ZooKeeper/Etcd/Consul configuration synchronization. 2. Publish selectors/rules in namespace `namespace-a`. 3. Leave old config-center data behind after a missed/failed deletion or other stale-state condition while Admin's current group becomes empty. 4. Run namespace synchronize or import followed by `syncAllByNamespaceId(REFRESH, namespace-a)`. 5. Observe an empty event carrying namespace-a, but no deletion/replacement of the old config-center entries. An offline verifier seeded namespace-a and namespace-b in in-memory subclasses of the actual node/path listener bases, then invoked their actual three-argument methods. Current-source output: ```text PASS node empty REFRESH kept seeded APP_AUTH/PLUGIN/SELECTOR/RULE for namespace-a PASS node nonempty REFRESH controls delete target namespace stale data and isolate other namespace PASS path empty REFRESH kept seeded APP_AUTH/PLUGIN/SELECTOR/RULE for namespace-a PASS path nonempty REFRESH controls delete target namespace stale selector/rule and isolate other namespace ``` ## Location And Scope - [DataChangedListener.java:54](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-admin-listener/shenyu-admin-listener-api/src/main/java/org/apache/shenyu/admin/listener/DataChangedListener.java#L54): namespace-aware defaults delegate to legacy methods. - [AbstractNodeDataChangedListener.java:172](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-admin-listener/shenyu-admin-listener-api/src/main/java/org/apache/shenyu/admin/listener/AbstractNodeDataChangedListener.java#L172): empty selector refresh returns without clearing config-center state; analogous guards apply to covered groups. - [AbstractPathDataChangedListener.java:121](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-admin-listener/shenyu-admin-listener-api/src/main/java/org/apache/shenyu/admin/listener/AbstractPathDataChangedListener.java#L121): selector refresh deletion requires nonempty data; analogous rule handling starts at line 167. - [SyncDataServiceImpl.java:145](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/SyncDataServiceImpl.java#L145): namespace sync publishes plugin/selector/rule events with the namespace. - [AppAuthServiceImpl.java:281](https://github.com/apache/shenyu/blob/67596c1d228b62da75cd0a0ecb47d0ac5d995384/shenyu-admin/src/main/java/org/apache/shenyu/admin/service/impl/AppAuthServiceImpl.java#L281): app-auth namespace synchronization emits an empty refresh. Verified groups: PLUGIN, SELECTOR, RULE, APP_AUTH. Verified shared listener families: node-based Nacos/Apollo/Polaris and path-based ZooKeeper/Etcd/Consul, whose concrete implementations inherit these methods. This issue does not claim metadata/discovery/proxy-selector/AI-key behavior, nor HTTP/WebSocket behavior. ## Impact Severity: Medium. Confidence: high. Full synchronization cannot repair a config center whose last entries became stale after a deletion. Gateways can continue loading old routing/configuration data until an explicit deletion or manual center cleanup succeeds. Normal incremental delete delivery is a separate path; this reproduction targets full-refresh recovery with empty current data. ## Suggested Fix And Regression Coverage Implement namespace-aware full-refresh reconciliation in the node/path abstractions. On empty refresh, use the supplied namespace to remove stale group entries or replace lists with empty state. For selectors/rules, identify stored plugin/group parents without relying on a first current row. Keep CREATE/UPDATE/DELETE semantics and cross-namespace isolation unchanged. Test previously populated -> empty namespace full refresh for each covered group, and verify another namespace survives. Retain nonempty replacement and ordinary incremental delete controls. ## Validation And Related Issues Reviewed `2.7.2-SNAPSHOT` master at `67596c1d228b62da75cd0a0ecb47d0ac5d995384`. Isolated verification and leader recompilation/reproduction confirmed the shared listener behavior. Existing `AbstractNodeDataChangedListenerTest,AbstractPathDataChangedListenerTest`: 8 tests passed. #6831 fixed nonempty node refresh union behavior. #6832 fixed nonempty multi-plugin path refresh clearing. This is the empty namespace-aware payload discarded before those replacement algorithms can run. #6662/#6663 concern HTTP gateway refresh; #7356 concerns WebSocket convergence. Those channels are outside this finding. No real config-center deployment was started; proof uses current listener source and in-memory persistence implementations. -- 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]
