WIP: add more debugging/react info

This commit is contained in:
Scott Lystig Fritchie 2015-07-15 11:25:06 +09:00
parent 7c970d90a6
commit 0f667c4356
2 changed files with 12 additions and 2 deletions

View file

@ -694,6 +694,9 @@ calc_up_nodes_sim(MyName, AllMembers, RunEnv1) ->
[{network_partitions, Partitions2}, [{network_partitions, Partitions2},
{network_islands, Islands2}, {network_islands, Islands2},
{up_nodes, UpNodes}]), {up_nodes, UpNodes}]),
catch ?REACT({calc_up_nodes,?LINE,[{partitions,Partitions2},
{islands,Islands2},
{up_nodes, UpNodes}]}),
{UpNodes, Partitions2, RunEnv2}. {UpNodes, Partitions2, RunEnv2}.
replace(PropList, Items) -> replace(PropList, Items) ->
@ -1459,7 +1462,7 @@ react_to_env_C110(P_latest, #ch_mgr{name=MyName} = S) ->
end, end,
react_to_env_C120(P_latest, [], S). react_to_env_C120(P_latest, [], S).
react_to_env_C120(P_latest, FinalProps, #ch_mgr{proj_history=H} = S) -> react_to_env_C120(P_latest, FinalProps, #ch_mgr{proj_history=H}=S) ->
?REACT(c120), ?REACT(c120),
H2 = queue:in(P_latest, H), H2 = queue:in(P_latest, H),
H3 = case queue:len(H2) of H3 = case queue:len(H2) of
@ -1525,7 +1528,7 @@ react_to_env_C310(P_newprop, S) ->
calculate_flaps(P_newprop, _P_current, _FlapLimit, calculate_flaps(P_newprop, _P_current, _FlapLimit,
#ch_mgr{name=MyName, proj_history=H, flap_start=FlapStart, #ch_mgr{name=MyName, proj_history=H, flap_start=FlapStart,
flaps=Flaps, runenv=RunEnv1} = S) -> flaps=Flaps, runenv=RunEnv1}=S) ->
HistoryPs = queue:to_list(H), HistoryPs = queue:to_list(H),
Ps = HistoryPs ++ [P_newprop], Ps = HistoryPs ++ [P_newprop],
UniqueProposalSummaries = lists:usort([{P#projection_v1.upi, UniqueProposalSummaries = lists:usort([{P#projection_v1.upi,
@ -2073,6 +2076,10 @@ simple_chain_state_transition_is_sane(_Author1, UPI1, Repair1, Author2, UPI2) ->
Answer1 = false == lists:member(error, Orders) Answer1 = false == lists:member(error, Orders)
andalso Orders == lists:sort(Orders) andalso Orders == lists:sort(Orders)
andalso length(UPI2) == NumKeeps + NumOrders, andalso length(UPI2) == NumKeeps + NumOrders,
catch (put(react, [{sane,author1,_Author1, upi1,UPI1, repair1,Repair1,
author2,Author2, upi2,UPI2,
keepsdels,KeepsDels, orders,Orders, numKeeps,NumKeeps,
numOrders,NumOrders, answer1,Answer1}|get(react)])),
if not Answer1 -> if not Answer1 ->
?RETURN2(Answer1); ?RETURN2(Answer1);
true -> true ->

View file

@ -148,6 +148,7 @@ make_summary(#projection_v1{epoch_number=EpochNum,
upi=UPI_list, upi=UPI_list,
repairing=Repairing_list, repairing=Repairing_list,
inner=Inner, inner=Inner,
flap=Flap,
dbg=Dbg, dbg2=Dbg2}) -> dbg=Dbg, dbg2=Dbg2}) ->
InnerInfo = if is_record(Inner, projection_v1) -> InnerInfo = if is_record(Inner, projection_v1) ->
[{inner, make_summary(Inner)}]; [{inner, make_summary(Inner)}];
@ -157,6 +158,8 @@ make_summary(#projection_v1{epoch_number=EpochNum,
[{epoch,EpochNum},{author,Author}, [{epoch,EpochNum},{author,Author},
{upi,UPI_list},{repair,Repairing_list},{down,Down_list}] ++ {upi,UPI_list},{repair,Repairing_list},{down,Down_list}] ++
InnerInfo ++ InnerInfo ++
[{flap, Flap}] ++
%% [{flap, lists:flatten(io_lib:format("~p", [Flap]))}] ++
[{d,Dbg}, {d2,Dbg2}]. [{d,Dbg}, {d2,Dbg2}].
%% @doc Make a `p_srvr_dict()' out of a list of `p_srvr()' or out of a %% @doc Make a `p_srvr_dict()' out of a list of `p_srvr()' or out of a