From 9a0082db4eb88fbb9068ecb01d45e1aeb0ab7971 Mon Sep 17 00:00:00 2001 From: Martin Sumner Date: Wed, 3 Oct 2018 18:29:20 +0100 Subject: [PATCH] Test to expose startup issue See #194 --- test/end_to_end/basic_SUITE.erl | 62 ++++++++++++++++++++++++++------- 1 file changed, 50 insertions(+), 12 deletions(-) diff --git a/test/end_to_end/basic_SUITE.erl b/test/end_to_end/basic_SUITE.erl index 4234aaf..968b56a 100644 --- a/test/end_to_end/basic_SUITE.erl +++ b/test/end_to_end/basic_SUITE.erl @@ -12,21 +12,23 @@ is_empty_test/1, many_put_fetch_switchcompression/1, bigjournal_littlejournal/1, - safereaderror_startup/1 + safereaderror_startup/1, + remove_journal_test/1 ]). all() -> [ - simple_put_fetch_head_delete, - many_put_fetch_head, - journal_compaction, - fetchput_snapshot, - load_and_count, - load_and_count_withdelete, - space_clear_ondelete, - is_empty_test, - many_put_fetch_switchcompression, - bigjournal_littlejournal, - safereaderror_startup + % simple_put_fetch_head_delete, + % many_put_fetch_head, + % journal_compaction, + % fetchput_snapshot, + % load_and_count, + % load_and_count_withdelete, + % space_clear_ondelete, + % is_empty_test, + % many_put_fetch_switchcompression, + % bigjournal_littlejournal, + % safereaderror_startup, + remove_journal_test ]. @@ -831,6 +833,42 @@ is_empty_test(_Config) -> ok = leveled_bookie:book_close(Bookie1). +remove_journal_test(_Config) -> + RootPath = testutil:reset_filestructure(), + StartOpts1 = [{root_path, RootPath}, + {max_pencillercachesize, 16000}, + {sync_strategy, testutil:sync_strategy()}, + {compression_point, on_compact}], + {ok, Bookie1} = leveled_bookie:book_start(StartOpts1), + GenList = [1, 20001, 40001, 60001], + CLs = testutil:load_objects(20000, GenList, Bookie1, no_check, + fun testutil:generate_smallobjects/2), + CheckList1 = lists:sublist(lists:nth(1, CLs), 100, 1000), + CheckList2 = lists:sublist(lists:nth(2, CLs), 100, 1000), + CheckList3 = lists:sublist(lists:nth(3, CLs), 100, 1000), + CheckList4 = lists:sublist(lists:nth(4, CLs), 100, 1000), + testutil:check_forlist(Bookie1, CheckList1), + testutil:check_forlist(Bookie1, CheckList2), + testutil:check_forlist(Bookie1, CheckList3), + testutil:check_forlist(Bookie1, CheckList4), + + ok = leveled_bookie:book_close(Bookie1), + leveled_inker:clean_testdir(RootPath ++ "/journal"), + {ok, Bookie2} = leveled_bookie:book_start(StartOpts1), + + % If we're not careful here new data will be added, and we + % won't be able to read it + [NewCheckList] = + testutil:load_objects(1000, [80001], Bookie2, no_check, + fun testutil:generate_smallobjects/2), + + ok = leveled_bookie:book_close(Bookie2), + {ok, Bookie3} = leveled_bookie:book_start(StartOpts1), + testutil:check_forlist(Bookie3, NewCheckList), + ok = leveled_bookie:book_destroy(Bookie3). + + + many_put_fetch_switchcompression(_Config) -> RootPath = testutil:reset_filestructure(), StartOpts1 = [{root_path, RootPath},