Test to expose startup issue

See #194
This commit is contained in:
Martin Sumner 2018-10-03 18:29:20 +01:00
parent cc676190c4
commit 9a0082db4e

View file

@ -12,21 +12,23 @@
is_empty_test/1, is_empty_test/1,
many_put_fetch_switchcompression/1, many_put_fetch_switchcompression/1,
bigjournal_littlejournal/1, bigjournal_littlejournal/1,
safereaderror_startup/1 safereaderror_startup/1,
remove_journal_test/1
]). ]).
all() -> [ all() -> [
simple_put_fetch_head_delete, % simple_put_fetch_head_delete,
many_put_fetch_head, % many_put_fetch_head,
journal_compaction, % journal_compaction,
fetchput_snapshot, % fetchput_snapshot,
load_and_count, % load_and_count,
load_and_count_withdelete, % load_and_count_withdelete,
space_clear_ondelete, % space_clear_ondelete,
is_empty_test, % is_empty_test,
many_put_fetch_switchcompression, % many_put_fetch_switchcompression,
bigjournal_littlejournal, % bigjournal_littlejournal,
safereaderror_startup % safereaderror_startup,
remove_journal_test
]. ].
@ -831,6 +833,42 @@ is_empty_test(_Config) ->
ok = leveled_bookie:book_close(Bookie1). 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) -> many_put_fetch_switchcompression(_Config) ->
RootPath = testutil:reset_filestructure(), RootPath = testutil:reset_filestructure(),
StartOpts1 = [{root_path, RootPath}, StartOpts1 = [{root_path, RootPath},