Repository navigation
fix(admin): forward instance heartbeats to the master admin (#7778) - #7797
Merged
Merged
Conversation
Aias00
approved these changes
Oct 18, 2026
Aias00
left a comment
Contributor
There was a problem hiding this comment.
Approved.
In cluster mode a worker admin should not persist instance heartbeats locally; forwarding /instance/beat to the master keeps the master authoritative for instance data, consistent with the existing forward-list pattern (shenyu-client, configs, etc.). The change is config-only plus the new ClusterForwardFilterTest, which covers local handling on master, forwarding to master, unlisted paths, and a YAML assertion that the forward-list includes /instance/beat.
CI is green on this branch.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #7778.
Summary
In cluster mode,
POST /instance/beatis absent from theClusterForwardFilterforward 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
/instance/beatto the clusterforward-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.GET /instance,/instance/analysis/**) stay local.ClusterForwardFilterTest, the cluster filter module's first test.Verifying this change
ClusterForwardFilterTest: master handles locally; a follower forwards/instance/beatto the elected master with body andContent-Typeintact and does not run the local chain; unlisted paths are handled locally; the shippedapplication.ymlkeeps the path in the forward list.Red-green: removing the yml entry fails the yml assertion (
instance heartbeats must be forwarded to the master admin); restoring it passes (4/4).Targeted tests pass:
./mvnw -B -ntp -pl shenyu-admin test -Dtest=ClusterForwardFilterTest4/4 green.
Checkstyle passes:
clean.
Notes
Forward failures (master unreachable) behave like every other forwarded path — no new fallback is introduced here.
/instance/beatis not in the shiro white list, and the filter forwards the original headers including credentials, so authentication behaviour is unchanged.