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

[couchdb] 26/28: ss - bt engine

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

davisp pushed a commit to branch COUCHDB-3287-pluggable-storage-engines
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 9c6caa2d3542798ddb09a542bdffcd83eb8ea0f4
Author: Paul J. Davis <pa...@gmail.com>
AuthorDate: Tue Sep 12 14:40:02 2017 -0500

    ss - bt engine
---
 src/couch/src/couch_bt_engine_compactor.erl | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/src/couch/src/couch_bt_engine_compactor.erl b/src/couch/src/couch_bt_engine_compactor.erl
index 7f3b5d7..843da57 100644
--- a/src/couch/src/couch_bt_engine_compactor.erl
+++ b/src/couch/src/couch_bt_engine_compactor.erl
@@ -203,6 +203,14 @@ copy_docs(St, #st{} = NewSt, MixedInfos, Retry) ->
         {NewRevTree, FinalAcc} = couch_key_tree:mapfold(fun
             ({RevPos, RevId}, #leaf{ptr=Sp}=Leaf, leaf, SizesAcc) ->
                 {Body, AttInfos} = copy_doc_attachments(St, Sp, NewSt),
+                % In the future, we should figure out how to do this for
+                % upgrade purposes.
+                EJsonBody = case is_binary(Body) of
+                    true ->
+                        couch_compress:decompress(Body);
+                    false ->
+                        Body
+                end,
                 Doc0 = #doc{
                     id = Info#full_doc_info.id,
                     revs = {RevPos, [RevId]},
@@ -211,7 +219,7 @@ copy_docs(St, #st{} = NewSt, MixedInfos, Retry) ->
                     atts = AttInfos
                 },
                 Doc1 = couch_bt_engine:serialize_doc(NewSt, Doc0),
-                ExternalSize = ?term_size(Doc1#doc.body),
+                ExternalSize = ?term_size(EJsonBody),
                 {ok, Doc2, ActiveSize} =
                         couch_bt_engine:write_doc_body(NewSt, Doc1),
                 AttSizes = [{element(3,A), element(4,A)} || A <- AttInfos],

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