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 2019/01/18 18:22:28 UTC
[GitHub] rnewson commented on a change in pull request #1811: Add new
/{db}/_sync_shards endpoint (admin-only)
rnewson commented on a change in pull request #1811: Add new /{db}/_sync_shards endpoint (admin-only)
URL: https://github.com/apache/couchdb/pull/1811#discussion_r249138927
##########
File path: src/mem3/src/mem3_httpd.erl
##########
@@ -52,6 +53,16 @@ handle_shards_req(#httpd{path_parts=[_DbName, <<"_shards">>]}=Req, _Db) ->
handle_shards_req(#httpd{path_parts=[_DbName, <<"_shards">>, _DocId]}=Req, _Db) ->
chttpd:send_method_not_allowed(Req, "GET").
+handle_sync_req(#httpd{method='POST',
+ path_parts=[_DbName, <<"_sync_shards">>]} = Req, Db) ->
+ DbName = mem3:dbname(couch_db:name(Db)),
+ ShardList = [S#shard.name || S <- mem3:ushards(DbName)],
+ [ sync_shard(S) || S <- ShardList ],
+ chttpd:send_json(Req, 202, {[{ok, true}]});
+handle_sync_req(#httpd{method='GET'}=Req, _Db) ->
Review comment:
best to catch all non-POST methods here so we send an error response for every method.
----------------------------------------------------------------
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