You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by gi...@git.apache.org on 2017/06/28 20:49:32 UTC
[GitHub] nickva commented on a change in pull request #623: Ensure replicator _active_tasks entry reports recent pending changes
nickva commented on a change in pull request #623: Ensure replicator _active_tasks entry reports recent pending changes
URL: https://github.com/apache/couchdb/pull/623#discussion_r124652951
##########
File path: src/couch_replicator/src/couch_replicator_scheduler_job.erl
##########
@@ -652,16 +652,38 @@ changes_manager_loop_open(Parent, ChangesQueue, BatchSize, Ts) ->
case couch_work_queue:dequeue(ChangesQueue, BatchSize) of
closed ->
From ! {closed, self()};
- {ok, Changes} ->
- #doc_info{high_seq = Seq} = lists:last(Changes),
- ReportSeq = {Ts, Seq},
- ok = gen_server:cast(Parent, {report_seq, ReportSeq}),
- From ! {changes, self(), Changes, ReportSeq}
+ {ok, ChangesOrLastSeqs} ->
+ {LastSeqs, Changes} = lists:partition(
+ fun({last_seq, _Seq}) ->
+ true;
+ (#doc_info{}) ->
+ false
+ end, ChangesOrLastSeqs),
+ ok = maybe_report_last_sequence(Parent, LastSeqs, Ts),
+ ok = maybe_process_changes(Parent, Changes, From, Ts)
end,
changes_manager_loop_open(Parent, ChangesQueue, BatchSize, Ts + 1)
end.
+maybe_report_last_sequence(_Parent, [] = _LastSeqs, _Ts) ->
+ ok;
+maybe_report_last_sequence(Parent, LastSeqs, Ts) ->
+ {last_seq, Seq} = lists:last(LastSeqs),
+ Msg = {report_seq_done, {Ts, Seq}, couch_replicator_stats:new()},
+ ok = gen_server:call(Parent, Msg, infinity).
+
+
+maybe_process_changes(_Parent, [] = _Changes, _From, _Ts) ->
+ ok;
Review comment:
You're right!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services