You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by va...@apache.org on 2017/09/19 01:19:47 UTC

[couchdb] branch compactor-optimize-emsort-skip-compression updated (184acaa -> b920609)

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

vatamane pushed a change to branch compactor-optimize-emsort-skip-compression
in repository https://gitbox.apache.org/repos/asf/couchdb.git.


    omit 184acaa  Skip compression for EMSort data
     new b920609  Skip compression for EMSort data

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (184acaa)
            \
             N -- N -- N   refs/heads/compactor-optimize-emsort-skip-compression (b920609)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 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:

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

[couchdb] 01/01: Skip compression for EMSort data

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

vatamane pushed a commit to branch compactor-optimize-emsort-skip-compression
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit b9206094f32d60a9cbe000e443909726e8e93715
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Mon Sep 18 17:59:55 2017 -0400

    Skip compression for EMSort data
    
    EMSort data is either FDIs or {{Id, Seq}, Loc} KVs and using the default snappy
    compression on it is wasteful. snappy is a NIF so no matter how small the data
    there a cost associated with jumping to C and back.
    
    Since snappy is always the default for append_term(s)/2 even if user explicitly
    picks the default compression as something else in config files, have to
    explicitly pass the option to skip compression in each function call.
---
 src/couch/src/couch_db_updater.erl | 3 ++-
 src/couch/src/couch_emsort.erl     | 9 ++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/couch/src/couch_db_updater.erl b/src/couch/src/couch_db_updater.erl
index 4786ee7..f8cf764 100644
--- a/src/couch/src/couch_db_updater.erl
+++ b/src/couch/src/couch_db_updater.erl
@@ -1342,7 +1342,8 @@ copy_docs(Db, #db{fd = DestFd} = NewDb, MixedInfos, Retry) ->
             NewDb#db.seq_tree, NewInfos, RemoveSeqs),
 
     EMSortFd = couch_emsort:get_fd(NewDb#db.id_tree),
-    {ok, LocSizes} = couch_file:append_terms(EMSortFd, NewInfos),
+    EMOpts = [{compression, none}],
+    {ok, LocSizes} = couch_file:append_terms(EMSortFd, NewInfos, EMOpts),
     EMSortEntries = lists:zipwith(fun(FDI, {Loc, _}) ->
         #full_doc_info{
             id = Id,
diff --git a/src/couch/src/couch_emsort.erl b/src/couch/src/couch_emsort.erl
index 2a25a23..80edcbd 100644
--- a/src/couch/src/couch_emsort.erl
+++ b/src/couch/src/couch_emsort.erl
@@ -216,7 +216,8 @@ write_kvs(Ems, KVs) ->
     lists:foldr(fun(KV, Acc) ->
         append_item(Ems, Acc, KV, Ems#ems.chain_chunk)
     end, {[], nil}, lists:sort(KVs)),
-    {ok, Final, _} = couch_file:append_term(Ems#ems.fd, {LastKVs, LastPos}),
+    {ok, Final, _} = couch_file:append_term(Ems#ems.fd, {LastKVs, LastPos},
+        [{compression, none}]),
     Final.
 
 
@@ -263,7 +264,8 @@ merge_chains(Ems, Choose, BB) ->
 
 
 merge_chains(Ems, _Choose, [], ChainAcc) ->
-    {ok, CPos, _} = couch_file:append_term(Ems#ems.fd, ChainAcc),
+    {ok, CPos, _} = couch_file:append_term(Ems#ems.fd, ChainAcc,
+        [{compression, none}]),
     CPos;
 merge_chains(#ems{chain_chunk=CC}=Ems, Choose, Chains, Acc) ->
     {KV, RestChains} = choose_kv(Choose, Ems, Chains),
@@ -311,7 +313,8 @@ ins_big_chain(Rest, Chain, Acc) ->
 
 
 append_item(Ems, {List, Prev}, Pos, Size) when length(List) >= Size ->
-    {ok, PrevList, _} = couch_file:append_term(Ems#ems.fd, {List, Prev}),
+    {ok, PrevList, _} = couch_file:append_term(Ems#ems.fd, {List, Prev},
+        [{compression, none}]),
     {[Pos], PrevList};
 append_item(_Ems, {List, Prev}, Pos, _Size) ->
     {[Pos | List], Prev}.

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