-
Notifications
You must be signed in to change notification settings - Fork 3.6k
feat: Down all when indirectly connected, #32862 #32865
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
Merged
+130
−7
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
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 hidden or 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 hidden or 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 hidden or 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
98 changes: 98 additions & 0 deletions
98
akka-cluster/src/multi-jvm/scala/akka/cluster/sbr/DownAllIndirectlyConnected3NodeSpec.scala
This file contains hidden or 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,98 @@ | ||
| /* | ||
| * Copyright (C) 2020-2025 Lightbend Inc. <https://www.lightbend.com> | ||
| */ | ||
|
|
||
| package akka.cluster.sbr | ||
|
|
||
| import scala.concurrent.duration._ | ||
|
|
||
| import com.typesafe.config.ConfigFactory | ||
|
|
||
| import akka.cluster.Cluster | ||
| import akka.cluster.MemberStatus | ||
| import akka.cluster.MultiNodeClusterSpec | ||
| import akka.remote.testkit.Direction | ||
| import akka.remote.testkit.MultiNodeConfig | ||
|
|
||
| object DownAllIndirectlyConnected3NodeSpec extends MultiNodeConfig { | ||
| val node1 = role("node1") | ||
| val node2 = role("node2") | ||
| val node3 = role("node3") | ||
|
|
||
| commonConfig(ConfigFactory.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 | ||
| split-brain-resolver.down-all-when-indirectly-connected = on | ||
|
|
||
| run-coordinated-shutdown-when-down = off | ||
| } | ||
|
|
||
| actor.provider = cluster | ||
|
|
||
| test.filter-leeway = 10s | ||
| } | ||
| """)) | ||
|
|
||
| testTransport(on = true) | ||
| } | ||
|
|
||
| class DownAllIndirectlyConnected3NodeSpecMultiJvmNode1 extends DownAllIndirectlyConnected3NodeSpec | ||
| class DownAllIndirectlyConnected3NodeSpecMultiJvmNode2 extends DownAllIndirectlyConnected3NodeSpec | ||
| class DownAllIndirectlyConnected3NodeSpecMultiJvmNode3 extends DownAllIndirectlyConnected3NodeSpec | ||
|
|
||
| class DownAllIndirectlyConnected3NodeSpec extends MultiNodeClusterSpec(DownAllIndirectlyConnected3NodeSpec) { | ||
| import DownAllIndirectlyConnected3NodeSpec._ | ||
|
|
||
| "A 3-node cluster with down-all-when-indirectly-connected=on" should { | ||
| "down all when two unreachable but can talk via third" in { | ||
| val cluster = Cluster(system) | ||
|
|
||
| runOn(node1) { | ||
| cluster.join(cluster.selfAddress) | ||
| } | ||
| enterBarrier("node1 joined") | ||
| runOn(node2, node3) { | ||
| cluster.join(node(node1).address) | ||
| } | ||
| within(10.seconds) { | ||
| awaitAssert { | ||
| cluster.state.members.size should ===(3) | ||
| cluster.state.members.foreach { | ||
| _.status should ===(MemberStatus.Up) | ||
| } | ||
| } | ||
| } | ||
| enterBarrier("Cluster formed") | ||
|
|
||
| runOn(node1) { | ||
| testConductor.blackhole(node2, node3, Direction.Both).await | ||
| } | ||
| enterBarrier("Blackholed") | ||
|
|
||
| within(10.seconds) { | ||
| awaitAssert { | ||
| runOn(node3) { | ||
| cluster.state.unreachable.map(_.address) should ===(Set(node(node2).address)) | ||
| } | ||
| runOn(node2) { | ||
| cluster.state.unreachable.map(_.address) should ===(Set(node(node3).address)) | ||
| } | ||
| runOn(node1) { | ||
| cluster.state.unreachable.map(_.address) should ===(Set(node(node3).address, node(node2).address)) | ||
| } | ||
| } | ||
| } | ||
| enterBarrier("unreachable") | ||
|
|
||
| // all downed | ||
| awaitCond(cluster.isTerminated, max = 15.seconds) | ||
|
|
||
| enterBarrier("done") | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or 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 hidden or 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
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.
Uh oh!
There was an error while loading. Please reload this page.