summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2012-04-13 12:13:41 +0100
committerFilipe David Borba Manana <fdmanana@apache.org>2012-05-25 14:09:53 +0100
commit5f93f041411a6a00c6923a19c562b77c18f9341b (patch)
treeb4f78acba4f96ee75ec9a3b6289cc370d1b0a558
parent51000fd9c2dd83c38a85a6e0e1f0a79f0ebe6e1f (diff)
downloadcouchdb-5f93f041411a6a00c6923a19c562b77c18f9341b.tar.gz
Avoid possible timeout initializing replications
If 2 different replications start and finish at about the same time, there's a chance one is doing a synchronous gen_server call to the replication manager (to notify it that it started) while the replication manager is doing a call to the replication supervisor because the other replication just finished. COUCHDB-1461
-rw-r--r--src/couchdb/couch_replication_manager.erl9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/couchdb/couch_replication_manager.erl b/src/couchdb/couch_replication_manager.erl
index 7b998a830..6421e7837 100644
--- a/src/couchdb/couch_replication_manager.erl
+++ b/src/couchdb/couch_replication_manager.erl
@@ -431,7 +431,14 @@ replication_complete(DocId) ->
% We want to be able to start the same replication but with
% eventually different values for parameters that don't
% contribute to its ID calculation.
- _ = supervisor:delete_child(couch_rep_sup, BaseId ++ Ext);
+ case erlang:system_info(otp_release) < "R14B02" of
+ true ->
+ spawn(fun() ->
+ _ = supervisor:delete_child(couch_rep_sup, BaseId ++ Ext)
+ end);
+ false ->
+ ok
+ end;
#rep_state{} ->
ok
end,