You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@pekko.apache.org by "pjfanning (via GitHub)" <gi...@apache.org> on 2026/10/23 00:42:47 UTC

[PR] feat: define custom lease name for sharding and singleton [pekko]

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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] feat: define custom lease name for sharding and singleton [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin merged PR #3648:
URL: https://github.com/apache/pekko/pull/3648


-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org


Re: [PR] feat: define custom lease name for sharding and singleton [pekko]

Posted by "He-Pin (via GitHub)" <gi...@apache.org>.
He-Pin commented on code in PR #3648:
URL: https://github.com/apache/pekko/pull/3648#discussion_r4357240093


##########
coordination/src/main/scala/org/apache/pekko/coordination/lease/LeaseUsageSettings.scala:
##########
@@ -19,9 +19,38 @@ import scala.jdk.DurationConverters._
 import org.apache.pekko
 import pekko.util.PrettyDuration._
 
-final class LeaseUsageSettings private[pekko] (val leaseImplementation: String,
-    val leaseRetryInterval: FiniteDuration) {
+/**
+ * Note that if you define a custom lease name and have several Cluster Singletons or Cluster Sharding

Review Comment:
   Post-merge follow-up: the copied lease-name implementation and contract text still have only the older source notices ending in 2022. The corresponding upstream files carry these notices:
   
   - [LeaseUsageSettings.scala](https://github.com/akka/akka-core/blob/f3bb544cf78bf9fdeb6bd6d5800450d3078a4d20/akka-coordination/src/main/scala/akka/coordination/lease/LeaseUsageSettings.scala#L1-L4): `Copyright (C) 2019-2023 Lightbend Inc. <https://www.lightbend.com>`
   - [Shard.scala](https://github.com/akka/akka-core/blob/f3bb544cf78bf9fdeb6bd6d5800450d3078a4d20/akka-cluster-sharding/src/main/scala/akka/cluster/sharding/Shard.scala#L1-L4): `Copyright (C) 2009-2023 Lightbend Inc. <https://www.lightbend.com>`
   - [ClusterSingletonManager.scala](https://github.com/akka/akka-core/blob/f3bb544cf78bf9fdeb6bd6d5800450d3078a4d20/akka-cluster-tools/src/main/scala/akka/cluster/singleton/ClusterSingletonManager.scala#L1-L4): `Copyright (C) 2009-2023 Lightbend Inc. <https://www.lightbend.com>`
   - [Typed ClusterShardingSettings.scala](https://github.com/akka/akka-core/blob/f3bb544cf78bf9fdeb6bd6d5800450d3078a4d20/akka-cluster-sharding-typed/src/main/scala/akka/cluster/sharding/typed/ClusterShardingSettings.scala#L1-L4): `Copyright (C) 2017-2023 Lightbend Inc. <https://www.lightbend.com>`
   - [Classic ClusterShardingSettings.scala](https://github.com/akka/akka-core/blob/f3bb544cf78bf9fdeb6bd6d5800450d3078a4d20/akka-cluster-sharding/src/main/scala/akka/cluster/sharding/ClusterShardingSettings.scala#L1-L4): `Copyright (C) 2015-2023 Lightbend Inc. <https://www.lightbend.com>`
   - [ClusterSingleton.scala](https://github.com/akka/akka-core/blob/f3bb544cf78bf9fdeb6bd6d5800450d3078a4d20/akka-cluster-typed/src/main/scala/akka/cluster/typed/ClusterSingleton.scala#L1-L4): `Copyright (C) 2009-2023 Lightbend Inc. <https://www.lightbend.com>`
   
   Please preserve these exact source notices alongside the existing notices in a focused follow-up and run the header checks.



-- 
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: notifications-unsubscribe@pekko.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@pekko.apache.org
For additional commands, e-mail: notifications-help@pekko.apache.org