summaryrefslogtreecommitdiff
path: root/src/couchdb/couch_rep_missing_revs.erl
diff options
context:
space:
mode:
authorAdam Kocoloski <kocolosk@apache.org>2009-08-10 18:37:43 +0000
committerAdam Kocoloski <kocolosk@apache.org>2009-08-10 18:37:43 +0000
commit5dcbc2290ac780f1a625b5c9435cfb35eac4e1ef (patch)
treebc9e04c73807b9eb34e05d5c70026b2e951fc673 /src/couchdb/couch_rep_missing_revs.erl
parentabcc5a35fda60c7124af7899939f09e59ae7968b (diff)
new replicator using _changes feed for continuous replication
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@802888 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_rep_missing_revs.erl')
-rw-r--r--src/couchdb/couch_rep_missing_revs.erl15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/couchdb/couch_rep_missing_revs.erl b/src/couchdb/couch_rep_missing_revs.erl
index bd7cda66..7e1dc16a 100644
--- a/src/couchdb/couch_rep_missing_revs.erl
+++ b/src/couchdb/couch_rep_missing_revs.erl
@@ -51,19 +51,17 @@ init([Parent, Target, ChangesFeed, _PostProps]) ->
{ok, #state{changes_loop=Pid, target=Target, parent=Parent}}.
handle_call({add_missing_revs, {HighSeq, Revs}}, From, State) ->
+ State#state.parent ! {update_stats, missing_revs, length(Revs)},
handle_add_missing_revs(HighSeq, Revs, From, State);
handle_call(next_missing_revs, From, State) ->
- handle_next_missing_revs(From, State);
+ handle_next_missing_revs(From, State).
-handle_call({update_committed_seq, N}, _From, State) ->
+handle_cast({update_committed_seq, N}, State) ->
if State#state.high_committed_seq < N ->
?LOG_DEBUG("missing_revs updating committed seq to ~p", [N]);
true -> ok end,
- {reply, ok, State#state{high_committed_seq=N}}.
-
-handle_cast(_Msg, State) ->
- {noreply, State}.
+ {noreply, State#state{high_committed_seq=N}}.
handle_info({'EXIT', Pid, Reason}, #state{changes_loop=Pid} = State) ->
handle_changes_loop_exit(Reason, State);
@@ -84,8 +82,9 @@ code_change(_OldVsn, State, _Extra) ->
%internal funs
handle_add_missing_revs(HighSeq, [], _From, State) ->
- maybe_checkpoint(State),
- {reply, ok, State#state{high_source_seq=HighSeq}};
+ NewState = State#state{high_source_seq=HighSeq},
+ maybe_checkpoint(NewState),
+ {reply, ok, NewState};
handle_add_missing_revs(HighSeq, Revs, From, #state{reply_to=nil} = State) ->
#state{rows=Rows, count=Count} = State,
NewState = State#state{