Return-Path: Delivered-To: apmail-couchdb-commits-archive@www.apache.org Received: (qmail 15734 invoked from network); 23 Dec 2010 11:28:04 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 23 Dec 2010 11:28:04 -0000 Received: (qmail 37971 invoked by uid 500); 23 Dec 2010 11:28:04 -0000 Delivered-To: apmail-couchdb-commits-archive@couchdb.apache.org Received: (qmail 37854 invoked by uid 500); 23 Dec 2010 11:28:04 -0000 Mailing-List: contact commits-help@couchdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@couchdb.apache.org Delivered-To: mailing list commits@couchdb.apache.org Received: (qmail 37846 invoked by uid 99); 23 Dec 2010 11:28:04 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Dec 2010 11:28:04 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Dec 2010 11:28:01 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6CE262388994; Thu, 23 Dec 2010 11:27:38 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1052229 - in /couchdb/branches/1.1.x: etc/couchdb/default.ini.tpl.in src/couchdb/couch_db.hrl src/couchdb/couch_rep_httpc.erl src/couchdb/couch_rep_reader.erl Date: Thu, 23 Dec 2010 11:27:38 -0000 To: commits@couchdb.apache.org From: fdmanana@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20101223112738.6CE262388994@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: fdmanana Date: Thu Dec 23 11:27:37 2010 New Revision: 1052229 URL: http://svn.apache.org/viewvc?rev=1052229&view=rev Log: Merged revision 1052227 from trunk: Fix: replicator didn't use the HTTP settings defined in the .ini config Issue found by Randall Leeds. Thanks. Closes COUCHDB-992 Modified: couchdb/branches/1.1.x/etc/couchdb/default.ini.tpl.in couchdb/branches/1.1.x/src/couchdb/couch_db.hrl couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl couchdb/branches/1.1.x/src/couchdb/couch_rep_reader.erl Modified: couchdb/branches/1.1.x/etc/couchdb/default.ini.tpl.in URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/etc/couchdb/default.ini.tpl.in?rev=1052229&r1=1052228&r2=1052229&view=diff ============================================================================== --- couchdb/branches/1.1.x/etc/couchdb/default.ini.tpl.in (original) +++ couchdb/branches/1.1.x/etc/couchdb/default.ini.tpl.in Thu Dec 23 11:27:37 2010 @@ -135,8 +135,8 @@ compressible_types = text/*, application [replicator] db = _replicator -max_http_sessions = 10 -max_http_pipeline_size = 10 +max_http_sessions = 20 +max_http_pipeline_size = 50 ; set to true to validate peer certificates verify_ssl_certificates = false ; file containing a list of peer trusted certificates (PEM format) Modified: couchdb/branches/1.1.x/src/couchdb/couch_db.hrl URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_db.hrl?rev=1052229&r1=1052228&r2=1052229&view=diff ============================================================================== --- couchdb/branches/1.1.x/src/couchdb/couch_db.hrl (original) +++ couchdb/branches/1.1.x/src/couchdb/couch_db.hrl Thu Dec 23 11:27:37 2010 @@ -268,13 +268,7 @@ body = nil, options = [ {response_format,binary}, - {inactivity_timeout, 30000}, - {max_sessions, list_to_integer( - couch_config:get("replicator", "max_http_sessions", "10") - )}, - {max_pipeline_size, list_to_integer( - couch_config:get("replicator", "max_http_pipeline_size", "10") - )} + {inactivity_timeout, 30000} ], retries = 10, pause = 500, Modified: couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl?rev=1052229&r1=1052228&r2=1052229&view=diff ============================================================================== --- couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl (original) +++ couchdb/branches/1.1.x/src/couchdb/couch_rep_httpc.erl Thu Dec 23 11:27:37 2010 @@ -93,6 +93,7 @@ db_exists(Req, CanonicalUrl, CreateDB) - end, case catch ibrowse:send_req(Url, HeadersFun(head), head, [], Options) of {ok, "200", _, _} -> + config_http(CanonicalUrl), Req#http_db{url = CanonicalUrl}; {ok, "301", RespHeaders, _} -> RedirectUrl = redirect_url(RespHeaders, Req#http_db.url), @@ -110,6 +111,19 @@ db_exists(Req, CanonicalUrl, CreateDB) - throw({db_not_found, ?l2b(Url)}) end. +config_http(Url) -> + #url{host = Host, port = Port} = ibrowse_lib:parse_url(Url), + ok = ibrowse:set_max_sessions(Host, Port, list_to_integer( + couch_config:get("replicator", "max_http_sessions", "20"))), + ok = ibrowse:set_max_pipeline_size(Host, Port, list_to_integer( + couch_config:get("replicator", "max_http_pipeline_size", "50"))), + ok = couch_config:register( + fun("replicator", "max_http_sessions", MaxSessions) -> + ibrowse:set_max_sessions(Host, Port, list_to_integer(MaxSessions)); + ("replicator", "max_http_pipeline_size", PipeSize) -> + ibrowse:set_max_pipeline_size(Host, Port, list_to_integer(PipeSize)) + end). + redirect_url(RespHeaders, OrigUrl) -> MochiHeaders = mochiweb_headers:make(RespHeaders), RedUrl = mochiweb_headers:get_value("Location", MochiHeaders), Modified: couchdb/branches/1.1.x/src/couchdb/couch_rep_reader.erl URL: http://svn.apache.org/viewvc/couchdb/branches/1.1.x/src/couchdb/couch_rep_reader.erl?rev=1052229&r1=1052228&r2=1052229&view=diff ============================================================================== --- couchdb/branches/1.1.x/src/couchdb/couch_rep_reader.erl (original) +++ couchdb/branches/1.1.x/src/couchdb/couch_rep_reader.erl Thu Dec 23 11:27:37 2010 @@ -21,11 +21,8 @@ -define (BUFFER_SIZE, 1000). -define (MAX_CONCURRENT_REQUESTS, 100). --define (MAX_CONNECTIONS, 20). --define (MAX_PIPELINE_SIZE, 50). -include("couch_db.hrl"). --include("../ibrowse/ibrowse.hrl"). -record (state, { parent, @@ -51,11 +48,6 @@ next(Pid) -> init([Parent, Source, MissingRevs, _PostProps]) -> process_flag(trap_exit, true), - if is_record(Source, http_db) -> - #url{host=Host, port=Port} = ibrowse_lib:parse_url(Source#http_db.url), - ibrowse:set_max_sessions(Host, Port, ?MAX_CONNECTIONS), - ibrowse:set_max_pipeline_size(Host, Port, ?MAX_PIPELINE_SIZE); - true -> ok end, Self = self(), ReaderLoop = spawn_link( fun() -> reader_loop(Self, Parent, Source, MissingRevs) end),