Skip to content

Commit 81f1590

Browse files
committed
cache: query list of nodes from Mnesia
Previously, we were retrieving the list of nodes onto which to replicate the cache by querying the VM. This had the side effect of retrieving all connected nodes and not only those in which Mnesia schema was installed. This is usually not an issue as it's unlikely someone would connect a BEAM VM to RabbitMQ and the broker installs the schema on all its running nodes. Nevertheless, the system tests are an exception to the above assumption and they where failing when trying to replicate a disc cache onto the test VM. To remediate that, we now retrieve the list of nodes by querying Mnesia.system_info rather than Erlang.Node. An alternative would be to query the list of nodes through RabbitMQ itself but I'd rather keep the caching logic RMQ agnostic. Signed-off-by: Matteo Cafasso <[email protected]>
1 parent fb5a622 commit 81f1590

File tree

1 file changed

+1
-1
lines changed
  • lib/rabbitmq_message_deduplication

1 file changed

+1
-1
lines changed

lib/rabbitmq_message_deduplication/cache.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ defmodule RabbitMQMessageDeduplication.Cache do
221221
# List the nodes on which to create the cache replicas.
222222
# Distributed caches are replicated on two-thirds of the cluster nodes.
223223
defp cache_replicas(_distributed = true) do
224-
nodes = [Node.self() | Node.list()]
224+
nodes = Mnesia.system_info(:db_nodes)
225225

226226
if length(nodes) > 2 do
227227
nodes |> Enum.split(floor((length(nodes) * 2) / 3)) |> elem(0)

0 commit comments

Comments
 (0)