@@ -366,7 +366,7 @@ init([]) ->
366366 {ok , ensure_keepalive_timer (# state {monitors = Monitors ,
367367 subscribers = pmon :new (),
368368 partitions = [],
369- guid = rabbit_guid : gen ( ),
369+ guid = erlang : system_info ( creation ),
370370 node_guids = maps :new (),
371371 autoheal = rabbit_autoheal :init ()})}.
372372
@@ -416,6 +416,13 @@ handle_cast(notify_node_up, State = #state{guid = GUID}) ->
416416% % disconnected, it would become a minority, pause, realise it's not
417417% % in a minority any more, and come back, still partitioned (albeit no
418418% % longer partially).
419+ % %
420+ % % UPDATE: The GUID is actually not a GUID anymore - it is the value
421+ % % returned by erlang:system_info(creation). This prevent false-positives
422+ % % in a situation when a node is restarted (Erlang VM is up) but the rabbit
423+ % % app is not yet up. The GUID was only generated and announced upon rabbit
424+ % % startup; creation is available immediately. Therefore we can tell that
425+ % % the node was restarted, before it announces the new value.
419426% % ----------------------------------------------------------------------------
420427
421428handle_cast ({node_up , Node , NodeType , GUID },
@@ -435,15 +442,18 @@ handle_cast({check_partial_partition, Node, Rep, NodeGUID, MyGUID, RepGUID},
435442 maps :find (Node , GUIDs ) =:= {ok , NodeGUID } of
436443 true -> spawn_link ( % %[1]
437444 fun () ->
438- case rpc :call (Node , rabbit , is_running , []) of
445+ case rpc :call (Node , erlang , system_info , [creation ]) of
439446 {badrpc , _ } -> ok ;
440- _ ->
447+ NodeGUID ->
441448 rabbit_log :warning (" Received a 'DOWN' message"
442449 " from ~p but still can"
443450 " communicate with it " ,
444451 [Node ]),
445452 cast (Rep , {partial_partition ,
446- Node , node (), RepGUID })
453+ Node , node (), RepGUID });
454+ _ ->
455+ rabbit_log :warning (" Node ~p was restarted" , [Node ]),
456+ ok
447457 end
448458 end );
449459 false -> ok
0 commit comments