summaryrefslogtreecommitdiff
path: root/src/couch
diff options
context:
space:
mode:
authorPaul J. Davis <paul.joseph.davis@gmail.com>2018-03-29 11:02:25 -0500
committerPaul J. Davis <paul.joseph.davis@gmail.com>2018-03-29 14:39:53 -0500
commit455d6341fb3fde32d55a59d9b823ac01f15745ba (patch)
tree257a39ec8697fefe7fa051cd800713c3c4c4bd9a /src/couch
parent6ffe0421ac524138a6b48fd010f2540631b83d16 (diff)
downloadcouchdb-455d6341fb3fde32d55a59d9b823ac01f15745ba.tar.gz
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.
Diffstat (limited to 'src/couch')
-rw-r--r--src/couch/src/couch_bt_engine.erl1
-rw-r--r--src/couch/src/couch_bt_engine_compactor.erl2
2 files changed, 2 insertions, 1 deletions
diff --git a/src/couch/src/couch_bt_engine.erl b/src/couch/src/couch_bt_engine.erl
index 940689708..43a77b071 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 2f7a3513a..4e52064b4 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