You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2024/05/17 20:00:31 UTC
(couchdb) branch cleanup-upgrade-clauses-for-fabric-view-changes created (now b50240fe7)
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a change to branch cleanup-upgrade-clauses-for-fabric-view-changes
in repository https://gitbox.apache.org/repos/asf/couchdb.git
at b50240fe7 Cleanup a few clauses in fabric_view_changes
This branch includes the following new commits:
new b50240fe7 Cleanup a few clauses in fabric_view_changes
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(couchdb) 01/01: Cleanup a few clauses in fabric_view_changes
Posted by va...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
vatamane pushed a commit to branch cleanup-upgrade-clauses-for-fabric-view-changes
in repository https://gitbox.apache.org/repos/asf/couchdb.git
commit b50240fe7f34d3dcd3aeb08ef3c2111d6478716d
Author: Nick Vatamaniuc <va...@gmail.com>
AuthorDate: Fri May 17 15:54:37 2024 -0400
Cleanup a few clauses in fabric_view_changes
`#changes{}` record and old `complete` format was deprecated 10 years ago [1].
While at it, cleanup un-necessarily long arg per line call formats.
Coincidentally, this also improve code coverage a bit:
```
fabric_view_changes : 72% (pr)
fabric_view_changes : 71% (main)
```
[1] https://github.com/apache/couchdb/commit/865b5555771e6099c9b34b1b14d2428ce02e50c3
---
src/fabric/include/fabric.hrl | 1 -
src/fabric/src/fabric_view_changes.erl | 44 +++++-----------------------------
2 files changed, 6 insertions(+), 39 deletions(-)
diff --git a/src/fabric/include/fabric.hrl b/src/fabric/include/fabric.hrl
index 19eb6751c..dd312f028 100644
--- a/src/fabric/include/fabric.hrl
+++ b/src/fabric/include/fabric.hrl
@@ -41,7 +41,6 @@
}).
-record(view_row, {key, id, value, doc, worker}).
--record(change, {key, id, value, deleted=false, doc, worker}).
-type row_property_key() :: id | key | value | doc | worker.
-type row_properties() :: [{row_property_key(), any()}].
diff --git a/src/fabric/src/fabric_view_changes.erl b/src/fabric/src/fabric_view_changes.erl
index 6697a1c67..85bc7370c 100644
--- a/src/fabric/src/fabric_view_changes.erl
+++ b/src/fabric/src/fabric_view_changes.erl
@@ -124,15 +124,9 @@ keep_sending_changes(DbName, Args, Callback, Seqs, AccIn, Timeout, UpListen, T0)
Callback({stop, LastSeq, pending_count(Offset)}, AccOut);
_ ->
{ok, AccTimeout} = Callback(timeout, AccOut),
- ?MODULE:keep_sending_changes(
- DbName,
- Args#changes_args{limit = Limit2},
- Callback,
- LastSeq,
- AccTimeout,
- Timeout,
- UpListen,
- T0
+ Args1 = Args#changes_args{limit = Limit2},
+ keep_sending_changes(
+ DbName, Args1, Callback, LastSeq, AccTimeout, Timeout, UpListen, T0
)
end
end.
@@ -201,15 +195,7 @@ send_changes(DbName, ChangesArgs, Callback, PackedSeqs, AccIn, Timeout) ->
end,
Workers
),
- send_changes(
- DbName,
- Workers,
- LiveSeqs,
- ChangesArgs,
- Callback,
- AccIn,
- Timeout
- )
+ send_changes(DbName, Workers, LiveSeqs, ChangesArgs, Callback, AccIn, Timeout)
after
fabric_streams:cleanup(Workers)
end;
@@ -270,9 +256,6 @@ handle_message({rexi_DOWN, _, {_, NodeRef}, _}, _, State) ->
fabric_view:check_down_shards(State, NodeRef);
handle_message({rexi_EXIT, Reason}, Worker, State) ->
fabric_view:handle_worker_exit(State, Worker, Reason);
-% Temporary upgrade clause - Case 24236
-handle_message({complete, Key}, Worker, State) when is_tuple(Key) ->
- handle_message({complete, [{seq, Key}, {pending, 0}]}, Worker, State);
handle_message({change, Props}, {Worker, _}, #collector{limit = 0} = State) ->
O0 = State#collector.offset,
O1 =
@@ -295,9 +278,7 @@ handle_message({complete, Props}, Worker, #collector{limit = 0} = State) ->
O0
end,
maybe_stop(State#collector{offset = O1});
-handle_message({no_pass, Props}, {Worker, From}, #collector{limit = 0} = State) when
- is_list(Props)
-->
+handle_message({no_pass, [_ | _] = Props}, {Worker, From}, #collector{limit = 0} = State) ->
#collector{counters = S0, offset = O0} = State,
O1 =
case fabric_dict:lookup_element(Worker, O0) of
@@ -309,16 +290,6 @@ handle_message({no_pass, Props}, {Worker, From}, #collector{limit = 0} = State)
S1 = fabric_dict:store(Worker, couch_util:get_value(seq, Props), S0),
rexi:stream_ack(From),
maybe_stop(State#collector{counters = S1, offset = O1});
-handle_message(#change{} = Row, {Worker, From}, St) ->
- Change =
- {change, [
- {seq, Row#change.key},
- {id, Row#change.id},
- {changes, Row#change.value},
- {deleted, Row#change.deleted},
- {doc, Row#change.doc}
- ]},
- handle_message(Change, {Worker, From}, St);
handle_message({change, Props}, {Worker, From}, St) ->
#collector{
callback = Callback,
@@ -341,9 +312,6 @@ handle_message({change, Props}, {Worker, From}, St) ->
{Go, Acc} = Callback(changes_row(Props2), AccIn),
rexi:stream_ack(From),
{Go, St#collector{counters = S1, offset = O1, limit = Limit - 1, user_acc = Acc}};
-%% upgrade clause
-handle_message({no_pass, Seq}, From, St) when is_integer(Seq) ->
- handle_message({no_pass, [{seq, Seq}]}, From, St);
handle_message({no_pass, Props}, {Worker, From}, St) ->
Seq = couch_util:get_value(seq, Props),
#collector{counters = S0} = St,
@@ -351,7 +319,7 @@ handle_message({no_pass, Props}, {Worker, From}, St) ->
S1 = fabric_dict:store(Worker, Seq, S0),
rexi:stream_ack(From),
{ok, St#collector{counters = S1}};
-handle_message({complete, Props}, Worker, State) ->
+handle_message({complete, [_ | _] = Props}, Worker, State) ->
Key = couch_util:get_value(seq, Props),
#collector{
counters = S0,