-
Notifications
You must be signed in to change notification settings - Fork 4k
AWS peer discovery: add multi-hostname path support #14705
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
base: main
Are you sure you want to change the base?
AWS peer discovery: add multi-hostname path support #14705
Conversation
deps/rabbitmq_peer_discovery_aws/src/rabbit_peer_discovery_aws.erl
Outdated
Show resolved
Hide resolved
deps/rabbitmq_peer_discovery_aws/src/rabbit_peer_discovery_aws.erl
Outdated
Show resolved
Hide resolved
deps/rabbitmq_peer_discovery_aws/src/rabbit_peer_discovery_aws.erl
Outdated
Show resolved
Hide resolved
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.
Please be aware that the genie is extremely lazy with whitespace and will gladly add space characters on blank lines, at the end of lines, etc.
deps/rabbitmq_peer_discovery_aws/src/rabbit_peer_discovery_aws.erl
Outdated
Show resolved
Hide resolved
deps/rabbitmq_peer_discovery_aws/src/rabbit_peer_discovery_aws.erl
Outdated
Show resolved
Hide resolved
deps/rabbitmq_peer_discovery_aws/src/rabbit_peer_discovery_aws.erl
Outdated
Show resolved
Hide resolved
ca6b404
to
175a956
Compare
deps/rabbitmq_peer_discovery_aws/priv/schema/rabbitmq_peer_discovery_aws.schema
Show resolved
Hide resolved
deps/rabbitmq_peer_discovery_aws/src/rabbit_peer_discovery_aws.erl
Outdated
Show resolved
Hide resolved
deps/rabbitmq_peer_discovery_aws/src/rabbit_peer_discovery_aws.erl
Outdated
Show resolved
Hide resolved
end. | ||
|
||
-spec get_value(string()|integer(), props()) -> props(). | ||
get_value(_, []) -> |
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.
get_value(Key, []) when is_integer(Key) -> | |
[]; | |
get_value(Key, Props) when is_integer(Key) -> | |
{"item", Props2} = lists:nth(Key, Props), | |
Props2; | |
get_value(Key, Props) -> | |
Value = proplists:get_value(Key, Props), | |
sort_ec2_hostname_path_set_members(Key, Value). |
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.
The second clause would be redundant, no? It should always be covered by the first clause
(suggestion edited)
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.
Note: I added this new "Malformed data" case in response to this boot error when an invalid hostname path is used (i.e. pointing to a 3rd ENI when it doesn't exist). Hopefully this maintains the intent this suggestion.
get_value(Key, Props) when is_integer(Key), is_list(Props), length(Props) >= Key, Key > 0 ->
case lists:nth(Key, Props) of
{"item", Props2} -> Props2;
_ -> [] % Malformed data
end;
Error without above case:
BOOT FAILED
===========
Exception during startup:
error:function_clause
rabbit_peer_discovery_util:node_name/1, line 210
args: "1"
rabbit_peer_discovery_aws:-get_autoscaling_group_node_list/2-lc$^0/1-0-/1, line 207
rabbit_peer_discovery_aws:get_autoscaling_group_node_list/2, line 207
rabbit_peer_discovery:discover_cluster_nodes/1, line 316
rabbit_peer_discovery:sync_desired_cluster/3, line 196
rabbit_db:init/0, line 64
rabbit_boot_steps:-run_step/2-lc$^0/1-0-/2, line 53
rabbit_boot_steps:run_step/2, line 60
175a956
to
b75758a
Compare
Adds support for multiple hostname paths in the AWS peer discovery plugin to enable zero-downtime rolling upgrades during hostname migration scenarios. The implementation allows RabbitMQ nodes to discover peers using multiple hostname paths, ensuring cluster formation succeeds even when nodes are configured with different hostname paths during rolling upgrades. Example usage: cluster_formation.aws.hostname_path.1 = privateDnsName cluster_formation.aws.hostname_path.2 = privateIpAddress
b75758a
to
7cdb505
Compare
end}] | ||
}). | ||
|
||
invalid_hostname_paths_graceful_handling(_Config) -> |
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.
Also added these new test cases to signify intent and improve coverage.
Proposed Changes
This PR adds support for multiple hostname paths in the AWS peer discovery plugin to enable zero-downtime rolling upgrades during hostname migration scenarios. The implementation allows RabbitMQ nodes to discover peers using multiple hostname paths, ensuring cluster formation succeeds even when nodes are configured with different hostname paths during rolling upgrades.
Backward Compatibility
Existing single
hostname_path
configuration continues to work (unchanged).We fallback to single path behavior when no numbered paths are configured.
Configuration Examples
Multiple paths for zero-downtime migration
Note: This follows the existing pattern we have for
classic_config
:Single path (backward compatible)
Types of Changes
What types of changes does your code introduce to this project?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply.You can also fill these out after creating the PR.
This is simply a reminder of what we are going to look for before merging your code.
CONTRIBUTING.md
document