Reduce verbosity, try fix up convergence demo for chain len=4

This commit is contained in:
Scott Lystig Fritchie 2015-06-15 12:41:16 +09:00
parent 9bf76e0bfb
commit b244a3b8e4
3 changed files with 67 additions and 16 deletions

View file

@ -1227,7 +1227,12 @@ react_to_env_B10(Retries, P_newprop, P_latest, LatestUnanimousP,
{newprop_flap_count, P_newprop_flap_count}, {newprop_flap_count, P_newprop_flap_count},
{flap_limit, FlapLimit}]}), {flap_limit, FlapLimit}]}),
_B10Hack = get(b10_hack), _B10Hack = get(b10_hack),
io:format(user, "{FLAP: ~w flaps ~w}! ", [S#ch_mgr.name, P_newprop_flap_count]), case proplists:get_value(private_write_verbose, S#ch_mgr.opts) of
true ->
io:format(user, "{FLAP: ~w flaps ~w}! ", [S#ch_mgr.name, P_newprop_flap_count]);
_ ->
ok
end,
if if
%% MEANWHILE, we have learned some things about this %% MEANWHILE, we have learned some things about this
@ -1372,14 +1377,24 @@ react_to_env_C110(P_latest, #ch_mgr{name=MyName} = S) ->
{HH,MM,SS} = time(), {HH,MM,SS} = time(),
case inner_projection_exists(P_latest2) of case inner_projection_exists(P_latest2) of
false -> false ->
case proplists:get_value(private_write_verbose, S#ch_mgr.opts) of
true ->
io:format(user, "\n~2..0w:~2..0w:~2..0w.~3..0w ~p uses plain: ~w\n", io:format(user, "\n~2..0w:~2..0w:~2..0w.~3..0w ~p uses plain: ~w\n",
[HH,MM,SS,MSec, S#ch_mgr.name, [HH,MM,SS,MSec, S#ch_mgr.name,
machi_projection:make_summary(P_latest2)]); machi_projection:make_summary(P_latest2)]);
_ ->
ok
end;
true ->
case proplists:get_value(private_write_verbose, S#ch_mgr.opts) of
true -> true ->
P_inner = inner_projection_or_self(P_latest2), P_inner = inner_projection_or_self(P_latest2),
io:format(user, "\n~2..0w:~2..0w:~2..0w.~3..0w ~p uses inner: ~w\n", io:format(user, "\n~2..0w:~2..0w:~2..0w.~3..0w ~p uses inner: ~w\n",
[HH,MM,SS,MSec, S#ch_mgr.name, [HH,MM,SS,MSec, S#ch_mgr.name,
machi_projection:make_summary(P_inner)]) machi_projection:make_summary(P_inner)]);
_ ->
ok
end
end; end;
_ -> _ ->
ok ok

View file

@ -168,7 +168,8 @@ convergence_demo_testfun(NumFLUs) ->
{Name, PPid} {Name, PPid}
end || {#p_srvr{name=Name}=P, _Dir} <- PsDirs], end || {#p_srvr{name=Name}=P, _Dir} <- PsDirs],
MembersDict = machi_projection:make_members_dict(Ps), MembersDict = machi_projection:make_members_dict(Ps),
MgrOpts = [private_write_verbose, {active_mode,false}, %% MgrOpts = [private_write_verbose, {active_mode,false},
MgrOpts = [{active_mode,false},
{use_partition_simulator, true}], {use_partition_simulator, true}],
MgrNamez = MgrNamez =
[begin [begin
@ -187,14 +188,15 @@ convergence_demo_testfun(NumFLUs) ->
Parent = self(), Parent = self(),
DoIt = fun(Iters, S_min, S_max) -> DoIt = fun(Iters, S_min, S_max) ->
io:format(user, "\nDoIt: top\n\n", []), %% io:format(user, "\nDoIt: top\n\n", []),
io:format(user, "DoIt, ", []),
Pids = [spawn(fun() -> Pids = [spawn(fun() ->
random:seed(now()), random:seed(now()),
[begin [begin
erlang:yield(), erlang:yield(),
S_max_rand = random:uniform( S_max_rand = random:uniform(
S_max + 1), S_max + 1),
io:format(user, "{t}", []), %% io:format(user, "{t}", []),
Elapsed = Elapsed =
?MGR:sleep_ranked_order( ?MGR:sleep_ranked_order(
S_min, S_max_rand, S_min, S_max_rand,
@ -218,16 +220,45 @@ convergence_demo_testfun(NumFLUs) ->
machi_partition_simulator:reset_thresholds(10, 50), machi_partition_simulator:reset_thresholds(10, 50),
io:format(user, "\nLet loose the dogs of war!\n", []), io:format(user, "\nLet loose the dogs of war!\n", []),
DoIt(30, 0, 0), DoIt(30, 0, 0),
AllPs = make_partition_list(All_list),
PartitionCounts = lists:zip(AllPs, lists:seq(1, length(AllPs))),
FLUFudge = if NumFLUs < 4 ->
2;
true ->
13
end,
[begin [begin
machi_partition_simulator:always_these_partitions(Partition), machi_partition_simulator:always_these_partitions(Partition),
io:format(user, "\nSET partitions = ~w.\n", [Partition]), io:format(user, "\nSET partitions = ~w (~w of ~w) at ~w\n",
[DoIt(40, 10, 50) || _ <- [1,2,3,4,5,6] ], [Partition, Count, length(AllPs), time()]),
[DoIt(40, 10, 50) || _ <- lists:seq(0, trunc(NumFLUs*FLUFudge)) ],
{stable,true} = {stable,private_projections_are_stable(Namez, DoIt)}, {stable,true} = {stable,private_projections_are_stable(Namez, DoIt)},
io:format(user, "\nSweet, private projections are stable\n", []), io:format(user, "\nSweet, private projections are stable\n", []),
io:format(user, "Rolling sanity check ... ", []),
PrivProjs = [{Name, begin
{ok, Ps8} = ?FLU_PC:get_all_projections(FLU,
private),
Ps9 = if length(Ps8) < 5*1000 ->
Ps8;
true ->
io:format(user, "trunc a bit... ", []),
lists:nthtail(3*1000, Ps8)
end,
[P || P <- Ps9,
P#projection_v1.epoch_number /= 0]
end} || {Name, FLU} <- Namez],
try
[{FLU, true} = {FLU, ?MGR:projection_transitions_are_sane_retrospective(Psx, FLU)} ||
{FLU, Psx} <- PrivProjs]
catch _Err:_What ->
io:format(user, "PrivProjs ~p\n", [PrivProjs]),
exit({line, ?LINE, _Err, _What})
end,
io:format(user, "Yay!\n", []),
timer:sleep(1250), timer:sleep(1250),
ok ok
end || Partition <- make_partition_list(All_list) end || {Partition, Count} <- PartitionCounts
], ],
%% exit(end_experiment), %% exit(end_experiment),
@ -300,7 +331,7 @@ make_partition_list(All_list) ->
%% Concat = _X_Ys1 ++ _X_Ys2. %% Concat = _X_Ys1 ++ _X_Ys2.
%% Concat = _X_Ys3. %% Concat = _X_Ys3.
Concat = _X_Ys1 ++ _X_Ys2 ++ _X_Ys3, Concat = _X_Ys1 ++ _X_Ys2 ++ _X_Ys3,
lists:usort([lists:sort(L) || L <- Concat]). random_sort(lists:usort([lists:sort(L) || L <- Concat])).
%% [ [{a,b},{b,d},{c,b}], %% [ [{a,b},{b,d},{c,b}],
%% [{a,b},{b,d},{c,b}, {a,b},{b,a},{a,c},{c,a},{a,d},{d,a}], %% [{a,b},{b,d},{c,b}, {a,b},{b,a},{a,c},{c,a},{a,d},{d,a}],
@ -379,5 +410,10 @@ get_latest_inner_proj_summ(FLU) ->
machi_chain_manager1:inner_projection_or_self(Proj), machi_chain_manager1:inner_projection_or_self(Proj),
{E, UPI, Repairing, Down}. {E, UPI, Repairing, Down}.
random_sort(L) ->
random:seed(now()),
L1 = [{random:uniform(99999), X} || X <- L],
[X || {_, X} <- lists:sort(L1)].
-endif. % !PULSE -endif. % !PULSE
-endif. % TEST -endif. % TEST

View file

@ -110,10 +110,10 @@ all_list_extra() ->
props=[{chmgr, b_chmgr}]}, "./data.pulse.b"} props=[{chmgr, b_chmgr}]}, "./data.pulse.b"}
, {#p_srvr{name=c, address="localhost", port=7402, , {#p_srvr{name=c, address="localhost", port=7402,
props=[{chmgr, c_chmgr}]}, "./data.pulse.c"} props=[{chmgr, c_chmgr}]}, "./data.pulse.c"}
%% , {#p_srvr{name=d, address="localhost", port=7403, , {#p_srvr{name=d, address="localhost", port=7403,
%% props=[{chmgr, d_chmgr}]}, "./data.pulse.d"} props=[{chmgr, d_chmgr}]}, "./data.pulse.d"}
%% , {#p_srvr{name=e, address="localhost", port=7404, , {#p_srvr{name=e, address="localhost", port=7404,
%% props=[{chmgr, e_chmgr}]}, "./data.pulse.e"} props=[{chmgr, e_chmgr}]}, "./data.pulse.e"}
]. ].
all_list() -> all_list() ->