summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Avdey <eiri@eiri.ca>2018-06-29 18:31:55 -0300
committerGitHub <noreply@github.com>2018-06-29 18:31:55 -0300
commit5bbfbeb707a9dbae93597544b59abc259dae1865 (patch)
tree4c8c06a0b64d5aec00ad54f4341282d285a0f9ce
parentd36149ec3a0d071d067589c8f3fe7d263626948d (diff)
downloadcouchdb-5bbfbeb707a9dbae93597544b59abc259dae1865.tar.gz
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.
-rw-r--r--src/couch/src/couch_bt_engine.erl4
-rw-r--r--src/couch/src/couch_server.erl2
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 43a77b071..a42d116f8 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 903eb09cd..002f08ebb 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,