From 665df9e7a2edd06a5b6d345df27058e38c053c2f Mon Sep 17 00:00:00 2001 From: Benjamin Bastian Date: Wed, 1 Oct 2014 11:14:53 -0700 Subject: [PATCH] Add `hash_algorithm` QS option to DB creation --- src/chttpd_db.erl | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl index eec18be..43ec247 100644 --- a/src/chttpd_db.erl +++ b/src/chttpd_db.erl @@ -225,8 +225,10 @@ create_db_req(#httpd{}=Req, DbName) -> N = couch_httpd:qs_value(Req, "n", config:get("cluster", "n", "3")), Q = couch_httpd:qs_value(Req, "q", config:get("cluster", "q", "8")), P = couch_httpd:qs_value(Req, "placement", config:get("cluster", "placement")), + DefaultAlgo = config:get("cluster", "hash_algorithm", "crc32"), + HashAlgo = couch_httpd:qs_value(Req, "hash_algorithm", DefaultAlgo), DocUrl = absolute_uri(Req, "/" ++ couch_util:url_encode(DbName)), - case fabric:create_db(DbName, [{n,N}, {q,Q}, {placement,P}]) of + case fabric:create_db(DbName, [{n,N}, {q,Q}, {placement,P},{hash_algo,HashAlgo}]) of ok -> send_json(Req, 201, [{"Location", DocUrl}], {[{ok, true}]}); accepted ->