From 8faa1404c689c130f15673bb9320d3a716e181b7 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Fri, 31 Oct 2014 17:25:27 +0900 Subject: [PATCH] Remove unused prev_epoch_num and prev_epoch_csum --- prototype/poc-machi/include/machi.hrl | 2 -- prototype/poc-machi/src/machi_chain_manager0.erl | 4 +--- prototype/poc-machi/src/machi_chain_manager1.erl | 14 +++++--------- .../poc-machi/test/machi_chain_manager0_test.erl | 7 ------- 4 files changed, 6 insertions(+), 21 deletions(-) diff --git a/prototype/poc-machi/include/machi.hrl b/prototype/poc-machi/include/machi.hrl index 7a1d969..a7627ed 100644 --- a/prototype/poc-machi/include/machi.hrl +++ b/prototype/poc-machi/include/machi.hrl @@ -35,8 +35,6 @@ -record(projection, { epoch_number :: m_epoch_n(), epoch_csum :: m_csum(), - prev_epoch_num :: m_epoch_n(), - prev_epoch_csum :: m_csum(), all_members :: [m_server()], down :: [m_server()], creation_time :: timestamp(), diff --git a/prototype/poc-machi/src/machi_chain_manager0.erl b/prototype/poc-machi/src/machi_chain_manager0.erl index e7933ab..c0c3fed 100644 --- a/prototype/poc-machi/src/machi_chain_manager0.erl +++ b/prototype/poc-machi/src/machi_chain_manager0.erl @@ -47,12 +47,10 @@ make_initial_projection(MyName, All_list, UPI_list, Repairing_list, Ps) -> make_projection(1, 0, <<>>, MyName, All_list, [], UPI_list, Repairing_list, Ps). -make_projection(EpochNum, PrevEpochNum, PrevEpochCSum, +make_projection(EpochNum, _PrevEpochNum, _PrevEpochCSum, MyName, All_list, Down_list, UPI_list, Repairing_list, Ps) -> P = #projection{epoch_number=EpochNum, epoch_csum= <<>>, - prev_epoch_num=PrevEpochNum, - prev_epoch_csum=PrevEpochCSum, creation_time=now(), author_server=MyName, all_members=All_list, diff --git a/prototype/poc-machi/src/machi_chain_manager1.erl b/prototype/poc-machi/src/machi_chain_manager1.erl index c770d6c..40fed28 100644 --- a/prototype/poc-machi/src/machi_chain_manager1.erl +++ b/prototype/poc-machi/src/machi_chain_manager1.erl @@ -320,23 +320,20 @@ do_read_repair(FLUsRs, _Extra, #ch_mgr{proj=CurrentProj} = S) -> end. make_initial_projection(MyName, All_list, UPI_list, Repairing_list, Ps) -> - make_projection(0, -1, <<>>, - MyName, All_list, [], UPI_list, Repairing_list, Ps). + make_projection(0, MyName, All_list, [], UPI_list, Repairing_list, Ps). -make_projection(EpochNum, PrevEpochNum, PrevEpochCSum, +make_projection(EpochNum, MyName, All_list, Down_list, UPI_list, Repairing_list, Dbg) -> - make_projection(EpochNum, PrevEpochNum, PrevEpochCSum, + make_projection(EpochNum, MyName, All_list, Down_list, UPI_list, Repairing_list, Dbg, []). -make_projection(EpochNum, PrevEpochNum, PrevEpochCSum, +make_projection(EpochNum, MyName, All_list, Down_list, UPI_list, Repairing_list, Dbg, Dbg2) -> P = #projection{epoch_number=EpochNum, epoch_csum= <<>>, % always checksums as <<>> - prev_epoch_num=PrevEpochNum, - prev_epoch_csum=PrevEpochCSum, creation_time=now(), author_server=MyName, all_members=All_list, @@ -368,7 +365,6 @@ calc_projection(#ch_mgr{proj=LastProj, runenv=RunEnv} = S, Dbg) -> calc_projection(OldThreshold, NoPartitionThreshold, LastProj, Dbg, #ch_mgr{name=MyName, runenv=RunEnv1} = S) -> #projection{epoch_number=OldEpochNum, - epoch_csum=OldEpochCsum, all_members=All_list, upi=OldUPI_list, repairing=OldRepairing_list @@ -401,7 +397,7 @@ calc_projection(OldThreshold, NoPartitionThreshold, LastProj, Dbg, NewUp -> Repairing_list3 ++ NewUp end, Repairing_list5 = Repairing_list4 -- Down, - P = make_projection(OldEpochNum + 1, OldEpochNum, OldEpochCsum, + P = make_projection(OldEpochNum + 1, MyName, All_list, Down, NewUPI_list3, Repairing_list5, Dbg ++ [{nodes_up, Up}]), {P, S#ch_mgr{runenv=RunEnv3}}. diff --git a/prototype/poc-machi/test/machi_chain_manager0_test.erl b/prototype/poc-machi/test/machi_chain_manager0_test.erl index 34f11ad..05eb86e 100644 --- a/prototype/poc-machi/test/machi_chain_manager0_test.erl +++ b/prototype/poc-machi/test/machi_chain_manager0_test.erl @@ -222,8 +222,6 @@ projection_transitions_are_sane([P1, P2|T]) -> projection_transition_is_sane( #projection{epoch_number=Epoch1, epoch_csum=CSum1, - prev_epoch_num=PrevEpoch1, - prev_epoch_csum=PrevCSum1, creation_time=CreationTime1, author_server=AuthorServer1, all_members=All_list1, @@ -233,8 +231,6 @@ projection_transition_is_sane( dbg=Dbg1} = P1, #projection{epoch_number=Epoch2, epoch_csum=CSum2, - prev_epoch_num=PrevEpoch2, - prev_epoch_csum=PrevCSum2, creation_time=CreationTime2, author_server=AuthorServer2, all_members=All_list2, @@ -245,8 +241,6 @@ projection_transition_is_sane( try true = is_integer(Epoch1) andalso is_integer(Epoch2), true = is_binary(CSum1) andalso is_binary(CSum2), - true = is_integer(PrevEpoch1) andalso is_integer(PrevEpoch2), - true = is_binary(PrevCSum1) andalso is_binary(PrevCSum2), {_,_,_} = CreationTime1, {_,_,_} = CreationTime2, true = is_atom(AuthorServer1) andalso is_atom(AuthorServer2), % todo will probably change @@ -257,7 +251,6 @@ projection_transition_is_sane( true = is_list(Dbg1) andalso is_list(Dbg2), true = Epoch2 > Epoch1, - true = PrevEpoch2 > PrevEpoch1, All_list1 = All_list2, % todo will probably change %% No duplicates