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 2021/09/15 21:25:52 UTC

[couchdb] 02/02: Restrict the limit=0 clause to the sorted=false case as originally intended

This is an automated email from the ASF dual-hosted git repository.

rnewson pushed a commit to branch fix-limit0-for-views-again
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 4e158bbe136d02c81bad8e928fb9febe1777df17
Author: Robert Newson <rn...@apache.org>
AuthorDate: Wed Sep 15 22:22:43 2021 +0100

    Restrict the limit=0 clause to the sorted=false case as originally intended
    
    The limit=0 clause was introduced in commit 4e0c97bf which added
    sorted=false support. It accidentally matches when the user specifies
    limit=0 and causes us not to apply the logic that ensures we collect a
    {meta, Meta} message from each shard range and then send the
    total_rows and offset fields.
---
 src/fabric/src/fabric_view_map.erl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/fabric/src/fabric_view_map.erl b/src/fabric/src/fabric_view_map.erl
index b8d0d39..ff6aa8b 100644
--- a/src/fabric/src/fabric_view_map.erl
+++ b/src/fabric/src/fabric_view_map.erl
@@ -146,7 +146,7 @@ handle_message({meta, Meta0}, {Worker, From}, State) ->
         }}
     end;
 
-handle_message(#view_row{}, {_, _}, #collector{limit=0} = State) ->
+handle_message(#view_row{}, {_, _}, #collector{sorted=false, limit=0} = State) ->
     #collector{callback=Callback} = State,
     {_, Acc} = Callback(complete, State#collector.user_acc),
     {stop, State#collector{user_acc=Acc}};