rabbitmq/support-tools

rebalance-queue-masters -r regex option causes an error after having processed all matching queues

PingNGE opened this issue · 4 comments

The error :
20220222-13:49:28 [INFO] Updating queue master for queue '' from '' to 'rabbit@rabbitmq2'
20220222-13:49:28 [INFO] Error (argument validation): Invalid options for this command:
-ha-temp :
Arguments given:
set_policy -p EasyClip.PostProcess --priority 990 --apply-to queues -ha-temp ^$ {"ha-mode":"exactly","ha-params":1}

The regex match result includes an empty line (=>empty queue name).

It would be really helpful if you provided the exact command you ran and the full output.

We would welcome instructions to reproduce this and a pull request with a fix. Apparently it's this line that could be the cause of the issue:

https://github.com/rabbitmq/support-tools/blob/master/scripts/rebalance-queue-masters#L176

Sure : rebalance-queue-masters -p myVHost -r MyQueuePattern

After having successfully processed queues that match the given pattern, the queue_and_pid is set with an empty value during next loop, that causes the error.

I searched a way to stop the loop before but the stop condition is based on the node_with_most_queues_count & max_queues_desired_per_host variables, that seem not to be calculated taking care of the filtering pattern. And I didn't really understand how these variables were set.

Hope these informations will help.

rebalance-queue-masters -p myVHost -r MyQueuePattern

What is the value for MyQueuePattern? In addition, it would be good to know the full list of queue names so that I can check against the pattern you used. Without that information I have to guess how an empty value is set and I don't have time to guess!

An easy workaround would be to skip values that are invalid, like the empty string.

Current versions of RabbitMQ have the rabbitmq-queues rebalance command built in so fixing this script is very low priority now since it only exists to help users who use unsupported RabbitMQ versions.

Closing due to inactivity. Current versions of RabbitMQ have a command to rebalance queues.