You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by rn...@apache.org on 2014/08/28 14:12:50 UTC
[1/9] couch-mrview commit: updated refs/heads/master to 4cc8114
Repository: couchdb-couch-mrview
Updated Branches:
refs/heads/master 60eb161f4 -> 4cc8114a6
Gracefully handle design document updates with malformatted structure
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/911e5e95
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/911e5e95
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/911e5e95
Branch: refs/heads/master
Commit: 911e5e955516d9a7b705cfde3a73b1ba786341b0
Parents: 60eb161
Author: Robert Newson <rn...@apache.org>
Authored: Wed Aug 6 11:34:25 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Aug 6 11:39:56 2014 +0100
----------------------------------------------------------------------
src/couch_mrview.erl | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/911e5e95/src/couch_mrview.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview.erl b/src/couch_mrview.erl
index d5faca3..047bc00 100644
--- a/src/couch_mrview.erl
+++ b/src/couch_mrview.erl
@@ -42,6 +42,15 @@
validate(DbName, DDoc) ->
+ {Fields} = DDoc#doc.body,
+ case couch_util:get_value(<<"options">>, Fields, {[]}) of
+ {_} -> ok;
+ _ -> throw({invalid_design_doc, <<"`options` parameter must be an object.">>})
+ end,
+ case couch_util:get_value(<<"views">>, Fields, {[]}) of
+ {_} -> ok;
+ _ -> throw({invalid_design_doc, <<"`views` parameter must be an object.">>})
+ end,
GetName = fun
(#mrview{map_names = [Name | _]}) -> Name;
(#mrview{reduce_funs = [{Name, _} | _]}) -> Name;
[2/9] couch-mrview commit: updated refs/heads/master to 4cc8114
Posted by rn...@apache.org.
Expose language and views from #mrst{} records
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/a6dfc8c4
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/a6dfc8c4
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/a6dfc8c4
Branch: refs/heads/master
Commit: a6dfc8c402a7bc3bc3b4bc919597b4ec33146b91
Parents: 911e5e9
Author: Paul J. Davis <pa...@gmail.com>
Authored: Sun Aug 17 12:37:08 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Sun Aug 17 12:37:08 2014 -0500
----------------------------------------------------------------------
src/couch_mrview_index.erl | 4 ++++
1 file changed, 4 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/a6dfc8c4/src/couch_mrview_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_index.erl b/src/couch_mrview_index.erl
index 5baee7c..5cebcf1 100644
--- a/src/couch_mrview_index.erl
+++ b/src/couch_mrview_index.erl
@@ -40,6 +40,10 @@ get(Property, State) ->
LocalSeq = couch_util:get_value(<<"local_seq">>, Opts, false),
if IncDesign -> [include_design]; true -> [] end
++ if LocalSeq -> [local_seq]; true -> [] end;
+ language ->
+ State#mrst.language;
+ views ->
+ State#mrst.views;
info ->
#mrst{
fd = Fd,
[9/9] couch-mrview commit: updated refs/heads/master to 4cc8114
Posted by rn...@apache.org.
Monitor the newly compacted view file
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/4cc8114a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/4cc8114a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/4cc8114a
Branch: refs/heads/master
Commit: 4cc8114a680d309deb77e0451bad5e45642f4006
Parents: 6831348
Author: Robert Newson <rn...@apache.org>
Authored: Wed Aug 27 19:15:18 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Wed Aug 27 19:15:18 2014 +0100
----------------------------------------------------------------------
src/couch_mrview_compactor.erl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/4cc8114a/src/couch_mrview_compactor.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_compactor.erl b/src/couch_mrview_compactor.erl
index f8293bd..735b790 100644
--- a/src/couch_mrview_compactor.erl
+++ b/src/couch_mrview_compactor.erl
@@ -174,6 +174,7 @@ swap_compacted(OldState, NewState) ->
} = NewState,
link(NewState#mrst.fd),
+ Ref = erlang:monitor(process, NewState#mrst.fd),
RootDir = couch_index_util:root_dir(),
IndexFName = couch_mrview_util:index_file(DbName, Sig),
@@ -184,4 +185,4 @@ swap_compacted(OldState, NewState) ->
unlink(OldState#mrst.fd),
erlang:demonitor(OldState#mrst.fd_monitor, [flush]),
- {ok, NewState}.
+ {ok, NewState#mrst{fd_monitor=Ref}}.
[6/9] couch-mrview commit: updated refs/heads/master to 4cc8114
Posted by rn...@apache.org.
Update to use couch_stats
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/2c41c9d3
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/2c41c9d3
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/2c41c9d3
Branch: refs/heads/master
Commit: 2c41c9d31a287f037fde00181525ddd9570f2634
Parents: ad72dc8
Author: Paul J. Davis <pa...@gmail.com>
Authored: Thu Aug 21 02:04:07 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Thu Aug 21 02:04:28 2014 -0500
----------------------------------------------------------------------
src/couch_mrview.app.src | 2 +-
src/couch_mrview_http.erl | 9 +++++----
src/couch_mrview_updater.erl | 1 +
3 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/2c41c9d3/src/couch_mrview.app.src
----------------------------------------------------------------------
diff --git a/src/couch_mrview.app.src b/src/couch_mrview.app.src
index 99c52f0..4da46f9 100644
--- a/src/couch_mrview.app.src
+++ b/src/couch_mrview.app.src
@@ -24,5 +24,5 @@
couch_mrview_util
]},
{registered, []},
- {applications, [kernel, stdlib, couch_index]}
+ {applications, [kernel, stdlib, couch_index, couch_stats]}
]}.
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/2c41c9d3/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index 4c7355d..4ae72f3 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -49,7 +49,7 @@ handle_all_docs_req(Req, _Db) ->
handle_view_req(#httpd{method='GET'}=Req, Db, DDoc) ->
[_, _, _, _, ViewName] = Req#httpd.path_parts,
- couch_stats_collector:increment({httpd, view_reads}),
+ couch_stats:increment_counter([httpd, view_reads]),
design_doc_view(Req, Db, DDoc, ViewName, undefined);
handle_view_req(#httpd{method='POST'}=Req, Db, DDoc) ->
[_, _, _, _, ViewName] = Req#httpd.path_parts,
@@ -58,10 +58,11 @@ handle_view_req(#httpd{method='POST'}=Req, Db, DDoc) ->
Queries = couch_mrview_util:get_view_queries(Props),
case {Queries, Keys} of
{Queries, undefined} when is_list(Queries) ->
- [couch_stats_collector:increment({httpd, view_reads}) || _I <- Queries],
+ IncrBy = length(Queries),
+ couch_stats:increment_counter([couchdb, httpd, view_reads], IncrBy),
multi_query_view(Req, Db, DDoc, ViewName, Queries);
{undefined, Keys} when is_list(Keys) ->
- couch_stats_collector:increment({httpd, view_reads}),
+ couch_stats:increment_counter([couchdb, httpd, view_reads]),
design_doc_view(Req, Db, DDoc, ViewName, Keys);
{undefined, undefined} ->
throw({
@@ -81,7 +82,7 @@ handle_temp_view_req(#httpd{method='POST'}=Req, Db) ->
{Body} = couch_httpd:json_body_obj(Req),
DDoc = couch_mrview_util:temp_view_to_ddoc({Body}),
Keys = couch_mrview_util:get_view_keys({Body}),
- couch_stats_collector:increment({httpd, temporary_view_reads}),
+ couch_stats:increment_counter([couchdb, httpd, temporary_view_reads]),
design_doc_view(Req, Db, DDoc, <<"temp">>, Keys);
handle_temp_view_req(Req, _Db) ->
couch_httpd:send_method_not_allowed(Req, "POST").
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/2c41c9d3/src/couch_mrview_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_updater.erl b/src/couch_mrview_updater.erl
index 7aee110..362df0e 100644
--- a/src/couch_mrview_updater.erl
+++ b/src/couch_mrview_updater.erl
@@ -241,6 +241,7 @@ insert_results(DocId, [KVs | RKVs], [{Id, VKVs} | RVKVs], VKVAcc, VIdKeys) ->
{[KV | Rest], [{Id, Key} | IdKeys]}
end,
InitAcc = {[], VIdKeys},
+ couch_stats:increment_counter([couchdb, couchjs, emits], length(KVs)),
{Duped, VIdKeys0} = lists:foldl(CombineDupesFun, InitAcc, lists:sort(KVs)),
FinalKVs = [{{Key, DocId}, Val} || {Key, Val} <- Duped] ++ VKVs,
insert_results(DocId, RKVs, RVKVs, [{Id, FinalKVs} | VKVAcc], VIdKeys0).
[4/9] couch-mrview commit: updated refs/heads/master to 4cc8114
Posted by rn...@apache.org.
Add an API to see if the index file exists
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/cd338d60
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/cd338d60
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/cd338d60
Branch: refs/heads/master
Commit: cd338d60f76a699e9f8e222f930ef8afd83fe11e
Parents: d6b5884
Author: Paul J. Davis <pa...@gmail.com>
Authored: Sun Aug 17 15:13:55 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Sun Aug 17 15:13:55 2014 -0500
----------------------------------------------------------------------
src/couch_mrview_index.erl | 9 +++++++++
1 file changed, 9 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/cd338d60/src/couch_mrview_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_index.erl b/src/couch_mrview_index.erl
index 108d74a..709a6a9 100644
--- a/src/couch_mrview_index.erl
+++ b/src/couch_mrview_index.erl
@@ -17,6 +17,7 @@
-export([init/2, open/2, close/1, reset/1, delete/1]).
-export([start_update/3, purge/4, process_doc/3, finish_update/1, commit/1]).
-export([compact/3, swap_compacted/2]).
+-export([check_index_file/1]).
-include_lib("couch/include/couch_db.hrl").
-include_lib("couch_mrview/include/couch_mrview.hrl").
@@ -164,3 +165,11 @@ compact(Db, State, Opts) ->
swap_compacted(OldState, NewState) ->
couch_mrview_compactor:swap_compacted(OldState, NewState).
+
+check_index_file(State) ->
+ #mrst{
+ db_name=DbName,
+ sig=Sig
+ } = State,
+ IndexFName = couch_mrview_util:index_file(DbName, Sig),
+ filelib:is_file(IndexFName).
[5/9] couch-mrview commit: updated refs/heads/master to 4cc8114
Posted by rn...@apache.org.
Don't use delayed send when a resp hasn't started
This is for a bit of an edge condition if we get an error before we
start streaming data through the coordinator. Easily triggered by
setting all copies of a shard to maintenance mode.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/ad72dc84
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/ad72dc84
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/ad72dc84
Branch: refs/heads/master
Commit: ad72dc84be02f4ce41a837aa7630b385384d37d8
Parents: cd338d6
Author: Paul J. Davis <pa...@gmail.com>
Authored: Thu Aug 14 12:50:06 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Tue Aug 19 11:48:28 2014 -0500
----------------------------------------------------------------------
src/couch_mrview_http.erl | 3 +++
1 file changed, 3 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/ad72dc84/src/couch_mrview_http.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_http.erl b/src/couch_mrview_http.erl
index 1965aa3..4c7355d 100644
--- a/src/couch_mrview_http.erl
+++ b/src/couch_mrview_http.erl
@@ -287,6 +287,9 @@ view_cb(complete, #vacc{resp=Resp}=Acc) ->
_ ->
{ok, Acc#vacc{resp=Resp1, prepend=",\r\n"}}
end;
+view_cb({error, Reason}, #vacc{resp=undefined}=Acc) ->
+ {ok, Resp} = chttpd:send_error(Acc#vacc.req, Reason),
+ {ok, Acc#vacc{resp=Resp}};
view_cb({error, Reason}, #vacc{resp=Resp}=Acc) ->
{ok, Resp1} = chttpd:send_delayed_error(Resp, Reason),
{ok, Acc#vacc{resp=Resp1}}.
[8/9] couch-mrview commit: updated refs/heads/master to 4cc8114
Posted by rn...@apache.org.
squash! Add an API to see if the index file exists
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/68313488
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/68313488
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/68313488
Branch: refs/heads/master
Commit: 68313488d2469c24e17c3214cdb4dcaa8f295a06
Parents: db88586
Author: Robert Newson <rn...@apache.org>
Authored: Tue Aug 26 12:49:08 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Tue Aug 26 13:02:40 2014 +0100
----------------------------------------------------------------------
src/couch_mrview_index.erl | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/68313488/src/couch_mrview_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_index.erl b/src/couch_mrview_index.erl
index ab30b7d..a269a8d 100644
--- a/src/couch_mrview_index.erl
+++ b/src/couch_mrview_index.erl
@@ -17,7 +17,7 @@
-export([init/2, open/2, close/1, reset/1, delete/1]).
-export([start_update/3, purge/4, process_doc/3, finish_update/1, commit/1]).
-export([compact/3, swap_compacted/2]).
--export([check_index_file/1]).
+-export([index_file_exists/1]).
-include_lib("couch/include/couch_db.hrl").
-include_lib("couch_mrview/include/couch_mrview.hrl").
@@ -172,7 +172,7 @@ swap_compacted(OldState, NewState) ->
couch_mrview_compactor:swap_compacted(OldState, NewState).
-check_index_file(State) ->
+index_file_exists(State) ->
#mrst{
db_name=DbName,
sig=Sig
[3/9] couch-mrview commit: updated refs/heads/master to 4cc8114
Posted by rn...@apache.org.
Expose access to the file descriptor for monitoring.
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/d6b5884a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/d6b5884a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/d6b5884a
Branch: refs/heads/master
Commit: d6b5884a1b3da1af3cdc75f585cb0bf1b48c7294
Parents: a6dfc8c
Author: Paul J. Davis <pa...@gmail.com>
Authored: Sun Aug 17 13:40:20 2014 -0500
Committer: Paul J. Davis <pa...@gmail.com>
Committed: Sun Aug 17 13:40:20 2014 -0500
----------------------------------------------------------------------
src/couch_mrview_index.erl | 2 ++
1 file changed, 2 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/d6b5884a/src/couch_mrview_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_index.erl b/src/couch_mrview_index.erl
index 5cebcf1..108d74a 100644
--- a/src/couch_mrview_index.erl
+++ b/src/couch_mrview_index.erl
@@ -40,6 +40,8 @@ get(Property, State) ->
LocalSeq = couch_util:get_value(<<"local_seq">>, Opts, false),
if IncDesign -> [include_design]; true -> [] end
++ if LocalSeq -> [local_seq]; true -> [] end;
+ fd ->
+ State#mrst.fd;
language ->
State#mrst.language;
views ->
[7/9] couch-mrview commit: updated refs/heads/master to 4cc8114
Posted by rn...@apache.org.
Merge data_size calculations for views
This adds the new data size information to view info data.
BugzId: 27061
Project: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/repo
Commit: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/commit/db885864
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/db885864
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/db885864
Branch: refs/heads/master
Commit: db88586439f0e1f5c35203d5d9d98aa9a5a47c2c
Parents: 2c41c9d
Author: Robert Newson <rn...@apache.org>
Authored: Fri Aug 22 16:56:44 2014 +0100
Committer: Robert Newson <rn...@apache.org>
Committed: Fri Aug 22 16:56:44 2014 +0100
----------------------------------------------------------------------
src/couch_mrview_index.erl | 14 ++++++++++----
src/couch_mrview_util.erl | 6 +++---
2 files changed, 13 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/db885864/src/couch_mrview_index.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_index.erl b/src/couch_mrview_index.erl
index 709a6a9..ab30b7d 100644
--- a/src/couch_mrview_index.erl
+++ b/src/couch_mrview_index.erl
@@ -57,13 +57,19 @@ get(Property, State) ->
purge_seq = PurgeSeq,
views = Views
} = State,
- {ok, Size} = couch_file:bytes(Fd),
- {ok, DataSize} = couch_mrview_util:calculate_data_size(Btree,Views),
+ {ok, FileSize} = couch_file:bytes(Fd),
+ {ok, ExternalSize} = couch_mrview_util:calculate_external_size(Views),
+ ActiveSize = ExternalSize + couch_btree:size(Btree),
{ok, [
{signature, list_to_binary(couch_index_util:hexsig(Sig))},
{language, Lang},
- {disk_size, Size},
- {data_size, DataSize},
+ {disk_size, FileSize}, % legacy
+ {data_size, ExternalSize}, % legacy
+ {sizes, {[
+ {file, FileSize},
+ {active, ActiveSize},
+ {external, ExternalSize}
+ ]}},
{update_seq, UpdateSeq},
{purge_seq, PurgeSeq}
]};
http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/db885864/src/couch_mrview_util.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_util.erl b/src/couch_mrview_util.erl
index cbba5ac..1836338 100644
--- a/src/couch_mrview_util.erl
+++ b/src/couch_mrview_util.erl
@@ -21,7 +21,7 @@
-export([all_docs_key_opts/1, all_docs_key_opts/2, key_opts/1, key_opts/2]).
-export([fold/4, fold_reduce/4]).
-export([temp_view_to_ddoc/1]).
--export([calculate_data_size/2]).
+-export([calculate_external_size/1]).
-export([validate_args/1]).
-export([maybe_load_doc/3, maybe_load_doc/4]).
-export([maybe_update_index_file/1]).
@@ -635,11 +635,11 @@ reverse_key_default(<<255>>) -> <<>>;
reverse_key_default(Key) -> Key.
-calculate_data_size(IdBt, Views) ->
+calculate_external_size(Views) ->
SumFun = fun(#mrview{btree=Bt}, Acc) ->
sum_btree_sizes(Acc, couch_btree:size(Bt))
end,
- Size = lists:foldl(SumFun, couch_btree:size(IdBt), Views),
+ Size = lists:foldl(SumFun, 0, Views),
{ok, Size}.