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

Revert singleton app version #7287

Closed

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -880,9 +880,7 @@ private void InitializeFSM()
{
case StartOldestChangedBuffer _:
{
_oldestChangedBuffer = Context.ActorOf(
Actor.Props.Create(() => new OldestChangedBuffer(_settings.Role, _settings.ConsiderAppVersion))
.WithDispatcher(Context.Props.Dispatcher));
_oldestChangedBuffer = Context.ActorOf(Actor.Props.Create<OldestChangedBuffer>(_settings.Role).WithDispatcher(Context.Props.Dispatcher));
GetNextOldestChanged();
return Stay();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ public static ClusterSingletonManagerSettings Create(Config config)
role: RoleOption(config.GetString("role")),
removalMargin: TimeSpan.Zero, // defaults to ClusterSettings.DownRemovalMargin
handOverRetryInterval: config.GetTimeSpan("hand-over-retry-interval"),
leaseSettings: lease,
considerAppVersion: config.GetBoolean("consider-app-version"));
leaseSettings: lease);
}

private static string RoleOption(string role)
Expand Down Expand Up @@ -92,14 +91,6 @@ private static string RoleOption(string role)
/// LeaseSettings for acquiring before creating the singleton actor
/// </summary>
public LeaseUsageSettings LeaseSettings { get; }


/// <summary>
/// Should <see cref="Member.AppVersion"/> be considered when the cluster singleton instance is being moved to another node.
/// When set to false, singleton instance will always be created on oldest member.
/// When set to true, singleton instance will be created on the oldest member with the highest <see cref="Member.AppVersion"/> number.
/// </summary>
public bool ConsiderAppVersion { get; }

/// <summary>
/// Creates a new instance of the <see cref="ClusterSingletonManagerSettings"/>.
Expand All @@ -123,19 +114,50 @@ private static string RoleOption(string role)
/// over has started or the previous oldest member is removed from the cluster
/// (+ <paramref name="removalMargin"/>).
/// </param>
/// <param name="leaseSettings">LeaseSettings for acquiring before creating the singleton actor</param>
/// <param name="considerAppVersion">
/// Should <see cref="Member.AppVersion"/> be considered when the cluster singleton instance is being moved to another node.
/// When set to false, singleton instance will always be created on oldest member.
/// When set to true, singleton instance will be created on the oldest member with the highest <see cref="Member.AppVersion"/> number.
/// </param>
/// <exception cref="ArgumentException">TBD</exception>
[Obsolete("considerAppVersion is not supported anymore, please use constructor that does not have the considerAppVersion argument. Since 1.5.27")]
public ClusterSingletonManagerSettings(
string singletonName,
string role,
TimeSpan removalMargin,
TimeSpan handOverRetryInterval,
LeaseUsageSettings leaseSettings,
bool considerAppVersion)
: this(singletonName, role, removalMargin, handOverRetryInterval, null, considerAppVersion)
:this(singletonName, role, removalMargin, handOverRetryInterval, leaseSettings)
{
}

/// <summary>
/// Creates a new instance of the <see cref="ClusterSingletonManagerSettings"/>.
/// </summary>
/// <param name="singletonName">The actor name of the child singleton actor.</param>
/// <param name="role">
/// Singleton among the nodes tagged with specified role. If the role is not specified
/// it's a singleton among all nodes in the cluster.
/// </param>
/// <param name="removalMargin">
/// Margin until the singleton instance that belonged to a downed/removed partition is
/// created in surviving partition. The purpose of this margin is that in case of
/// a network partition the singleton actors in the non-surviving partitions must
/// be stopped before corresponding actors are started somewhere else.
/// This is especially important for persistent actors.
/// </param>
/// <param name="handOverRetryInterval">
/// When a node is becoming oldest it sends hand-over
/// request to previous oldest, that might be leaving the cluster. This is
/// retried with this interval until the previous oldest confirms that the hand
/// over has started or the previous oldest member is removed from the cluster
/// (+ <paramref name="removalMargin"/>).
/// </param>
/// <exception cref="ArgumentException">TBD</exception>
public ClusterSingletonManagerSettings(string singletonName, string role, TimeSpan removalMargin, TimeSpan handOverRetryInterval)
: this(singletonName, role, removalMargin, handOverRetryInterval, null)
{
}

Expand All @@ -162,19 +184,8 @@ public ClusterSingletonManagerSettings(
/// (+ <paramref name="removalMargin"/>).
/// </param>
/// <param name="leaseSettings">LeaseSettings for acquiring before creating the singleton actor</param>
/// <param name="considerAppVersion">
/// Should <see cref="Member.AppVersion"/> be considered when the cluster singleton instance is being moved to another node.
/// When set to false, singleton instance will always be created on oldest member.
/// When set to true, singleton instance will be created on the oldest member with the highest <see cref="Member.AppVersion"/> number.
/// </param>
/// <exception cref="ArgumentException">TBD</exception>
public ClusterSingletonManagerSettings(
string singletonName,
string role,
TimeSpan removalMargin,
TimeSpan handOverRetryInterval,
LeaseUsageSettings leaseSettings,
bool considerAppVersion)
public ClusterSingletonManagerSettings(string singletonName, string role, TimeSpan removalMargin, TimeSpan handOverRetryInterval, LeaseUsageSettings leaseSettings)
{
if (string.IsNullOrWhiteSpace(singletonName))
throw new ArgumentNullException(nameof(singletonName));
Expand All @@ -188,7 +199,6 @@ public ClusterSingletonManagerSettings(
RemovalMargin = removalMargin;
HandOverRetryInterval = handOverRetryInterval;
LeaseSettings = leaseSettings;
ConsiderAppVersion = considerAppVersion;
}

/// <summary>
Expand Down Expand Up @@ -241,21 +251,15 @@ public ClusterSingletonManagerSettings WithLeaseSettings(LeaseUsageSettings leas
return Copy(leaseSettings: leaseSettings);
}

private ClusterSingletonManagerSettings Copy(
string singletonName = null,
Option<string> role = default,
TimeSpan? removalMargin = null,
TimeSpan? handOverRetryInterval = null,
Option<LeaseUsageSettings> leaseSettings = default,
bool? considerAppVersion = null)
private ClusterSingletonManagerSettings Copy(string singletonName = null, Option<string> role = default, TimeSpan? removalMargin = null,
TimeSpan? handOverRetryInterval = null, Option<LeaseUsageSettings> leaseSettings = default)
{
return new ClusterSingletonManagerSettings(
singletonName: singletonName ?? SingletonName,
role: role.HasValue ? role.Value : Role,
removalMargin: removalMargin ?? RemovalMargin,
handOverRetryInterval: handOverRetryInterval ?? HandOverRetryInterval,
leaseSettings: leaseSettings.HasValue ? leaseSettings.Value : LeaseSettings,
considerAppVersion: considerAppVersion ?? ConsiderAppVersion
leaseSettings: leaseSettings.HasValue ? leaseSettings.Value : LeaseSettings
);
}
}
Expand Down
Loading
Loading