Repository: couchdb-couch-replicator
Updated Branches:
  refs/heads/transient-workers [created] f86bb9e0a


Use transient restart type for all replications

We want replication tasks to be restarted automatically if they crash
abnormally. Replication tasks that complete or are cancelled (by
deleting the backing _replicator doc or issuing an "cancel":true for
non-persistent jobs) should still exit, should not be restarted, and
should not have their child spec linger in the supervisor.


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

Branch: refs/heads/transient-workers
Commit: f86bb9e0a3c8a9f4cf95b18a614377cea6e60756
Parents: ec3c30d
Author: Robert Newson <rnew...@apache.org>
Authored: Thu Mar 24 11:29:10 2016 +0000
Committer: Robert Newson <rnew...@apache.org>
Committed: Thu Mar 24 11:33:20 2016 +0000

----------------------------------------------------------------------
 src/couch_replicator.erl | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/f86bb9e0/src/couch_replicator.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator.erl b/src/couch_replicator.erl
index 30cdd29..d887d68 100644
--- a/src/couch_replicator.erl
+++ b/src/couch_replicator.erl
@@ -123,7 +123,7 @@ async_replicate(#rep{id = {BaseId, Ext}, source = Src, 
target = Tgt} = Rep) ->
     ChildSpec = {
         RepChildId,
         {gen_server, start_link, [?MODULE, Rep, [{timeout, Timeout}]]},
-        temporary,
+        transient,
         250,
         worker,
         [?MODULE]
@@ -306,16 +306,6 @@ do_init(#rep{options = Options, id = {BaseId, Ext}, 
user_ctx=UserCtx} = Rep) ->
     ]),
     couch_task_status:set_update_frequency(1000),
 
-    % Until OTP R14B03:
-    %
-    % Restarting a temporary supervised child implies that the original 
arguments
-    % (#rep{} record) specified in the MFA component of the supervisor
-    % child spec will always be used whenever the child is restarted.
-    % This implies the same replication performance tunning parameters will
-    % always be used. The solution is to delete the child spec (see
-    % cancel_replication/1) and then start the replication again, but this is
-    % unfortunately not immune to race conditions.
-
     couch_log:notice("Replication `~p` is using:~n"
         "~c~p worker processes~n"
         "~ca worker batch size of ~p~n"

Reply via email to