fix(#5359): wire DeliveryTopology + MetaStore into runtime boot; rollback on failure - #5370
Merged
Merged
Conversation
…back on failure Phase 1 wiring of the production-HA plan (#5354), sub-issue #5359. The gap: EventMeshApplication.enableCluster built a PartitionOwnership state machine (Meta CAS + fencing) but never told the RUNTIME - the pull loop kept its constructor-time topology (LOCAL_STICKY_PULL by default) and polled every partition on every instance while the app layer believed ownership was exclusive. Two divergent ownership views; the cluster looked healthy but delivered duplicates. Boot wiring: - enableCluster now flips the runtime topology to PARTITION_OWNED_PULL and injects the shared MetaStore BEFORE runtime.start(), so the pull loop consults the same PartitionOwnership (ownedPartitions) the app built - one state machine, not two - UniRuntime.topology becomes volatile (flippable pre-start); new withTopology / withClusterMeta builders reject post-start mutation (fail fast, like the #5356 contract); new topology() / clusterMeta() accessors Startup transactionality (#5359): - EventMeshApplication.start() wraps the whole boot in try/catch: on any failure it runs shutdown() (stop schedulers, release ports, release storage) with cleanup failures attached as suppressed, then rethrows - no more half-started processes holding the admin port - single-line effective-config log at startup (topology / metaWired / wsPort / tls) so operators can audit a running deployment Tests (new EventMeshApplicationStartupTest, 4 cases): - enableCluster contract: topology flipped + shared meta injected - withTopology / withClusterMeta fail fast after start - null topology rejected Local: runtime tests + checkstyle (maxWarnings=0) all green. Refs #5359 (sub-issue of #5354). Co-authored-by: qqeasonchen <qqeasonchen@gmail.com>
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.
What this PR does
Closes #5359 — Phase 1 wiring of the production-HA plan (#5354): close the divergent-ownership gap and make startup transactional.
1. The gap this fixes
EventMeshApplication.enableClusterbuilt aPartitionOwnershipstate machine (Meta CAS + fencing) but never told the runtime — the pull loop kept its constructor-time topology (LOCAL_STICKY_PULLdefault) and polled every partition on every instance while the app layer believed ownership was exclusive. Two divergent ownership views; the cluster looked healthy but delivered duplicates.2. Boot wiring
enableClusternow callsruntime.withClusterMeta(metaStore)+runtime.withTopology(PARTITION_OWNED_PULL)beforeruntime.start()PartitionOwnership(ownedPartitions) the app built — one state machine, not twoUniRuntime.topologybecomesvolatile(flippable pre-start); newwithTopology/withClusterMetabuilderstopology()/clusterMeta()accessors3. Startup transactionality
EventMeshApplication.start()wraps the whole boot in try/catch: on any failure it runsshutdown()(stop schedulers, release ports, release storage), attaches cleanup failures as suppressed, and rethrows — no more half-started processes holding the admin port.topology=… metaWired=… wsPort=… tls=…) so operators can audit a running deployment.4. Tests (new
EventMeshApplicationStartupTest, 4 cases)enableClusterFlipsTopologyAndInjectsMeta— the core contracttopologyCannotFlipAfterStart/clusterMetaCannotChangeAfterStart— fail-fast guardsnullTopologyRejectedLocal verification (Temurin 21.0.11): runtime tests + checkstyle (maxWarnings=0) all green.
Relations
docs/architecture-review/production-ha-plan.md(PR docs(#5354): production-HA acceptance plan — 10-issue topology (#5356-#5365) #5366)3dffe9551)Co-authored-by: qqeasonchen qqeasonchen@gmail.com