You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by fd...@apache.org on 2011/11/13 13:15:51 UTC

git commit: Avoid confusing log messages when replication completes

Updated Branches:
  refs/heads/master c307ba95c -> 0277d4580


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.


Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/0277d458
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0277d458
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0277d458

Branch: refs/heads/master
Commit: 0277d45804799d791b4dba9e37951bc225132859
Parents: c307ba9
Author: Filipe David Borba Manana <fd...@apache.org>
Authored: Sun Nov 13 11:46:01 2011 +0000
Committer: Filipe David Borba Manana <fd...@apache.org>
Committed: Sun Nov 13 12:15:33 2011 +0000

----------------------------------------------------------------------
 src/couchdb/couch_replication_manager.erl |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb/blob/0277d458/src/couchdb/couch_replication_manager.erl
----------------------------------------------------------------------
diff --git a/src/couchdb/couch_replication_manager.erl b/src/couchdb/couch_replication_manager.erl
index 7d1860e..1c038d6 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,