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 2020/07/13 15:48:34 UTC

[couchdb] branch 3.x updated: Fix compactor bind_emsort clause

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

vatamane pushed a commit to branch 3.x
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/3.x by this push:
     new 44eeee3  Fix compactor bind_emsort clause
44eeee3 is described below

commit 44eeee3414cafe8acbbcf028d5e67a00567df38d
Author: Nick Vatamaniuc <va...@apache.org>
AuthorDate: Mon Jul 13 11:07:55 2020 -0400

    Fix compactor bind_emsort clause
    
    When compactor finds an old compaction file, before the state was upgraded to a
    a proplist, the state will be `Root` from `emsort`, which is a `{BB, Prev}`
    tuple not an integer.
---
 src/couch/src/couch_bt_engine_compactor.erl | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/couch/src/couch_bt_engine_compactor.erl b/src/couch/src/couch_bt_engine_compactor.erl
index 4bed49c..3e356e2 100644
--- a/src/couch/src/couch_bt_engine_compactor.erl
+++ b/src/couch/src/couch_bt_engine_compactor.erl
@@ -628,8 +628,9 @@ commit_compaction_data(#st{header = OldHeader} = St0, Fd) ->
 bind_emsort(St, Fd, nil) ->
     {ok, Ems} = couch_emsort:open(Fd),
     St#st{id_tree=Ems};
-bind_emsort(St, Fd, State) when is_integer(State) ->
-    bind_emsort(St, Fd, [{root, State}]);
+bind_emsort(St, Fd, {BB, _} = Root) when is_list(BB) ->
+    % Upgrade clause when we find old compaction files
+    bind_emsort(St, Fd, [{root, Root}]);
 bind_emsort(St, Fd, State) ->
     {ok, Ems} = couch_emsort:open(Fd, State),
     St#st{id_tree=Ems}.