From 471cde1f2cef549b3504f35d9411c70d4170b4cf Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Mon, 6 Jul 2015 16:11:14 +0900 Subject: [PATCH] WIP: debugging fmt shuffle --- src/machi_chain_manager1.erl | 16 +++--- test/machi_chain_manager1_converge_demo.erl | 54 +++++++++++++-------- 2 files changed, 42 insertions(+), 28 deletions(-) diff --git a/src/machi_chain_manager1.erl b/src/machi_chain_manager1.erl index 200e6cc..3442fdc 100644 --- a/src/machi_chain_manager1.erl +++ b/src/machi_chain_manager1.erl @@ -1343,11 +1343,11 @@ react_to_env_C100(P_newprop, P_latest, I_am_Repairing_in_latest_p = lists:member(MyName, P_latest#projection_v1.repairing), Sane = projection_transition_is_sane(P_current, P_latest, MyName), - put(xxx_hack, [{p_current, machi_projection:make_summary(P_current)}, - {epoch_compare, P_latest#projection_v1.epoch_number > P_current#projection_v1.epoch_number}, - {i_am_upi_in_newprop_p, I_am_UPI_in_newprop_p}, - {i_am_repairing_in_latest_p, I_am_Repairing_in_latest_p}, - {sane_p, Sane}]), + %% put(xxx_hack, [{p_current, machi_projection:make_summary(P_current)}, + %% {epoch_compare, P_latest#projection_v1.epoch_number > P_current#projection_v1.epoch_number}, + %% {i_am_upi_in_newprop_p, I_am_UPI_in_newprop_p}, + %% {i_am_repairing_in_latest_p, I_am_Repairing_in_latest_p}, + %% {sane_p, Sane}]), case Sane of _ when P_current#projection_v1.epoch_number == 0 -> %% Epoch == 0 is reserved for first-time, just booting conditions. @@ -1366,8 +1366,8 @@ react_to_env_C100(P_newprop, P_latest, react_to_env_C110(P_latest, #ch_mgr{name=MyName} = S) -> ?REACT(c110), - %% Extra_todo = [], - Extra_todo = get(xxx_hack), + Extra_todo = [], + %% Extra_todo = get(xxx_hack), %% Extra_todo = [{hee, lists:reverse(get(react))}], P_latest2 = machi_projection:update_dbg2(P_latest, Extra_todo), @@ -1385,6 +1385,7 @@ react_to_env_C110(P_latest, #ch_mgr{name=MyName} = S) -> {_,_,C} = os:timestamp(), MSec = trunc(C / 1000), {HH,MM,SS} = time(), +io:format(user, "HEE120 ~w ~w ~P\n", [S#ch_mgr.name, self(), get(react), 150]), case inner_projection_exists(P_latest2) of false -> case proplists:get_value(private_write_verbose, S#ch_mgr.opts) of @@ -1684,7 +1685,6 @@ projection_transition_is_sane_final_review(_P1, P2, %% the correct authorship here. if UPI1_tail == P2#projection_v1.author_server -> - io:format(user, "\nset new projection by author ~w is OK!!!!\n", [UPI1_tail]), ?RETURN2(true); true -> ?RETURN2(Else) diff --git a/test/machi_chain_manager1_converge_demo.erl b/test/machi_chain_manager1_converge_demo.erl index 0b7f0bb..761f74a 100644 --- a/test/machi_chain_manager1_converge_demo.erl +++ b/test/machi_chain_manager1_converge_demo.erl @@ -154,9 +154,10 @@ convergence_demo_testfun(NumFLUs, MgrOpts0) -> %% Faster test startup, commented: timer:sleep(3000), TcpPort = 62877, - FluInfo = [{a,TcpPort+0,"./data.a"}, {b,TcpPort+1,"./data.b"}, - {c,TcpPort+2,"./data.c"}, {d,TcpPort+3,"./data.d"}, - {e,TcpPort+4,"./data.e"}, {f,TcpPort+5,"./data.f"}], + ok = filelib:ensure_dir("/tmp/c/data.a"), + FluInfo = [{a,TcpPort+0,"/tmp/c/data.a"}, {b,TcpPort+1,"/tmp/c/data.b"}, + {c,TcpPort+2,"/tmp/c/data.c"}, {d,TcpPort+3,"/tmp/c/data.d"}, + {e,TcpPort+4,"/tmp/c/data.e"}, {f,TcpPort+5,"/tmp/c/data.f"}], FLU_biglist = [X || {X,_,_} <- FluInfo], All_list = lists:sublist(FLU_biglist, NumFLUs), io:format(user, "\nSET # of FLUs = ~w members ~w).\n", @@ -175,7 +176,6 @@ convergence_demo_testfun(NumFLUs, MgrOpts0) -> {Name, PPid} end || {#p_srvr{name=Name}=P, _Dir} <- PsDirs], MembersDict = machi_projection:make_members_dict(Ps), - %% MgrOpts = [private_write_verbose, {active_mode,false}, MgrOpts = MgrOpts0 ++ ?DEFAULT_MGR_OPTS, MgrNamez = [begin @@ -225,13 +225,14 @@ convergence_demo_testfun(NumFLUs, MgrOpts0) -> machi_partition_simulator:reset_thresholds(10, 50), io:format(user, "\nLet loose the dogs of war!\n", []), - DoIt(30, 0, 0), + [DoIt(30, 0, 0) || _ <- lists:seq(1,2)], AllPs = make_partition_list(All_list), PartitionCounts = lists:zip(AllPs, lists:seq(1, length(AllPs))), FLUFudge = if NumFLUs < 4 -> 2; true -> - 13 + 8 + %% 13 end, [begin machi_partition_simulator:always_these_partitions(Partition), @@ -262,9 +263,9 @@ catch _Err:_What -> exit({line, ?LINE, _Err, _What}) end, io:format(user, "Yay!\n", []), - ReportXXX = machi_chain_manager1_test:unanimous_report(Namez), - true = machi_chain_manager1_test:all_reports_are_disjoint(ReportXXX), -io:format(user, "\nLast Reports: ~p\n", [lists:nthtail(length(ReportXXX)-8,ReportXXX)]), +%% ReportXXX = machi_chain_manager1_test:unanimous_report(Namez), +%% true = machi_chain_manager1_test:all_reports_are_disjoint(ReportXXX), +%% io:format(user, "\nLast Reports: ~p\n", [lists:nthtail(length(ReportXXX)-8,ReportXXX)]), timer:sleep(1250), ok end || {Partition, Count} <- PartitionCounts @@ -290,7 +291,7 @@ io:format(user, "\nLast Reports: ~p\n", [lists:nthtail(length(ReportXXX)-8,Repor %% members appear in only one unique chain, i.e., the sets of %% unique chains are disjoint. true = machi_chain_manager1_test:all_reports_are_disjoint(Report), -io:format(user, "\nLast Reports: ~p\n", [lists:nthtail(length(Report)-8,Report)]), +%% io:format(user, "\nLast Reports: ~p\n", [lists:nthtail(length(Report)-8,Report)]), %% For each chain transition experienced by a particular FLU, %% confirm that each state transition is OK. @@ -338,10 +339,12 @@ make_partition_list(All_list) -> A <- All_list, B <- All_list, A /= B, C <- All_list, D <- All_list, C /= D, X /= A, X /= C, A /= C], + %% Concat = _X_Ys1. + %% Concat = _X_Ys2. %% Concat = _X_Ys1 ++ _X_Ys2. %% Concat = _X_Ys3. - Concat = _X_Ys1 ++ _X_Ys2 ++ _X_Ys3, - random_sort(lists:usort([lists:sort(L) || L <- Concat])). + %% Concat = _X_Ys1 ++ _X_Ys2 ++ _X_Ys3, + %% random_sort(lists:usort([lists:sort(L) || L <- Concat])). %% [ [{a,b},{b,d},{c,b}], %% [{a,b},{b,d},{c,b}, {a,b},{b,a},{a,c},{c,a},{a,d},{d,a}], @@ -352,17 +355,27 @@ make_partition_list(All_list) -> %% [ [{a,b}, {b,c}], %% [{a,b}, {c,b}] ]. - %% [{a,b}, {b,c}] ]. %% hosed-not-equal @ 3 FLUs + %% [ [{a,b}, {b,c}] ]. %% hosed-not-equal @ 3 FLUs - %% [{b,d}] ]. + %% [ [{b,d}] ]. + + %% [ [{a,b}], [], [{a,b}], [], [{a,b}] ]. + [ + [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], + [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], + [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], + [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], + [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], + [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [], [{a,b}], [] + ]. %% [ [{a,b}, {b,a}] ]. %% [ [{a,b},{b,c},{c,a}], %% [{a,b}, {b,a}, {a,c},{c,a}] ]. - %% [{a,b}, {c,b}], - %% [{a,b}, {b,c}] ]. + %% [ [{a,b}, {c,b}], + %% [{a,b}, {b,c}] ]. %% [ [{a,b}, {b,c}, {c,d}], %% [{a,b}, {b,c},{b,d}, {c,d}], @@ -376,17 +389,18 @@ make_partition_list(All_list) -> %% [{a,b}, {b,c}, {d,c}, {d,e}], %% [{a,b}, {b,c}, {c,d}, {e,d}] ]. - %% [ [{c,a}] ]. + %% [ [{c,a}] ]. %% TODO double-check for total repair stability at SET=[]!! - %% [ [{c,a}], [{c,b}, {a, b}] ]. + %% [ [{c,a}], + %% [{c,b}, {a, b}] ]. %% [ [{a,b},{b,a}, {a,c},{c,a}, {a,d},{d,a}], %% [{a,b},{b,a}, {a,c},{c,a}, {a,d},{d,a}, {b,c}], %% [{a,b},{b,a}, {a,c},{c,a}, {a,d},{d,a}, {c,d}] ]. - %% [ [{a,b}], - %% [{a,b}, {a,b},{b,a},{a,c},{c,a},{a,d},{d,a}], + %% [ [{a,b}, {a,b},{b,a},{a,c},{c,a},{a,d},{d,a}], %% [{a,b}, {b,a},{a,b},{b,c},{c,b},{b,d},{d,b}], + %% [{a,b}], %% [{a,b}, {c,a},{a,c},{c,b},{b,c},{c,d},{d,c}], %% [{a,b}, {d,a},{a,d},{d,b},{b,d},{d,c},{c,d}] ].