@@ -366,7 +366,7 @@ init([]) ->
366
366
{ok , ensure_keepalive_timer (# state {monitors = Monitors ,
367
367
subscribers = pmon :new (),
368
368
partitions = [],
369
- guid = rabbit_guid : gen ( ),
369
+ guid = erlang : system_info ( creation ),
370
370
node_guids = maps :new (),
371
371
autoheal = rabbit_autoheal :init ()})}.
372
372
@@ -416,6 +416,13 @@ handle_cast(notify_node_up, State = #state{guid = GUID}) ->
416
416
% % disconnected, it would become a minority, pause, realise it's not
417
417
% % in a minority any more, and come back, still partitioned (albeit no
418
418
% % 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.
419
426
% % ----------------------------------------------------------------------------
420
427
421
428
handle_cast ({node_up , Node , NodeType , GUID },
@@ -435,15 +442,18 @@ handle_cast({check_partial_partition, Node, Rep, NodeGUID, MyGUID, RepGUID},
435
442
maps :find (Node , GUIDs ) =:= {ok , NodeGUID } of
436
443
true -> spawn_link ( % %[1]
437
444
fun () ->
438
- case rpc :call (Node , rabbit , is_running , []) of
445
+ case rpc :call (Node , erlang , system_info , [creation ]) of
439
446
{badrpc , _ } -> ok ;
440
- _ ->
447
+ NodeGUID ->
441
448
rabbit_log :warning (" Received a 'DOWN' message"
442
449
" from ~p but still can"
443
450
" communicate with it " ,
444
451
[Node ]),
445
452
cast (Rep , {partial_partition ,
446
- Node , node (), RepGUID })
453
+ Node , node (), RepGUID });
454
+ _ ->
455
+ rabbit_log :warning (" Node ~p was restarted" , [Node ]),
456
+ ok
447
457
end
448
458
end );
449
459
false -> ok
0 commit comments