Aias00 opened a new issue, #6478:
URL: https://github.com/apache/shenyu/issues/6478

   ### Current Behavior
   
   Node-based sync consumers unsubscribe auth and metadata entries using the 
wrong key segment.
   
   The admin node listener writes app-auth and metadata entries under keys 
shaped like:
   
   ```text
   <namespace>.<auth>.<appKey>
   <namespace>.<meta>.<metadataId>
   ```
   
   `AbstractNodeDataChangedListener` builds those prefixes and appends 
`AppAuthData::getAppKey` or `MetaData::getId`.
   
   On delete, `AbstractNodeDataSyncService` splits the remove key but uses 
`ruleKeys[1]` as the deleted identifier:
   
   ```java
   appAuthData.setAppKey(ruleKeys[1]);
   metaData.setId(ruleKeys[1]);
   ```
   
   For a key like `namespace.auth.actualAppKey`, `ruleKeys[1]` is only `auth`, 
not the deleted app key. The same applies to metadata, where `ruleKeys[1]` is 
`meta`.
   
   ### Expected Behavior
   
   Auth and metadata delete events should unsubscribe the actual deleted 
identifier from the final key segment.
   
   ### Impact
   
   Apollo/Nacos/Polaris-style node sync clients can keep stale app auth or 
metadata cache entries after those records are deleted in admin.
   
   ### Code Location
   
   - 
`shenyu-admin-listener/shenyu-admin-listener-api/src/main/java/org/apache/shenyu/admin/listener/AbstractNodeDataChangedListener.java`
     - app auth and metadata keys are written with the actual id/appKey as the 
final segment.
   - 
`shenyu-sync-data-center/shenyu-sync-data-api/src/main/java/org/apache/shenyu/sync/data/core/AbstractNodeDataSyncService.java`
     - `unCacheAuthData()` and `unCacheMetaData()` read `ruleKeys[1]` instead 
of the final identifier segment.
   


-- 
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]

Reply via email to