Merge pull request #10 from yamt/fixes

Fixes issue with long running range fold 
introduced in f324972cdd
This commit is contained in:
Kresten Krab Thorup 2012-09-12 03:00:24 -07:00
commit f34f2c5ec2

View file

@ -439,10 +439,10 @@ main_loop(State = #state{ next=Next }) ->
?log("init_range_fold ~p -> ~p", [Range, WorkerPID]),
{FoldingPIDs, NextList} =
{NextList, FoldingPIDs} =
case {State#state.a, State#state.b, State#state.c} of
{undefined, undefined, undefined} ->
{[], List};
{List, []};
{_, undefined, undefined} ->
ok = file:make_link(filename("A", State), filename("AF", State)),
@ -821,7 +821,7 @@ start_range_fold(FileName, WorkerPID, Range, State) ->
Owner = self(),
PID = proc_lib:spawn( fun() ->
try
?log("start_range_fold ~p on ~p -> ~p", [self, FileName, WorkerPID]),
?log("start_range_fold ~p on ~p -> ~p", [self(), FileName, WorkerPID]),
erlang:link(WorkerPID),
{ok, File} = hanoidb_reader:open(FileName, [folding|State#state.opts]),
do_range_fold2(File, WorkerPID, self(), Range),