-
Notifications
You must be signed in to change notification settings - Fork 1k
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
SBR fix & update #5147
Merged
Merged
SBR fix & update #5147
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
46c6461
configuration for SBR lease release (migrated from https://github.com…
zbynek001 7bdf34d
Simplified reverse in lease majority (migrated from https://github.co…
zbynek001 2392630
shared TestLease objects moved to Akka.Coordination.Tests
zbynek001 45e591f
Gossip verbose log fix
zbynek001 33ef2c7
SBR fix
zbynek001 369732b
SBR missing multinode tests added
zbynek001 1be906e
lease test fix
zbynek001 b027725
Merge branch 'dev' into sbr-update
zbynek001 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...trib/cluster/Akka.Cluster.Tools.Tests.MultiNode/Akka.Cluster.Tools.Tests.MultiNode.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
174 changes: 174 additions & 0 deletions
174
src/core/Akka.Cluster.Tests.MultiNode/SBR/DownAllIndirectlyConnected5NodeSpec.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,174 @@ | ||
//----------------------------------------------------------------------- | ||
// <copyright file="DownAllIndirectlyConnected5NodeSpec.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2009-2021 Lightbend Inc. <http://www.lightbend.com> | ||
// Copyright (C) 2013-2021 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
//----------------------------------------------------------------------- | ||
|
||
using System; | ||
using System.Linq; | ||
using Akka.Cluster.TestKit; | ||
using Akka.Configuration; | ||
using Akka.Remote.TestKit; | ||
using Akka.Remote.Transport; | ||
using Akka.TestKit; | ||
using FluentAssertions; | ||
|
||
namespace Akka.Cluster.Tests.MultiNode.SBR | ||
{ | ||
public class DownAllIndirectlyConnected5NodeSpecConfig : MultiNodeConfig | ||
{ | ||
public RoleName Node1 { get; } | ||
public RoleName Node2 { get; } | ||
public RoleName Node3 { get; } | ||
public RoleName Node4 { get; } | ||
public RoleName Node5 { get; } | ||
|
||
|
||
public DownAllIndirectlyConnected5NodeSpecConfig() | ||
{ | ||
Node1 = Role("node1"); | ||
Node2 = Role("node2"); | ||
Node3 = Role("node3"); | ||
Node4 = Role("node4"); | ||
Node5 = Role("node5"); | ||
|
||
CommonConfig = ConfigurationFactory.ParseString(@" | ||
|
||
akka { | ||
loglevel = INFO | ||
cluster { | ||
downing-provider-class = ""Akka.Cluster.SBR.SplitBrainResolverProvider"" | ||
split-brain-resolver.active-strategy = keep-majority | ||
split-brain-resolver.stable-after = 6s | ||
|
||
run-coordinated-shutdown-when-down = off | ||
} | ||
|
||
actor.provider = cluster | ||
|
||
test.filter-leeway = 10s | ||
}") | ||
.WithFallback(MultiNodeLoggingConfig.LoggingConfig) | ||
.WithFallback(DebugConfig(true)) | ||
.WithFallback(MultiNodeClusterSpec.ClusterConfig()); | ||
|
||
TestTransport = true; | ||
} | ||
} | ||
|
||
public class DownAllIndirectlyConnected5NodeSpec : MultiNodeClusterSpec | ||
{ | ||
private readonly DownAllIndirectlyConnected5NodeSpecConfig _config; | ||
|
||
public DownAllIndirectlyConnected5NodeSpec() | ||
: this(new DownAllIndirectlyConnected5NodeSpecConfig()) | ||
{ | ||
} | ||
|
||
protected DownAllIndirectlyConnected5NodeSpec(DownAllIndirectlyConnected5NodeSpecConfig config) | ||
: base(config, typeof(DownAllIndirectlyConnected5NodeSpec)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. MNTR constructors and config all look fine |
||
{ | ||
_config = config; | ||
} | ||
|
||
[MultiNodeFact] | ||
public void DownAllIndirectlyConnected5NodeSpecTests() | ||
{ | ||
A_5_node_cluster_with_keep_one_indirectly_connected_off_should_down_all_when_indirectly_connected_combined_with_clean_partition(); | ||
} | ||
|
||
public void A_5_node_cluster_with_keep_one_indirectly_connected_off_should_down_all_when_indirectly_connected_combined_with_clean_partition() | ||
{ | ||
var cluster = Cluster.Get(Sys); | ||
|
||
RunOn(() => | ||
{ | ||
cluster.Join(cluster.SelfAddress); | ||
}, _config.Node1); | ||
EnterBarrier("node1 joined"); | ||
RunOn(() => | ||
{ | ||
cluster.Join(Node(_config.Node1).Address); | ||
}, _config.Node2, _config.Node3, _config.Node4, _config.Node5); | ||
Within(TimeSpan.FromSeconds(10), () => | ||
{ | ||
AwaitAssert(() => | ||
{ | ||
cluster.State.Members.Count.Should().Be(5); | ||
foreach (var m in cluster.State.Members) | ||
{ | ||
m.Status.Should().Be(MemberStatus.Up); | ||
} | ||
}); | ||
}); | ||
EnterBarrier("Cluster formed"); | ||
|
||
RunOn(() => | ||
{ | ||
|
||
foreach (var x in new[] { _config.Node1, _config.Node2, _config.Node3 }) | ||
{ | ||
foreach (var y in new[] { _config.Node4, _config.Node5 }) | ||
{ | ||
TestConductor.Blackhole(x, y, ThrottleTransportAdapter.Direction.Both).Wait(); | ||
} | ||
} | ||
}, _config.Node1); | ||
EnterBarrier("blackholed-clean-partition"); | ||
|
||
RunOn(() => | ||
{ | ||
TestConductor.Blackhole(_config.Node2, _config.Node3, ThrottleTransportAdapter.Direction.Both).Wait(); | ||
}, _config.Node1); | ||
EnterBarrier("blackholed-indirectly-connected"); | ||
|
||
Within(TimeSpan.FromSeconds(10), () => | ||
{ | ||
AwaitAssert(() => | ||
{ | ||
RunOn(() => | ||
{ | ||
cluster.State.Unreachable.Select(i => i.Address).Should().BeEquivalentTo(new[] { _config.Node2, _config.Node3, _config.Node4, _config.Node5 }.Select(i => Node(i).Address)); | ||
}, _config.Node1); | ||
RunOn(() => | ||
{ | ||
cluster.State.Unreachable.Select(i => i.Address).Should().BeEquivalentTo(new[] { _config.Node3, _config.Node4, _config.Node5 }.Select(i => Node(i).Address)); | ||
}, _config.Node2); | ||
RunOn(() => | ||
{ | ||
cluster.State.Unreachable.Select(i => i.Address).Should().BeEquivalentTo(new[] { _config.Node2, _config.Node4, _config.Node5 }.Select(i => Node(i).Address)); | ||
}, _config.Node3); | ||
RunOn(() => | ||
{ | ||
cluster.State.Unreachable.Select(i => i.Address).Should().BeEquivalentTo(new[] { _config.Node1, _config.Node2, _config.Node3 }.Select(i => Node(i).Address)); | ||
}, _config.Node4, _config.Node5); | ||
}); | ||
}); | ||
EnterBarrier("unreachable"); | ||
|
||
RunOn(() => | ||
{ | ||
Within(TimeSpan.FromSeconds(15), () => | ||
{ | ||
AwaitAssert(() => | ||
{ | ||
cluster.State.Members.Select(i => i.Address).Should().BeEquivalentTo(Node(_config.Node1).Address); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So all of the nodes that have at least one broken connection are downed... |
||
foreach (var m in cluster.State.Members) | ||
{ | ||
m.Status.Should().Be(MemberStatus.Up); | ||
} | ||
}); | ||
}); | ||
}, _config.Node1); | ||
|
||
RunOn(() => | ||
{ | ||
// downed | ||
AwaitCondition(() => cluster.IsTerminated, max: TimeSpan.FromSeconds(15)); | ||
}, _config.Node2, _config.Node3, _config.Node4, _config.Node5); | ||
|
||
EnterBarrier("done"); | ||
} | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM