couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jason Davies <ja...@jasondavies.com>
Subject Re: svn commit: r755009 - /couchdb/trunk/src/couchdb/couch_rep.erl
Date Mon, 16 Mar 2009 22:30:44 GMT
The replication test in Futon is failing now, with the following:

{"message":"docB is null","fileName":"http://127.0.0.1:5984/_utils/script/test/replication.js

","lineNumber":69,"stack":"([object Object],[object Object])@http://127.0.0.1:5984/_utils/script/test/replication.js:69

\n(true)@http://127.0.0.1:5984/_utils/script/test/replication.js: 
228\nrun(0)@http://127.0.0.1:5984/_utils/script/couch_test_runner.js: 
78\n","name":"TypeError"}

Jason

On 16 Mar 2009, at 22:05, Damien Katz wrote:

> You are correct, it does need to be set to true there. Doh. Since I  
> never hit the problem, I couldn't be sure I fixed it correctly.
>
> -Damien
>
>
> On Mar 16, 2009, at 5:39 PM, Adam Kocoloski wrote:
>
>> Hi Damien, I'm confused.  Don't you need to set done=true in the  
>> handle_call for fin?
>>
>> Adam
>>
>> On Mar 16, 2009, at 5:26 PM, damien@apache.org wrote:
>>
>>> Author: damien
>>> Date: Mon Mar 16 21:26:47 2009
>>> New Revision: 755009
>>>
>>> URL: http://svn.apache.org/viewvc?rev=755009&view=rev
>>> Log:
>>> Fix for occasional replication failure where replication would  
>>> complete before before the caller had a chance to request the  
>>> results. No tests, but this should fix this error that already  
>>> occurs occasionally: {"error":"normal","reason":"{gen_server,call, 
>>> [<0.228.0>,get_result,infinity]}"}
>>>
>>> Modified:
>>>  couchdb/trunk/src/couchdb/couch_rep.erl
>>>
>>> Modified: couchdb/trunk/src/couchdb/couch_rep.erl
>>> URL: http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_rep.erl?rev=755009&r1=755008&r2=755009&view=diff
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> = 
>>> ====================================================================
>>> --- couchdb/trunk/src/couchdb/couch_rep.erl (original)
>>> +++ couchdb/trunk/src/couchdb/couch_rep.erl Mon Mar 16 21:26:47 2009
>>> @@ -91,7 +91,8 @@
>>>   stats,
>>>   enum_pid,
>>>   docs_buffer = [],
>>> -    listeners = []
>>> +    listeners = [],
>>> +    done = false
>>> }).
>>>
>>>
>>> @@ -178,7 +179,8 @@
>>>   },
>>>
>>>   {ok, State}.
>>> -
>>> +handle_call(get_result, From, #state{listeners=L,done=true} =  
>>> State) ->
>>> +    {stop, normal, State#state{listeners=[From|L]}};
>>> handle_call(get_result, From, #state{listeners=L} = State) ->
>>>   {noreply, State#state{listeners=[From|L]}};
>>>
>>> @@ -218,7 +220,13 @@
>>>
>>> handle_call({fin, {LastSeq, RevsCount}}, {Pid,_},  
>>> #state{enum_pid=Pid} = State) ->
>>>   ets:update_counter(State#state.stats, total_revs, RevsCount),
>>> -    {stop, normal, ok, State#state{current_seq=LastSeq}}.
>>> +    case State#state.listeners of
>>> +    [] ->
>>> +        % still waiting for the first listener to sen a request
>>> +        {noreply, State#state{current_seq=LastSeq}};
>>> +    _ ->
>>> +        {stop, normal, ok, State#state{current_seq=LastSeq}}
>>> +    end.
>>>
>>> handle_cast({increment_update_seq, Seq}, State) ->
>>>   couch_task_status:update("Processed source update #~p", [Seq]),
>>> @@ -270,12 +278,8 @@
>>>   ets:delete(Stats),
>>>   close_db(Target),
>>>
>>> -    case Listeners of
>>> -    [Original|Rest] ->
>>> -        %% reply to original requester
>>> -        gen_server:reply(Original, {ok, NewRepHistory});
>>> -    Rest -> ok
>>> -    end,
>>> +    [Original|Rest] = Listeners,
>>> +    gen_server:reply(Original, {ok, NewRepHistory}),
>>>
>>>   %% maybe trigger another replication. If this replicator uses a  
>>> local
>>>   %% source Db, changes to that Db since we started will not be  
>>> included in
>>>
>>>
>>
>

--
Jason Davies

www.jasondavies.com


Mime
View raw message