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 2018/08/13 21:35:18 UTC

[couchdb] 02/06: validate new partition arguments

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

rnewson pushed a commit to branch user-partitioned-dbs-6
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit d3d28211ecb83cc6cfcc5e6b407b7fa8f968ceb6
Author: Robert Newson <rn...@apache.org>
AuthorDate: Mon Aug 6 19:21:49 2018 +0100

    validate new partition arguments
---
 src/couch_mrview/src/couch_mrview_util.erl | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl
index a63701f..592bfb5 100644
--- a/src/couch_mrview/src/couch_mrview_util.erl
+++ b/src/couch_mrview/src/couch_mrview_util.erl
@@ -577,6 +577,17 @@ validate_args(Args) ->
         _ -> mrverror(<<"Invalid value for `sorted`.">>)
     end,
 
+    case {get_extra(Args, partitioned, false), get_extra(Args, partition)} of
+        {true, undefined} ->
+            mrverror(<<"`partition` parameter is mandatory for queries to this view.">>);
+        {true, _Partition} ->
+            ok;
+        {false, undefined} ->
+            ok;
+        {false, _Partition} ->
+            mrverror(<<"`partition` parameter is not supported in this view.">>)
+    end,
+
     Args#mrargs{
         start_key_docid=SKDocId,
         end_key_docid=EKDocId,