konlue opened a new pull request, #7797:
URL: https://github.com/apache/shenyu/pull/7797
Fixes #7778.
## Summary
In cluster mode, `POST /instance/beat` is absent from the
`ClusterForwardFilter` forward list, so a follower handles the heartbeat
locally: only that JVM's in-memory map is refreshed, while the master — the
node that persists instance state — keeps aging the instance to OFFLINE.
## Modifications
- Add `/instance/beat` to the cluster `forward-list`, making the master the
single authority for instance heartbeats: `isMaster()` short-circuits locally
(no forwarding loops), and the filter forwards the POST body and headers
verbatim, so master-side validation and handling are unchanged.
- Scope is the beat endpoint only; dashboard reads (`GET /instance`,
`/instance/analysis/**`) stay local.
- Add `ClusterForwardFilterTest`, the cluster filter module's first test.
## Verifying this change
- [x] `ClusterForwardFilterTest`: master handles locally; a follower
forwards `/instance/beat` to the elected master with body and `Content-Type`
intact and does not run the local chain; unlisted paths are handled locally;
the shipped `application.yml` keeps the path in the forward list.
- [x] Red-green: removing the yml entry fails the yml assertion (`instance
heartbeats must be forwarded to the master admin`); restoring it passes (4/4).
- [x] Targeted tests pass:
```bash
./mvnw -B -ntp -pl shenyu-admin test -Dtest=ClusterForwardFilterTest
```
4/4 green.
- [x] Checkstyle passes:
```bash
./mvnw -B -ntp -pl shenyu-admin checkstyle:check
```
clean.
## Notes
Forward failures (master unreachable) behave like every other forwarded path
— no new fallback is introduced here. `/instance/beat` is not in the shiro
white list, and the filter forwards the original headers including credentials,
so authentication behaviour is unchanged.
--
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]