You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/08/29 20:33:17 UTC
[GitHub] eiri commented on a change in pull request #1588: Check if db
exists in /db/_ensure_full_commit call
eiri commented on a change in pull request #1588: Check if db exists in /db/_ensure_full_commit call
URL: https://github.com/apache/couchdb/pull/1588#discussion_r213824318
##########
File path: src/chttpd/src/chttpd_db.erl
##########
@@ -375,8 +375,10 @@ db_req(#httpd{method='POST', path_parts=[DbName], user_ctx=Ctx}=Req, Db) ->
db_req(#httpd{path_parts=[_DbName]}=Req, _Db) ->
send_method_not_allowed(Req, "DELETE,GET,HEAD,POST");
-db_req(#httpd{method='POST',path_parts=[_,<<"_ensure_full_commit">>]}=Req, _Db) ->
+db_req(#httpd{method='POST', path_parts=[DbName, <<"_ensure_full_commit">>],
+ user_ctx=Ctx}=Req, _Db) ->
chttpd:validate_ctype(Req, "application/json"),
+ fabric:get_security(DbName, [{user_ctx, Ctx}]),
Review comment:
I'm using `get_security` here because 1) it is what old code was using 2) get security calls `fabric_util:get_db` that actually does open remote shards, but gives priority to local ones, so it allows to avoid round-trip when possible 3) it _presumably_ also confirms user to be `reader`, that what old code was saying, but I don't see it in fabric, tbh.
I can drop a comment here or I can switch to `fabric:get_db_info` if you think that'd be less subtle.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services