You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by to...@apache.org on 2017/07/11 23:56:40 UTC

[couchdb] branch 3430-external-size-views updated (f95cd61 -> 0f150fb)

This is an automated email from the ASF dual-hosted git repository.

tonysun83 pushed a change to branch 3430-external-size-views
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


    from f95cd61  calculate data_size correctly
     new ab6db5f  use 0 as return value for no external size value
     new 0f150fb  update compression comparison tests

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/couch/test/couchdb_file_compression_tests.erl | 17 ++++++++++++++++-
 src/couch_mrview/src/couch_mrview_util.erl        | 17 +++++++++--------
 2 files changed, 25 insertions(+), 9 deletions(-)

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

[couchdb] 01/02: use 0 as return value for no external size value

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit ab6db5f98d15e4428b012236ca5c0344b4040fc9
Author: Tony Sun <to...@cloudant.com>
AuthorDate: Wed Jun 28 19:10:07 2017 -0700

    use 0 as return value for no external size value
    
    COUCHDB-3430
---
 src/couch_mrview/src/couch_mrview_util.erl | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/couch_mrview/src/couch_mrview_util.erl b/src/couch_mrview/src/couch_mrview_util.erl
index f09f4eb..aae08ae 100644
--- a/src/couch_mrview/src/couch_mrview_util.erl
+++ b/src/couch_mrview/src/couch_mrview_util.erl
@@ -612,6 +612,7 @@ make_header(State) ->
         log_btree=LogBtree,
         views=Views
     } = State,
+
     #mrheader{
         seq=Seq,
         purge_seq=PurgeSeq,
@@ -791,8 +792,8 @@ changes_ekey_opts(_StartSeq, #mrargs{end_key=EKey,
 reduced_external_size(Tree) ->
     case couch_btree:full_reduce(Tree) of
         {ok, {_, _, Size}} -> Size;
-        % return null for versions of the reduce function without Size
-        {ok, {_, _}} -> null
+        % return 0 for versions of the reduce function without Size
+        {ok, {_, _}} -> 0
     end.
 
 
@@ -811,10 +812,10 @@ calculate_external_size(Views) ->
     {ok, lists:foldl(SumFun, 0, Views)}.
 
 
-sum_btree_sizes(null, _) ->
-    null;
-sum_btree_sizes(_, null) ->
-    null;
+sum_btree_sizes(nil, _) ->
+    0;
+sum_btree_sizes(_, nil) ->
+    0;
 sum_btree_sizes(Size1, Size2) ->
     Size1 + Size2.
 
@@ -1152,5 +1153,5 @@ get_view_queries({Props}) ->
 
 kv_external_size(KVList, Reduction) ->
     lists:foldl(fun([[Key, _], Value], Acc) ->
-        size(term_to_binary(Key)) + size(term_to_binary(Value)) + Acc
-    end, size(term_to_binary(Reduction)), KVList).
+        ?term_size(Key) + ?term_size(Value) + Acc
+    end, ?term_size(Reduction), KVList).

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

[couchdb] 02/02: update compression comparison tests

Posted by to...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit 0f150fb68485ba9f5eea0dbae133c0f9c75d4e36
Author: Tony Sun <to...@cloudant.com>
AuthorDate: Tue Jul 11 17:01:43 2017 -0700

    update compression comparison tests
---
 src/couch/test/couchdb_file_compression_tests.erl | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/src/couch/test/couchdb_file_compression_tests.erl b/src/couch/test/couchdb_file_compression_tests.erl
index a91a924..4b4fec8 100644
--- a/src/couch/test/couchdb_file_compression_tests.erl
+++ b/src/couch/test/couchdb_file_compression_tests.erl
@@ -115,12 +115,14 @@ compare_compression_methods(DbName) ->
     compact_view(DbName),
     DbSizeNone = db_disk_size(DbName),
     ViewSizeNone = view_disk_size(DbName),
+    ViewExternalSizeNone = view_external_size(DbName),
 
     config:set("couchdb", "file_compression", "snappy", false),
     compact_db(DbName),
     compact_view(DbName),
     DbSizeSnappy = db_disk_size(DbName),
     ViewSizeSnappy = view_disk_size(DbName),
+    ViewExternalSizeSnappy = view_external_size(DbName),
 
     ?assert(DbSizeNone > DbSizeSnappy),
     ?assert(ViewSizeNone > ViewSizeSnappy),
@@ -139,9 +141,12 @@ compare_compression_methods(DbName) ->
     compact_view(DbName),
     DbSizeDeflate9 = db_disk_size(DbName),
     ViewSizeDeflate9 = view_disk_size(DbName),
+    ViewExternalSizeDeflate9 = view_external_size(DbName),
 
     ?assert(DbSizeDeflate1 > DbSizeDeflate9),
-    ?assert(ViewSizeDeflate1 > ViewSizeDeflate9).
+    ?assert(ViewSizeDeflate1 > ViewSizeDeflate9),
+    ?assert(ViewExternalSizeNone =:= ViewExternalSizeSnappy),
+    ?assert(ViewExternalSizeNone =:= ViewExternalSizeDeflate9).
 
 
 populate_db(_Db, NumDocs) when NumDocs =< 0 ->
@@ -193,9 +198,19 @@ view_disk_size(DbName) ->
     ok = couch_db:close(Db),
     active_size(Info).
 
+view_external_size(DbName) ->
+    {ok, Db} = couch_db:open_int(DbName, []),
+    {ok, DDoc} = couch_db:open_doc(Db, ?DDOC_ID, [ejson_body]),
+    {ok, Info} = couch_mrview:get_info(Db, DDoc),
+    ok = couch_db:close(Db),
+    external_size(Info).
+
 active_size(Info) ->
     couch_util:get_nested_json_value({Info}, [sizes, active]).
 
+external_size(Info) ->
+    couch_util:get_nested_json_value({Info}, [sizes, external]).
+
 wait_compaction(DbName, Kind, Line) ->
     WaitFun = fun() ->
        case is_compaction_running(DbName) of

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