pjfanning opened a new pull request, #3648:
URL: https://github.com/apache/pekko/pull/3648
### Motivation
The lease names used by Cluster Sharding shards and Cluster Singletons are
derived from the
ActorSystem name and the entity type name or singleton actor path. Those
names can become too
long for some lease implementations, such as the Kubernetes lease, and there
was no way to
choose a shorter name.
### Modification
- Add a `leaseName` to `LeaseUsageSettings` (empty means the derived name,
as before), with
`withLeaseName` and the Java `getLeaseName`. The existing two-argument
constructor is kept and
is now public.
- `Shard` uses `<leaseName>-<shardId>` when a custom lease name is defined.
- `ClusterSingletonManager` uses the custom lease name as is when defined.
- The lease name is intentionally not read from config, since every
singleton and entity type
must have a unique lease name; reference.conf documents how to define it
programmatically.
- Document the uniqueness requirement on the `withLeaseSettings` methods of
the classic and
typed sharding and singleton settings.
- Tests in `ShardWithLeaseSpec` and `ClusterSingletonLeaseSpec`.
### Result
Users can define shorter custom lease names for sharding and singletons. The
default lease
names are unchanged.
### Tests
Not run locally - left to CI
### References
Ported from (Apache-2.0 since 2026-10-23):
- https://github.com/akka/akka-core/pull/32122
### Notes for reviewers
- Binary compatibility: only additions (new primary constructor,
`leaseName`, `getLeaseName`,
`withLeaseName`); the existing two-argument constructor is retained. No
MiMa excludes added.
- Wire compatibility: no serialized messages or protobuf changed.
- Config defaults: no new config keys; reference.conf only gains comments.
Default lease names
are unchanged.
- Rolling upgrade: with no custom name, old and new nodes use the same lease
names. If a custom
lease name is introduced, all nodes must use it, so introducing one during
a rolling upgrade
means old and new nodes use different leases; do it with a full cluster
restart.
--
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]