Author: fdmanana
Date: Mon Mar 28 11:11:01 2011
New Revision: 1086188
URL: http://svn.apache.org/viewvc?rev=1086188&view=rev
Log:
Backport fix from revision 1086185
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/branches/1.0.x/src/couchdb/couch_rep.erl
Modified: couchdb/branches/1.0.x/src/couchdb/couch_rep.erl
URL:
http://svn.apache.org/viewvc/couchdb/branches/1.0.x/src/couchdb/couch_rep.erl?rev=1086188&r1=1086187&r2=1086188&view=diff
==============================================================================
--- couchdb/branches/1.0.x/src/couchdb/couch_rep.erl (original)
+++ couchdb/branches/1.0.x/src/couchdb/couch_rep.erl Mon Mar 28 11:11:01 2011
@@ -321,7 +321,14 @@ start_replication_server(Replicator) ->
throw({db_not_found, <<"could not open ", DbUrl/binary>>});
{error, {unauthorized, DbUrl}} ->
throw({unauthorized,
- <<"unauthorized to access database ", DbUrl/binary>>})
+ <<"unauthorized to access database ", DbUrl/binary>>});
+ {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, RepId),
+ start_replication_server(Replicator)
end;
{error, {already_started, Pid}} ->
?LOG_DEBUG("replication ~p already running at ~p", [RepId, Pid]),