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