Initial code with busted ct test
Initiat comparison made betwene trees externally - but ct test is bust.
This commit is contained in:
parent
6ad98d77c5
commit
c586b78f45
5 changed files with 238 additions and 39 deletions
|
@ -31,6 +31,7 @@
|
|||
get_randomindexes_generator/1,
|
||||
name_list/0,
|
||||
load_objects/5,
|
||||
load_objects/6,
|
||||
put_indexed_objects/3,
|
||||
put_altered_indexed_objects/3,
|
||||
put_altered_indexed_objects/4,
|
||||
|
@ -52,6 +53,7 @@
|
|||
-define(MD_LASTMOD, <<"X-Riak-Last-Modified">>).
|
||||
-define(MD_DELETED, <<"X-Riak-Deleted">>).
|
||||
-define(EMPTY_VTAG_BIN, <<"e">>).
|
||||
-define(ROOT_PATH, "test").
|
||||
|
||||
%% =================================================
|
||||
%% From riak_object
|
||||
|
@ -169,13 +171,17 @@ riakload(Bookie, ObjectList) ->
|
|||
|
||||
|
||||
reset_filestructure() ->
|
||||
reset_filestructure(0).
|
||||
reset_filestructure(0, ?ROOT_PATH).
|
||||
|
||||
reset_filestructure(Wait) ->
|
||||
io:format("Waiting ~w ms to give a chance for all file closes " ++
|
||||
reset_filestructure(Wait) when is_integer(Wait) ->
|
||||
reset_filestructure(Wait, ?ROOT_PATH);
|
||||
reset_filestructure(RootPath) when is_list(RootPath) ->
|
||||
reset_filestructure(0, RootPath).
|
||||
|
||||
reset_filestructure(Wait, RootPath) ->
|
||||
io:format("Waiting ~w ms to give a chance for all file closes " ++
|
||||
"to complete~n", [Wait]),
|
||||
timer:sleep(Wait),
|
||||
RootPath = "test",
|
||||
timer:sleep(Wait),
|
||||
filelib:ensure_dir(RootPath ++ "/journal/"),
|
||||
filelib:ensure_dir(RootPath ++ "/ledger/"),
|
||||
leveled_inker:clean_testdir(RootPath ++ "/journal"),
|
||||
|
@ -420,6 +426,9 @@ get_vclock(ObjectBin) ->
|
|||
binary_to_term(VclockBin).
|
||||
|
||||
load_objects(ChunkSize, GenList, Bookie, TestObject, Generator) ->
|
||||
load_objects(ChunkSize, GenList, Bookie, TestObject, Generator, 1000).
|
||||
|
||||
load_objects(ChunkSize, GenList, Bookie, TestObject, Generator, SubListL) ->
|
||||
lists:map(fun(KN) ->
|
||||
ObjListA = Generator(ChunkSize, KN),
|
||||
StartWatchA = os:timestamp(),
|
||||
|
@ -433,7 +442,7 @@ load_objects(ChunkSize, GenList, Bookie, TestObject, Generator) ->
|
|||
true ->
|
||||
check_forobject(Bookie, TestObject)
|
||||
end,
|
||||
lists:sublist(ObjListA, 1000) end,
|
||||
lists:sublist(ObjListA, SubListL) end,
|
||||
GenList).
|
||||
|
||||
|
||||
|
|
69
test/end_to_end/tictac_SUITE.erl
Normal file
69
test/end_to_end/tictac_SUITE.erl
Normal file
|
@ -0,0 +1,69 @@
|
|||
-module(tictac_SUITE).
|
||||
-include_lib("common_test/include/ct.hrl").
|
||||
-include("include/leveled.hrl").
|
||||
-export([all/0]).
|
||||
-export([
|
||||
many_put_compare/1
|
||||
]).
|
||||
|
||||
all() -> [
|
||||
many_put_compare
|
||||
].
|
||||
|
||||
|
||||
many_put_compare(_Config) ->
|
||||
RootPathA = testutil:reset_filestructure("testA"),
|
||||
StartOpts1 = [{root_path, RootPathA},
|
||||
{max_pencillercachesize, 16000},
|
||||
{sync_strategy, riak_sync}],
|
||||
{ok, Bookie1} = leveled_bookie:book_start(StartOpts1),
|
||||
{TestObject, TestSpec} = testutil:generate_testobject(),
|
||||
ok = testutil:book_riakput(Bookie1, TestObject, TestSpec),
|
||||
testutil:check_forobject(Bookie1, TestObject),
|
||||
ok = leveled_bookie:book_close(Bookie1),
|
||||
StartOpts2 = [{root_path, RootPathA},
|
||||
{max_journalsize, 500000000},
|
||||
{max_pencillercachesize, 32000},
|
||||
{sync_strategy, testutil:sync_strategy()}],
|
||||
{ok, Bookie2} = leveled_bookie:book_start(StartOpts2),
|
||||
testutil:check_forobject(Bookie2, TestObject),
|
||||
GenList = [2, 20002, 40002, 60002, 80002,
|
||||
100002, 120002, 140002, 160002, 180002],
|
||||
CLs = testutil:load_objects(20000,
|
||||
GenList,
|
||||
Bookie2,
|
||||
TestObject,
|
||||
fun testutil:generate_smallobjects/2,
|
||||
20000),
|
||||
|
||||
RootPathB = testutil:reset_filestructure("testB"),
|
||||
StartOpts3 = [{root_path, RootPathB},
|
||||
{max_journalsize, 200000000},
|
||||
{max_pencillercachesize, 16000},
|
||||
{sync_strategy, testutil:sync_strategy()}],
|
||||
{ok, Bookie3} = leveled_bookie:book_start(StartOpts3),
|
||||
lists:foreach(fun(ObjL) -> testutil:riakload(Bookie3, ObjL) end, CLs),
|
||||
|
||||
TicTacQ = {tictactree_obj,
|
||||
{o_rkv, "Bucket", null, null, false},
|
||||
fun(_B, _K) -> accumulate end},
|
||||
{async, TreeAFolder} = leveled_bookie:book_returnfolder(Bookie2, TicTacQ),
|
||||
{async, TreeBFolder} = leveled_bookie:book_returnfolder(Bookie3, TicTacQ),
|
||||
SWA0 = os:timestamp(),
|
||||
TreeA = TreeAFolder(),
|
||||
io:format("Build tictac tree with 200K objects in ~w~n",
|
||||
[timer:now_diff(os:timestamp(), SWA0)]),
|
||||
SWB0 = os:timestamp(),
|
||||
TreeB = TreeBFolder(),
|
||||
io:format("Build tictac tree with 200K objects in ~w~n",
|
||||
[timer:now_diff(os:timestamp(), SWB0)]),
|
||||
SWC0 = os:timestamp(),
|
||||
SegList = leveled_tictac:find_dirtyleaves(TreeA, TreeB),
|
||||
io:format("Compare tictac trees with 200K objects in ~w~n",
|
||||
[timer:now_diff(os:timestamp(), SWC0)]),
|
||||
io:format("Tree comparison shows ~w different leaves~n",
|
||||
[length(SegList)]),
|
||||
true = length(SegList) == 1,
|
||||
|
||||
ok = leveled_bookie:book_destroy(Bookie2),
|
||||
ok = leveled_bookie:book_destroy(Bookie3).
|
Loading…
Add table
Add a link
Reference in a new issue