WIP: remove repair_always_done option, it was flawed
This commit is contained in:
parent
87417d2872
commit
d3df2bd31d
2 changed files with 31 additions and 22 deletions
|
@ -578,7 +578,6 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
|
|||
end,
|
||||
Repairing_list2 = [X || X <- OldRepairing_list, lists:member(X, Up)],
|
||||
Simulator_p = proplists:get_value(use_partition_simulator, RunEnv2, false),
|
||||
Repair_done_p = proplists:get_value(repair_always_done, RunEnv2, false),
|
||||
{NewUPI_list3, Repairing_list3, RunEnv3} =
|
||||
case {NewUp, Repairing_list2} of
|
||||
{[], []} ->
|
||||
|
@ -595,7 +594,7 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
|
|||
SameEpoch_p = check_latest_private_projections_same_epoch(
|
||||
tl(NewUPI_list) ++ Repairing_list2,
|
||||
S#ch_mgr.proj, Partitions, S),
|
||||
if Simulator_p andalso (SameEpoch_p orelse Repair_done_p) ->
|
||||
if Simulator_p andalso SameEpoch_p ->
|
||||
D_foo=[{repair_airquote_done, {we_agree, (S#ch_mgr.proj)#projection_v1.epoch_number}}],
|
||||
{NewUPI_list ++ [H], T, RunEnv2};
|
||||
not Simulator_p
|
||||
|
@ -1331,6 +1330,9 @@ react_to_env_C100(P_newprop, P_latest,
|
|||
%% am/should be repairing. We ignore our proposal and try
|
||||
%% to go with the latest.
|
||||
?REACT({c100, ?LINE, [repairing_short_circuit]}),
|
||||
%% io:format(user, "C100 shortcut true: E ~w -> E ~w sane ~w\n", [P_current#projection_v1.epoch_number, P_latest#projection_v1.epoch_number, Current_sane_p]),
|
||||
%% ZXZX = lists:flatten(io_lib:format("C100 shortcut true: E ~w -> E ~w sane ~w\n", [P_current#projection_v1.epoch_number, P_latest#projection_v1.epoch_number, Current_sane_p])),
|
||||
%% erlang:display(ZXZX),
|
||||
react_to_env_C110(P_latest, S);
|
||||
{_, true} ->
|
||||
?REACT({c100, ?LINE, [sane]}),
|
||||
|
@ -1719,10 +1721,13 @@ projection_transition_is_sane(
|
|||
MoreCheckingP ->
|
||||
%% Where did elements in UPI_2_suffix come from?
|
||||
%% Only two sources are permitted.
|
||||
[lists:member(X, Repairing_list1) % X added after repair done
|
||||
orelse
|
||||
lists:member(X, UPI_list1) % X in UPI_list1 after common pref
|
||||
|| X <- UPI_2_suffix],
|
||||
Oops_check_UPI_2_suffix =
|
||||
[lists:member(X, Repairing_list1) % X added after repair done
|
||||
orelse
|
||||
lists:member(X, UPI_list1) % X in UPI_list1 after common pref
|
||||
|| X <- UPI_2_suffix],
|
||||
%% Grrrrr, ok, so this check isn't good, at least at bootstrap time.
|
||||
%% TODO: false = lists:member(false, Oops_check_UPI_2_suffix),
|
||||
|
||||
%% The UPI_2_suffix must exactly be equal to: ordered items from
|
||||
%% UPI_list1 concat'ed with ordered items from Repairing_list1.
|
||||
|
@ -1793,13 +1798,21 @@ projection_transition_is_sane(
|
|||
%% normal projection to an inner one. The old
|
||||
%% normal has a UPI that has nothing to do with
|
||||
%% RelativeToServer a.k.a. me.
|
||||
%% Or else the UPI_list1 is empty, and I'm
|
||||
%% the only member of UPI_list2
|
||||
%% But the new/suffix is definitely me.
|
||||
%% from:
|
||||
%% {epoch,847},{author,c},{upi,[c]},{repair,[]},
|
||||
%% {down,[a,b,d]}
|
||||
%% to:
|
||||
%% {epoch,848},{author,a},{upi,[a]},{repair,[]},
|
||||
%% {down,[b,c,d]}
|
||||
FirstCase_p = UPI_2_suffix == [AuthorServer2],
|
||||
FirstCase_p = (UPI_2_suffix == [AuthorServer2])
|
||||
andalso
|
||||
((inner_projection_exists(P1) == false
|
||||
andalso
|
||||
inner_projection_exists(P2) == true)
|
||||
orelse UPI_list1 == []),
|
||||
|
||||
%% Here's another case that's alright:
|
||||
%%
|
||||
|
|
|
@ -126,23 +126,23 @@ setup(Num, Seed) ->
|
|||
All_listE = lists:sublist(all_list_extra(), Num),
|
||||
%% shutdown_hard() has taken care of killing all relevant procs.
|
||||
[machi_flu1_test:clean_up_data_dir(Dir) || {_P, Dir} <- All_listE],
|
||||
?QC_FMT(",z~w", [?LINE]),
|
||||
|
||||
%% Start partition simulator
|
||||
{ok, PSimPid} = machi_partition_simulator:start_link(Seed, 0, 100),
|
||||
_Partitions = machi_partition_simulator:get(All_list),
|
||||
?QC_FMT(",z~w", [?LINE]),
|
||||
|
||||
%% Start FLUs and their associated procs
|
||||
{ok, SupPid} = machi_flu_sup:start_link(),
|
||||
FluOpts = [{use_partition_simulator, true}, {active_mode, false},
|
||||
%% TODO: Move repair_always_done to ETS table and reset
|
||||
%% after setup?
|
||||
{repair_always_done, true}],
|
||||
FluOpts = [{use_partition_simulator, true}, {active_mode, false}],
|
||||
[begin
|
||||
#p_srvr{name=Name, port=Port} = P,
|
||||
{ok, _} = machi_flu_psup:start_flu_package(Name, Port, Dir, FluOpts)
|
||||
end || {P, Dir} <- All_listE],
|
||||
%% Set up the chain
|
||||
Dict = orddict:from_list([{P#p_srvr.name, P} || {P, _Dir} <- All_listE]),
|
||||
?QC_FMT(",z~w", [?LINE]),
|
||||
[machi_chain_manager1:set_chain_members(get_chmgr(P), Dict) ||
|
||||
{P, _Dir} <- All_listE],
|
||||
%% Trigger some environment reactions for humming consensus: first
|
||||
|
@ -151,17 +151,11 @@ setup(Num, Seed) ->
|
|||
[begin
|
||||
_QQa = machi_chain_manager1:test_react_to_env(get_chmgr(P))
|
||||
end || {P, _Dir} <- All_listE, _I <- lists:seq(1,20), _Repeat <- [1,2]],
|
||||
?QC_FMT(",z~w", [?LINE]),
|
||||
[begin
|
||||
_QQa = machi_chain_manager1:test_react_to_env(get_chmgr(P))
|
||||
end || _I <- lists:seq(1,20), {P, _Dir} <- All_listE, _Repeat <- [1,2]],
|
||||
%% %% All chain managers & projection stores should be using the
|
||||
%% %% same projection which is max projection in each store.
|
||||
%% ChMgrs = [get_chmgr(P) || {P, _Dir} <- All_listE],
|
||||
%% {no_change,_,Epoch_m} = machi_chain_manager1:test_react_to_env(
|
||||
%% hd(ChMgrs)),
|
||||
%% [{Epoch_m,{no_change,_,Epoch_m}} =
|
||||
%% {Epoch_m, machi_chain_manager1:test_react_to_env(
|
||||
%% ChMgr)} || ChMgr <- ChMgrs],
|
||||
?QC_FMT(",z~w", [?LINE]),
|
||||
|
||||
ProxiesDict = ?FLU_PC:start_proxies(Dict),
|
||||
|
||||
|
@ -356,6 +350,7 @@ prop_pulse() ->
|
|||
?QC_FMT("Report = ~p\n", [Report]),
|
||||
?QC_FMT("Sane = ~p\n", [Sane]),
|
||||
?QC_FMT("SingleChainNoRepair failure =\n ~p\n", [SingleChainNoRepair])
|
||||
,erlang:halt(0)
|
||||
end,
|
||||
conjunction([{res, Res == true orelse Res == ok},
|
||||
{all_disjoint, AllDisjointP},
|
||||
|
@ -381,10 +376,12 @@ prop_pulse_test_() ->
|
|||
end}.
|
||||
|
||||
shutdown_hard() ->
|
||||
?QC_FMT("shutdown(", []),
|
||||
(catch unlink(whereis(machi_partition_simulator))),
|
||||
[begin
|
||||
Pid = whereis(X),
|
||||
(catch X:stop()), timer:sleep(1),
|
||||
spawn(fun() -> (catch X:stop()) end),
|
||||
timer:sleep(50),
|
||||
(catch unlink(Pid)),
|
||||
timer:sleep(10),
|
||||
(catch exit(Pid, shutdown)),
|
||||
|
@ -392,8 +389,7 @@ shutdown_hard() ->
|
|||
(catch exit(Pid, kill))
|
||||
end || X <- [machi_partition_simulator, machi_flu_sup] ],
|
||||
timer:sleep(1),
|
||||
(catch machi_partition_simulator:stop()),
|
||||
timer:sleep(1),
|
||||
?QC_FMT(")", []),
|
||||
ok.
|
||||
|
||||
exec_ticks(Num, All_listE) ->
|
||||
|
|
Loading…
Reference in a new issue