couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fdman...@apache.org
Subject svn commit: r1003872 - /couchdb/branches/new_replicator/src/couchdb/couch_replicator.erl
Date Sat, 02 Oct 2010 19:36:52 GMT
Author: fdmanana
Date: Sat Oct  2 19:36:52 2010
New Revision: 1003872

URL: http://svn.apache.org/viewvc?rev=1003872&view=rev
Log:
New replicator: reducing the number of messages sent to a replicator gen_server.

Modified:
    couchdb/branches/new_replicator/src/couchdb/couch_replicator.erl

Modified: couchdb/branches/new_replicator/src/couchdb/couch_replicator.erl
URL: http://svn.apache.org/viewvc/couchdb/branches/new_replicator/src/couchdb/couch_replicator.erl?rev=1003872&r1=1003871&r2=1003872&view=diff
==============================================================================
--- couchdb/branches/new_replicator/src/couchdb/couch_replicator.erl (original)
+++ couchdb/branches/new_replicator/src/couchdb/couch_replicator.erl Sat Oct  2 19:36:52 2010
@@ -271,9 +271,15 @@ do_init(#rep{options = Options} = Rep) -
 
 
 handle_info({seq_start, {Seq, NumChanges}}, State) ->
-    SeqsInProgress2 = gb_trees:insert(Seq, NumChanges,
-        State#rep_state.seqs_in_progress),
-    {noreply, State#rep_state{seqs_in_progress = SeqsInProgress2}};
+    #rep_state{
+        seqs_in_progress = SeqsInProgress,
+        stats = #rep_stats{missing_checked = Mc} = Stats
+    } = State,
+    NewState = State#rep_state{
+        seqs_in_progress = gb_trees:insert(Seq, NumChanges, SeqsInProgress),
+        stats = Stats#rep_stats{missing_checked = Mc + NumChanges}
+    },
+    {noreply, NewState};
 
 handle_info({seq_changes_done, Changes}, State) ->
     {noreply, process_seq_changes_done(Changes, State)};
@@ -505,7 +511,6 @@ spawn_changes_reader(Cp, StartSeq, Sourc
             couch_api_wrap:changes_since(Source, all_docs, StartSeq,
                 fun(#doc_info{high_seq=Seq, revs=Revs} = DocInfo) ->
                     Cp ! {seq_start, {Seq, length(Revs)}},
-                    Cp ! {add_stat, {#rep_stats.missing_checked, length(Revs)}},
                     ok = couch_work_queue:queue(ChangesQueue, DocInfo)
                 end, Options),
             couch_work_queue:close(ChangesQueue)



Mime
View raw message