couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iil...@apache.org
Subject [couchdb] 03/05: Fix compaction resumption for the BT engine
Date Fri, 13 Apr 2018 18:41:19 GMT
This is an automated email from the ASF dual-hosted git repository.

iilyak pushed a commit to branch release-candidate-104492
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 65669c55fb3de10a8de7ca773e50b7dc93ffb04f
Author: Paul J. Davis <paul.joseph.davis@gmail.com>
AuthorDate: Thu Mar 29 11:02:25 2018 -0500

    Fix compaction resumption for the BT engine
    
    This bug prevents the proper resumption of compactions that died during
    the meta copy phase. The issue is that we were setting the update_seq
    but not copying over the id and seq tree states. Thus when compaction
    resumed from the bad files we'd end up skipping the part where we copy
    docs over and then think everything was finished. Thus completely
    clearing a database of its contents.
    
    Luckily this isn't release code and as such should have fairly minimal
    impact other than those who might be running off master.
---
 src/couch/src/couch_bt_engine.erl           | 1 +
 src/couch/src/couch_bt_engine_compactor.erl | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/couch/src/couch_bt_engine.erl b/src/couch/src/couch_bt_engine.erl
index 9406897..43a77b0 100644
--- a/src/couch/src/couch_bt_engine.erl
+++ b/src/couch/src/couch_bt_engine.erl
@@ -92,6 +92,7 @@
 % Used by the compactor
 -export([
     set_update_seq/2,
+    update_header/2,
     copy_security/2
 ]).
 
diff --git a/src/couch/src/couch_bt_engine_compactor.erl b/src/couch/src/couch_bt_engine_compactor.erl
index 2f7a351..4e52064 100644
--- a/src/couch/src/couch_bt_engine_compactor.erl
+++ b/src/couch/src/couch_bt_engine_compactor.erl
@@ -386,7 +386,7 @@ commit_compaction_data(#st{header = OldHeader} = St0, Fd) ->
     MetaFd = couch_emsort:get_fd(St0#st.id_tree),
     MetaState = couch_emsort:get_state(St0#st.id_tree),
     St1 = bind_id_tree(St0, St0#st.fd, DataState),
-    Header = St1#st.header,
+    Header = couch_bt_engine:update_header(St1, St1#st.header),
     CompHeader = #comp_header{
         db_header = Header,
         meta_state = MetaState

-- 
To stop receiving notification emails like this one, please contact
iilyak@apache.org.

Mime
View raw message