qqeasonchen opened a new pull request, #5370: URL: https://github.com/apache/eventmesh/pull/5370
## 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.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` 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. ### 2. Boot wiring | Change | Effect | |---|---| | `enableCluster` now calls `runtime.withClusterMeta(metaStore)` + `runtime.withTopology(PARTITION_OWNED_PULL)` **before** `runtime.start()` | 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 | Post-start mutation fails fast (extends the #5356 fail-fast contract) | | New `topology()` / `clusterMeta()` accessors | Startup logging can report effective state | ### 3. Startup transactionality - `EventMeshApplication.start()` wraps the whole boot in try/catch: on any failure it runs `shutdown()` (stop schedulers, release ports, release storage), attaches cleanup failures as **suppressed**, and 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. ### 4. Tests (new `EventMeshApplicationStartupTest`, 4 cases) - `enableClusterFlipsTopologyAndInjectsMeta` — the core contract - `topologyCannotFlipAfterStart` / `clusterMetaCannotChangeAfterStart` — fail-fast guards - `nullTopologyRejected` Local verification (Temurin 21.0.11): runtime tests + checkstyle (maxWarnings=0) all green. ### Relations - Closes #5359 (Phase 1, P0) - Parent: #5354 · Plan: `docs/architecture-review/production-ha-plan.md` (PR #5366) - Builds on the #5356 fail-fast contract (merged `3dffe9551`) - Unblocks #5360 (fencing epoch propagation — needs the wired MetaStore) Co-authored-by: qqeasonchen <[email protected]> -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
