WIP: stuck, need to add even MORE repairing list, before continuing

This commit is contained in:
Scott Lystig Fritchie 2014-11-05 16:42:59 +09:00
parent a36f23ee7a
commit c69a206039
2 changed files with 27 additions and 15 deletions

View file

@ -398,6 +398,7 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
{NewUPI_list3, Repairing_list3, RunEnv3} = {NewUPI_list3, Repairing_list3, RunEnv3} =
case {NewUp, Repairing_list2} of case {NewUp, Repairing_list2} of
{[], []} -> {[], []} ->
D_foo=[],
{NewUPI_list, [], RunEnv2}; {NewUPI_list, [], RunEnv2};
{[], [H|T]} when RelativeToServer == hd(NewUPI_list) -> {[], [H|T]} when RelativeToServer == hd(NewUPI_list) ->
%% The author is head of the UPI list. Let's see if the %% The author is head of the UPI list. Let's see if the
@ -411,14 +412,18 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
andalso andalso
(S#ch_mgr.proj)#projection.epoch_csum == (S#ch_mgr.proj)#projection.epoch_csum ==
RemotePrivateProj#projection.epoch_csum -> RemotePrivateProj#projection.epoch_csum ->
D_foo=[{repair_airquote_done, {we_agree, RemotePrivateProj#projection.epoch_number}}],
{NewUPI_list ++ [H], T, RunEnv2}; {NewUPI_list ++ [H], T, RunEnv2};
true -> true ->
D_foo=[],
{NewUPI_list, OldRepairing_list, RunEnv2} {NewUPI_list, OldRepairing_list, RunEnv2}
end; end;
_ -> _ ->
D_foo=[],
{NewUPI_list, OldRepairing_list, RunEnv2} {NewUPI_list, OldRepairing_list, RunEnv2}
end; end;
{_, _} -> {_, _} ->
D_foo=[],
{NewUPI_list, OldRepairing_list, RunEnv2} {NewUPI_list, OldRepairing_list, RunEnv2}
end, end,
Repairing_list4 = case NewUp of Repairing_list4 = case NewUp of
@ -440,6 +445,7 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
P = make_projection(OldEpochNum + 1, P = make_projection(OldEpochNum + 1,
MyName, All_list, Down, NewUPI, NewRepairing, MyName, All_list, Down, NewUPI, NewRepairing,
D_foo ++
Dbg ++ [{nodes_up, Up}]), Dbg ++ [{nodes_up, Up}]),
{P, S#ch_mgr{runenv=RunEnv3}}. {P, S#ch_mgr{runenv=RunEnv3}}.

View file

@ -239,8 +239,9 @@ zoof_test() ->
R_Chains = [extract_chains_relative_to_flu(FLU, Report) || R_Chains = [extract_chains_relative_to_flu(FLU, Report) ||
FLU <- All_list], FLU <- All_list],
?D(R_Chains), ?D(R_Chains),
R_Projs = [{FLU, [chain_to_projection(FLU, Epoch, Chain, All_list) || R_Projs = [{FLU, [chain_to_projection(FLU, Epoch, UPI, Repairing,
{Epoch, Chain} <- E_Chains]} || All_list) ||
{Epoch, UPI, Repairing} <- E_Chains]} ||
{FLU, E_Chains} <- R_Chains], {FLU, E_Chains} <- R_Chains],
[{FLU, true} = {FLU, machi_chain_manager0_test:projection_transitions_are_sane(Ps)} || {FLU, Ps} <- R_Projs], [{FLU, true} = {FLU, machi_chain_manager0_test:projection_transitions_are_sane(Ps)} || {FLU, Ps} <- R_Projs],
?D(R_Projs), ?D(R_Projs),
@ -266,13 +267,15 @@ unanimous_report(Epoch, Namez) ->
{ok, T} -> T; {ok, T} -> T;
_Else -> not_in_this_epoch _Else -> not_in_this_epoch
end} || {FLUName, FLU} <- Namez], end} || {FLUName, FLU} <- Namez],
UPI_Sums = [{Proj#projection.upi, Proj#projection.epoch_csum} || UPI_R_Sums = [{Proj#projection.upi, Proj#projection.repairing,
Proj#projection.epoch_csum} ||
{_FLUname, Proj} <- Projs, {_FLUname, Proj} <- Projs,
is_record(Proj, projection)], is_record(Proj, projection)],
UniqueUPIs = lists:usort([UPI || {UPI, _CSum} <- UPI_Sums]), UniqueUPIs = lists:usort([UPI || {UPI, _Repairing, _CSum} <- UPI_R_Sums]),
Res = Res =
[begin [begin
case lists:usort([CSum || {U, CSum} <- UPI_Sums, U == UPI]) of case lists:usort([CSum || {U, _Repairing, CSum} <- UPI_R_Sums,
U == UPI]) of
[_] -> [_] ->
%% Yay, there's only 1 checksum. Let's check %% Yay, there's only 1 checksum. Let's check
%% that all FLUs are in agreement. %% that all FLUs are in agreement.
@ -282,11 +285,13 @@ unanimous_report(Epoch, Namez) ->
Else -> Else ->
Else Else
end} || FLU <- UPI], end} || FLU <- UPI],
{UPI, Repairing, _CSum} =
lists:keyfind(UPI, 1, UPI_R_Sums),
case lists:usort([CSum || {_FLU, CSum} <- Tmp]) of case lists:usort([CSum || {_FLU, CSum} <- Tmp]) of
[_] -> [_] ->
{agreed_membership, UPI}; {agreed_membership, {UPI, Repairing}};
Else2 -> Else2 ->
{not_agreed, UPI, Else2} {not_agreed, {UPI, Repairing}, Else2}
end; end;
_Else -> _Else ->
{UPI, not_unique, Epoch, _Else} {UPI, not_unique, Epoch, _Else}
@ -307,13 +312,14 @@ all_reports_are_disjoint(Report) ->
element(1, Tuple) /= ok_disjoint]. element(1, Tuple) /= ok_disjoint].
extract_chains_relative_to_flu(FLU, Report) -> extract_chains_relative_to_flu(FLU, Report) ->
{FLU, [{Epoch, UPI} || {Epoch, {ok_disjoint, Es}} <- Report, {FLU, [{Epoch, UPI, Repairing} ||
{agreed_membership, UPI} <- Es, {Epoch, {ok_disjoint, Es}} <- Report,
{agreed_membership, {UPI, Repairing}} <- Es,
lists:member(FLU, UPI)]}. lists:member(FLU, UPI)]}.
chain_to_projection(MyName, Epoch, UPI_list, All_list) -> chain_to_projection(MyName, Epoch, UPI_list, Repairing_list, All_list) ->
?MGR:make_projection(Epoch, MyName, All_list, ?MGR:make_projection(Epoch, MyName, All_list,
All_list -- UPI_list, % hack for down list All_list -- (UPI_list ++ Repairing_list),
UPI_list, [], []). UPI_list, Repairing_list, []).
-endif. -endif.