summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilipe David Borba Manana <fdmanana@apache.org>2011-11-13 11:46:01 +0000
committerFilipe David Borba Manana <fdmanana@apache.org>2011-11-13 12:15:33 +0000
commit0277d45804799d791b4dba9e37951bc225132859 (patch)
tree3a79134ce35facd0d5d51c3658b27b6e4e87ff66
parentc307ba95c6edcb0708b948c5fc55d8a6a6192e40 (diff)
downloadcouchdb-0277d45804799d791b4dba9e37951bc225132859.tar.gz
Avoid confusing log messages when replication completes
When a replication finishes, the replicator manager (database) will call couch_replicator:cancel_replication/1 with the purpose of ensuring the child spec is removed from the supervisor. This function however is used as well when users explicitly ask to cancel a replication, and logs messages which don't make sense when invoked by the replication manager (added by COUCHDB-1271). This change also adds a comment about this behaviour.
-rw-r--r--src/couchdb/couch_replication_manager.erl9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/couchdb/couch_replication_manager.erl b/src/couchdb/couch_replication_manager.erl
index 7d1860eb9..1c038d6e3 100644
--- a/src/couchdb/couch_replication_manager.erl
+++ b/src/couchdb/couch_replication_manager.erl
@@ -416,10 +416,15 @@ start_replication(Rep, Wait) ->
replication_complete(DocId) ->
case ets:lookup(?DOC_TO_REP, DocId) of
- [{DocId, RepId}] ->
+ [{DocId, {BaseId, Ext} = RepId}] ->
case rep_state(RepId) of
nil ->
- couch_replicator:cancel_replication(RepId);
+ % Prior to OTP R14B02, temporary child specs remain in
+ % in the supervisor after a worker finishes - remove them.
+ % 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);
#rep_state{} ->
ok
end,