Bugfix: allow none proj to re-emerge from flapping (more)

See comments added in this commit at A40.

So far, I've been doing CP mode testing with a handful of (very useful)
network partition combinations using:

    machi_chain_manager1_converge_demo:t(3, [{private_write_verbose,true}, {consistency_mode, cp_mode}, {witnesses, [a]}]).

Next steps:

* Expand number & types of partitions
* Expand to chain lengths of 5 and beyond
This commit is contained in:
Scott Lystig Fritchie 2015-08-29 21:36:53 +09:00
parent ee19a0856b
commit 94394d3429
2 changed files with 15 additions and 9 deletions

View file

@ -1641,6 +1641,7 @@ react_to_env_A40(Retries, P_newprop, P_latest, LatestUnanimousP,
true ->
?REACT({a40, ?LINE, [true]}),
CurrentZerfInStatus_p = has_make_zerf_annotation(P_current),
GoTo50_p =
case inner_projection_exists(P_current) andalso
inner_projection_exists(P_newprop) andalso
@ -1664,8 +1665,20 @@ react_to_env_A40(Retries, P_newprop, P_latest, LatestUnanimousP,
true
end;
false ->
?REACT({a40, ?LINE, []}),
true
?REACT({a40, ?LINE, [{currentzerfinstatus_p,CurrentZerfInStatus_p}]}),
if CurrentZerfInStatus_p andalso
P_newprop#projection_v1.upi /= [] ->
%% One scenario here: we are waking up after
%% a slumber with the none proj and need to
%% send P_newprop (which has non/empty UPI)
%% through the process to continue chain
%% recovery.
?REACT({a40, ?LINE, []}),
false;
true ->
?REACT({a40, ?LINE, []}),
true
end
end,
if GoTo50_p ->
?REACT({a40, ?LINE, []}),
@ -1692,10 +1705,6 @@ react_to_env_A50(P_latest, FinalProps, #ch_mgr{proj=P_current}=S) ->
?REACT({a50, ?LINE, [{current_epoch, P_current#projection_v1.epoch_number},
{latest_epoch, P_latest#projection_v1.epoch_number},
{final_props, FinalProps}]}),
V = case file:read_file("/tmp/moomoo") of {ok, _} -> true; _ -> false end,
if V,S#ch_mgr.name == b -> io:format(user, "A50: ~p: ~p\n", [S#ch_mgr.name, get(react)]); true -> ok end,
%% if V andalso (S#ch_mgr.name == b orelse S#ch_mgr.name == c) -> io:format(user, "A50: ~p: ~p\n", [S#ch_mgr.name, get(react)]); true -> ok end,
%% io:format(user, "Debug A50: ~w P_current outer ~w ~w ~w\n", [S#ch_mgr.name, P_current#projection_v1.epoch_number,P_current#projection_v1.upi,P_current#projection_v1.repairing]),
{{no_change, FinalProps, P_current#projection_v1.epoch_number}, S}.
react_to_env_B10(Retries, P_newprop, P_latest, LatestUnanimousP,

View file

@ -254,10 +254,8 @@ convergence_demo_testfun(NumFLUs, MgrOpts0) ->
AllPs = make_partition_list(All_list),
PartitionCounts = lists:zip(AllPs, lists:seq(1, length(AllPs))),
MaxIters = NumFLUs * (NumFLUs + 1) * 6,
os:cmd("rm -f /tmp/moomoo"),
[begin
machi_partition_simulator:always_these_partitions(Partition),
%% if Partition==[] -> os:cmd("touch /tmp/moomoo"); true -> ok end,
io:format(user, "\nSET partitions = ~w (~w of ~w) at ~w\n",
[Partition, Count, length(AllPs), time()]),
true = lists:foldl(
@ -318,7 +316,6 @@ os:cmd("rm -f /tmp/moomoo"),
end || {Partition, Count} <- PartitionCounts
],
os:cmd("touch /tmp/moomoo"),
io:format(user, "\nSET partitions = []\n", []),
io:format(user, "We should see convergence to 1 correct chain.\n", []),
machi_partition_simulator:no_partitions(),