couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tonysu...@apache.org
Subject [couchdb] branch seqt-external-size-bug updated: formatting changes
Date Tue, 31 Oct 2017 22:06:06 GMT
This is an automated email from the ASF dual-hosted git repository.

tonysun83 pushed a commit to branch seqt-external-size-bug
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/seqt-external-size-bug by this push:
     new 181bf51  formatting changes
181bf51 is described below

commit 181bf514e23b32bf5112353260ca04790aac5668
Author: Tony Sun <tony.sun427@gmail.com>
AuthorDate: Tue Oct 31 15:07:29 2017 -0700

    formatting changes
---
 src/couch_mrview/src/couch_mrview.erl      | 16 ++++++++--------
 src/couch_mrview/src/couch_mrview_util.erl | 14 ++++++++------
 2 files changed, 16 insertions(+), 14 deletions(-)

diff --git a/src/couch_mrview/src/couch_mrview.erl b/src/couch_mrview/src/couch_mrview.erl
index 741e8c1..83a03ff 100644
--- a/src/couch_mrview/src/couch_mrview.erl
+++ b/src/couch_mrview/src/couch_mrview.erl
@@ -314,15 +314,15 @@ count_view_changes_since(Db, DDoc, VName, SinceSeq, Options) ->
                 true -> View#mrview.key_byseq_btree;
                 _ -> View#mrview.seq_btree
             end,
+            RedFun = fun(_SeqStart, PartialReds, 0) ->
+                {ok, couch_btree:final_reduce(Btree, PartialReds)}
+            end,
             lists:foldl(fun(Opts, Acc0) ->
-                case couch_btree:fold_reduce(Btree,
-                    fun(_SeqStart, PartialReds, 0) ->
-                        {ok, couch_btree:final_reduce(Btree, PartialReds)}
-                    end,0, Opts) of
-                        {ok, N} when is_integer(N) ->
-                            Acc0 + N;
-                        {ok, N} when is_tuple(N) ->
-                            Acc0 + element(1, N)
+                case couch_btree:fold_reduce(Btree, RedFun, 0, Opts) of
+                    {ok, N} when is_integer(N) ->
+                        Acc0 + N;
+                    {ok, N} when is_tuple(N) ->
+                        Acc0 + element(1, N)
                 end
             end, 0, OptList);
         _ ->
diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl
index 02e05fd..d26df94 100644
--- a/src/couch_mrview/src/couch_mrview_util.erl
+++ b/src/couch_mrview/src/couch_mrview_util.erl
@@ -796,13 +796,15 @@ changes_ekey_opts(_StartSeq, #mrargs{end_key=EKey,
     end.
 
 
-reduced_external_size(btree, Tree) ->
+reduced_external_size(Tree) ->
     case couch_btree:full_reduce(Tree) of
         {ok, {_, _, Size}} -> Size;
         % return 0 for versions of the reduce function without Size
         {ok, {_, _}} -> 0
-    end;
-reduced_external_size(seq_btree, Tree) ->
+    end.
+
+
+reduced_seq_external_size(Tree) ->
     case couch_btree:full_reduce(Tree) of
         {ok, {_, Size}} -> Size;
         % return 0 for older versions that only returned number of docs
@@ -812,14 +814,14 @@ reduced_external_size(seq_btree, Tree) ->
 
 calculate_external_size(Views) ->
     SumFun = fun(#mrview{btree=Bt, seq_btree=SBt, key_byseq_btree=KSBt}, Acc) ->
-        Size0 = sum_btree_sizes(Acc, reduced_external_size(btree, Bt)),
+        Size0 = sum_btree_sizes(Acc, reduced_external_size(Bt)),
         Size1 = case SBt of
             nil -> Size0;
-            _ -> sum_btree_sizes(Size0, reduced_external_size(seq_btree, SBt))
+            _ -> sum_btree_sizes(Size0, reduced_seq_external_size(SBt))
         end,
         case KSBt of
             nil -> Size1;
-            _ -> sum_btree_sizes(Size1, reduced_external_size(seq_btree, KSBt))
+            _ -> sum_btree_sizes(Size1, reduced_seq_external_size(KSBt))
         end
     end,
     {ok, lists:foldl(SumFun, 0, Views)}.

-- 
To stop receiving notification emails like this one, please contact
['"commits@couchdb.apache.org" <commits@couchdb.apache.org>'].

Mime
View raw message