diff options
author | Arnaud Cogoluègnes <acogoluegnes@gmail.com> | 2023-04-20 09:58:09 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-20 09:58:09 +0200 |
commit | b2aec2b3b89210b509872a3344e29ad89f7be81d (patch) | |
tree | eff67512c7c61cc5ff9612ac4cfcbfabf95aad67 | |
parent | 0c8b6810cbf01ecb41a3973d5d604c9e01765c77 (diff) | |
download | rabbitmq-server-git-b2aec2b3b89210b509872a3344e29ad89f7be81d.tar.gz |
Fix stream import on startup (#7866)
* Use reachable nodes to start stream coordinator Ra cluster
rabbit_nodes:list_running/0 was previously used, but it returns
only nodes with the rabbit application running. The application
may not be running when streams are created, e.g. when importing
definitions on startup. The function would then return an empty
list, which makes the Ra cluster startup fail.
rabbit_nodes:list_reachable/0 returns cluster nodes, regardless
of the status of the rabbit application, which is enough in this case.
* Return existing queue record on queue creation
If any. And do not expect the record to be exactly
equal to the passed-in queue parameter: it is not
for streams (spotted by trying to import stream definitions
on startup several times).
* Add an assertion
---------
Co-authored-by: Michal Kuratczyk <mkuratczyk@vmware.com>
-rw-r--r-- | deps/rabbit/src/rabbit_db_queue.erl | 4 | ||||
-rw-r--r-- | deps/rabbit/src/rabbit_stream_coordinator.erl | 3 |
2 files changed, 4 insertions, 3 deletions
diff --git a/deps/rabbit/src/rabbit_db_queue.erl b/deps/rabbit/src/rabbit_db_queue.erl index 213f82a8ab..032416b02d 100644 --- a/deps/rabbit/src/rabbit_db_queue.erl +++ b/deps/rabbit/src/rabbit_db_queue.erl @@ -594,8 +594,8 @@ create_or_get_in_mnesia(Q) -> {error, not_found} -> set_in_mnesia_tx(DurableQ, Q), {created, Q}; - {ok, Q} -> - {absent, Q, nodedown} + {ok, QRecord} -> + {absent, QRecord, nodedown} end; [ExistingQ] -> {existing, ExistingQ} diff --git a/deps/rabbit/src/rabbit_stream_coordinator.erl b/deps/rabbit/src/rabbit_stream_coordinator.erl index e12918588e..52d3ba7b20 100644 --- a/deps/rabbit/src/rabbit_stream_coordinator.erl +++ b/deps/rabbit/src/rabbit_stream_coordinator.erl @@ -425,8 +425,9 @@ ensure_coordinator_started() -> end. start_coordinator_cluster() -> - Nodes = rabbit_nodes:list_running(), + Nodes = rabbit_nodes:list_reachable(), rabbit_log:debug("Starting stream coordinator on nodes: ~w", [Nodes]), + true = Nodes =/= [], case ra:start_cluster(?RA_SYSTEM, [make_ra_conf(Node, Nodes) || Node <- Nodes]) of {ok, Started, _} -> rabbit_log:debug("Started stream coordinator on ~w", [Started]), |