@@ -434,9 +434,10 @@ init_db(ClusterNodes, NodeType, CheckOtherNodes) ->
434434 % % First disc node up
435435 maybe_force_load (),
436436 ok ;
437- {[_ | _ ], _ , _ } ->
437+ {[AnotherNode | _ ], _ , _ } ->
438438 % % Subsequent node in cluster, catch up
439- ok = ensure_version_ok (Nodes ),
439+ ensure_version_ok (
440+ rpc :call (AnotherNode , rabbit_version , recorded , [])),
440441 maybe_force_load (),
441442 ok = rabbit_table :wait_for_replicated (),
442443 ok = rabbit_table :create_local_copy (NodeType )
@@ -638,29 +639,14 @@ schema_ok_or_move() ->
638639 ok = create_schema ()
639640 end .
640641
641- ensure_version_ok (OtherNodes ) ->
642- Desired = rabbit_version :desired (),
643- Fun = fun (Node , FoundMatch ) ->
644- case rpc :call (Node , rabbit_version , recorded , []) of
645- {error , _ } ->
646- FoundMatch ; % % Node probably isn't fully up.
647- {ok , NodeVersion } ->
648- case rabbit_version :compare (Desired , NodeVersion ) of
649- eq ->
650- true ;
651- gt ->
652- FoundMatch ; % % Remote is just older than us.
653- _ ->
654- throw ({error , {version_mismatch ,
655- Desired , NodeVersion }})
656- end
657- end
658- end ,
659- FoundMatch = lists :foldl (Fun , false , OtherNodes ),
660- case FoundMatch of
642+ ensure_version_ok ({ok , DiscVersion }) ->
643+ DesiredVersion = rabbit_version :desired (),
644+ case rabbit_version :matches (DesiredVersion , DiscVersion ) of
661645 true -> ok ;
662- false -> throw ({error , {version_mismatch , Desired }})
663- end .
646+ false -> throw ({error , {version_mismatch , DesiredVersion , DiscVersion }})
647+ end ;
648+ ensure_version_ok ({error , _ }) ->
649+ ok = rabbit_version :record_desired ().
664650
665651% % We only care about disc nodes since ram nodes are supposed to catch
666652% % up only
0 commit comments