couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertkowal...@apache.org
Subject chttpd commit: updated refs/heads/master to 994f132
Date Thu, 27 Aug 2015 13:50:35 GMT
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 129cdf934 -> 994f132fd


add clusterwide compaction for dbs

PRs:
https://github.com/apache/couchdb-chttpd/pull/62
https://github.com/apache/couchdb-fabric/pull/27

COUCHDB-2492

PR: #62
PR-URL: https://github.com/apache/couchdb-chttpd/pull/62
Reviewed-By: Robert Newson <rnewson@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/commit/994f132f
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/tree/994f132f
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/diff/994f132f

Branch: refs/heads/master
Commit: 994f132fd0923223ec7fd0802288fc2814bcc634
Parents: 129cdf9
Author: Robert Kowalski <robertkowalski@apache.org>
Authored: Fri Aug 21 14:13:18 2015 +0200
Committer: Robert Kowalski <robertkowalski@apache.org>
Committed: Thu Aug 27 15:50:09 2015 +0200

----------------------------------------------------------------------
 src/chttpd_db.erl | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/994f132f/src/chttpd_db.erl
----------------------------------------------------------------------
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 89e3a88..9b064ce 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -225,9 +225,20 @@ maybe_flush_changes_feed(Acc0, Data, Len) ->
     },
     {ok, Acc}.
 
-handle_compact_req(Req, _) ->
-    Msg = <<"Compaction must be triggered on a per-shard basis in CouchDB">>,
-    couch_httpd:send_error(Req, 403, forbidden, Msg).
+handle_compact_req(#httpd{method='POST', path_parts=[_DbName, <<"_compact">>,
_DesignName | _]}=Req, _Db) ->
+    Msg = <<"Compactions for views must be triggered on a per-shard basis in CouchDB">>,
+    couch_httpd:send_error(Req, 403, forbidden, Msg);
+
+handle_compact_req(#httpd{method='POST', path_parts=[_DbName, <<"_compact">>]}=Req,
Db) ->
+    couch_httpd:validate_ctype(Req, "application/json"),
+    ok = couch_db:check_is_admin(Db),
+    couch_httpd:body(Req),
+    fabric:compact_db(Db#db.name),
+    send_json(Req, 202, {[{ok, true}]});
+
+handle_compact_req(Req, _Db) ->
+    send_method_not_allowed(Req, "POST").
+
 
 handle_view_cleanup_req(Req, Db) ->
     ok = fabric:cleanup_index_files(Db),


Mime
View raw message