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 2012/01/07 14:48:49 UTC
git commit: Add heartbeat parameter to all _changes requests
Updated Branches:
refs/heads/master 975ea08c7 -> a2d57c8bb
Add heartbeat parameter to all _changes requests
Even non-continuous _changes requests, particularly filtered
ones, can cause long periods of inactivity.
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/a2d57c8b
Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a2d57c8b
Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a2d57c8b
Branch: refs/heads/master
Commit: a2d57c8bb34f4621fed00f4e65191a1531bc3110
Parents: 975ea08
Author: Filipe David Borba Manana <fd...@apache.org>
Authored: Sat Jan 7 13:44:45 2012 +0000
Committer: Filipe David Borba Manana <fd...@apache.org>
Committed: Sat Jan 7 13:44:45 2012 +0000
----------------------------------------------------------------------
.../src/couch_replicator_api_wrap.erl | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2d57c8b/src/couch_replicator/src/couch_replicator_api_wrap.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl
index a29fe94..d287fcb 100644
--- a/src/couch_replicator/src/couch_replicator_api_wrap.erl
+++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl
@@ -306,13 +306,15 @@ update_docs(Db, DocList, Options, UpdateType) ->
changes_since(#httpdb{headers = Headers1} = HttpDb, Style, StartSeq,
UserFun, Options) ->
+ HeartBeat = erlang:max(1000, HttpDb#httpdb.timeout div 3),
BaseQArgs = case get_value(continuous, Options, false) of
false ->
[{"feed", "normal"}];
true ->
- [{"feed", "continuous"}, {"heartbeat", "10000"}]
+ [{"feed", "continuous"}]
end ++ [
- {"style", atom_to_list(Style)}, {"since", couch_util:to_list(StartSeq)}
+ {"style", atom_to_list(Style)}, {"since", couch_util:to_list(StartSeq)},
+ {"heartbeat", integer_to_list(HeartBeat)}
],
DocIds = get_value(doc_ids, Options),
{QArgs, Method, Body, Headers} = case DocIds of
Re: git commit: Add heartbeat parameter to all _changes requests
Posted by Filipe David Manana <fd...@apache.org>.
On Sat, Jan 7, 2012 at 8:55 PM, Randall Leeds <ra...@gmail.com> wrote:
> I'm cherry-picking this for 1.2. Especially with a brand new
> replicator, it would be very nice if no-one gets bitten by this doing
> filtered replication.
> Applies cleanly.
Fine for me.
>
> On Sat, Jan 7, 2012 at 05:48, <fd...@apache.org> wrote:
>> Updated Branches:
>> refs/heads/master 975ea08c7 -> a2d57c8bb
>>
>>
>> Add heartbeat parameter to all _changes requests
>>
>> Even non-continuous _changes requests, particularly filtered
>> ones, can cause long periods of inactivity.
>>
>>
>> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
>> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/a2d57c8b
>> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a2d57c8b
>> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a2d57c8b
>>
>> Branch: refs/heads/master
>> Commit: a2d57c8bb34f4621fed00f4e65191a1531bc3110
>> Parents: 975ea08
>> Author: Filipe David Borba Manana <fd...@apache.org>
>> Authored: Sat Jan 7 13:44:45 2012 +0000
>> Committer: Filipe David Borba Manana <fd...@apache.org>
>> Committed: Sat Jan 7 13:44:45 2012 +0000
>>
>> ----------------------------------------------------------------------
>> .../src/couch_replicator_api_wrap.erl | 6 ++++--
>> 1 files changed, 4 insertions(+), 2 deletions(-)
>> ----------------------------------------------------------------------
>>
>>
>> http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2d57c8b/src/couch_replicator/src/couch_replicator_api_wrap.erl
>> ----------------------------------------------------------------------
>> diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl
>> index a29fe94..d287fcb 100644
>> --- a/src/couch_replicator/src/couch_replicator_api_wrap.erl
>> +++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl
>> @@ -306,13 +306,15 @@ update_docs(Db, DocList, Options, UpdateType) ->
>>
>> changes_since(#httpdb{headers = Headers1} = HttpDb, Style, StartSeq,
>> UserFun, Options) ->
>> + HeartBeat = erlang:max(1000, HttpDb#httpdb.timeout div 3),
>> BaseQArgs = case get_value(continuous, Options, false) of
>> false ->
>> [{"feed", "normal"}];
>> true ->
>> - [{"feed", "continuous"}, {"heartbeat", "10000"}]
>> + [{"feed", "continuous"}]
>> end ++ [
>> - {"style", atom_to_list(Style)}, {"since", couch_util:to_list(StartSeq)}
>> + {"style", atom_to_list(Style)}, {"since", couch_util:to_list(StartSeq)},
>> + {"heartbeat", integer_to_list(HeartBeat)}
>> ],
>> DocIds = get_value(doc_ids, Options),
>> {QArgs, Method, Body, Headers} = case DocIds of
>>
--
Filipe David Manana,
"Reasonable men adapt themselves to the world.
Unreasonable men adapt the world to themselves.
That's why all progress depends on unreasonable men."
Re: git commit: Add heartbeat parameter to all _changes requests
Posted by Randall Leeds <ra...@gmail.com>.
I'm cherry-picking this for 1.2. Especially with a brand new
replicator, it would be very nice if no-one gets bitten by this doing
filtered replication.
Applies cleanly.
On Sat, Jan 7, 2012 at 05:48, <fd...@apache.org> wrote:
> Updated Branches:
> refs/heads/master 975ea08c7 -> a2d57c8bb
>
>
> Add heartbeat parameter to all _changes requests
>
> Even non-continuous _changes requests, particularly filtered
> ones, can cause long periods of inactivity.
>
>
> Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo
> Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/a2d57c8b
> Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/a2d57c8b
> Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/a2d57c8b
>
> Branch: refs/heads/master
> Commit: a2d57c8bb34f4621fed00f4e65191a1531bc3110
> Parents: 975ea08
> Author: Filipe David Borba Manana <fd...@apache.org>
> Authored: Sat Jan 7 13:44:45 2012 +0000
> Committer: Filipe David Borba Manana <fd...@apache.org>
> Committed: Sat Jan 7 13:44:45 2012 +0000
>
> ----------------------------------------------------------------------
> .../src/couch_replicator_api_wrap.erl | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
> ----------------------------------------------------------------------
>
>
> http://git-wip-us.apache.org/repos/asf/couchdb/blob/a2d57c8b/src/couch_replicator/src/couch_replicator_api_wrap.erl
> ----------------------------------------------------------------------
> diff --git a/src/couch_replicator/src/couch_replicator_api_wrap.erl b/src/couch_replicator/src/couch_replicator_api_wrap.erl
> index a29fe94..d287fcb 100644
> --- a/src/couch_replicator/src/couch_replicator_api_wrap.erl
> +++ b/src/couch_replicator/src/couch_replicator_api_wrap.erl
> @@ -306,13 +306,15 @@ update_docs(Db, DocList, Options, UpdateType) ->
>
> changes_since(#httpdb{headers = Headers1} = HttpDb, Style, StartSeq,
> UserFun, Options) ->
> + HeartBeat = erlang:max(1000, HttpDb#httpdb.timeout div 3),
> BaseQArgs = case get_value(continuous, Options, false) of
> false ->
> [{"feed", "normal"}];
> true ->
> - [{"feed", "continuous"}, {"heartbeat", "10000"}]
> + [{"feed", "continuous"}]
> end ++ [
> - {"style", atom_to_list(Style)}, {"since", couch_util:to_list(StartSeq)}
> + {"style", atom_to_list(Style)}, {"since", couch_util:to_list(StartSeq)},
> + {"heartbeat", integer_to_list(HeartBeat)}
> ],
> DocIds = get_value(doc_ids, Options),
> {QArgs, Method, Body, Headers} = case DocIds of
>