Port akka-core#31859: Improve StopShards coordinator command#2783
Merged
pjfanning merged 5 commits intoapache:mainfrom Mar 24, 2026
Merged
Port akka-core#31859: Improve StopShards coordinator command#2783pjfanning merged 5 commits intoapache:mainfrom
pjfanning merged 5 commits intoapache:mainfrom
Conversation
Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com> Agent-Logs-Url: https://github.com/pjfanning/incubator-pekko/sessions/ee962896-5c0b-4e9c-8a67-bc38f3364c04
…rdsSpec Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com> Agent-Logs-Url: https://github.com/pjfanning/incubator-pekko/sessions/ee962896-5c0b-4e9c-8a67-bc38f3364c04
Contributor
There was a problem hiding this comment.
Pull request overview
Ports Akka improvements to the Cluster Sharding StopShards coordinator command, making it safer/correcter under various coordinator states and enabling cross-node usage via protobuf serialization.
Changes:
- Harden
ShardCoordinatorhandling ofStopShards(guards, correct region targeting, immediate acks, timeout cleanup). - Add protobuf schema + serializer support for
StopShards("ST"manifest). - Add/extend tests covering
StopShardsserialization and a 2-node stop flow.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/protobuf/ClusterShardingMessageSerializerSpec.scala | Adds a serialization roundtrip test for StopShards. |
| cluster-sharding/src/test/scala/org/apache/pekko/cluster/sharding/StopShardsSpec.scala | New 2-node cluster spec exercising StopShards and ShardStopped acks. |
| cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/protobuf/ClusterShardingMessageSerializer.scala | Adds "ST" manifest and protobuf (de)serialization for StopShards. |
| cluster-sharding/src/main/scala/org/apache/pekko/cluster/sharding/ShardCoordinator.scala | Implements guarded, region-aware StopShards execution plus timeout cleanup. |
| cluster-sharding/src/main/protobuf/ClusterShardingMessages.proto | Adds protobuf message definition for StopShards. |
| cluster-sharding/src/main/java/org/apache/pekko/cluster/sharding/protobuf/msg/ClusterShardingMessages.java | Regenerated protobuf Java output including StopShards. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…ing/StopShardsSpec.scala Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
Part of #2730
See #2782
Ports akka/akka-core#31859 — improves the
StopShardscoordinator command with proper guards, correctness fixes, and serialization support.ShardCoordinator changes
rememberEntities— logs error and ignoresStopShards(incompatible combination)ShardStoppedimmediately rather than hangingStopShardTimeoutcleans up waiting actors afterhandOffTimeoutelapsesSerialization
Added protobuf serialization for
StopShardsso the command can be sent across nodes (e.g., from aShardRegionproxy to the coordinator):StopShardsmessage toClusterShardingMessages.protoClusterShardingMessages.java"ST"manifest +stopShardsToProto/stopShardsFromBinarytoClusterShardingMessageSerializerTests
StopShardsSpec— 2-node cluster test verifying full stop flow includingShardStoppedacks and entity terminationClusterShardingMessageSerializerSpec— serialization roundtrip forStopShardsUsage