chttpd commit: updated refs/heads/master to 994f132

2015-08-27 Thread robertkowalski
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 rnew...@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 robertkowal...@apache.org
Authored: Fri Aug 21 14:13:18 2015 +0200
Committer: Robert Kowalski robertkowal...@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),



fabric commit: updated refs/heads/master to 140bcfa

2015-08-27 Thread robertkowalski
Repository: couchdb-fabric
Updated Branches:
  refs/heads/master 42a67d0a0 - 140bcfacb


add clusterwide compaction for dbs

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

COUCHDB-2492

PR: #27
PR-URL: https://github.com/apache/couchdb-fabric/pull/27
Reviewed-By: Robert Newson rnew...@apache.org


Project: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/commit/140bcfac
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/tree/140bcfac
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-fabric/diff/140bcfac

Branch: refs/heads/master
Commit: 140bcfacbb220bc3b47697fdd7b8b306eb6d7330
Parents: 42a67d0
Author: Robert Kowalski robertkowal...@apache.org
Authored: Fri Aug 21 14:16:34 2015 +0200
Committer: Robert Kowalski robertkowal...@apache.org
Committed: Thu Aug 27 15:52:09 2015 +0200

--
 src/fabric.erl |  6 +-
 src/fabric_rpc.erl | 11 ++-
 2 files changed, 15 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/140bcfac/src/fabric.erl
--
diff --git a/src/fabric.erl b/src/fabric.erl
index 07c4c9c..c52c10a 100644
--- a/src/fabric.erl
+++ b/src/fabric.erl
@@ -33,7 +33,7 @@
 
 % miscellany
 -export([design_docs/1, reset_validation_funs/1, cleanup_index_files/0,
-cleanup_index_files/1, dbname/1]).
+cleanup_index_files/1, dbname/1, compact_db/1]).
 
 -include_lib(fabric/include/fabric.hrl).
 
@@ -411,6 +411,10 @@ reset_validation_funs(DbName) -
 [rexi:cast(Node, {fabric_rpc, reset_validation_funs, [Name]}) ||
 #shard{node=Node, name=Name} -  mem3:shards(DbName)].
 
+compact_db(DbName) -
+[rexi:cast(Node, {fabric_rpc, compact_db, [Name]}) ||
+#shard{node=Node, name=Name} - mem3:shards(DbName)].
+
 %% @doc clean up index files for all Dbs
 -spec cleanup_index_files() - [ok].
 cleanup_index_files() -

http://git-wip-us.apache.org/repos/asf/couchdb-fabric/blob/140bcfac/src/fabric_rpc.erl
--
diff --git a/src/fabric_rpc.erl b/src/fabric_rpc.erl
index 057dec3..aef34bc 100644
--- a/src/fabric_rpc.erl
+++ b/src/fabric_rpc.erl
@@ -21,7 +21,8 @@
 -export([get_all_security/2, open_shard/2]).
 
 -export([get_db_info/2, get_doc_count/2, get_update_seq/2,
- changes/4, map_view/5, reduce_view/5, group_info/3]).
+ changes/4, map_view/5, reduce_view/5, group_info/3,
+ compact_db/1]).
 
 -include_lib(fabric/include/fabric.hrl).
 -include_lib(couch/include/couch_db.hrl).
@@ -132,6 +133,14 @@ delete_db(DbName) -
 delete_shard_db_doc(_, DocId) -
 rexi:reply(mem3_util:delete_db_doc(DocId)).
 
+compact_db(DbName) -
+{ok, Db} = couch_db:open(DbName, [?ADMIN_CTX]),
+try
+{ok, _} = couch_db:start_compact(Db)
+after
+couch_db:close(Db)
+end.
+
 %% @equiv get_db_info(DbName, [])
 get_db_info(DbName) -
 get_db_info(DbName, []).



[4/4] chttpd commit: updated refs/heads/2492-compaction to 3b50727

2015-08-27 Thread robertkowalski
fix intendation


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

Branch: refs/heads/2492-compaction
Commit: 3b507275d3d5c57359d8df186c3ae81d8510af2c
Parents: 78c6f70
Author: Robert Kowalski robertkowal...@apache.org
Authored: Thu Aug 27 15:34:30 2015 +0200
Committer: Robert Kowalski robertkowal...@apache.org
Committed: Thu Aug 27 15:34:30 2015 +0200

--
 src/chttpd_db.erl | 8 ++--
 1 file changed, 2 insertions(+), 6 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/3b507275/src/chttpd_db.erl
--
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index fd02692..34b568b 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -225,15 +225,11 @@ maybe_flush_changes_feed(Acc0, Data, Len) -
 },
 {ok, Acc}.
 
-handle_compact_req(#httpd{
-method='POST', path_parts=[_DbName, _compact, _DesignName | _]
-}=Req, _Db) -
+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) -
+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),



[1/4] chttpd commit: updated refs/heads/2492-compaction to 3b50727

2015-08-27 Thread robertkowalski
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/2492-compaction [created] 3b507275d


add clusterwide compaction for dbs

COUCHDB-2492


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

