You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ch...@apache.org on 2014/08/28 19:30:06 UTC

[06/50] [abbrv] couch-replicator commit: updated refs/heads/1963-eunit-bigcouch to 3cf0b13

Fix replication checkpoint frequency

The patch to track and checkpoint last_seq values seen in the _changes
feed resulted in high frequency updates to the checkpoint document. This
is because the comparison made for "needs a checkpoint" was including
the replicator's incrementing counter which the changes reader was
bumping each time it saw last_seq even if it was the same last_seq as
the previous time.

This just compares the new last_seq value to the old last_seq value and
if they're equal then skips notifying the replication manager so that no
superfluous checkpoint is made.


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

Branch: refs/heads/1963-eunit-bigcouch
Commit: 6acc906b41130319961c210ac76bdd3835eff6ed
Parents: d6079a6
Author: Paul J. Davis <pa...@gmail.com>
Authored: Mon Jun 17 20:02:58 2013 -0500
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Jul 29 13:48:06 2014 +0100

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


http://git-wip-us.apache.org/repos/asf/couchdb-couch-replicator/blob/6acc906b/src/couch_replicator.erl
----------------------------------------------------------------------
diff --git a/src/couch_replicator.erl b/src/couch_replicator.erl
index 895bbcc..3ef5e9c 100644
--- a/src/couch_replicator.erl
+++ b/src/couch_replicator.erl
@@ -659,7 +659,11 @@ read_changes(Parent, StartSeq, Db, ChangesQueue, Options, Ts) ->
                     % LS should never be undefined, but it doesn't hurt to be
                     % defensive inside the replicator.
                     Seq = case LS of undefined -> get(last_seq); _ -> LS end,
-                    ok = gen_server:call(Parent, {report_seq_done, {Ts, Seq}, #rep_stats{}}, infinity),
+                    OldSeq = get(last_seq),
+                    if Seq == OldSeq -> ok; true ->
+                        Msg = {report_seq_done, {Ts, Seq}, #rep_stats{}},
+                        ok = gen_server:call(Parent, Msg, infinity)
+                    end,
                     put(last_seq, Seq),
                     read_changes(Parent, Seq, Db, ChangesQueue, Options, Ts + 1);
                 _ ->