WIP: always start chain manager with none projection
This commit is contained in:
parent
0d7f6c8d7e
commit
3ca0f4491d
2 changed files with 31 additions and 16 deletions
|
@ -219,15 +219,28 @@ init({MyName, InitMembersDict, MgrOpts}) ->
|
|||
ZeroProj = make_none_projection(MyName, ZeroAll_list, [], InitMembersDict),
|
||||
ok = store_zeroth_projection_maybe(ZeroProj, MgrOpts),
|
||||
|
||||
%% Using whatever is the largest epoch number in our local private
|
||||
%% store, this manager starts out using the "none" projection. If
|
||||
%% other members of the chain are running, then we'll simply adopt
|
||||
%% whatever they're using as a basis for our next suggested
|
||||
%% projection.
|
||||
%%
|
||||
%% If we're in CP mode, we have to be very careful about who we
|
||||
%% choose to be UPI members when we (or anyone else) restarts.
|
||||
%% However, that choice is *not* made here: it is made later
|
||||
%% during our first humming consensus iteration. When we start
|
||||
%% with the none projection, we're make a safe choice before
|
||||
%% wading into the deep waters.
|
||||
{MembersDict, Proj0} =
|
||||
get_my_private_proj_boot_info(MgrOpts, InitMembersDict, ZeroProj),
|
||||
All_list = [P#p_srvr.name || {_, P} <- orddict:to_list(MembersDict)],
|
||||
#projection_v1{epoch_number=CurrentEpoch,
|
||||
all_members=All_list, witnesses=Witness_list} = Proj0,
|
||||
Proj1 = make_none_projection(MyName, All_list, Witness_list, MembersDict),
|
||||
Proj = machi_projection:update_checksum(
|
||||
Proj1#projection_v1{epoch_number=CurrentEpoch}),
|
||||
|
||||
Opt = fun(Key, Default) -> proplists:get_value(Key, MgrOpts, Default) end,
|
||||
CMode = Opt(consistency_mode, ap_mode),
|
||||
Proj = if CMode == ap_mode -> Proj0;
|
||||
CMode == cp_mode -> Proj0 % TODO FIXMEFIXMEFIXME!
|
||||
end,
|
||||
RunEnv = [{seed, Opt(seed, now())},
|
||||
{use_partition_simulator, Opt(use_partition_simulator, false)},
|
||||
{simulate_repair, Opt(simulate_repair, true)},
|
||||
|
|
|
@ -247,6 +247,7 @@ convergence_demo_testfun(NumFLUs, MgrOpts0) ->
|
|||
private_projections_are_stable(Namez, DoIt)
|
||||
end, false, lists:seq(0, MaxIters)),
|
||||
io:format(user, "\nSweet, private projections are stable\n", []),
|
||||
io:format(user, "\t~p\n", [get(stable)]),
|
||||
io:format(user, "Rolling sanity check ... ", []),
|
||||
MaxFiles = 3*1000,
|
||||
PrivProjs = [{Name, begin
|
||||
|
@ -359,8 +360,8 @@ make_partition_list(All_list) ->
|
|||
%% Concat = _X_Ys2,
|
||||
%% Concat = _X_Ys1 ++ _X_Ys2,
|
||||
%% %% Concat = _X_Ys3,
|
||||
%% %% Concat = _X_Ys1 ++ _X_Ys2 ++ _X_Ys3,
|
||||
%% random_sort(lists:usort([lists:sort(L) || L <- Concat])).
|
||||
Concat = _X_Ys1 ++ _X_Ys2 ++ _X_Ys3,
|
||||
random_sort(lists:usort([lists:sort(L) || L <- Concat])).
|
||||
|
||||
%% [ [{a,b},{b,d},{c,b}],
|
||||
%% [{a,b},{b,d},{c,b}, {a,b},{b,a},{a,c},{c,a},{a,d},{d,a}],
|
||||
|
@ -401,16 +402,16 @@ make_partition_list(All_list) ->
|
|||
%% [{a,b}, {c,b}, {c,d}],
|
||||
%% [{a,b}, {b,c}, {d,c}] ].
|
||||
|
||||
[
|
||||
%% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [],
|
||||
%% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [],
|
||||
%% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [],
|
||||
%% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [],
|
||||
[{a,b}], [], [{a,b}], [], [{a,b}]
|
||||
%% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [],
|
||||
%% [{b,a},{d,e}],
|
||||
%% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], []
|
||||
].
|
||||
%% [
|
||||
%% %% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [],
|
||||
%% %% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [],
|
||||
%% %% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [],
|
||||
%% %% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [],
|
||||
%% [{a,b}], [], [{a,b}], [], [{a,b}]
|
||||
%% %% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [],
|
||||
%% %% [{b,a},{d,e}],
|
||||
%% %% [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], []
|
||||
%% ].
|
||||
%% [ [{a,b}, {b,c}, {c,d}, {d,e}],
|
||||
%% [{b,a}, {b,c}, {c,d}, {d,e}],
|
||||
%% [{a,b}, {c,b}, {c,d}, {d,e}],
|
||||
|
@ -450,6 +451,7 @@ private_projections_are_stable(Namez, PollFunc) ->
|
|||
Private2 = [get_latest_inner_proj_summ(FLU) || {_Name, FLU} <- Namez],
|
||||
Is = [Inner_p || {_,_,_,_,Inner_p} <- Private1],
|
||||
%% We want either all true or all false (inner or not).
|
||||
put(stable, Private1),
|
||||
Private1 == Private2 andalso length(lists:usort(Is)) == 1.
|
||||
|
||||
get_latest_inner_proj_summ(FLU) ->
|
||||
|
|
Loading…
Reference in a new issue