rabbitmq / rabbitmq-peer-discovery-aws

AWS-based peer discovery backend for RabbitMQ 3.7.0+
Other
24 stars 11 forks source link

Autoscaling group: may fail to discover all nodes in an `instancesSet` #20

Closed dumbbell closed 6 years ago

dumbbell commented 6 years ago

Let's consider the get_hostname_name_from_reservation_set() function:

get_hostname_name_from_reservation_set([{"item", RI}|T], Accum) ->
    InstancesSet = proplists:get_value("instancesSet", RI),
    Item = proplists:get_value("item", InstancesSet),
    DNSName = proplists:get_value(select_hostname(), Item),
    if
        DNSName == [] -> get_hostname_name_from_reservation_set(T, Accum);
        true -> get_hostname_name_from_reservation_set(T, lists:append([DNSName], Accum))
    end.

The function only takes the first element in the instances set:

Item = proplists:get_value("item", InstancesSet),

Following elements are ignored. Unfortunately, if the first element is the VM itself, the plugin will consider there are no other RabbitMQ nodes to cluster with.

michaelklishin commented 6 years ago

Good catch.