WIP: rearrange CP mode projection calc

This commit is contained in:
Scott Lystig Fritchie 2015-08-06 15:22:04 +09:00
parent 82b6726261
commit e9c4e2f98d
2 changed files with 10 additions and 8 deletions

View file

@ -587,11 +587,11 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
RelativeToServer, AllHosed, Dbg, RelativeToServer, AllHosed, Dbg,
#ch_mgr{name=MyName, #ch_mgr{name=MyName,
proj=CurrentProj, proj=CurrentProj,
consistency_mode=CMode,
runenv=RunEnv1, runenv=RunEnv1,
repair_final_status=RepairFS}=S) -> repair_final_status=RepairFS}=S) ->
#projection_v1{epoch_number=OldEpochNum, #projection_v1{epoch_number=OldEpochNum,
members_dict=MembersDict, members_dict=MembersDict,
all_members=OldAll_list,
witnesses=OldWitness_list, witnesses=OldWitness_list,
upi=OldUPI_list, upi=OldUPI_list,
repairing=OldRepairing_list repairing=OldRepairing_list
@ -606,8 +606,6 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
Down = AllMembers -- Up, Down = AllMembers -- Up,
NewUPI_list = NewUPI_list =
[W || W <- Up, lists:member(W, OldWitness_list)]
++
[X || X <- OldUPI_list, lists:member(X, Up) andalso [X || X <- OldUPI_list, lists:member(X, Up) andalso
not lists:member(X, OldWitness_list)], not lists:member(X, OldWitness_list)],
#projection_v1{upi=CurrentUPI_list} = CurrentProj, #projection_v1{upi=CurrentUPI_list} = CurrentProj,
@ -681,9 +679,15 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
MyName, MembersDict, Down, NewUPI, NewRepairing, MyName, MembersDict, Down, NewUPI, NewRepairing,
D_foo ++ D_foo ++
Dbg ++ [{ps, Partitions},{nodes_up, Up}]), Dbg ++ [{ps, Partitions},{nodes_up, Up}]),
P2 = machi_projection:update_checksum( P2 = if CMode == cp_mode ->
P#projection_v1{witnesses=OldWitness_list}), UpWitnesses = [W || W <- Up, lists:member(W, OldWitness_list)],
{P2, S#ch_mgr{runenv=RunEnv3}}. P;
CMode == ap_mode ->
P
end,
P3 = machi_projection:update_checksum(
P2#projection_v1{witnesses=OldWitness_list}),
{P3, S#ch_mgr{runenv=RunEnv3}}.
check_latest_private_projections_same_epoch(FLUs, MyProj, Partitions, S) -> check_latest_private_projections_same_epoch(FLUs, MyProj, Partitions, S) ->
%% NOTE: The caller must provide us with the FLUs list for all %% NOTE: The caller must provide us with the FLUs list for all

View file

@ -31,7 +31,6 @@
smoke_test_() -> {timeout, 1*60, fun() -> smoke_test2() end}. smoke_test_() -> {timeout, 1*60, fun() -> smoke_test2() end}.
setup_smoke_test(Host, PortBase, Os, Witness_list) -> setup_smoke_test(Host, PortBase, Os, Witness_list) ->
io:format(user, "setup_smoke_test(", []),
os:cmd("rm -rf ./data.a ./data.b ./data.c"), os:cmd("rm -rf ./data.a ./data.b ./data.c"),
F = fun(X) -> case lists:member(X, Witness_list) of F = fun(X) -> case lists:member(X, Witness_list) of
@ -70,7 +69,6 @@ io:format(user, "setup_smoke_test(", []),
{ok, EpochID} = machi_flu1_client:get_latest_epochid(Host, PortBase+2, {ok, EpochID} = machi_flu1_client:get_latest_epochid(Host, PortBase+2,
private), private),
io:format(user, ")\n", []),
{D, EpochID}. {D, EpochID}.
run_ticks(MgrList) -> run_ticks(MgrList) ->