You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@eventmesh.apache.org by "qqeasonchen (via GitHub)" <gi...@apache.org> on 2026/10/18 13:16:18 UTC

[I] [Bug] Fencing-token order lets a late-booted instance freeze partition ownership on boot order (eventmesh)

qqeasonchen opened a new issue, #5418:
URL: https://github.com/apache/eventmesh/issues/5418

   ### Describe the bug
   
   Partition ownership **freezes on boot order** instead of following the `PartitionAssigner` plan: `acquireOrFence` takes a partition away from a **live** peer whenever our fencing token is strictly higher, and `FencingToken` is seeded from the wall clock at boot (`bootEpoch`, then a counter). The instance that booted last therefore has permanently higher tokens and steals every partition it wants, while the earlier instance can never take back the partitions the plan assigns to it — it just burns one CAS per cycle per partition.
   
   Symptom in a 2-instance / 4-partition cluster: the split drifts to 4/0 instead of 2/2 (and stays there), so one instance's subscriber receives nothing and the other one carries all the load.
   
   ### Reproduction
   
   1. Start A, wait for it to own its share (2 partitions of 4).
   2. Start B a few seconds later (its `bootEpoch` is higher).
   3. Watch the assignment records: B claims all 4 partitions on its first cycles; A stays at 0 forever, logging a fencing line for every partition every 5 s.
   
   ### Root cause
   
   Token order is not a valid authority signal here: tokens are boot-clock seeded, so they encode *when* an instance started, not *whether it is entitled* to the partition. Liveness (heartbeat TTL) is the only signal that should override the plan.
   
   ### Fix
   
   `eventmesh-runtime/.../cluster/PartitionOwnership.java`
   
   - a partition is taken over only when its recorded owner is **no longer in the live set** (TTL-evicted / crashed) or its record is malformed;
   - a live peer keeps the partition until it releases it via `releaseStale`, which happens as soon as the deterministic plan moves the partition away from it — so the cluster converges to the plan within a cycle or two of the views lining up, in both directions (scale out and scale in);
   - the fencing log line now says "held by live peer (waiting for its release)" instead of comparing tokens.
   
   `PartitionFencingTest` was updated to pin the CAS mechanics that make this safe (a stale reader can never clobber a newer record), rather than the removed token-order guard.
   
   ### Verification
   
   E2E `ClusterBalanceAndResilienceE2EIntegrationTest#partitionOwnershipConvergesOnMembershipChanges`: 2/2 → 2/1/1 (C joins) → 2/2 (C leaves) with the exact expected partition sets, no permanent fencing.
   


-- 
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: issues-unsubscribe@eventmesh.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org


Re: [I] [Bug] Fencing-token order lets a late-booted instance freeze partition ownership on boot order (eventmesh)

Posted by "qqeasonchen (via GitHub)" <gi...@apache.org>.
qqeasonchen closed issue #5418: [Bug] Fencing-token order lets a late-booted instance freeze partition ownership on boot order
URL: https://github.com/apache/eventmesh/issues/5418


-- 
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: issues-unsubscribe@eventmesh.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org