couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bbast...@apache.org
Subject [1/3] couch-replicator commit: updated refs/heads/master to 7ff43ed
Date Fri, 04 Mar 2016 23:53:34 GMT
Repository: couchdb-couch-replicator
Updated Branches:
  refs/heads/master da860981c -> 7ff43edd4


Adjust minimum number of http connections to 2

Replication changes feed and main replicator process could
end up waiting on the http connection to be available, and also
waiting on each other in a gen_server call. So set minimum
number of http connections to 2 to avoid deadlock.

JIRA: COUCHDB-2959


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/493a0d11
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/tree/493a0d11
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/diff/493a0d11

Branch: refs/heads/master
Commit: 493a0d11d43b512ae81195f84aab0336ca61e94f
Parents: da86098
Author: Nick Vatamaniuc <vatamane@gmail.com>
Authored: Thu Mar 3 23:38:20 2016 -0500
Committer: Nick Vatamaniuc <vatamane@gmail.com>
Committed: Fri Mar 4 01:31:45 2016 -0500

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


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/493a0d11/src/couch_replicator.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator.erl b/src/couch_replicator.erl
index e5beb25..b838d17 100644
--- a/src/couch_replicator.erl
+++ b/src/couch_replicator.erl
@@ -353,6 +353,13 @@ do_init(#rep{options = Options, id = {BaseId, Ext}, user_ctx=UserCtx}
= Rep) ->
         }
     }.
 
+adjust_maxconn(Src = #httpdb{http_connections = 1}, RepId) ->
+    Msg = "Adjusting minimum number of HTTP source connections to 2 for ~p",
+    couch_log:notice(Msg, [RepId]),
+    Src#httpdb{http_connections = 2};
+
+adjust_maxconn(Src, _RepId) ->
+    Src.
 
 handle_info(shutdown, St) ->
     {stop, shutdown, St};
@@ -627,10 +634,13 @@ cancel_timer(#rep_state{timer = Timer} = State) ->
 
 init_state(Rep) ->
     #rep{
-        source = Src, target = Tgt,
+        id = {BaseId, _Ext},
+        source = Src0, target = Tgt,
         options = Options, user_ctx = UserCtx,
         type = Type, view = View
     } = Rep,
+    % Adjust minimum number of http source connections to 2 to avoid deadlock
+    Src = adjust_maxconn(Src0, BaseId),
     {ok, Source} = couch_replicator_api_wrap:db_open(Src, [{user_ctx, UserCtx}]),
     {ok, Target} = couch_replicator_api_wrap:db_open(Tgt, [{user_ctx, UserCtx}],
         get_value(create_target, Options, false)),


Mime
View raw message