From 93b9b948fcd60320d2a223098d47204d5b004948 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Thu, 27 Aug 2015 22:02:23 +0900 Subject: [PATCH] WIP: debugging, uff da --- src/machi_chain_manager1.erl | 11 +++++++++-- src/machi_projection.erl | 2 +- src/machi_projection_store.erl | 5 ++++- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/src/machi_chain_manager1.erl b/src/machi_chain_manager1.erl index d23c55b..874ab62 100644 --- a/src/machi_chain_manager1.erl +++ b/src/machi_chain_manager1.erl @@ -1857,7 +1857,9 @@ react_to_env_C100(P_newprop, #projection_v1{author_server=Author_latest, ?REACT(c100), Sane = projection_transition_is_sane(P_current, P_latest, MyName), - if Sane == true -> ok; true -> ?V("~w-insane-~w-auth=~w:~w:~w:~w:~w:~w:~w-~p,", [?LINE, MyName, P_newprop#projection_v1.author_server, P_newprop#projection_v1.epoch_number, P_newprop#projection_v1.upi, P_newprop#projection_v1.repairing, (inner_projection_or_self(P_newprop))#projection_v1.epoch_number, (inner_projection_or_self(P_newprop))#projection_v1.upi, (inner_projection_or_self(P_newprop))#projection_v1.repairing, Sane]) end, %%% DELME!!! + QQ_current = lists:flatten(io_lib:format("~w:~w,~w/~w:~w,~w", [P_current#projection_v1.epoch_number, P_current#projection_v1.upi, P_current#projection_v1.repairing, (inner_projection_or_self(P_current))#projection_v1.epoch_number, (inner_projection_or_self(P_current))#projection_v1.upi, (inner_projection_or_self(P_current))#projection_v1.repairing])), + QQ_latest = lists:flatten(io_lib:format("~w:~w,~w/~w:~w,~w", [P_latest#projection_v1.epoch_number, P_latest#projection_v1.upi, P_latest#projection_v1.repairing, (inner_projection_or_self(P_latest))#projection_v1.epoch_number, (inner_projection_or_self(P_latest))#projection_v1.upi, (inner_projection_or_self(P_latest))#projection_v1.repairing])), + if Sane == true -> ok; true -> ?V("\n~w-insane-~w-auth=~w ~s -> ~s ~w\n", [?LINE, MyName, P_newprop#projection_v1.author_server, QQ_current, QQ_latest, Sane]) end, Flap_latest = if is_record(Flap_latest0, flap_i) -> Flap_latest0; true -> @@ -2687,7 +2689,12 @@ poll_private_proj_is_upi_unanimous3(#ch_mgr{name=MyName, proj=P_current, PStr -> PStr end, - io:format(user, "\nCONFIRM epoch ~w ~W upi ~w rep ~w by ~w\n", [NewProj#projection_v1.epoch_number, NewProj#projection_v1.epoch_csum, 6, NewProj#projection_v1.upi, NewProj#projection_v1.repairing, MyName]), + #projection_v1{epoch_number=_EpochRep, + epoch_csum= <<_CSumRep:4/binary, _/binary>>, + upi=_UPIRep, + repairing=_RepairingRep} = + inner_projection_or_self(NewProj), + io:format(user, "\nCONFIRM epoch ~w ~w upi ~w rep ~w by ~w ~w\n", [_EpochRep, _CSumRep, _UPIRep, _RepairingRep, MyName, if P_current#projection_v1.inner == undefined -> outer; true -> {inner,{outer,P_current#projection_v1.epoch_number}} end]), ok = machi_projection_store:write(ProjStore, private, NewProj), %% Unwedge our FLU. {ok, NotifyPid} = machi_projection_store:get_wedge_notify_pid(ProjStore), diff --git a/src/machi_projection.erl b/src/machi_projection.erl index a31fb12..08b20ab 100644 --- a/src/machi_projection.erl +++ b/src/machi_projection.erl @@ -174,7 +174,7 @@ make_summary(#projection_v1{epoch_number=EpochNum, true -> [] end, - [{epoch,EpochNum}, %% {csum,CSum4}, + [{epoch,EpochNum}, {csum,_CSum4}, {author,Author}, {mode,CMode},{witnesses, Witness_list}, {upi,UPI_list},{repair,Repairing_list},{down,Down_list}] ++ InnerInfo ++ diff --git a/src/machi_projection_store.erl b/src/machi_projection_store.erl index a4987db..126698d 100644 --- a/src/machi_projection_store.erl +++ b/src/machi_projection_store.erl @@ -306,7 +306,10 @@ do_proj_write3(ProjType, #projection_v1{epoch_number=Epoch, if CurEpoch == Epoch, CurCSum == CSum -> do_proj_write4(ProjType, Proj, Path, Epoch, S); true -> - {{error, written}, S} + io:format(user, "OUCH: on disk: ~w\n", [machi_projection:make_summary(binary_to_term(Bin))]), + io:format(user, "OUCH: clobber: ~w\n", [machi_projection:make_summary(Proj)]), + io:format(user, "OUCH: clobber: ~p\n", [Proj#projection_v1.dbg2]), + {{error, written, CurEpoch, Epoch, CurCSum, CSum}, S} end; {error, enoent} -> do_proj_write4(ProjType, Proj, Path, Epoch, S);