summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2020-03-16 22:39:16 +0000
committerRobert Newson <rnewson@apache.org>2020-03-16 22:39:16 +0000
commit6fd307272744aff2d9d1e21a2a9263e37032de74 (patch)
tree6998285e3e7e0ed42752a007318a5efa829717f4
parentf7bdc8c085fcb3cf7c4155adcb97b5675b5e2467 (diff)
downloadcouchdb-dont-crash-dbview-partitioned.tar.gz
View is partitioned if db and view are partitioneddont-crash-dbview-partitioned
We've seen a crash if DbPartitioned is false and ViewPartitioned is true, which is obviously nonsense. The effect of the `nocase` is the termination of the couch_index_server gen_server, which is a serious amplification of a small (user-initiated) oddity.
-rw-r--r--src/couch_mrview/src/couch_mrview_index.erl11
1 files changed, 1 insertions, 10 deletions
diff --git a/src/couch_mrview/src/couch_mrview_index.erl b/src/couch_mrview/src/couch_mrview_index.erl
index cc013c5bd..68f1d2322 100644
--- a/src/couch_mrview/src/couch_mrview_index.erl
+++ b/src/couch_mrview/src/couch_mrview_index.erl
@@ -258,16 +258,7 @@ set_partitioned(Db, State) ->
DbPartitioned = couch_db:is_partitioned(Db),
ViewPartitioned = couch_util:get_value(
<<"partitioned">>, DesignOpts, DbPartitioned),
- IsPartitioned = case {DbPartitioned, ViewPartitioned} of
- {true, true} ->
- true;
- {true, false} ->
- false;
- {false, false} ->
- false;
- _ ->
- throw({bad_request, <<"invalid partition option">>})
- end,
+ IsPartitioned = DbPartitioned andalso ViewPartitioned,
State#mrst{partitioned = IsPartitioned}.