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,
#ch_mgr{name=MyName,
proj=CurrentProj,
consistency_mode=CMode,
runenv=RunEnv1,
repair_final_status=RepairFS}=S) ->
#projection_v1{epoch_number=OldEpochNum,
members_dict=MembersDict,
all_members=OldAll_list,
witnesses=OldWitness_list,
upi=OldUPI_list,
repairing=OldRepairing_list
@ -606,8 +606,6 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
Down = AllMembers -- Up,
NewUPI_list =
[W || W <- Up, lists:member(W, OldWitness_list)]
++
[X || X <- OldUPI_list, lists:member(X, Up) andalso
not lists:member(X, OldWitness_list)],
#projection_v1{upi=CurrentUPI_list} = CurrentProj,
@ -681,9 +679,15 @@ calc_projection(_OldThreshold, _NoPartitionThreshold, LastProj,
MyName, MembersDict, Down, NewUPI, NewRepairing,
D_foo ++
Dbg ++ [{ps, Partitions},{nodes_up, Up}]),
P2 = machi_projection:update_checksum(
P#projection_v1{witnesses=OldWitness_list}),
{P2, S#ch_mgr{runenv=RunEnv3}}.
P2 = if CMode == cp_mode ->
UpWitnesses = [W || W <- Up, lists:member(W, OldWitness_list)],
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) ->
%% 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}.
setup_smoke_test(Host, PortBase, Os, Witness_list) ->
io:format(user, "setup_smoke_test(", []),
os:cmd("rm -rf ./data.a ./data.b ./data.c"),
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,
private),
io:format(user, ")\n", []),
{D, EpochID}.
run_ticks(MgrList) ->