summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoan Touzet <joant@atypical.net>2020-01-31 19:02:10 -0500
committerJoan Touzet <wohali@users.noreply.github.com>2020-02-01 04:21:34 +0000
commit3aab21c8c47246d00af4a777d47924c506dcd2fb (patch)
tree3fa5d74ea25f9b6651cf40a7258592fda9e6cc17
parent8f2fbec14e8b18eadd42e873e6d73712e12af1aa (diff)
downloadcouchdb-3aab21c8c47246d00af4a777d47924c506dcd2fb.tar.gz
Enable per-view-shard access
-rw-r--r--src/couch/src/couch_httpd_db.erl10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/couch/src/couch_httpd_db.erl b/src/couch/src/couch_httpd_db.erl
index 1a07b202c..2418c1a4c 100644
--- a/src/couch/src/couch_httpd_db.erl
+++ b/src/couch/src/couch_httpd_db.erl
@@ -199,9 +199,15 @@ handle_design_req(#httpd{
false -> ok
end,
- % load ddoc
+ % maybe load ddoc through fabric
DesignId = <<"_design/", DesignName/binary>>,
- DDoc = couch_httpd_db:couch_doc_open(Db, DesignId, nil, [ejson_body]),
+ case couch_httpd_db:couch_doc_open(Db, DesignId, nil, [ejson_body]) of
+ not_found ->
+ DbName = mem3:dbname(couch_db:name(Db)),
+ {ok, DDoc} = fabric:open_doc(DbName, DesignId, [?ADMIN_CTX]);
+ DDoc ->
+ ok
+ end,
Handler = couch_util:dict_find(Action, DesignUrlHandlers, fun(_, _, _) ->
throw({not_found, <<"missing handler: ", Action/binary>>})
end),