Sophie

Sophie

distrib > Fedora > 14 > i386 > by-pkgid > f20d0d135cae80bfed43a76599390ffd > files > 13

couchdb-1.0.2-7.fc14.src.rpm

From 3f37157da19e8ae2fecc52a3b39be959e17aa713 Mon Sep 17 00:00:00 2001
From: Filipe David Borba Manana <fdmanana@apache.org>
Date: Mon, 28 Mar 2011 11:08:58 +0000
Subject: [PATCH 12/13] 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

git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@1086185 13f79535-47bb-0310-9956-ffa450edef68
---
 src/couchdb/couch_rep.erl |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/couchdb/couch_rep.erl b/src/couchdb/couch_rep.erl
index c804b49..d94d042 100644
--- a/src/couchdb/couch_rep.erl
+++ b/src/couchdb/couch_rep.erl
@@ -317,6 +317,13 @@ start_replication_server(Replicator) ->
                 supervisor:start_child(couch_rep_sup, Replicator),
             ?LOG_DEBUG("replication ~p already running at ~p", [RepId, Pid]),
             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, RepId),
+            start_replication_server(Replicator);
         {error, {db_not_found, DbUrl}} ->
             throw({db_not_found, <<"could not open ", DbUrl/binary>>});
         {error, {unauthorized, DbUrl}} ->
-- 
1.7.5.1