diff --git a/src/leveled_bookie.erl b/src/leveled_bookie.erl index acd0d9e..5305eaf 100644 --- a/src/leveled_bookie.erl +++ b/src/leveled_bookie.erl @@ -186,6 +186,15 @@ book_riakput(Pid, RiakObject, IndexSpecs) -> book_put(Pid, Bucket, Key, Object, IndexSpecs) -> book_put(Pid, Bucket, Key, Object, IndexSpecs, ?STD_TAG). +%% TODO: +%% It is not enough simply to change the value to delete, as the journal +%% needs to know the key is a tombstone at compaction time, and currently at +%% compaction time the clerk only knows the Key and not the Value. +%% +%% The tombstone cannot be removed from the Journal on compaction, as the +%% journal entry the tombstone deletes may not have been reaped - and so if the +%% ledger got erased, the value would be resurrected. + book_riakdelete(Pid, Bucket, Key, IndexSpecs) -> book_put(Pid, Bucket, Key, delete, IndexSpecs, ?RIAK_TAG). diff --git a/src/leveled_sft.erl b/src/leveled_sft.erl index f85ebcc..52809f3 100644 --- a/src/leveled_sft.erl +++ b/src/leveled_sft.erl @@ -1615,7 +1615,50 @@ merge_seglists_test() -> check_for_segments(SegBin2, [1024*1024 - 1], true)), % This match is before the flipped bit, so still works without CRC check ?assertMatch({maybe_present, [0]}, - check_for_segments(SegBin2, [0,900], false)). + check_for_segments(SegBin2, [0,900], false)), + + ExpectedDeltasAll1s = <<4294967295:32/integer>>, + SegBin3 = <>, + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin3, [900], true)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin3, [200], true)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin3, [0,900], true)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin3, [1024*1024 - 1], true)), + % This is so badly mangled, the error gets detected event without CRC + % checking being enforced + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin3, [900], false)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin3, [200], false)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin3, [0,900], false)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin3, [1024*1024 - 1], false)), + + ExpectedDeltasNearlyAll1s = <<4294967287:32/integer>>, + SegBin4 = <>, + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin4, [900], true)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin4, [200], true)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin4, [0,900], true)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin4, [1024*1024 - 1], true)), + % This is so badly mangled, the error gets detected event without CRC + % checking being enforced + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin4, [900], false)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin4, [200], false)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin4, [0,900], false)), + ?assertMatch(error_so_maybe_present, + check_for_segments(SegBin4, [1024*1024 - 1], false)). createslot_stage1_test() -> {KeyList1, KeyList2} = sample_keylist(),