You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by ei...@apache.org on 2018/06/29 21:31:59 UTC

[couchdb] branch master updated: Don't set context for compaction files during db delete (#1419)

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

eiri pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/couchdb.git


The following commit(s) were added to refs/heads/master by this push:
     new 5bbfbeb  Don't set context for compaction files during db delete (#1419)
5bbfbeb is described below

commit 5bbfbeb707a9dbae93597544b59abc259dae1865
Author: Eric Avdey <ei...@eiri.ca>
AuthorDate: Fri Jun 29 18:31:55 2018 -0300

    Don't set context for compaction files during db delete (#1419)
    
    When we delete files with context option set to `delete`,
    `couch_file` respects configuration flag "enable_database_recovery"
    and just renames the files in case it's set to true.
    
    This change removes context for compaction files deleted
    during database deletion to make sure we are actually
    erasing them and not just renaming and leaving behind.
---
 src/couch/src/couch_bt_engine.erl | 4 ++--
 src/couch/src/couch_server.erl    | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/couch/src/couch_bt_engine.erl b/src/couch/src/couch_bt_engine.erl
index 43a77b0..a42d116 100644
--- a/src/couch/src/couch_bt_engine.erl
+++ b/src/couch/src/couch_bt_engine.erl
@@ -114,7 +114,7 @@ delete(RootDir, FilePath, Async) ->
     %% Delete any leftover compaction files. If we don't do this a
     %% subsequent request for this DB will try to open them to use
     %% as a recovery.
-    delete_compaction_files(RootDir, FilePath, [{context, delete}]),
+    delete_compaction_files(RootDir, FilePath, [{context, compaction}]),
 
     % Delete the actual database file
     couch_file:delete(RootDir, FilePath, Async).
@@ -765,7 +765,7 @@ set_default_security_object(Fd, Header, Compression, Options) ->
 
 delete_compaction_files(FilePath) ->
     RootDir = config:get("couchdb", "database_dir", "."),
-    DelOpts = [{context, delete}],
+    DelOpts = [{context, compaction}],
     delete_compaction_files(RootDir, FilePath, DelOpts).
 
 
diff --git a/src/couch/src/couch_server.erl b/src/couch/src/couch_server.erl
index 903eb09..002f08e 100644
--- a/src/couch/src/couch_server.erl
+++ b/src/couch/src/couch_server.erl
@@ -525,7 +525,7 @@ handle_call({delete, DbName, Options}, _From, Server) ->
         DelOpt = [{context, delete} | Options],
 
         % Make sure and remove all compaction data
-        delete_compaction_files(DbNameList, DelOpt),
+        delete_compaction_files(DbNameList, Options),
 
         {ok, {Engine, FilePath}} = get_engine(Server, DbNameList),
         RootDir = Server#server.root_dir,