From 8da46f78fe9ddb8fc53b3e6229d55caefd998c04 Mon Sep 17 00:00:00 2001 From: Scott Lystig Fritchie Date: Sun, 21 Sep 2014 15:48:20 +0900 Subject: [PATCH] BAH! Checkpoint is quite broken, see new README.tango.md --- prototype/tango-prototype/README.tango.md | 18 ++++++++++++++++++ prototype/tango-prototype/src/tango_dt.erl | 3 +++ prototype/tango-prototype/test/tango_test.erl | 5 +++++ 3 files changed, 26 insertions(+) create mode 100644 prototype/tango-prototype/README.tango.md diff --git a/prototype/tango-prototype/README.tango.md b/prototype/tango-prototype/README.tango.md new file mode 100644 index 0000000..eb7ef1a --- /dev/null +++ b/prototype/tango-prototype/README.tango.md @@ -0,0 +1,18 @@ + +Tango prototype TODO list +========================= + +__ The current checkpoint implementation is fundamentally broken and + needs a rewrite, or else. + option 1: fix checkpoint to be 100% correct + option 2: checkpointing is for the weak and the memory-constrained, so + don't bother. Instead, rip out the current checkpoint code, + period. + +__ Checkpoint fix option #1: history splicing within the same OID? + +__ Checkpoint fix option #2: checkpoint to a new OID, history writes to both + OIDs during the CP, then a marker in the old OID + to switch over to the new OID? + + diff --git a/prototype/tango-prototype/src/tango_dt.erl b/prototype/tango-prototype/src/tango_dt.erl index ad2863f..7a60ffe 100644 --- a/prototype/tango-prototype/src/tango_dt.erl +++ b/prototype/tango-prototype/src/tango_dt.erl @@ -75,6 +75,7 @@ checkpoint(Pid) -> init([PageSize, SequencerPid, Proj, CallbackMod, StreamNum]) -> LastLPN = find_last_lpn(SequencerPid, StreamNum), {LPNs, Pages} = fetch_unread_pages(Proj, LastLPN, 0, StreamNum), +?D({self(), LPNs}), BackPs = tango:append_lpns(LPNs, []), LastFetchLPN = tango:back_ps2last_lpn(BackPs), I_State = play_log_pages(Pages, CallbackMod:fresh(), CallbackMod, false), @@ -113,6 +114,7 @@ handle_call({sync_checkpoint}, From, {_OpT, I_State2, Proj1, _LPN} = CallbackMod:do_dirty_op(CheckpointOps, From, I_State, StreamNum, Proj0, PageSize), +?D({sync_checkpoint, _LPN}), %% TODO: Use this LPN so that we can tell the corfurl log GC %% that we have created some dead bytes in the log. {reply, ok, State#state{i_state=I_State2, @@ -161,6 +163,7 @@ roll_log_forward(#state{seq=SequencerPid, proj=Proj, all_back_ps=BackPs, last_fetch_lpn=StopAtLPN} = State) -> LastLPN = find_last_lpn(SequencerPid, StreamNum), {LPNs, Pages} = fetch_unread_pages(Proj, LastLPN, StopAtLPN, StreamNum), +?D({self(), LPNs}), NewBackPs = tango:append_lpns(LPNs, BackPs), LastFetchLPN = tango:back_ps2last_lpn(NewBackPs), play_log_pages(Pages, true, diff --git a/prototype/tango-prototype/test/tango_test.erl b/prototype/tango-prototype/test/tango_test.erl index eea5e05..0ddf1e0 100644 --- a/prototype/tango-prototype/test/tango_test.erl +++ b/prototype/tango-prototype/test/tango_test.erl @@ -294,12 +294,17 @@ tango_dt_queue_int(PageSize, Seq, Proj) -> ok = C1(Q2, Num1), ok = C1(Q1, Num1), +?D(before_CPs_start), [ok = MOD:checkpoint(Q1) || _ <- lists:seq(1, 4)], +?D(after_CPs_end), [ok = C1(X, Num1) || X <- [Q1, Q2]], {ok, Q3} = MOD:start_link(PageSize, Seq, Proj, Q1Num), [ok = C1(X, Num1) || X <- [Q1, Q2, Q3]], +?D(before_Q4_start), {ok, Q4} = MOD:start_link(PageSize, Seq, Proj, Q1Num), +?D({after_Q4_start, Q4}), ok = MOD:in(Q4, 89), +?D(after_Q4_in), Num1Plus1 = Num1 + 1, [ok = C1(X, Num1Plus1) || X <- [Q1, Q2, Q3, Q4]],