Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix how ClusterShardingSettings were applied #480

Merged
merged 9 commits into from
Jul 29, 2024

Conversation

Arkatufus
Copy link
Contributor

@Arkatufus Arkatufus commented Jul 26, 2024

Fixes #477

Previously, settings were applied directly to the HOCON configuration, setting up a cluster shard region using ShardOptions would not work because only the last ShardOptions would be applied to the HOCON configuration.

Changes

  • Make ShardOptions to be applied separately per WithShardRegion() call.

Note

Distributed data settings for all shard regions are still stored as a single HOCON setting (akka.cluster.sharding.distributed-data), they are not applied on a per region basis.

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some suggestions

@@ -850,7 +874,7 @@ public static class AkkaClusterHostingExtensions
IMessageExtractor messageExtractor,
ShardOptions shardOptions)
{
shardOptions.Apply(builder);
shardOptions.DistributedData.Apply(builder);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just don't worry about DData settings. Please remove this entirely from the API. Let users configure DData separately if needed. Only stick to what's in the ClusterShardingSettings class for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how would the user set the akka.cluster.sharding.distribute-data settings then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a situation arises where they would ever need to do it, they can do it through HOCON.

src/Akka.Cluster.Hosting/AkkaClusterHostingExtensions.cs Outdated Show resolved Hide resolved
Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but add a regression spec to verify that two different ShardRegions in the same node can be configured with separate:

  1. Remember entities
  2. Passivization settings
  3. Roles

You don't need to end2end this spec - just testing the ClusterShardingSettings output produced by consuming the shardOptions.ToConfig() should be fine.

var coordinatorConfig = system.Settings.Config.GetConfig(
shardingConfig.GetString("coordinator-singleton"));

var settings = ClusterShardingSettings.Create(shardingConfig, coordinatorConfig);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Arkatufus
Copy link
Contributor Author

Done

Copy link
Member

@Aaronontheweb Aaronontheweb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Aaronontheweb Aaronontheweb merged commit 2e56b9f into akkadotnet:dev Jul 29, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multiple shardregion configuration using .WithShardRegion<T>(...) act similar
2 participants