Use ?BTREE_SIZE macro everywhere
This commit is contained in:
parent
c26e0695c5
commit
30a0bd4b01
2 changed files with 3 additions and 3 deletions
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
%% smallest levels are 32 entries
|
%% smallest levels are 32 entries
|
||||||
-define(TOP_LEVEL, 5).
|
-define(TOP_LEVEL, 5).
|
||||||
-define(BTREE_SIZE(Level), (1 bsl Level)).
|
-define(BTREE_SIZE(Level), (1 bsl (Level))).
|
||||||
|
|
||||||
-define(TOMBSTONE, 'deleted').
|
-define(TOMBSTONE, 'deleted').
|
||||||
|
|
||||||
|
|
|
@ -263,7 +263,7 @@ main_loop(State = #state{ next=Next }) ->
|
||||||
%% The outcome of merging resulted in a file with less than
|
%% The outcome of merging resulted in a file with less than
|
||||||
%% level #entries, so we keep it at this level
|
%% level #entries, so we keep it at this level
|
||||||
%%
|
%%
|
||||||
{merge_done, Count, OutFileName} when Count =< (1 bsl State#state.level) ->
|
{merge_done, Count, OutFileName} when Count =< ?BTREE_SIZE(State#state.level) ->
|
||||||
|
|
||||||
% first, rename the tmp file to C, so recovery will pick it up
|
% first, rename the tmp file to C, so recovery will pick it up
|
||||||
CFileName = filename("C",State),
|
CFileName = filename("C",State),
|
||||||
|
@ -365,7 +365,7 @@ begin_merge(State) ->
|
||||||
|
|
||||||
MergePID = proc_lib:spawn_link(fun() ->
|
MergePID = proc_lib:spawn_link(fun() ->
|
||||||
{ok, OutCount} = lsm_btree_merger:merge(AFileName, BFileName, XFileName,
|
{ok, OutCount} = lsm_btree_merger:merge(AFileName, BFileName, XFileName,
|
||||||
1 bsl (State#state.level + 1),
|
?BTREE_SIZE(State#state.level + 1),
|
||||||
State#state.next =:= undefined),
|
State#state.next =:= undefined),
|
||||||
% error_logger:info_msg("merge done ~p,~p -> ~p~n", [AFileName, BFileName, XFileName]),
|
% error_logger:info_msg("merge done ~p,~p -> ~p~n", [AFileName, BFileName, XFileName]),
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue