You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2016/03/30 13:14:30 UTC
fabric commit: updated refs/heads/2849-update_seq_view to dea3b5e
Repository: couchdb-fabric
Updated Branches:
refs/heads/2849-update_seq_view [created] dea3b5ea3
return packed update_seq (WIP)
Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/dea3b5ea
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/dea3b5ea
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/dea3b5ea
Branch: refs/heads/2849-update_seq_view
Commit: dea3b5ea30b72913107d53e9cce8c0e53ab9880b
Parents: 68b2210
Author: Robert Newson <rn...@apache.org>
Authored: Wed Mar 30 12:14:20 2016 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Mar 30 12:14:20 2016 +0100
----------------------------------------------------------------------
include/fabric.hrl | 3 ++-
src/fabric_view_map.erl | 10 ++++++++--
2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/dea3b5ea/include/fabric.hrl
----------------------------------------------------------------------
diff --git a/include/fabric.hrl b/include/fabric.hrl
index abbc4ad..eb7858e 100644
--- a/include/fabric.hrl
+++ b/include/fabric.hrl
@@ -29,7 +29,8 @@
reducer,
lang,
sorted,
- user_acc
+ user_acc,
+ update_seq
}).
-record(stream_acc, {
http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/dea3b5ea/src/fabric_view_map.erl
----------------------------------------------------------------------
diff --git a/src/fabric_view_map.erl b/src/fabric_view_map.erl
index 1977888..e9d8db7 100644
--- a/src/fabric_view_map.erl
+++ b/src/fabric_view_map.erl
@@ -64,6 +64,7 @@ go(DbName, Workers, Args, Callback, Acc0) ->
query_args = Args,
callback = Callback,
counters = fabric_dict:init(Workers, 0),
+ update_seq = fabric_dict:init(Workers, nil),
skip = Skip,
limit = Limit,
keys = fabric_view:keydict(Keys),
@@ -89,30 +90,35 @@ handle_message({rexi_EXIT, Reason}, Worker, State) ->
handle_message({meta, Meta0}, {Worker, From}, State) ->
Tot = couch_util:get_value(total, Meta0, 0),
Off = couch_util:get_value(offset, Meta0, 0),
+ UpdateSeq = couch_util:get_value(update_seq, Meta0, 0),
#collector{
callback = Callback,
counters = Counters0,
total_rows = Total0,
offset = Offset0,
- user_acc = AccIn
+ user_acc = AccIn,
+ update_seq = UpdateSeq0
} = State,
% Assert that we don't have other messages from this
% worker when the total_and_offset message arrives.
0 = fabric_dict:lookup_element(Worker, Counters0),
rexi:stream_ack(From),
Counters1 = fabric_dict:update_counter(Worker, 1, Counters0),
+ UpdateSeq1 = fabric_dict:store(Worker, UpdateSeq, UpdateSeq0),
Total = Total0 + Tot,
Offset = Offset0 + Off,
case fabric_dict:any(0, Counters1) of
true ->
{ok, State#collector{
counters = Counters1,
+ update_seq = UpdateSeq1,
total_rows = Total,
offset = Offset
}};
false ->
FinalOffset = erlang:min(Total, Offset+State#collector.skip),
- Meta = [{total, Total}, {offset, FinalOffset}],
+ Meta = [{total, Total}, {offset, FinalOffset},
+ {update_seq, fabric_view_changes:pack_seqs(UpdateSeq1)}],
{Go, Acc} = Callback({meta, Meta}, AccIn),
{Go, State#collector{
counters = fabric_dict:decrement_all(Counters1),