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

dont pass default parameter values #6799

Open
wants to merge 4 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions src/benchmark/Akka.Benchmarks/Hocon/HoconBenchmarks.cs
Expand Up @@ -74,31 +74,31 @@ public void Setup()
[Benchmark]
public string Hocon_parse_resolve_string_value()
{
return fallback2.GetString("akka.actor.provider", null);
return fallback2.GetString("akka.actor.provider");
}

[Benchmark]
public int Hocon_parse_resolve_int_value()
{
return fallback2.GetInt("akka.remote.dot-netty.tcp.port", 0);
return fallback2.GetInt("akka.remote.dot-netty.tcp.port");
}

[Benchmark]
public double Hocon_parse_resolve_double_value()
{
return fallback1.GetDouble("akka.actor.branch-factor", 0);
return fallback1.GetDouble("akka.actor.branch-factor");
}

[Benchmark]
public bool Hocon_parse_resolve_boolean_value()
{
return fallback1.GetBoolean("akka.persistence.journal.sql-server.auto-initialize", false);
return fallback1.GetBoolean("akka.persistence.journal.sql-server.auto-initialize");
}

[Benchmark]
public TimeSpan Hocon_parse_resolve_TimeSpan_value()
{
return fallback1.GetTimeSpan("akka.actor.ask-timeout", null);
return fallback1.GetTimeSpan("akka.actor.ask-timeout");
}

