fold from file counting

When folding, don't count tombstones towards
the folding limit.  Merge worker needs to be
able to progress to LIMIT number of non-deleted
entries.
This commit is contained in:
Kresten Krab Thorup 2012-05-05 13:02:36 +02:00
parent f821b38ea2
commit ec55a38c42

View file

@ -161,6 +161,8 @@ do_range_fold(Fun, Acc0, File, Range, N0) ->
{stop, {limit, Acc, Key}}; {stop, {limit, Acc, Key}};
({Key,_}, {_,Acc}) when not ?KEY_IN_TO_RANGE(Key,Range)-> ({Key,_}, {_,Acc}) when not ?KEY_IN_TO_RANGE(Key,Range)->
{stop, {done, Acc}}; {stop, {done, Acc}};
({Key,?TOMBSTONE}, {N1,Acc}) when ?KEY_IN_FROM_RANGE(Key,Range) ->
{continue, {N1, Fun(Key, ?TOMBSTONE, Acc)}};
({Key,Value}, {N1,Acc}) when ?KEY_IN_FROM_RANGE(Key,Range) -> ({Key,Value}, {N1,Acc}) when ?KEY_IN_FROM_RANGE(Key,Range) ->
{continue, {N1-1, Fun(Key, Value, Acc)}}; {continue, {N1-1, Fun(Key, Value, Acc)}};
(_, Acc) -> (_, Acc) ->