You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by kx...@apache.org on 2014/10/16 11:36:14 UTC

[1/3] couch-mrview commit: updated refs/heads/master to 1a6bd40

Repository: couchdb-couch-mrview
Updated Branches:
  refs/heads/master 899a2d551 -> 1a6bd404e


Move query server related stats from couch to couch_mrview


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/71206865
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/71206865
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/71206865

Branch: refs/heads/master
Commit: 7120686567e1cb0971cbc0c6fe7e96c34dc0d48b
Parents: 899a2d5
Author: Alexander Shorin <kx...@apache.org>
Authored: Tue Oct 14 22:27:24 2014 +0400
Committer: Alexander Shorin <kx...@apache.org>
Committed: Tue Oct 14 22:27:24 2014 +0400

----------------------------------------------------------------------
 priv/stats_descriptions.cfg  | 24 ++++++++++++++++++++++++
 src/couch_mrview_updater.erl |  5 ++++-
 2 files changed, 28 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/71206865/priv/stats_descriptions.cfg
----------------------------------------------------------------------
diff --git a/priv/stats_descriptions.cfg b/priv/stats_descriptions.cfg
new file mode 100644
index 0000000..8d8682f
--- /dev/null
+++ b/priv/stats_descriptions.cfg
@@ -0,0 +1,24 @@
+%% Licensed under the Apache License, Version 2.0 (the "License"); you may not
+%% use this file except in compliance with the License. You may obtain a copy of
+%% the License at
+%%
+%%   http://www.apache.org/licenses/LICENSE-2.0
+%%
+%% Unless required by applicable law or agreed to in writing, software
+%% distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+%% WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+%% License for the specific language governing permissions and limitations under
+%% the License.
+
+% Style guide for descriptions: Start with a lowercase letter & do not add
+% a trailing full-stop / period
+% Please keep this in alphabetical order
+
+{[couchdb, couchjs, map_doc], [
+    {type, counter},
+    {desc, <<"number of documents mapped in the couchjs view server">>}
+]}.
+{[couchdb, couchjs, emits], [
+    {type, counter},
+    {desc, <<"number of invocations of `emit' in map functions in the couchjs view server">>}
+]}.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/71206865/src/couch_mrview_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_updater.erl b/src/couch_mrview_updater.erl
index 362df0e..6700836 100644
--- a/src/couch_mrview_updater.erl
+++ b/src/couch_mrview_updater.erl
@@ -147,7 +147,10 @@ map_docs(Parent, State0) ->
                     {erlang:max(Seq, SeqAcc), [{Id, Res} | Results]}
             end,
             FoldFun = fun(Docs, Acc) ->
-                update_task(length(Docs)),
+                LenDocs = length(Docs),
+                couch_stats:increment_counter([couchdb, couchjs, map_docs], 
+                                              LenDocs),
+                update_task(LenDocs),
                 lists:foldl(DocFun, Acc, Docs)
             end,
             Results = lists:foldl(FoldFun, {0, []}, Dequeued),


[2/3] couch-mrview commit: updated refs/heads/master to 1a6bd40

Posted by kx...@apache.org.
Rename stats group from `couchjs` to `mrview`

`couchjs` name is strictly points to the default JavaScript query server
while actually mrview work with various ones. You would be confused
seeing these metrics incremented when your actual query server is on
Clojure or Python.


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/69a5957a
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/69a5957a
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/69a5957a

Branch: refs/heads/master
Commit: 69a5957a54f36f5edc960e9c460f322d31e55cd6
Parents: 7120686
Author: Alexander Shorin <kx...@apache.org>
Authored: Tue Oct 14 22:30:47 2014 +0400
Committer: Alexander Shorin <kx...@apache.org>
Committed: Tue Oct 14 22:30:47 2014 +0400

----------------------------------------------------------------------
 priv/stats_descriptions.cfg  | 8 ++++----
 src/couch_mrview_updater.erl | 4 ++--
 2 files changed, 6 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/69a5957a/priv/stats_descriptions.cfg
