WIP: bugfixes and lots of verbose goop added

This commit is contained in:
Scott Lystig Fritchie 2015-08-28 01:55:31 +09:00
parent deb2cdee2c
commit 8ca1ffdb13

View file

@ -1162,17 +1162,18 @@ react_to_env_A29(Retries, P_latest, LatestUnanimousP, ReadExtra,
if CMode == cp_mode, if CMode == cp_mode,
Epoch_latest > P_current#projection_v1.epoch_number, Epoch_latest > P_current#projection_v1.epoch_number,
Author_latest /= MyName -> Author_latest /= MyName ->
put(yyy_hack, []),
case make_zerf(P_current, S) of case make_zerf(P_current, S) of
Zerf when is_record(Zerf, projection_v1) -> Zerf when is_record(Zerf, projection_v1) ->
?REACT({a29, ?LINE, ?REACT({a29, ?LINE,
[{zerf_filler, true}, [{zerf_filler, true},
{zerf_in, machi_projection:make_summary(Zerf)}]}), {zerf_in, machi_projection:make_summary(Zerf)}]}),
%% io:format(user, "zerf_in @ A29: ~p: ~w\n", [MyName, machi_projection:make_summary(Zerf)]), io:format(user, "zerf_in: A29: ~p: ~w\n\t~p\n", [MyName, machi_projection:make_summary(Zerf), get(yyy_hack)]),
P_current2 = Zerf#projection_v1{ P_current2 = Zerf#projection_v1{
flap=P_current#projection_v1.flap}, flap=P_current#projection_v1.flap},
%% Do not use the usual set_proj() wrapper here. S2 = set_proj(S, P_current2),
react_to_env_A30(Retries, P_latest, LatestUnanimousP, react_to_env_A30(Retries, P_latest, LatestUnanimousP,
ReadExtra, S#ch_mgr{proj=P_current2}); ReadExtra, S2);
Zerf -> Zerf ->
{{{yo_todo_incomplete_fix_me_cp_mode, line, ?LINE, Zerf}}} {{{yo_todo_incomplete_fix_me_cp_mode, line, ?LINE, Zerf}}}
end; end;
@ -1649,8 +1650,8 @@ react_to_env_A49(_P_latest, FinalProps, #ch_mgr{name=MyName,
members_dict=MembersDict} = P_current, members_dict=MembersDict} = P_current,
P_none = make_none_projection(MyName, All_list, Witness_list, P_none = make_none_projection(MyName, All_list, Witness_list,
MembersDict), MembersDict),
%% Do not use the usual set_proj() wrapper here. io:format(user, "Debug A49: ~w forced to none\n", [MyName]),
react_to_env_A50(P_none, FinalProps, S#ch_mgr{proj=P_none}). react_to_env_A50(P_none, FinalProps, set_proj(S, P_none)).
react_to_env_A50(P_latest, FinalProps, #ch_mgr{proj=P_current}=S) -> react_to_env_A50(P_latest, FinalProps, #ch_mgr{proj=P_current}=S) ->
?REACT(a50), ?REACT(a50),
@ -2018,10 +2019,12 @@ react_to_env_C110(P_latest, #ch_mgr{name=MyName, proj=P_current,
case {?FLU_PC:write_projection(MyNamePid, private, P_latest2,?TO*30),Goo} of case {?FLU_PC:write_projection(MyNamePid, private, P_latest2,?TO*30),Goo} of
{ok, Goo} -> {ok, Goo} ->
?REACT({c120, [{write, ok}]}), ?REACT({c120, [{write, ok}]}),
perhaps_verbose_c110(P_latest2, S),
%% We very intentionally do *not* pass P_latest2 forward: %% We very intentionally do *not* pass P_latest2 forward:
%% we must avoid bloating the dbg2 list! %% we must avoid bloating the dbg2 list!
react_to_env_C120(P_latest, [], S); P_latest_perhaps_annotated =
machi_projection:update_dbg2(P_latest, Extra1),
perhaps_verbose_c110(P_latest_perhaps_annotated, S),
react_to_env_C120(P_latest_perhaps_annotated, [], S);
{{error, bad_arg}, _Goo} -> {{error, bad_arg}, _Goo} ->
?REACT({c120, [{write, bad_arg}]}), ?REACT({c120, [{write, bad_arg}]}),
@ -2053,7 +2056,7 @@ react_to_env_C110(P_latest, #ch_mgr{name=MyName, proj=P_current,
%% React to newer public write by restarting the iteration. %% React to newer public write by restarting the iteration.
react_to_env_A20(0, S); react_to_env_A20(0, S);
Else -> Else ->
Summ = machi_projection:make_summary(P_latest), Summ = machi_projection:make_summary(P_latest2),
io:format(user, "C110 error by ~w: ~w, ~w\n~p\n", io:format(user, "C110 error by ~w: ~w, ~w\n~p\n",
[MyName, Else, Summ, get(react)]), [MyName, Else, Summ, get(react)]),
error_logger:error_msg("C110 error by ~w: ~w, ~w, ~w\n", error_logger:error_msg("C110 error by ~w: ~w, ~w, ~w\n",
@ -2070,9 +2073,16 @@ react_to_env_C120(P_latest, FinalProps, #ch_mgr{proj_history=H,
%% diversion_c120_verbose_goop(P_latest, S), %% diversion_c120_verbose_goop(P_latest, S),
?REACT({c120, [{latest, machi_projection:make_summary(P_latest)}]}), ?REACT({c120, [{latest, machi_projection:make_summary(P_latest)}]}),
{{now_using, FinalProps, P_latest#projection_v1.epoch_number}, S2 = set_proj(S#ch_mgr{proj_history=H2,
set_proj(S#ch_mgr{proj_history=H2, sane_transitions=Xtns + 1}, P_latest),
sane_transitions=Xtns + 1}, P_latest)}. S3 = case is_annotated(P_latest) of
false ->
S2;
{{_ConfEpoch, _ConfCSum}, ConfTime} ->
io:format(user, "\nCONFIRM debug C120 ~w was annotated ~W outer ~w\n", [S#ch_mgr.name, (inner_projection_or_self(P_latest))#projection_v1.epoch_number, 5, P_latest#projection_v1.epoch_number]),
S2#ch_mgr{proj_unanimous=ConfTime}
end,
{{now_using, FinalProps, P_latest#projection_v1.epoch_number}, S3}.
add_and_trunc_history(P_latest, H, MaxLength) -> add_and_trunc_history(P_latest, H, MaxLength) ->
H2 = if P_latest#projection_v1.epoch_number > 0 -> H2 = if P_latest#projection_v1.epoch_number > 0 ->
@ -3150,6 +3160,7 @@ make_zerf(#projection_v1{epoch_number=OldEpochNum,
runenv=RunEnv1} = S) -> runenv=RunEnv1} = S) ->
{Up, _Partitions, _RunEnv2} = calc_up_nodes(MyName, {Up, _Partitions, _RunEnv2} = calc_up_nodes(MyName,
AllMembers, RunEnv1), AllMembers, RunEnv1),
(catch put(yyy_hack, [{up,Up}|get(yyy_hack)])),
MajoritySize = full_majority_size(AllMembers), MajoritySize = full_majority_size(AllMembers),
case length(Up) >= MajoritySize of case length(Up) >= MajoritySize of
false -> false ->
@ -3212,23 +3223,29 @@ zerf_find_last_annotated(FLU, MajoritySize, S) ->
(Epoch, Acc) -> (Epoch, Acc) ->
{ok, Proj} = ?FLU_PC:read_projection(Proxy, private, {ok, Proj} = ?FLU_PC:read_projection(Proxy, private,
Epoch, ?TO*10), Epoch, ?TO*10),
case proplists:get_value(private_proj_is_upi_unanimous, case is_annotated(Proj) of
Proj#projection_v1.dbg2) of false ->
undefined -> (catch put(yyy_hack, [{FLU, Epoch, not_annotated}|get(yyy_hack)])),
Acc; Acc;
{{ConfEpoch, ConfCSum}, _ConfTime} -> {{ConfEpoch, ConfCSum}, _ConfTime} ->
Px = if ConfEpoch == Epoch -> Px = if ConfEpoch == Epoch ->
(catch put(yyy_hack, [{FLU, Epoch, outer_ok}|get(yyy_hack)])),
Proj; Proj;
true -> true ->
%% We only use Proj2 for sanity checking
%% here, do not return an inner!
Proj2 = inner_projection_or_self(Proj), Proj2 = inner_projection_or_self(Proj),
%% Sanity checking %% Sanity checking
ConfEpoch = Proj2#projection_v1.epoch_number, ConfEpoch = Proj2#projection_v1.epoch_number,
ConfCSum = Proj2#projection_v1.epoch_csum, ConfCSum = Proj2#projection_v1.epoch_csum,
Proj2 (catch put(yyy_hack, [{FLU, Epoch, inner_ok_return_original_outerplusinner}|get(yyy_hack)])),
Proj
end, end,
if length(Px#projection_v1.upi) >= MajoritySize -> if length(Px#projection_v1.upi) >= MajoritySize ->
(catch put(yyy_hack, [{FLU, Epoch, yay}|get(yyy_hack)])),
Px; Px;
true -> true ->
(catch put(yyy_hack, [{FLU, Epoch, skip}|get(yyy_hack)])),
Acc Acc
end end
end end
@ -3364,3 +3381,6 @@ set_proj(S, Proj) ->
make_annotation(EpochID, Time) -> make_annotation(EpochID, Time) ->
{private_proj_is_upi_unanimous, {EpochID, Time}}. {private_proj_is_upi_unanimous, {EpochID, Time}}.
is_annotated(#projection_v1{dbg2=Dbg2}) ->
proplists:get_value(private_proj_is_upi_unanimous, Dbg2, false).