Skip to content

Commit

Permalink
Akka.Cluster.Sharding: enable prefer-oldest by default on `Replicat…
Browse files Browse the repository at this point in the history
…or` (#7290)

* Akka.Cluster.Sharding: added tests for DData consistency settings

* Cluster.Sharding: enable `prefer-oldest` by default on `Replicator`

partially resolves #6973

* rolled back changes to sharding sample
  • Loading branch information
Aaronontheweb authored Jul 22, 2024
1 parent 4b7cff3 commit f7f9078
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,21 @@ public void Should_cluster_sharding_settings_have_default_config()
clusterShardingSettings.TuningParameters.CoordinatorStateReadMajorityPlus.Should().Be(5);
clusterShardingSettings.TuningParameters.CoordinatorStateWriteMajorityPlus.Should().Be(3);
}

[Fact]
public void ClusterSharding_replicator_settings_should_have_default_values()
{
ClusterSharding.Get(Sys);
var clusterShardingSettings = ClusterShardingSettings.Create(Sys);
var replicatorSettings = ClusterShardingGuardian.GetReplicatorSettings(clusterShardingSettings);

replicatorSettings.Should().NotBeNull();
replicatorSettings.Role.Should().BeNullOrEmpty();

// only populated when remember-entities is enabled
replicatorSettings.DurableKeys.Should().BeEmpty();
replicatorSettings.MaxDeltaElements.Should().Be(5);
replicatorSettings.PreferOldest.Should().BeTrue();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public ClusterShardingGuardian(
});
}

private ReplicatorSettings GetReplicatorSettings(ClusterShardingSettings shardingSettings)
internal static ReplicatorSettings GetReplicatorSettings(ClusterShardingSettings shardingSettings)
{
var config = Context.System.Settings.Config.GetConfig("akka.cluster.sharding.distributed-data")
.WithFallback(Context.System.Settings.Config.GetConfig("akka.cluster.distributed-data"));
Expand Down
3 changes: 3 additions & 0 deletions src/contrib/cluster/Akka.Cluster.Sharding/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ akka.cluster.sharding {
distributed-data {
# minCap parameter to MajorityWrite and MajorityRead consistency level.
majority-min-cap = 5

# ShardCoordinator is singleton running on oldest
prefer-oldest = on

durable.keys = ["shard-*"]

Expand Down

0 comments on commit f7f9078

Please sign in to comment.