Skip to content

Commit

Permalink
Extend DistributedData Replicator settings with VerboseDebugLogging s…
Browse files Browse the repository at this point in the history
…witch (#6080)

* Add verbose-debug-logging to Replication settings

* Add VerboseDebugLogging to verified tests

* Correct verified.txt

* added backwards compat constructor, fixed approvals

* updated `ReplicatorSettingsSpec`

Co-authored-by: Aaron Stannard <aaron@petabridge.com>
  • Loading branch information
object and Aaronontheweb authored Aug 30, 2022
1 parent 79c7afc commit e3511dc
Show file tree
Hide file tree
Showing 8 changed files with 75 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
using Akka.Configuration;
using Akka.Dispatch;
using Akka.TestKit;
using FluentAssertions;
using Xunit;

namespace Akka.DistributedData.Tests
Expand Down Expand Up @@ -39,6 +40,7 @@ public void SettingsShouldContainProperDefaultValues()
settings.DurableKeys.Count.ShouldBe(0);
settings.DurableStoreProps.ShouldBe(Props.Empty);
settings.DurablePruningMarkerTimeToLive.ShouldBe(TimeSpan.FromDays(10));
settings.VerboseDebugLogging.Should().BeFalse();

Sys.Settings.Config.GetTimeSpan("akka.cluster.distributed-data.serializer-cache-time-to-live")
.ShouldBe(TimeSpan.FromSeconds(10));
Expand Down
2 changes: 1 addition & 1 deletion src/contrib/cluster/Akka.DistributedData/Replicator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ private bool IsOtherDifferent(string key, Digest otherDigest)

private void ReceiveStatus(IImmutableDictionary<string, ByteString> otherDigests, int chunk, int totChunks)
{
if (_log.IsDebugEnabled)
if (_log.IsDebugEnabled && _settings.VerboseDebugLogging)
_log.Debug("Received gossip status from [{0}], chunk {1}/{2} containing [{3}]", Sender.Path.Address, chunk + 1, totChunks, string.Join(", ", otherDigests.Keys));

// if no data was send we do nothing
Expand Down
56 changes: 52 additions & 4 deletions src/contrib/cluster/Akka.DistributedData/ReplicatorSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using System;
using System.Collections.Immutable;
using System.Collections.Generic;
using Akka.Event;

namespace Akka.DistributedData
{
Expand Down Expand Up @@ -79,7 +80,8 @@ public static ReplicatorSettings Create(Config config)
durablePruningMarkerTimeToLive: durableConfig.GetTimeSpan("pruning-marker-time-to-live", TimeSpan.FromDays(10)),
maxDeltaSize: config.GetInt("delta-crdt.max-delta-size", 50),
restartReplicatorOnFailure: config.GetBoolean("recreate-on-failure", false),
preferOldest: config.GetBoolean("prefer-oldest"));
preferOldest: config.GetBoolean("prefer-oldest"),
verboseDebugLogging: config.GetBoolean("verbose-debug-logging"));
}

/// <summary>
Expand Down Expand Up @@ -159,6 +161,11 @@ public static ReplicatorSettings Create(Config config)
/// </summary>
public bool PreferOldest { get; }

/// <summary>
/// Whether verbose debug logging is enabled.
/// </summary>
public bool VerboseDebugLogging { get; }

