sunnysabor opened a new pull request, #7319: URL: https://github.com/apache/shenyu/pull/7319
Refs #7283. A gateway can accept a WebSocket connection before its initial configuration callbacks finish. This draft adds an opt-in initial synchronization readiness gate: the readiness group remains OUT_OF_SERVICE until a complete, matching synchronization attempt has been applied. Initial connection establishment is asynchronous when the gate is enabled, so an unavailable Admin does not prevent management endpoints from starting. The flag is `shenyu.sync.websocket.initial-sync-readiness` (default false). Upgrade Admin first, then enable the gateway flag. Existing clients and gateways with the flag disabled retain MYSELF and the legacy response format. Enabled gateways use a versioned request that older Admin versions ignore; they remain not ready and retry instead of treating connectivity as successful synchronization. Implementation: - Admin wraps configuration messages with a connection-scoped request ID and sequence, followed by an end frame carrying the expected count. Empty configuration can complete with zero frames. Followers do not acknowledge the request; leadership is checked again before sending completion. - Each Admin connection tracks its own attempt. One complete standalone/master attempt can satisfy the shared startup latch; partial attempts from different connections are never combined. Missing frames, callback failures, abandoned attempts and the 60-second attempt timeout cannot open readiness. The existing reconnect loop retries failed or timed-out startup attempts. - Completion waits for synchronous callbacks and deferred configuration work registered through `InitialSyncApplication.register(CompletionStage)`. Interleaved incremental callbacks participate while an attempt is pending. Late completion from an abandoned attempt cannot open the gate. CommonPluginDataSubscriber propagates failures in this scope while preserving its legacy behavior otherwise. - The synchronization indicator is included in readiness and excluded from aggregate health and liveness. Existing health group members and application readiness remain effective. Kubernetes examples use separate probe groups. - Once successful, the startup latch is never revoked merely because Admin disconnects. Application boundary and draft review: Subscribers that defer configuration application must register a stage before returning; that stage must cover their nested work and propagate failures. Unregistered background tasks, internally swallowed plugin errors, ongoing upstream health checks and lazy request-time connection establishment cannot be inferred from a void callback. This gate does not assert upstream service health. The implementation reuses current refresh/cache behavior; it does not add transactional snapshots or rollback of partially applied configuration. Please review the subscriber contract and retry/cache semantics, as well as default-off enablement and upgrade order, before promoting this draft. Validation: - Passed focused Admin protocol, gateway state/client, subscriber and Spring health-group tests, including unsupported peers, empty configuration, failure/retry, stale completions and multiple Admin attempts. - Passed a real loopback WebSocket test with deferred subscriber work, end-frame arrival before application completion and disconnection after initial success. - Full Java 17 `./mvnw -s /tmp/shenyu-maven-central-settings.xml clean install -Dmaven.javadoc.skip=true`: passed, all 235 reactor modules, 15m09s, including tests, Checkstyle and RAT. The temporary settings selects Maven Central. - `git diff --check`: passed. - Kubernetes deployment/network fault-injection suites were not run; the loopback test is not a Kubernetes validation. - [x] Read the contribution guidelines. - [x] Added regression tests. - [x] Local full build passed `./mvnw clean install -Dmaven.javadoc.skip=true`. -- 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]