[Benchmark]
Expand Down
Expand Up @@ -321,7 +321,7 @@ private async Task<IActorRef> StartRouter(string name)
{
var router = Sys.ActorOf(new ClusterRouterPool(
new AdaptiveLoadBalancingPool(MemoryMetricsSelector.Instance),
new ClusterRouterPoolSettings(10, 1, true, null)
new ClusterRouterPoolSettings(10, 1, true)
).Props(Props.Create<AdaptiveLoadBalancingRouterConfig.Echo>()), name);

// it may take some time until router receives cluster member events
Expand Down
Expand Up @@ -18,9 +18,9 @@ public class ClusterMetricsStrategy : OneForOneStrategy
{
public ClusterMetricsStrategy(Config config)
: base(
maxNrOfRetries: config.GetInt("maxNrOfRetries", 0),
withinTimeMilliseconds: (int)config.GetTimeSpan("withinTimeRange", null).TotalMilliseconds,
loggingEnabled: config.GetBoolean("loggingEnabled", false),
maxNrOfRetries: config.GetInt("maxNrOfRetries"),
withinTimeMilliseconds: (int)config.GetTimeSpan("withinTimeRange").TotalMilliseconds,
loggingEnabled: config.GetBoolean("loggingEnabled"),
localOnlyDecider: MetricsDecider)
{
}
Expand Down
Expand Up @@ -37,12 +37,12 @@ public ClusterMetricsSettings(Config config)
CollectorProvider = _config.GetString("collector.provider");
CollectorFallback = _config.GetBoolean("collector.fallback");
CollectorSampleInterval =
Requiring(_config.GetTimeSpan("collector.sample-interval", null), t => t > TimeSpan.Zero, "collector.sample-interval must be > 0");
Requiring(_config.GetTimeSpan("collector.sample-interval"), t => t > TimeSpan.Zero, "collector.sample-interval must be > 0");

CollectorGossipInterval =
Requiring(_config.GetTimeSpan("collector.gossip-interval", null), t => t > TimeSpan.Zero, "collector.gossip-interval must be > 0");
Requiring(_config.GetTimeSpan("collector.gossip-interval"), t => t > TimeSpan.Zero, "collector.gossip-interval must be > 0");
CollectorMovingAverageHalfLife =
Requiring(_config.GetTimeSpan("collector.moving-average-half-life", null), t => t > TimeSpan.Zero, "collector.moving-average-half-life must be > 0");
Requiring(_config.GetTimeSpan("collector.moving-average-half-life"), t => t > TimeSpan.Zero, "collector.moving-average-half-life must be > 0");
}

/// <summary>
Expand Down
Expand Up @@ -16,7 +16,7 @@ public class MemoryJournalShared : AsyncWriteProxyEx

public MemoryJournalShared()
{
Timeout = Context.System.Settings.Config.GetTimeSpan("akka.persistence.journal.memory-journal-shared.timeout", null);
Timeout = Context.System.Settings.Config.GetTimeSpan("akka.persistence.journal.memory-journal-shared.timeout");
}

public static void SetStore(IActorRef store, ActorSystem system)
Expand Down
Expand Up @@ -16,7 +16,7 @@ public class MemorySnapshotStoreShared : SnapshotStoreProxy

public MemorySnapshotStoreShared()
{
Timeout = Context.System.Settings.Config.GetTimeSpan("akka.persistence.memory-snapshot-store-shared.timeout", null);
Timeout = Context.System.Settings.Config.GetTimeSpan("akka.persistence.memory-snapshot-store-shared.timeout");
}

public static void SetStore(IActorRef store, ActorSystem system)
Expand Down
Expand Up @@ -47,7 +47,7 @@ public ShardRegionQueriesHashCodeSpecs(ITestOutputHelper outputHelper) : base(Ge
{
_clusterSharding = ClusterSharding.Get(Sys);
_cluster = Cluster.Get(Sys);
_shardRegion = _clusterSharding.Start("entity", _ => EchoActor.Props(this, true),
_shardRegion = _clusterSharding.Start("entity", _ => EchoActor.Props(this),
ClusterShardingSettings.Create(Sys).WithRole("shard"), new MessageExtractor());

var proxySysConfig = ConfigurationFactory.ParseString("akka.cluster.roles = [proxy]")
Expand Down
Expand Up @@ -31,7 +31,7 @@ public ShardRegionQueriesSpecs(ITestOutputHelper outputHelper) : base(GetConfig(
{
_clusterSharding = ClusterSharding.Get(Sys);
_cluster = Cluster.Get(Sys);
_shardRegion = _clusterSharding.Start("entity", _ => EchoActor.Props(this, true),
_shardRegion = _clusterSharding.Start("entity", _ => EchoActor.Props(this),
ClusterShardingSettings.Create(Sys).WithRole("shard"), ExtractEntityId, ExtractShardId);

var proxySysConfig = ConfigurationFactory.ParseString("akka.cluster.roles = [proxy]")
Expand Down
Expand Up @@ -150,7 +150,7 @@ public sealed class StartProxy : INoSerializationVerificationNeeded
private readonly Cluster _cluster = Cluster.Get(Context.System);
private readonly ClusterSharding _sharding = ClusterSharding.Get(Context.System);

private readonly int _majorityMinCap = Context.System.Settings.Config.GetInt("akka.cluster.sharding.distributed-data.majority-min-cap", 0);
private readonly int _majorityMinCap = Context.System.Settings.Config.GetInt("akka.cluster.sharding.distributed-data.majority-min-cap");
private ImmutableDictionary<string, IActorRef> _replicatorsByRole = ImmutableDictionary<string, IActorRef>.Empty;

private readonly ConcurrentDictionary<string, IActorRef> _regions;
Expand Down
Expand Up @@ -398,7 +398,7 @@ int ConfigMajorityPlus(string p)
leastShardAllocationRelativeLimit: config.GetDouble("least-shard-allocation-strategy.rebalance-relative-limit"));

var coordinatorSingletonSettings = ClusterSingletonManagerSettings.Create(singletonConfig);
var role = config.GetString("role", null);
var role = config.GetString("role");
if (role == string.Empty) role = null;

var usePassivateIdle = config.GetString("passivate-idle-entity-after").ToLowerInvariant();
Expand Down
Expand Up @@ -41,7 +41,7 @@ public void ClusterSingletonManagerSettings_must_have_default_config()

var config = Sys.Settings.Config.GetConfig("akka.cluster.singleton");
Assert.False(config.IsNullOrEmpty());
config.GetInt("min-number-of-hand-over-retries", 0).ShouldBe(15);
config.GetInt("min-number-of-hand-over-retries").ShouldBe(15);
}

[Fact]
Expand Down
Expand Up @@ -53,7 +53,7 @@ public ClusterClientReceptionist(ExtendedActorSystem system)
_system.Settings.InjectTopLevelFallback(DefaultConfig());
_config = system.Settings.Config.GetConfig("akka.cluster.client.receptionist");

_role = _config.GetString("role", null);
_role = _config.GetString("role");
if (string.IsNullOrEmpty(_role)) _role = null;

_receptionist = CreateReceptionist();
Expand Down Expand Up @@ -132,7 +132,7 @@ private IActorRef CreateReceptionist()
else
{
var name = _config.GetString("name");
var dispatcher = _config.GetString("use-dispatcher", null);
var dispatcher = _config.GetString("use-dispatcher");
if (string.IsNullOrEmpty(dispatcher)) dispatcher = Dispatchers.InternalDispatcherId;

// important to use var mediator here to activate it outside of ClusterReceptionist constructor
Expand Down
Expand Up @@ -43,7 +43,7 @@ public static ClusterReceptionistSettings Create(Config config)
if (config.IsNullOrEmpty())
throw ConfigurationException.NullOrEmptyConfig<ClusterReceptionistSettings>();

var role = config.GetString("role", null);
var role = config.GetString("role");
if (string.IsNullOrEmpty(role)) role = null;

return new ClusterReceptionistSettings(
Expand Down
Expand Up @@ -100,7 +100,7 @@ public IActorRef Mediator
private IActorRef CreateMediator()
{
var name = _system.Settings.Config.GetString("akka.cluster.pub-sub.name");
var dispatcher = _system.Settings.Config.GetString("akka.cluster.pub-sub.use-dispatcher", null);
var dispatcher = _system.Settings.Config.GetString("akka.cluster.pub-sub.use-dispatcher");
if (string.IsNullOrEmpty(dispatcher))
dispatcher = Dispatchers.InternalDispatcherId;

Expand Down
Expand Up @@ -70,7 +70,7 @@ public static DistributedPubSubSettings Create(Config config)
// TODO: "removed-time-to-live" key depends on Config.GetTimeSpan() to return a TimeSpan.Zero default.
// TODO: "max-delta-elements" key depends on Config.GetInt() to return a 0 default.
return new DistributedPubSubSettings(
config.GetString("role", null),
config.GetString("role"),
routingLogic,
config.GetTimeSpan("gossip-interval"),
config.GetTimeSpan("removed-time-to-live"),
Expand Down
Expand Up @@ -670,7 +670,7 @@ public ClusterSingletonManager(Props singletonProps, object terminationMessage,

var n = (int)(_removalMargin.TotalMilliseconds / _settings.HandOverRetryInterval.TotalMilliseconds);

var minRetries = Context.System.Settings.Config.GetInt("akka.cluster.singleton.min-number-of-hand-over-retries", 0);
var minRetries = Context.System.Settings.Config.GetInt("akka.cluster.singleton.min-number-of-hand-over-retries");
if (minRetries < 1)
throw new ConfigurationException("min-number-of-hand-over-retries must be >= 1");

Expand Down Expand Up @@ -1254,7 +1254,7 @@ private void InitializeFSM()
if (wasOldestData.NewOldest != null)
Peer(wasOldestData.NewOldest.Address).Tell(TakeOverFromMe.Instance);

SetTimer(TakeOverRetryTimer, new TakeOverRetry(takeOverRetry.Count + 1), _settings.HandOverRetryInterval, false);
SetTimer(TakeOverRetryTimer, new TakeOverRetry(takeOverRetry.Count + 1), _settings.HandOverRetryInterval);
return Stay();
}
else
Expand Down
Expand Up @@ -33,7 +33,7 @@ public static ClusterSingletonProxySettings Create(ActorSystem system)
throw ConfigurationException.NullOrEmptyConfig<ClusterSingletonProxySettings>("akka.cluster.singleton-proxy");

var considerAppVersion =
system.Settings.Config.GetBoolean("akka.cluster.singleton.consider-app-version", false);
system.Settings.Config.GetBoolean("akka.cluster.singleton.consider-app-version");
return Create(config, considerAppVersion);
}

Expand All @@ -49,14 +49,14 @@ public static ClusterSingletonProxySettings Create(Config config, bool considerA
if (config.IsNullOrEmpty())
throw ConfigurationException.NullOrEmptyConfig<ClusterSingletonProxySettings>();

var role = config.GetString("role", null);
var role = config.GetString("role");
if (role == string.Empty) role = null;

return new ClusterSingletonProxySettings(
singletonName: config.GetString("singleton-name"),
role: role,
singletonIdentificationInterval: config.GetTimeSpan("singleton-identification-interval"),
bufferSize: config.GetInt("buffer-size", 0),
bufferSize: config.GetInt("buffer-size"),
considerAppVersion: considerAppVersion);
}

Expand Down
Expand Up @@ -107,9 +107,9 @@ public void Replicator_in_chaotic_cluster_should_replicate_data_in_initial_phase
{
for (var i = 0; i < 5; i++)
{
_replicator.Tell(Dsl.Update(KeyA, GCounter.Empty, WriteLocal.Instance, x => x.Increment(_cluster, 1)));
_replicator.Tell(Dsl.Update(KeyB, PNCounter.Empty, WriteLocal.Instance, x => x.Decrement(_cluster, 1)));
_replicator.Tell(Dsl.Update(KeyC, GCounter.Empty, new WriteAll(_timeout), x => x.Increment(_cluster, 1)));
_replicator.Tell(Dsl.Update(KeyA, GCounter.Empty, WriteLocal.Instance, x => x.Increment(_cluster)));
_replicator.Tell(Dsl.Update(KeyB, PNCounter.Empty, WriteLocal.Instance, x => x.Decrement(_cluster)));
_replicator.Tell(Dsl.Update(KeyC, GCounter.Empty, new WriteAll(_timeout), x => x.Increment(_cluster)));
}
ReceiveN(15).Select(x => x.GetType()).ToImmutableHashSet().ShouldBe(new[] { typeof(UpdateSuccess) });
}, First);
Expand Down Expand Up @@ -187,7 +187,7 @@ public void Replicator_in_chaotic_cluster_should_be_available_during_network_spl

RunOn(() =>
{
_replicator.Tell(Dsl.Update(KeyA, GCounter.Empty, new WriteTo(2, _timeout), x => x.Increment(_cluster, 1)));
_replicator.Tell(Dsl.Update(KeyA, GCounter.Empty, new WriteTo(2, _timeout), x => x.Increment(_cluster)));
ExpectMsg(new UpdateSuccess(KeyA, null));
}, First);

Expand All @@ -205,7 +205,7 @@ public void Replicator_in_chaotic_cluster_should_be_available_during_network_spl

RunOn(() =>
{
_replicator.Tell(Dsl.Update(KeyD, GCounter.Empty, new WriteTo(2, _timeout), x => x.Increment(_cluster, 1)));
_replicator.Tell(Dsl.Update(KeyD, GCounter.Empty, new WriteTo(2, _timeout), x => x.Increment(_cluster)));
ExpectMsg(new UpdateSuccess(KeyD, null));
}, Fourth);

Expand Down
Expand Up @@ -190,7 +190,7 @@ void UpdateAfterPruning(ulong expectedValue)
{
// inject data from removed node to simulate bad data
_replicator.Tell(Dsl.Update(_keyA, GCounter.Empty,
new WriteAll(_timeout), x => x.Merge(oldCounter).Increment(_cluster, 1)));
new WriteAll(_timeout), x => x.Merge(oldCounter).Increment(_cluster)));
ExpectMsg<UpdateSuccess>();

AwaitAssert(() =>
Expand Down