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 2018/03/29 16:05:28 UTC

[couchdb] 01/01: Fix compaction resumption for the BT engine

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

davisp pushed a commit to branch fix-bt-engine-compaction-resumption
in repository https://gitbox.apache.org/repos/asf/couchdb.git

commit 59ebb250b9c6daad09a9861de4fbcebf0b663711
Author: Paul J. Davis <pa...@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
davisp@apache.org.