[BUG] Apollo registry ignores modified instance events and keeps stale cache
- Dominant language
- Java
- Stars
- 8.8k
- Forks
- 3.1k
- Avg merge
- 7d 1h
- Merged PRs (30d)
- 85
Description
### Current Behavior
The Apollo registry implementation updates its local instance cache for added and deleted keys, but ignores modified keys.
`ApolloInstanceRegisterRepository.selectInstances()` registers a `ConfigChangeListener` and handles only `ADDED` and `DELETED` events:
```java
switch (changeEvent.getChange(key).getChangeType()) {
case ADDED:
childrenList.put(key, changeEvent.getChange(key).getNewValue());
break;
case DELETED:
childrenList.remove(key);
break;
default:
break;
}
```
Apollo change events can also be `MODIFIED`. When an existing instance key is updated, for example host, port, scheme, or other instance JSON fields change while the key remains the same, the local `childrenList` is not updated.
### Expected Behavior
`MODIFIED` events should refresh the cached value for that instance key, the same as an add/update cache write.
### Impact
Consumers of `selectInstances()` can keep using stale instance data until the key is deleted/recreated or the process restarts and reloads the full Apollo state.
### Code Location
- `shenyu-registry/shenyu-registry-apollo/src/main/java/org/apache/shenyu/registry/apollo/ApolloInstanceRegisterRepository.java`
- `selectInstances()` listener ignores modified Apollo property changes.
Contributor guide
No contributing guide indexed for this repository
Research direction
Open shenyu-registry/shenyu-registry-apollo/src/main/java/org/apache/shenyu/registry/apollo/ApolloInstanceRegisterRepository.java and start at selectInstances(). Trace the ConfigChangeListener handling for ADDED, DELETED, and MODIFIED events. Done means a modified Apollo instance refreshes the corresponding cached value, with the relevant registry module tests passing.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100