Repository navigation
feat(admin,loadbalancer): add readiness admission and explicit resume for business instances (#8042) - #8130
Conversation
… for business instances (apache#8042)
Aias00
left a comment
There was a problem hiding this comment.
Reviewed 1518ad4. The normal NOT_READY/HEARTBEAT/DRAINING/READY flow preserves admission markers and delivers them through the production discovery sync and Divide cache paths. One blocking transition gap remains: a fresh REGISTER for an existing healthy endpoint can bypass the new readiness reset entirely and leave a restarted default-ready/legacy client excluded (inline).
Validation: 202 focused tests passed across Admin, load-balancing, plugin props/Divide/WebSocket handlers, the HTTP registration client and websocket sync handlers. An independent production-path probe passed 16 assertions using the real URI subscriber, Divide registration service, H2/MyBatis upstream persistence, Spring transaction interception, DataChangedEventDispatcher, Admin websocket emitter, gateway websocket parser, common discovery subscriber and Divide handler/cache. Only the websocket network-send boundary and unrelated collaborators were mocked. It confirmed marker preservation through heartbeats and a gateway health round, OR exclusion of the two markers, explicit READY re-admission, and the accepted fresh-REGISTER failure with an explicit READY positive control. Used ./mvnw with Corretto 21.0.13 and target 17; Checkstyle passed, RAT/JaCoCo were skipped.
No full reactor/E2E, live websocket connection or multi-Admin/native-database concurrency execution is claimed. The documented deferred boot-session fencing, gRPC picker consistency, propagation acknowledgements and operator-drain precedence are not findings against this delivery slice.
…n the selector handle changes (apache#8042)
|
Fixed — the reset was indeed owned by the handle-change path. Change:
Regression ( Verification: No live registry/websocket claim. |
Aias00
left a comment
There was a problem hiding this comment.
Reviewed 2a0fc96.
The previously reported same-endpoint REGISTER defect is fixed: doDiscoveryLocal now runs even when buildHandle returns null for an unchanged selector handle, so registration clears persisted readiness/draining markers and publishes the refreshed discovery state. The handler update remains conditional, and existing heartbeat behavior is unchanged. The new regression exercises the shared registration entry point with the unchanged-handle branch and verifies both readiness reset and publication.
The earlier change request is resolved by this revision. Coordinate merging/rebasing with the separate boot-session-fencing PR because both touch registration lifecycle code.
Targeted test report: 160 cases, 0 failures, 0 errors, 0 skipped. Checkstyle, separately executed Apache RAT and git diff --check pass. Validation used ./mvnw and Corretto 21/project target 17; no full-repository/Docker E2E pass is claimed. Required CI must pass before merge.
Summary
Second delivery slice of #8042, after the draining boundary in #8101. A registered business instance can now declare that it is alive but not ready (
NOT_READY), and can explicitly resume (READY). Gateways stop selecting it until the resume; heartbeats still cannot restore readiness or cancel a drain.State model
drainingnotReadyREGISTER(fresh)HEARTBEATDRAININGNOT_READYREADYOFFLINEREADYis the only client-owned "admit me" transition and clears both markers. There is no operator-driven drain yet; if one is added,READYmust not silently cancel it (needs source/epoch precedence, deferred).NOT_READYnever clears a drain; both markers may coexist and exclusion is an OR. A fresh registration resets both so legacy clients keep today's behavior.Change
EventType.NOT_READY/READY;ShenyuClientRegisterRepository.notReady/readyand the HTTP client implementation (same URI registration endpoint asDRAINING).props(notReady, andREADYremoves bothnotReadyanddrainingin one read-modify-write); the status column is never touched, so heartbeat-driven status flips cannot restore readiness.ShenyuClientRegisterService/ fallback / subscriber wiring;doDiscoveryLocalnow clears both markers on a fresh registration.UpstreamProps.isReady()(default true),Upstream.ready, andUpstreamCacheManageradmission:draining || !readyis removed from both health pools and cannot be probe-restored; a later sync without the marker re-admits through the normal paths. Divide and WebSocket handlers copy the flag.Compatibility / rollout
Appending enum constants is source-compatible but not wire-compatible in the failing direction. Jackson rejects unknown enum values, so an old Admin returns HTTP
400for the new events (same contract asDRAINING).Rollout order: Admin → gateways → clients.
Old clients never send the new events (default ready); old gateways ignore the unknown props key.
Tests / verification
props, subscriber routing, fallback delegation,doNotReady/doReadywiring.UpstreamPropsdefault/parse, cache exclusion and re-admission (including all-not-ready and draining+not-ready), Divide/WebSocket propagation.NOT_READY/READYwith the URI registration path.shenyu-admin2507 tests; changed modules all green; checkstyle 0.isReadypredicate fails the new not-ready cache tests.Deferred
REGISTERandNOT_READY.READY; long-lived session termination policy.Part of #8042.