----------------------------------------------------------------------
diff --git a/priv/stats_descriptions.cfg b/priv/stats_descriptions.cfg
index 8d8682f..9563467 100644
--- a/priv/stats_descriptions.cfg
+++ b/priv/stats_descriptions.cfg
@@ -14,11 +14,11 @@
 % a trailing full-stop / period
 % Please keep this in alphabetical order
 
-{[couchdb, couchjs, map_doc], [
+{[couchdb, mrview, map_doc], [
     {type, counter},
-    {desc, <<"number of documents mapped in the couchjs view server">>}
+    {desc, <<"number of documents mapped in the view server">>}
 ]}.
-{[couchdb, couchjs, emits], [
+{[couchdb, mrview, emits], [
     {type, counter},
-    {desc, <<"number of invocations of `emit' in map functions in the couchjs view server">>}
+    {desc, <<"number of invocations of `emit' in map functions in the view server">>}
 ]}.

http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/69a5957a/src/couch_mrview_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_updater.erl b/src/couch_mrview_updater.erl
index 6700836..e0b3e1e 100644
--- a/src/couch_mrview_updater.erl
+++ b/src/couch_mrview_updater.erl
@@ -148,7 +148,7 @@ map_docs(Parent, State0) ->
             end,
             FoldFun = fun(Docs, Acc) ->
                 LenDocs = length(Docs),
-                couch_stats:increment_counter([couchdb, couchjs, map_docs], 
+                couch_stats:increment_counter([couchdb, mrview, map_docs],
                                               LenDocs),
                 update_task(LenDocs),
                 lists:foldl(DocFun, Acc, Docs)
@@ -244,7 +244,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)),
+    couch_stats:increment_counter([couchdb, mrview, 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).


[3/3] couch-mrview commit: updated refs/heads/master to 1a6bd40

Posted by kx...@apache.org.
Count mapped docs one by one

Assuming that couch_stats:increment_counter call is cheap (due to ETS
power on backend) this let us to provide more fine grained values for
mapped docs. Doing this in bulk, as it was, leads us to the situation
when counters are telling that some batch of docs get mapped while it's
what is actually happening right now or even mapping failed on the half
of the way by some reason - this is the case when stats will lie us.


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/1a6bd404
Tree: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/tree/1a6bd404
Diff: http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/diff/1a6bd404

Branch: refs/heads/master
Commit: 1a6bd404e4c68f18d95fd9be6f731e3d8782870d
Parents: 69a5957
Author: Alexander Shorin <kx...@apache.org>
Authored: Tue Oct 14 22:37:27 2014 +0400
Committer: Alexander Shorin <kx...@apache.org>
Committed: Tue Oct 14 22:37:27 2014 +0400

----------------------------------------------------------------------
 src/couch_mrview_updater.erl | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/couchdb-couch-mrview/blob/1a6bd404/src/couch_mrview_updater.erl
----------------------------------------------------------------------
diff --git a/src/couch_mrview_updater.erl b/src/couch_mrview_updater.erl
index e0b3e1e..1525a4c 100644
--- a/src/couch_mrview_updater.erl
+++ b/src/couch_mrview_updater.erl
@@ -143,14 +143,13 @@ map_docs(Parent, State0) ->
                 ({Id, Seq, deleted}, {SeqAcc, Results}) ->
                     {erlang:max(Seq, SeqAcc), [{Id, []} | Results]};
                 ({Id, Seq, Doc}, {SeqAcc, Results}) ->
+                    couch_stats:increment_counter([couchdb, mrview, map_docs],
+                                                  1),
                     {ok, Res} = couch_query_servers:map_doc_raw(QServer, Doc),
                     {erlang:max(Seq, SeqAcc), [{Id, Res} | Results]}
             end,
             FoldFun = fun(Docs, Acc) ->
-                LenDocs = length(Docs),
-                couch_stats:increment_counter([couchdb, mrview, map_docs],
-                                              LenDocs),
-                update_task(LenDocs),
+                update_task(length(Docs)),
                 lists:foldl(DocFun, Acc, Docs)
             end,
             Results = lists:foldl(FoldFun, {0, []}, Dequeued),