Author: fdmanana
Date: Mon Mar 28 11:08:58 2011
New Revision: 1086185

URL: http://svn.apache.org/viewvc?rev=1086185&view=rev
Log:
Replicator: fix error when restarting replications in OTP R14B02

This is a workaround for a change introduced in OTP R14B02 to the supervisor
module. There's an erlang-bugs thread about this issue:

http://erlang.org/pipermail/erlang-bugs/2011-March/002273.html


Modified:
    couchdb/trunk/src/couchdb/couch_replicator.erl

Modified: couchdb/trunk/src/couchdb/couch_replicator.erl
URL: 
http://svn.apache.org/viewvc/couchdb/trunk/src/couchdb/couch_replicator.erl?rev=1086185&r1=1086184&r2=1086185&view=diff
==============================================================================
--- couchdb/trunk/src/couchdb/couch_replicator.erl (original)
+++ couchdb/trunk/src/couchdb/couch_replicator.erl Mon Mar 28 11:08:58 2011
@@ -136,6 +136,13 @@ async_replicate(#rep{id = {BaseId, Ext},
             ?LOG_INFO("replication `~s` already running at ~p (`~s` -> `~s`)",
                 [RepChildId, Pid, Source, Target]),
             {ok, Pid};
+        {error, {'EXIT', {badarg,
+            [{erlang, apply, [gen_server, start_link, undefined]} | _]}}} ->
+            % Clause to deal with a change in the supervisor module introduced
+            % in R14B02. For more details consult the thread at:
+            %     
http://erlang.org/pipermail/erlang-bugs/2011-March/002273.html
+            _ = supervisor:delete_child(couch_rep_sup, RepChildId),
+            async_replicate(Rep);
         {error, _} = Error ->
             Error
         end;


Reply via email to