Aias00 opened a new issue, #7312:
URL: https://github.com/apache/shenyu/issues/7312
## Current Behavior
In Admin cluster mode, a configuration write can commit successfully on a
non-master node but never reach WebSocket-connected gateways.
`DataChangedEvent` is a local Spring application event. In
`DataChangedEventDispatcher#onApplicationEvent`, a non-master node returns
before invoking non-`AbstractDataChangedListener` listeners:
```java
if (!(listener instanceof AbstractDataChangedListener)
&& clusterProperties.isEnabled()
&& shenyuClusterSelectMasterService != null
&& !shenyuClusterSelectMasterService.isMaster()) {
LOG.info("received DataChangedEvent, not master, pass");
return;
}
```
`WebsocketDataChangedListener` is one of the skipped listeners. There is no
forwarding/replay from the node that committed the database transaction to the
current master.
This produces the observed sequence:
1. a load-balanced write request reaches a non-master Admin;
2. database data is updated;
3. the local WebSocket event is skipped;
4. gateway cache remains stale while the socket stays healthy;
5. gateway restart sends `MYSELF` and reloads the correct database snapshot.
Related but distinct issue: #6461 covers reconnect behavior after an Admin
restart.
## Reproduction
- Start two Admin instances with cluster mode enabled and a shared database.
- Connect a gateway by WebSocket to the current master.
- Send a selector/rule/plugin update directly to the non-master Admin.
- Verify the database update succeeds and the non-master logs `received
DataChangedEvent, not master, pass`.
- Verify the connected gateway does not receive the update.
- Restart/reconnect the gateway and verify the full snapshot contains the
change.
## Expected Behavior
A committed configuration change accepted by any Admin node must eventually
reach gateways connected to the active master exactly once or through an
idempotent/reconcilable path.
## Scope
- Define a reliable cross-node handoff for committed data-change events, or
route writes to the master before mutation.
- Do not depend on local Spring events alone for cluster-wide propagation.
- Remove listener-order dependence caused by returning from inside the
listener loop.
- Preserve standalone behavior.
- Handle master changes during event delivery.
- Ensure rolled-back transactions are not published as committed
configuration.
- Add diagnostics containing event group, namespace, source node, master
identity, and delivery outcome.
## Acceptance Criteria
- [ ] Writes sent to either master or non-master Admin reach connected
gateways.
- [ ] Two-Admin load-balanced E2E covers plugin, selector, rule, metadata,
and delete events.
- [ ] Master failover during or immediately after a write converges to the
database state.
- [ ] Delivery is independent of Spring bean/listener iteration order.
- [ ] Duplicate delivery is idempotent or deduplicated.
- [ ] Standalone WebSocket sync remains unchanged.
- [ ] Cluster logs/metrics expose forwarded, skipped, delivered, and failed
events.
--
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]