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,
|
end,
|
||||||
Repairing_list2 = [X || X <- OldRepairing_list, lists:member(X, Up)],
|
Repairing_list2 = [X || X <- OldRepairing_list, lists:member(X, Up)],
|
||||||
Simulator_p = proplists:get_value(use_partition_simulator, RunEnv2, false),
|
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} =
|
{NewUPI_list3, Repairing_list3, RunEnv3} =
|
||||||
case {NewUp, Repairing_list2} of
|
case {NewUp, Repairing_list2} of
|
||||||
{[], []} ->
|
{[], []} ->
|
||||||
|
@ -595,7 +594,7 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
|
||||||
SameEpoch_p = check_latest_private_projections_same_epoch(
|
SameEpoch_p = check_latest_private_projections_same_epoch(
|
||||||
tl(NewUPI_list) ++ Repairing_list2,
|
tl(NewUPI_list) ++ Repairing_list2,
|
||||||
S#ch_mgr.proj, Partitions, S),
|
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}}],
|
D_foo=[{repair_airquote_done, {we_agree, (S#ch_mgr.proj)#projection_v1.epoch_number}}],
|
||||||
{NewUPI_list ++ [H], T, RunEnv2};
|
{NewUPI_list ++ [H], T, RunEnv2};
|
||||||
not Simulator_p
|
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
|
%% am/should be repairing. We ignore our proposal and try
|
||||||
%% to go with the latest.
|
%% to go with the latest.
|
||||||
?REACT({c100, ?LINE, [repairing_short_circuit]}),
|
?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);
|
react_to_env_C110(P_latest, S);
|
||||||
{_, true} ->
|
{_, true} ->
|
||||||
?REACT({c100, ?LINE, [sane]}),
|
?REACT({c100, ?LINE, [sane]}),
|
||||||
|
@ -1719,10 +1721,13 @@ projection_transition_is_sane(
|
||||||
MoreCheckingP ->
|
MoreCheckingP ->
|
||||||
%% Where did elements in UPI_2_suffix come from?
|
%% Where did elements in UPI_2_suffix come from?
|
||||||
%% Only two sources are permitted.
|
%% Only two sources are permitted.
|
||||||
[lists:member(X, Repairing_list1) % X added after repair done
|
Oops_check_UPI_2_suffix =
|
||||||
orelse
|
[lists:member(X, Repairing_list1) % X added after repair done
|
||||||
lists:member(X, UPI_list1) % X in UPI_list1 after common pref
|
orelse
|
||||||
|| X <- UPI_2_suffix],
|
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
|
%% The UPI_2_suffix must exactly be equal to: ordered items from
|
||||||
%% UPI_list1 concat'ed with ordered items from Repairing_list1.
|
%% 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 projection to an inner one. The old
|
||||||
%% normal has a UPI that has nothing to do with
|
%% normal has a UPI that has nothing to do with
|
||||||
%% RelativeToServer a.k.a. me.
|
%% 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:
|
%% from:
|
||||||
%% {epoch,847},{author,c},{upi,[c]},{repair,[]},
|
%% {epoch,847},{author,c},{upi,[c]},{repair,[]},
|
||||||
%% {down,[a,b,d]}
|
%% {down,[a,b,d]}
|
||||||
%% to:
|
%% to:
|
||||||
%% {epoch,848},{author,a},{upi,[a]},{repair,[]},
|
%% {epoch,848},{author,a},{upi,[a]},{repair,[]},
|
||||||
%% {down,[b,c,d]}
|
%% {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:
|
%% Here's another case that's alright:
|
||||||
%%
|
%%
|
||||||
|
|
|
@ -126,23 +126,23 @@ setup(Num, Seed) ->
|
||||||
All_listE = lists:sublist(all_list_extra(), Num),
|
All_listE = lists:sublist(all_list_extra(), Num),
|
||||||
%% shutdown_hard() has taken care of killing all relevant procs.
|
%% shutdown_hard() has taken care of killing all relevant procs.
|
||||||
[machi_flu1_test:clean_up_data_dir(Dir) || {_P, Dir} <- All_listE],
|
[machi_flu1_test:clean_up_data_dir(Dir) || {_P, Dir} <- All_listE],
|
||||||
|
?QC_FMT(",z~w", [?LINE]),
|
||||||
|
|
||||||
%% Start partition simulator
|
%% Start partition simulator
|
||||||
{ok, PSimPid} = machi_partition_simulator:start_link(Seed, 0, 100),
|
{ok, PSimPid} = machi_partition_simulator:start_link(Seed, 0, 100),
|
||||||
_Partitions = machi_partition_simulator:get(All_list),
|
_Partitions = machi_partition_simulator:get(All_list),
|
||||||
|
?QC_FMT(",z~w", [?LINE]),
|
||||||
|
|
||||||
%% Start FLUs and their associated procs
|
%% Start FLUs and their associated procs
|
||||||
{ok, SupPid} = machi_flu_sup:start_link(),
|
{ok, SupPid} = machi_flu_sup:start_link(),
|
||||||
FluOpts = [{use_partition_simulator, true}, {active_mode, false},
|
FluOpts = [{use_partition_simulator, true}, {active_mode, false}],
|
||||||
%% TODO: Move repair_always_done to ETS table and reset
|
|
||||||
%% after setup?
|
|
||||||
{repair_always_done, true}],
|
|
||||||
[begin
|
[begin
|
||||||
#p_srvr{name=Name, port=Port} = P,
|
#p_srvr{name=Name, port=Port} = P,
|
||||||
{ok, _} = machi_flu_psup:start_flu_package(Name, Port, Dir, FluOpts)
|
{ok, _} = machi_flu_psup:start_flu_package(Name, Port, Dir, FluOpts)
|
||||||
end || {P, Dir} <- All_listE],
|
end || {P, Dir} <- All_listE],
|
||||||
%% Set up the chain
|
%% Set up the chain
|
||||||
Dict = orddict:from_list([{P#p_srvr.name, P} || {P, _Dir} <- All_listE]),
|
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) ||
|
[machi_chain_manager1:set_chain_members(get_chmgr(P), Dict) ||
|
||||||
{P, _Dir} <- All_listE],
|
{P, _Dir} <- All_listE],
|
||||||
%% Trigger some environment reactions for humming consensus: first
|
%% Trigger some environment reactions for humming consensus: first
|
||||||
|
@ -151,17 +151,11 @@ setup(Num, Seed) ->
|
||||||
[begin
|
[begin
|
||||||
_QQa = machi_chain_manager1:test_react_to_env(get_chmgr(P))
|
_QQa = machi_chain_manager1:test_react_to_env(get_chmgr(P))
|
||||||
end || {P, _Dir} <- All_listE, _I <- lists:seq(1,20), _Repeat <- [1,2]],
|
end || {P, _Dir} <- All_listE, _I <- lists:seq(1,20), _Repeat <- [1,2]],
|
||||||
|
?QC_FMT(",z~w", [?LINE]),
|
||||||
[begin
|
[begin
|
||||||
_QQa = machi_chain_manager1:test_react_to_env(get_chmgr(P))
|
_QQa = machi_chain_manager1:test_react_to_env(get_chmgr(P))
|
||||||
end || _I <- lists:seq(1,20), {P, _Dir} <- All_listE, _Repeat <- [1,2]],
|
end || _I <- lists:seq(1,20), {P, _Dir} <- All_listE, _Repeat <- [1,2]],
|
||||||
%% %% All chain managers & projection stores should be using the
|
?QC_FMT(",z~w", [?LINE]),
|
||||||
%% %% 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],
|
|
||||||
|
|
||||||
ProxiesDict = ?FLU_PC:start_proxies(Dict),
|
ProxiesDict = ?FLU_PC:start_proxies(Dict),
|
||||||
|
|
||||||
|
@ -356,6 +350,7 @@ prop_pulse() ->
|
||||||
?QC_FMT("Report = ~p\n", [Report]),
|
?QC_FMT("Report = ~p\n", [Report]),
|
||||||
?QC_FMT("Sane = ~p\n", [Sane]),
|
?QC_FMT("Sane = ~p\n", [Sane]),
|
||||||
?QC_FMT("SingleChainNoRepair failure =\n ~p\n", [SingleChainNoRepair])
|
?QC_FMT("SingleChainNoRepair failure =\n ~p\n", [SingleChainNoRepair])
|
||||||
|
,erlang:halt(0)
|
||||||
end,
|
end,
|
||||||
conjunction([{res, Res == true orelse Res == ok},
|
conjunction([{res, Res == true orelse Res == ok},
|
||||||
{all_disjoint, AllDisjointP},
|
{all_disjoint, AllDisjointP},
|
||||||
|
@ -381,10 +376,12 @@ prop_pulse_test_() ->
|
||||||
end}.
|
end}.
|
||||||
|
|
||||||
shutdown_hard() ->
|
shutdown_hard() ->
|
||||||
|
?QC_FMT("shutdown(", []),
|
||||||
(catch unlink(whereis(machi_partition_simulator))),
|
(catch unlink(whereis(machi_partition_simulator))),
|
||||||
[begin
|
[begin
|
||||||
Pid = whereis(X),
|
Pid = whereis(X),
|
||||||
(catch X:stop()), timer:sleep(1),
|
spawn(fun() -> (catch X:stop()) end),
|
||||||
|
timer:sleep(50),
|
||||||
(catch unlink(Pid)),
|
(catch unlink(Pid)),
|
||||||
timer:sleep(10),
|
timer:sleep(10),
|
||||||
(catch exit(Pid, shutdown)),
|
(catch exit(Pid, shutdown)),
|
||||||
|
@ -392,8 +389,7 @@ shutdown_hard() ->
|
||||||
(catch exit(Pid, kill))
|
(catch exit(Pid, kill))
|
||||||
end || X <- [machi_partition_simulator, machi_flu_sup] ],
|
end || X <- [machi_partition_simulator, machi_flu_sup] ],
|
||||||
timer:sleep(1),
|
timer:sleep(1),
|
||||||
(catch machi_partition_simulator:stop()),
|
?QC_FMT(")", []),
|
||||||
timer:sleep(1),
|
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
exec_ticks(Num, All_listE) ->
|
exec_ticks(Num, All_listE) ->
|
||||||
|
|
Loading…
Reference in a new issue