[Obsolete]
public ReplicatorSettings(string role,
TimeSpan gossipInterval,
Expand Down Expand Up @@ -218,10 +225,45 @@ public ReplicatorSettings(string role,
durablePruningMarkerTimeToLive,
maxDeltaSize,
false,
false,
false
)
{
}

[Obsolete]
public ReplicatorSettings(string role,
TimeSpan gossipInterval,
TimeSpan notifySubscribersInterval,
int maxDeltaElements,
string dispatcher,
TimeSpan pruningInterval,
TimeSpan maxPruningDissemination,
IImmutableSet<string> durableKeys,
Props durableStoreProps,
TimeSpan pruningMarkerTimeToLive,
TimeSpan durablePruningMarkerTimeToLive,
int maxDeltaSize,
bool restartReplicatorOnFailure,
bool preferOldest) : this(
role,
gossipInterval,
notifySubscribersInterval,
maxDeltaElements,
dispatcher,
pruningInterval,
maxPruningDissemination,
durableKeys,
durableStoreProps,
pruningMarkerTimeToLive,
durablePruningMarkerTimeToLive,
maxDeltaSize,
restartReplicatorOnFailure,
preferOldest,
false
)
{
}

public ReplicatorSettings(string role,
TimeSpan gossipInterval,
Expand All @@ -236,7 +278,8 @@ public ReplicatorSettings(string role,
TimeSpan durablePruningMarkerTimeToLive,
int maxDeltaSize,
bool restartReplicatorOnFailure,
bool preferOldest)
bool preferOldest,
bool verboseDebugLogging)
{
Role = role;
GossipInterval = gossipInterval;
Expand All @@ -252,6 +295,7 @@ public ReplicatorSettings(string role,
MaxDeltaSize = maxDeltaSize;
RestartReplicatorOnFailure = restartReplicatorOnFailure;
PreferOldest = preferOldest;
VerboseDebugLogging = verboseDebugLogging;
}

private ReplicatorSettings Copy(string role = null,
Expand All @@ -267,7 +311,8 @@ private ReplicatorSettings Copy(string role = null,
TimeSpan? durablePruningMarkerTimeToLive = null,
int? maxDeltaSize = null,
bool? restartReplicatorOnFailure = null,
bool? preferOldest = null)
bool? preferOldest = null,
bool? verboseDebugLogging = null)
{
return new ReplicatorSettings(
role: role ?? this.Role,
Expand All @@ -283,7 +328,8 @@ private ReplicatorSettings Copy(string role = null,
durablePruningMarkerTimeToLive: durablePruningMarkerTimeToLive ?? this.DurablePruningMarkerTimeToLive,
maxDeltaSize: maxDeltaSize ?? this.MaxDeltaSize,
restartReplicatorOnFailure: restartReplicatorOnFailure ?? this.RestartReplicatorOnFailure,
preferOldest: preferOldest ?? this.PreferOldest);
preferOldest: preferOldest ?? this.PreferOldest,
verboseDebugLogging: verboseDebugLogging ?? this.VerboseDebugLogging);
}

public ReplicatorSettings WithRole(string role) => Copy(role: role);
Expand All @@ -302,5 +348,7 @@ public ReplicatorSettings WithRestartReplicatorOnFailure(bool restart) =>
Copy(restartReplicatorOnFailure: restart);
public ReplicatorSettings WithPreferOldest(bool preferOldest) =>
Copy(preferOldest: preferOldest);
public ReplicatorSettings WithVerboseDebugLogging(bool verboseDebugLogging) =>
Copy(verboseDebugLogging: verboseDebugLogging);
}
}
4 changes: 4 additions & 0 deletions src/contrib/cluster/Akka.DistributedData/reference.conf
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ akka.cluster.distributed-data {
# This is useful together with Cluster Singleton, which is running on oldest nodes.
prefer-oldest = off

# Provide a higher level of details in the debug logs, including gossip status.
# Be careful about enabling in production systems.
verbose-debug-logging = off

# Settings for delta-CRDT
delta-crdt {
# enable or disable delta-CRDT replication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,9 @@ namespace Akka.DistributedData
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize) { }
[System.ObsoleteAttribute()]
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize, bool restartReplicatorOnFailure) { }
[System.ObsoleteAttribute()]
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize, bool restartReplicatorOnFailure, bool preferOldest) { }
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize, bool restartReplicatorOnFailure, bool preferOldest, bool verboseDebugLogging) { }
public string Dispatcher { get; }
public System.Collections.Immutable.IImmutableSet<string> DurableKeys { get; }
public System.TimeSpan DurablePruningMarkerTimeToLive { get; }
Expand All @@ -793,6 +795,7 @@ namespace Akka.DistributedData
public System.TimeSpan PruningMarkerTimeToLive { get; }
public bool RestartReplicatorOnFailure { get; }
public string Role { get; }
public bool VerboseDebugLogging { get; }
public static Akka.DistributedData.ReplicatorSettings Create(Akka.Actor.ActorSystem system) { }
public static Akka.DistributedData.ReplicatorSettings Create(Akka.Configuration.Config config) { }
public Akka.DistributedData.ReplicatorSettings WithDispatcher(string dispatcher) { }
Expand All @@ -807,6 +810,7 @@ namespace Akka.DistributedData
public Akka.DistributedData.ReplicatorSettings WithPruningMarkerTimeToLive(System.TimeSpan pruningMarkerTtl, System.TimeSpan durablePruningMarkerTtl) { }
public Akka.DistributedData.ReplicatorSettings WithRestartReplicatorOnFailure(bool restart) { }
public Akka.DistributedData.ReplicatorSettings WithRole(string role) { }
public Akka.DistributedData.ReplicatorSettings WithVerboseDebugLogging(bool verboseDebugLogging) { }
}
[System.Diagnostics.DebuggerDisplayAttribute("VersionVector({Node}->{Version})")]
public sealed class SingleVersionVector : Akka.DistributedData.VersionVector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,9 @@ namespace Akka.DistributedData
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize) { }
[System.ObsoleteAttribute()]
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize, bool restartReplicatorOnFailure) { }
[System.ObsoleteAttribute()]
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize, bool restartReplicatorOnFailure, bool preferOldest) { }
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize, bool restartReplicatorOnFailure, bool preferOldest, bool verboseDebugLogging) { }
public string Dispatcher { get; }
public System.Collections.Immutable.IImmutableSet<string> DurableKeys { get; }
public System.TimeSpan DurablePruningMarkerTimeToLive { get; }
Expand All @@ -793,6 +795,7 @@ namespace Akka.DistributedData
public System.TimeSpan PruningMarkerTimeToLive { get; }
public bool RestartReplicatorOnFailure { get; }
public string Role { get; }
public bool VerboseDebugLogging { get; }
public static Akka.DistributedData.ReplicatorSettings Create(Akka.Actor.ActorSystem system) { }
public static Akka.DistributedData.ReplicatorSettings Create(Akka.Configuration.Config config) { }
public Akka.DistributedData.ReplicatorSettings WithDispatcher(string dispatcher) { }
Expand All @@ -807,6 +810,7 @@ namespace Akka.DistributedData
public Akka.DistributedData.ReplicatorSettings WithPruningMarkerTimeToLive(System.TimeSpan pruningMarkerTtl, System.TimeSpan durablePruningMarkerTtl) { }
public Akka.DistributedData.ReplicatorSettings WithRestartReplicatorOnFailure(bool restart) { }
public Akka.DistributedData.ReplicatorSettings WithRole(string role) { }
public Akka.DistributedData.ReplicatorSettings WithVerboseDebugLogging(bool verboseDebugLogging) { }
}
[System.Diagnostics.DebuggerDisplayAttribute("VersionVector({Node}->{Version})")]
public sealed class SingleVersionVector : Akka.DistributedData.VersionVector
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,9 @@ namespace Akka.DistributedData
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize) { }
[System.ObsoleteAttribute()]
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize, bool restartReplicatorOnFailure) { }
[System.ObsoleteAttribute()]
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize, bool restartReplicatorOnFailure, bool preferOldest) { }
public ReplicatorSettings(string role, System.TimeSpan gossipInterval, System.TimeSpan notifySubscribersInterval, int maxDeltaElements, string dispatcher, System.TimeSpan pruningInterval, System.TimeSpan maxPruningDissemination, System.Collections.Immutable.IImmutableSet<string> durableKeys, Akka.Actor.Props durableStoreProps, System.TimeSpan pruningMarkerTimeToLive, System.TimeSpan durablePruningMarkerTimeToLive, int maxDeltaSize, bool restartReplicatorOnFailure, bool preferOldest, bool verboseDebugLogging) { }
public string Dispatcher { get; }
public System.Collections.Immutable.IImmutableSet<string> DurableKeys { get; }
public System.TimeSpan DurablePruningMarkerTimeToLive { get; }
Expand All @@ -793,6 +795,7 @@ namespace Akka.DistributedData
public System.TimeSpan PruningMarkerTimeToLive { get; }
public bool RestartReplicatorOnFailure { get; }
public string Role { get; }
public bool VerboseDebugLogging { get; }
public static Akka.DistributedData.ReplicatorSettings Create(Akka.Actor.ActorSystem system) { }
public static Akka.DistributedData.ReplicatorSettings Create(Akka.Configuration.Config config) { }
public Akka.DistributedData.ReplicatorSettings WithDispatcher(string dispatcher) { }
Expand All @@ -807,6 +810,7 @@ namespace Akka.DistributedData
public Akka.DistributedData.ReplicatorSettings WithPruningMarkerTimeToLive(System.TimeSpan pruningMarkerTtl, System.TimeSpan durablePruningMarkerTtl) { }
public Akka.DistributedData.ReplicatorSettings WithRestartReplicatorOnFailure(bool restart) { }
public Akka.DistributedData.ReplicatorSettings WithRole(string role) { }
public Akka.DistributedData.ReplicatorSettings WithVerboseDebugLogging(bool verboseDebugLogging) { }
}
[System.Diagnostics.DebuggerDisplayAttribute("VersionVector({Node}->{Version})")]
public sealed class SingleVersionVector : Akka.DistributedData.VersionVector
Expand Down
Loading

0 comments on commit e3511dc

Please sign in to comment.