BAH! Checkpoint is quite broken, see new README.tango.md

This commit is contained in:
Scott Lystig Fritchie 2014-09-21 15:48:20 +09:00
parent 7bf98fa648
commit 8da46f78fe
3 changed files with 26 additions and 0 deletions

View file

@ -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?

View file

@ -75,6 +75,7 @@ checkpoint(Pid) ->
init([PageSize, SequencerPid, Proj, CallbackMod, StreamNum]) -> init([PageSize, SequencerPid, Proj, CallbackMod, StreamNum]) ->
LastLPN = find_last_lpn(SequencerPid, StreamNum), LastLPN = find_last_lpn(SequencerPid, StreamNum),
{LPNs, Pages} = fetch_unread_pages(Proj, LastLPN, 0, StreamNum), {LPNs, Pages} = fetch_unread_pages(Proj, LastLPN, 0, StreamNum),
?D({self(), LPNs}),
BackPs = tango:append_lpns(LPNs, []), BackPs = tango:append_lpns(LPNs, []),
LastFetchLPN = tango:back_ps2last_lpn(BackPs), LastFetchLPN = tango:back_ps2last_lpn(BackPs),
I_State = play_log_pages(Pages, CallbackMod:fresh(), CallbackMod, false), I_State = play_log_pages(Pages, CallbackMod:fresh(), CallbackMod, false),
@ -113,6 +114,7 @@ handle_call({sync_checkpoint}, From,
{_OpT, I_State2, Proj1, _LPN} = {_OpT, I_State2, Proj1, _LPN} =
CallbackMod:do_dirty_op(CheckpointOps, From, I_State, StreamNum, CallbackMod:do_dirty_op(CheckpointOps, From, I_State, StreamNum,
Proj0, PageSize), Proj0, PageSize),
?D({sync_checkpoint, _LPN}),
%% TODO: Use this LPN so that we can tell the corfurl log GC %% TODO: Use this LPN so that we can tell the corfurl log GC
%% that we have created some dead bytes in the log. %% that we have created some dead bytes in the log.
{reply, ok, State#state{i_state=I_State2, {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) -> last_fetch_lpn=StopAtLPN} = State) ->
LastLPN = find_last_lpn(SequencerPid, StreamNum), LastLPN = find_last_lpn(SequencerPid, StreamNum),
{LPNs, Pages} = fetch_unread_pages(Proj, LastLPN, StopAtLPN, StreamNum), {LPNs, Pages} = fetch_unread_pages(Proj, LastLPN, StopAtLPN, StreamNum),
?D({self(), LPNs}),
NewBackPs = tango:append_lpns(LPNs, BackPs), NewBackPs = tango:append_lpns(LPNs, BackPs),
LastFetchLPN = tango:back_ps2last_lpn(NewBackPs), LastFetchLPN = tango:back_ps2last_lpn(NewBackPs),
play_log_pages(Pages, true, play_log_pages(Pages, true,

View file

@ -294,12 +294,17 @@ tango_dt_queue_int(PageSize, Seq, Proj) ->
ok = C1(Q2, Num1), ok = C1(Q2, Num1),
ok = C1(Q1, Num1), ok = C1(Q1, Num1),
?D(before_CPs_start),
[ok = MOD:checkpoint(Q1) || _ <- lists:seq(1, 4)], [ok = MOD:checkpoint(Q1) || _ <- lists:seq(1, 4)],
?D(after_CPs_end),
[ok = C1(X, Num1) || X <- [Q1, Q2]], [ok = C1(X, Num1) || X <- [Q1, Q2]],
{ok, Q3} = MOD:start_link(PageSize, Seq, Proj, Q1Num), {ok, Q3} = MOD:start_link(PageSize, Seq, Proj, Q1Num),
[ok = C1(X, Num1) || X <- [Q1, Q2, Q3]], [ok = C1(X, Num1) || X <- [Q1, Q2, Q3]],
?D(before_Q4_start),
{ok, Q4} = MOD:start_link(PageSize, Seq, Proj, Q1Num), {ok, Q4} = MOD:start_link(PageSize, Seq, Proj, Q1Num),
?D({after_Q4_start, Q4}),
ok = MOD:in(Q4, 89), ok = MOD:in(Q4, 89),
?D(after_Q4_in),
Num1Plus1 = Num1 + 1, Num1Plus1 = Num1 + 1,
[ok = C1(X, Num1Plus1) || X <- [Q1, Q2, Q3, Q4]], [ok = C1(X, Num1Plus1) || X <- [Q1, Q2, Q3, Q4]],