Branch: refs/heads/2492-compaction
Commit: 0648df6b7fabf9e081baa14d19a1ddadd5ea0f7b
Parents: b8437a9
Author: Robert Kowalski robertkowal...@apache.org
Authored: Fri Aug 21 14:13:18 2015 +0200
Committer: Robert Kowalski robertkowal...@apache.org
Committed: Fri Aug 21 14:13:18 2015 +0200

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


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/0648df6b/src/chttpd_db.erl
--
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index a8fdc16..1fec0ec 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -225,9 +225,19 @@ 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'}=Req, Db) -
+case Req#httpd.path_parts of
+[_DbName, _compact] -
+ok = couch_db:check_is_admin(Db),
+couch_httpd:validate_ctype(Req, application/json),
+_ = couch_httpd:body(Req),
+fabric:compact_db_all_nodes(Db#db.name),
+send_json(Req, 202, {[{ok, true}]});
+end;
+
+handle_compact_req(Req, _Db) -
+send_method_not_allowed(Req, POST).
+
 
 handle_view_cleanup_req(Req, Db) -
 ok = fabric:cleanup_index_files(Db),



[2/4] chttpd commit: updated refs/heads/2492-compaction to 3b50727

2015-08-27 Thread robertkowalski
changes from review


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

Branch: refs/heads/2492-compaction
Commit: dc3c8dd636e21dba1a09413b75efa90271769170
Parents: 0648df6
Author: Robert Kowalski robertkowal...@apache.org
Authored: Mon Aug 24 11:34:20 2015 +0200
Committer: Robert Kowalski robertkowal...@apache.org
Committed: Mon Aug 24 18:03:03 2015 +0200

--
 src/chttpd_db.erl | 18 +-
 1 file changed, 9 insertions(+), 9 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/dc3c8dd6/src/chttpd_db.erl
--
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 1fec0ec..6d4f209 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -225,15 +225,15 @@ maybe_flush_changes_feed(Acc0, Data, Len) -
 },
 {ok, Acc}.
 
-handle_compact_req(#httpd{method='POST'}=Req, Db) -
-case Req#httpd.path_parts of
-[_DbName, _compact] -
-ok = couch_db:check_is_admin(Db),
-couch_httpd:validate_ctype(Req, application/json),
-_ = couch_httpd:body(Req),
-fabric:compact_db_all_nodes(Db#db.name),
-send_json(Req, 202, {[{ok, true}]});
-end;
+
+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).



[3/4] chttpd commit: updated refs/heads/2492-compaction to 3b50727

2015-08-27 Thread robertkowalski
readd errors for tbd view compaction


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

Branch: refs/heads/2492-compaction
Commit: 78c6f70f65354ef13586d11f5306c5f9a0538860
Parents: dc3c8dd
Author: Robert Kowalski robertkowal...@apache.org
Authored: Tue Aug 25 15:45:43 2015 +0200
Committer: Robert Kowalski robertkowal...@apache.org
Committed: Tue Aug 25 15:47:20 2015 +0200

--
 src/chttpd_db.erl | 5 +
 1 file changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/78c6f70f/src/chttpd_db.erl
--
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 6d4f209..fd02692 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -225,6 +225,11 @@ maybe_flush_changes_feed(Acc0, Data, Len) -
 },
 {ok, Acc}.
 
+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]



jiffy commit: updated refs/heads/master to cdcf677

2015-08-27 Thread wohali
Repository: couchdb-jiffy
Updated Branches:
  refs/heads/master ef77de4aa - cdcf6772a


fix Windows compile options


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

Branch: refs/heads/master
Commit: cdcf6772a0c6110910d10953509f2339e58fb036
Parents: ef77de4
Author: Joan Touzet woh...@apache.org
Authored: Thu Aug 27 13:53:43 2015 -0400
Committer: Joan Touzet woh...@apache.org
Committed: Thu Aug 27 13:53:43 2015 -0400

--
 rebar.config | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/cdcf6772/rebar.config
--
diff --git a/rebar.config b/rebar.config
index 76c5806..d458fd7 100644
--- a/rebar.config
+++ b/rebar.config
@@ -24,8 +24,8 @@
 {darwin10.*-32$, LDFLAGS, -arch i386},
 
 %% This will merge into basho/rebar/rebar.config eventually
