He-Pin opened a new pull request, #3701:
URL: https://github.com/apache/pekko/pull/3701

   ### Motivation
   While a shard is waiting to acquire its lease, `Shard.awaitingLease` stashes 
every message that is not lease- or membership-related — including `HandOff`. 
Since a failed acquisition is retried indefinitely, the coordinator's 
`RebalanceWorker` never receives `ShardStopped` and the rebalance cannot 
complete for as long as the lease backend is unavailable. That is precisely the 
scenario where rebalancing matters: a degraded lease backend combined with a 
topology change.
   
   ### Modification
   Handle `HandOff` in `awaitingLease` by delegating to the regular `handOff` 
path. A shard in `awaitingLease` has not sent `ShardInitialized` and therefore 
hosts no entities, so `handOff` replies `ShardStopped(shardId)` immediately and 
stops the shard. A `HandOff` for another shard id logs the same warning as the 
main receive.
   
   New test in `ShardWithLeaseSpec`: leaves the lease acquisition pending, 
sends `HandOff` directly to the shard actor, and asserts `ShardStopped` plus 
shard termination.
   
   ### Result
   A rebalance can now complete while the shard lease is unobtainable.
   
   ### Tests
   - `sbt "cluster-sharding / Test / testOnly 
org.apache.pekko.cluster.sharding.ShardWithLeaseSpec"`: 6/6 passed
   - Directional check: reverted the fix, re-ran the new test only — failed as 
expected (timeout waiting for `ShardStopped`)
   - Full validation on CI
   
   ### References
   Fixes #3686


-- 
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]

Reply via email to