more fixes
This commit is contained in:
parent
994b28a6a4
commit
f09e514d30
4 changed files with 19 additions and 18 deletions
|
@ -4,7 +4,7 @@
|
||||||
{eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.
|
{eunit_opts, [verbose, {report, {eunit_surefire, [{dir, "."}]}}]}.
|
||||||
|
|
||||||
{erl_opts, [%{d,'DEBUG',true},
|
{erl_opts, [%{d,'DEBUG',true},
|
||||||
{d,'USE_EBLOOM',false},
|
%{d,'USE_EBLOOM',true},
|
||||||
fail_on_warning,
|
fail_on_warning,
|
||||||
warn_unused_vars,
|
warn_unused_vars,
|
||||||
warn_export_all,
|
warn_export_all,
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
|
|
||||||
%% smallest levels are 1024 entries
|
%% smallest levels are 1024 entries
|
||||||
-define(TOP_LEVEL, 10).
|
-define(TOP_LEVEL, 8).
|
||||||
-define(BTREE_SIZE(Level), (1 bsl (Level))).
|
-define(BTREE_SIZE(Level), (1 bsl (Level))).
|
||||||
-define(FILE_FORMAT, <<"HAN2">>).
|
-define(FILE_FORMAT, <<"HAN2">>).
|
||||||
-define(FIRST_BLOCK_POS, byte_size(?FILE_FORMAT)).
|
-define(FIRST_BLOCK_POS, byte_size(?FILE_FORMAT)).
|
||||||
|
|
|
@ -5,17 +5,17 @@ run(Dir) ->
|
||||||
case hanoidb:open(filename:join(Dir, "test.hanoidb"), []) of
|
case hanoidb:open(filename:join(Dir, "test.hanoidb"), []) of
|
||||||
{error, Reason} ->
|
{error, Reason} ->
|
||||||
{error, Reason};
|
{error, Reason};
|
||||||
{ok, Tree} -> fill_db_timed(Tree, 5 * 60 * 1000)
|
{ok, Tree} -> fill_db_timed(Tree, 15 * 60 * 1000)
|
||||||
end.
|
end.
|
||||||
|
|
||||||
fill_db(Tree) -> fill_db(Tree, 5000).
|
%% fill_db(Tree) -> fill_db(Tree, 5000).
|
||||||
fill_db(Tree, 0) -> hanoidb:close(Tree);
|
%% fill_db(Tree, 0) -> hanoidb:close(Tree);
|
||||||
fill_db(Tree, N) ->
|
%% fill_db(Tree, N) ->
|
||||||
Letter = N rem 26 + $a,
|
%% Letter = N rem 26 + $a,
|
||||||
Length = rand:uniform(100),
|
%% Length = rand:uniform(100),
|
||||||
Key = << <<Letter/utf8>> || _ <- lists:seq(0, Length) >>,
|
%% Key = << <<Letter/utf8>> || _ <- lists:seq(0, Length) >>,
|
||||||
ok = hanoidb:put(Tree, Key, Key),
|
%% ok = hanoidb:put(Tree, Key, Key),
|
||||||
fill_db(Tree, N - 1).
|
%% fill_db(Tree, N - 1).
|
||||||
|
|
||||||
fill_db_timed(Tree, Timeout) ->
|
fill_db_timed(Tree, Timeout) ->
|
||||||
erlang:send_after(Timeout, self(), stop),
|
erlang:send_after(Timeout, self(), stop),
|
||||||
|
@ -26,9 +26,10 @@ fill_db_loop(Tree, N) ->
|
||||||
stop ->
|
stop ->
|
||||||
ok
|
ok
|
||||||
after 0 ->
|
after 0 ->
|
||||||
|
Key = crypto:strong_rand_bytes(2000),
|
||||||
Letter = N rem 26 + $a,
|
Letter = N rem 26 + $a,
|
||||||
Length = rand:uniform(100),
|
Length = rand:uniform(100),
|
||||||
Key = << <<Letter/utf8>> || _ <- lists:seq(0, Length) >>,
|
Value = << <<Letter/utf8>> || _ <- lists:seq(0, Length) >>,
|
||||||
ok = hanoidb:put(Tree, Key, Key),
|
ok = hanoidb:put(Tree, Key, Value),
|
||||||
fill_db_loop(Tree, N+1)
|
fill_db_loop(Tree, N+1)
|
||||||
end.
|
end.
|
||||||
|
|
|
@ -48,13 +48,13 @@ function periodic() {
|
||||||
}
|
}
|
||||||
|
|
||||||
merge_diff() {
|
merge_diff() {
|
||||||
SA=`/bin/ls -l A-${ID}.data 2> /dev/null | awk '{print $5}'`
|
SA=`stat -c %s A-${ID}.data 2> /dev/null`
|
||||||
SB=`/bin/ls -l B-${ID}.data 2> /dev/null | awk '{print $5}'`
|
SB=`stat -c %s B-${ID}.data 2> /dev/null`
|
||||||
SX=`/bin/ls -l X-${ID}.data 2> /dev/null | awk '{print $5}'`
|
SX=`stat -c %s X-${ID}.data 2> /dev/null`
|
||||||
if [ \( -n "$SA" \) -a \( -n "$SB" \) -a \( -n "$SX" \) ]; then
|
if [ \( -n "$SA" \) -a \( -n "$SB" \) -a \( -n "$SX" \) ]; then
|
||||||
export RES=`expr ${SX}0 / \( $SA + $SB \)`
|
export RES=`expr ${SX:-0} / \( $SA + $SB \)`
|
||||||
else
|
else
|
||||||
export RES="?"
|
export RES="⌂"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue