diff options
author | Robert Newson <rnewson@apache.org> | 2018-08-01 17:57:15 +0100 |
---|---|---|
committer | Robert Newson <rnewson@apache.org> | 2018-10-01 17:32:58 +0100 |
commit | 95b97a1cad4331f63302e2f13d74b8fb50d8ecde (patch) | |
tree | e869db4624c9d5bf08d575934b83e27b796267d9 | |
parent | 7adfb1f417cf7026ca0d33b98d1a153265c0f095 (diff) | |
download | couchdb-95b97a1cad4331f63302e2f13d74b8fb50d8ecde.tar.gz |
Support and persist ?partitioned=true flag at db creation time
-rw-r--r-- | src/chttpd/src/chttpd_db.erl | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/chttpd/src/chttpd_db.erl b/src/chttpd/src/chttpd_db.erl index 49d7b5849..b0b9b8a16 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 @@ -1453,6 +1455,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"} -> |