-{win32, CFLAGS, /Wall /DWIN32 /D_WINDOWS /D_WIN32 /DWINDOWS},
-{win32, CXXFLAGS, -g -Wall -O3}
+{win32, CFLAGS, /Wall /DWIN32 /D_WINDOWS /D_WIN32 /DWINDOWS /Ic_src},
+{win32, CXXFLAGS, $CFLAGS /O2 /DNDEBUG /Wall /Ic_src}
 ]}.
 
 {erl_opts, [



jiffy commit: updated refs/heads/master to ea19c41

2015-08-27 Thread wohali
Repository: couchdb-jiffy
Updated Branches:
  refs/heads/master cdcf6772a - ea19c417f


Reduce C++ flags to -O2 to fix gcc5 build


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

Branch: refs/heads/master
Commit: ea19c417f9fd52fa3f7ef2d378735e5532c59b29
Parents: cdcf677
Author: Joan Touzet woh...@apache.org
Authored: Thu Aug 27 14:25:54 2015 -0400
Committer: Joan Touzet woh...@apache.org
Committed: Thu Aug 27 14:25:54 2015 -0400

--
 rebar.config | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
--


http://git-wip-us.apache.org/repos/asf/couchdb-jiffy/blob/ea19c417/rebar.config
--
diff --git a/rebar.config b/rebar.config
index d458fd7..cf589ba 100644
--- a/rebar.config
+++ b/rebar.config
@@ -10,7 +10,7 @@
 {(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin),
 CFLAGS, $CFLAGS -Ic_src/ -g -Wall -Werror -O3 
-fno-strict-aliasing},
 {(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin),
-CXXFLAGS, $CXXFLAGS -Ic_src/ -g -Wall -Werror -O3},
+CXXFLAGS, $CXXFLAGS -Ic_src/ -g -Wall -Werror -O2},
 
 {(linux|solaris|freebsd|netbsd|openbsd|dragonfly|darwin),
 LDFLAGS, $LDFLAGS -lstdc++},



chttpd commit: updated refs/heads/master to a49c474

2015-08-27 Thread rnewson
Repository: couchdb-chttpd
Updated Branches:
  refs/heads/master 994f132fd - a49c47417


Capture histogram data for _bulk_requests

COUCHDB-2792


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

Branch: refs/heads/master
Commit: a49c47417cc9190f8b5afe0c058c9a742a6cf587
Parents: 994f132
Author: Robert Newson rnew...@apache.org
Authored: Thu Aug 27 21:29:55 2015 +0100
Committer: Robert Newson rnew...@apache.org
Committed: Thu Aug 27 22:48:46 2015 +0100

--
 src/chttpd_db.erl | 1 +
 1 file changed, 1 insertion(+)
--


http://git-wip-us.apache.org/repos/asf/couchdb-chttpd/blob/a49c4741/src/chttpd_db.erl
--
diff --git a/src/chttpd_db.erl b/src/chttpd_db.erl
index 9b064ce..9457ac1 100644
--- a/src/chttpd_db.erl
+++ b/src/chttpd_db.erl
@@ -383,6 +383,7 @@ 
db_req(#httpd{method='POST',path_parts=[_,_bulk_docs], user_ctx=Ctx}=Req,
 DocsArray0 -
 DocsArray0
 end,
+couch_stats:update_histogram([couchdb, httpd, bulk_docs], 
length(DocsArray)),
 W = case couch_util:get_value(w, JsonProps) of
 Value when is_integer(Value) -
 integer_to_list(Value);



couch commit: updated refs/heads/master to 0fdc50b

2015-08-27 Thread rnewson
Repository: couchdb-couch
Updated Branches:
  refs/heads/master f6b69a925 - 0fdc50bf3


Capture histogram data for _bulk_requests

COUCHDB-2792


Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch/commit/0fdc50bf
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch/tree/0fdc50bf
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch/diff/0fdc50bf

Branch: refs/heads/master
Commit: 0fdc50bf3e237c5b4f1f331e7063f44ce1cdf2aa
Parents: f6b69a9
Author: Robert Newson rnew...@apache.org
Authored: Thu Aug 27 21:22:17 2015 +0100
Committer: Robert Newson rnew...@apache.org
Committed: Thu Aug 27 22:20:54 2015 +0100

--
 priv/stats_descriptions.cfg | 4 
 src/couch_httpd_db.erl  | 1 +
 2 files changed, 5 insertions(+)
--


http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0fdc50bf/priv/stats_descriptions.cfg
--
diff --git a/priv/stats_descriptions.cfg b/priv/stats_descriptions.cfg
index 4410590..c695ae4 100644
--- a/priv/stats_descriptions.cfg
+++ b/priv/stats_descriptions.cfg
@@ -50,6 +50,10 @@
 {type, counter},
 {desc, number of _local document write operations}
 ]}.
+{[couchdb, httpd, bulk_docs], [
+{type, histogram},
+{desc, distribution of the number of docs in _bulk_docs requests}
+]}.
 {[couchdb, httpd, bulk_requests], [
 {type, counter},
 {desc, number of bulk requests}

http://git-wip-us.apache.org/repos/asf/couchdb-couch/blob/0fdc50bf/src/couch_httpd_db.erl
--
diff --git a/src/couch_httpd_db.erl b/src/couch_httpd_db.erl
index a3f2902..4337f41 100644
--- a/src/couch_httpd_db.erl
+++ b/src/couch_httpd_db.erl
@@ -304,6 +304,7 @@ 
db_req(#httpd{method='POST',path_parts=[_,_bulk_docs]}=Req, Db) -
 undefined -
 send_error(Req, 400, bad_request, Missing JSON list of 
'docs');
 DocsArray -
+couch_stats:update_histogram([couchdb, httpd, bulk_docs], 
length(DocsArray)),
 case couch_httpd:header_value(Req, X-Couch-Full-Commit) of
 true -
 Options = [full_commit];