diff options
author | Karl Nilsson <kjnilsson@gmail.com> | 2022-11-04 11:43:58 +0000 |
---|---|---|
committer | Karl Nilsson <kjnilsson@gmail.com> | 2022-11-04 11:43:58 +0000 |
commit | b98315472873ca90d9b02f53e660786fb4b47a56 (patch) | |
tree | 9e94768af688348ef436b898e79ec993c917f227 | |
parent | f17dd084dab93880835be3fdffe21be8f05d75bb (diff) | |
download | rabbitmq-server-git-gh_6317.tar.gz |
Be more explicit with timeouts when declaring quorum queuesgh_6317
Also use the likely leader id when updating the quorum queue configuration
immediately after creation.
-rw-r--r-- | deps/rabbit/src/rabbit_quorum_queue.erl | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/deps/rabbit/src/rabbit_quorum_queue.erl b/deps/rabbit/src/rabbit_quorum_queue.erl index 0a36980044..1b8200b009 100644 --- a/deps/rabbit/src/rabbit_quorum_queue.erl +++ b/deps/rabbit/src/rabbit_quorum_queue.erl @@ -105,7 +105,8 @@ messages_unacknowledged, local_state, type] ++ ?STATISTICS_KEYS). -define(RPC_TIMEOUT, 1000). --define(START_CLUSTER_RPC_TIMEOUT, 7000). %% the ra start cluster default is 5000 +-define(START_CLUSTER_TIMEOUT, 5000). +-define(START_CLUSTER_RPC_TIMEOUT, 7000). %% needs to be longer than START_CLUSTER_TIMEOUT -define(TICK_TIMEOUT, 5000). %% the ra server tick time -define(DELETE_TIMEOUT, 5000). -define(ADD_MEMBER_TIMEOUT, 5000). @@ -187,7 +188,6 @@ start_cluster(Q) -> {error, {too_long, N}} -> rabbit_data_coercion:to_atom(ra:new_uid(N)) end, - Id = {RaName, node()}, {Leader, Followers} = rabbit_queue_location:select_leader_and_followers(Q, QuorumSize), LeaderId = {RaName, Leader}, NewQ0 = amqqueue:set_pid(Q, LeaderId), @@ -203,7 +203,8 @@ start_cluster(Q) -> ?SNAPSHOT_INTERVAL), RaConfs = [make_ra_conf(NewQ, ServerId, TickTimeout, SnapshotInterval) || ServerId <- members(NewQ)], - try erpc_call(Leader, ra, start_cluster, [?RA_SYSTEM, RaConfs], + try erpc_call(Leader, ra, start_cluster, + [?RA_SYSTEM, RaConfs, ?START_CLUSTER_TIMEOUT], ?START_CLUSTER_RPC_TIMEOUT) of {ok, _, _} -> %% ensure the latest config is evaluated properly @@ -212,7 +213,7 @@ start_cluster(Q) -> %% keys %% TODO: handle error - what should be done if the %% config cannot be updated - ok = rabbit_fifo_client:update_machine_state(Id, + ok = rabbit_fifo_client:update_machine_state(LeaderId, ra_machine_config(NewQ)), notify_decorators(QName, startup), rabbit_event:notify(queue_created, |