Use ?BTREE_SIZE macro everywhere

This commit is contained in:
Kresten Krab Thorup 2012-01-20 10:09:54 +01:00
parent c26e0695c5
commit 30a0bd4b01
2 changed files with 3 additions and 3 deletions

View file

@ -2,7 +2,7 @@
%% smallest levels are 32 entries
-define(TOP_LEVEL, 5).
-define(BTREE_SIZE(Level), (1 bsl Level)).
-define(BTREE_SIZE(Level), (1 bsl (Level))).
-define(TOMBSTONE, 'deleted').

View file

@ -263,7 +263,7 @@ main_loop(State = #state{ next=Next }) ->
%% The outcome of merging resulted in a file with less than
%% 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
CFileName = filename("C",State),
@ -365,7 +365,7 @@ begin_merge(State) ->
MergePID = proc_lib:spawn_link(fun() ->
{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),
% error_logger:info_msg("merge done ~p,~p -> ~p~n", [AFileName, BFileName, XFileName]),