Disconnect of a node from a cluster of global nodes #6264
Merged
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.
Make it possible to disconnect a node from a cluster of
global
nodes without causing problems. Proposed API:global:disconnect() -> [node()]
Disconnect from all other nodes known to
global
. A list of node names (in an unspecified order) is returned which corresponds to the nodes that were disconnected. All disconnect operations performed have completed whenglobal:disconnect/0
returns.The disconnects will be made in such a way that only the current node will be removed from the cluster of
global
nodes. Ifprevent_overlapping_partitions
is enabled and you disconnect, from other nodes in the cluster ofglobal
nodes, by other means,global
on the other nodes may partition the remaining nodes in order to ensure that no overlapping partitions appear. Even ifprevent_overlapping_partitions
is disabled, you should preferably useglobal:disconnect/0
in order to remove current node from a cluster ofglobal
nodes, since you otherwise likely will create overlapping partitions which might cause problems.Note that if the node is going to be halted, there is no need to remove it from a cluster of
global
nodes explicitly by callingglobal:disconnect/0
before halting it. The removal from the cluster is taken care of automatically when the node halts regardless of whetherprevent_overlapping_partitions
is enabled or not.If current node has been configured to be part of a global group, only connected and/or synchronized nodes in that group are known to
global
, soglobal:disconnect/0
will only disconnect from those nodes. If current node is not part of a global group, all connected visible nodes will be known toglobal
, soglobal:disconnect/0
will disconnect from all those nodes.Note that information about connected nodes does not instantaneously reach
global
, so the caller might see a node part of the result returned bynodes()
while it still is not known toglobal
. The disconnect operation will, however, still not cause any overlapping partitions whenprevent_overlapping_partitions
is enabled. Ifprevent_overlapping_partitions
is disabled, overlapping partitions may form in this case.Note that when
prevent_overlapping_partitions
is enabled, you may see warning reports on other nodes when they detect that current node has disconnected. These are in this case completely harmless and can be ignored.