summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Newson <rnewson@apache.org>2018-08-01 17:57:15 +0100
committerRobert Newson <rnewson@apache.org>2018-08-06 14:20:19 +0100
commit0dfca463bc3ca4ae2cca2bca914fd7908460ed35 (patch)
tree9cec7f9ee56ff97b57add33f054d7581f9967b22
parent081757b33ff999dace3b6d272270ffd1f83487a0 (diff)
downloadcouchdb-0dfca463bc3ca4ae2cca2bca914fd7908460ed35.tar.gz
Support and persist ?partitioned=true flag at db creation time
-rw-r--r--src/chttpd/src/chttpd_db.erl16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl
index 776100730..090555935 100644
--- a/src/chttpd/src/chttpd_db.erl
+++ b/src/chttpd/src/chttpd_db.erl
@@ -285,10 +285,12 @@ create_db_req(#httpd{}=Req, DbName) ->
Q = chttpd:qs_value(Req, "q", config:get("cluster", "q", "8")),
P = chttpd:qs_value(Req, "placement", config:get("cluster", "placement")),
EngineOpt = parse_engine_opt(Req),
+ Partitioned = parse_partitioned_opt(Req),
Options = [
{n, N},
{q, Q},
- {placement, P}
+ {placement, P},
+ {initial_props, [{partitioned, Partitioned}]}
] ++ EngineOpt,
DocUrl = absolute_uri(Req, "/" ++ couch_util:url_encode(DbName)),
case fabric:create_db(DbName, Options) of
@@ -1412,6 +1414,18 @@ parse_engine_opt(Req) ->
end
end.
+
+parse_partitioned_opt(Req) ->
+ case chttpd:qs_value(Req, "partitioned") of
+ undefined ->
+ false;
+ "true" ->
+ true;
+ _ ->
+ throw({bad_request, <<"`partitioned` parameter can only be set to true.">>})
+ end.
+
+
parse_doc_query({Key, Value}, Args) ->
case {Key, Value} of
{"attachments", "true"} ->