From b2cf95fe38a7d3d767494eb0254638f0f75b1bbe Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Tue, 20 May 2014 14:28:51 -0700 Subject: [PATCH] Call EnableFileDeletions with false as argument --- db/db_filesnapshot.cc | 9 ++++++++- include/rocksdb/db.h | 2 +- utilities/backupable/backupable_db.cc | 4 ++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/db/db_filesnapshot.cc b/db/db_filesnapshot.cc index 1e1ec9757..582355ccd 100644 --- a/db/db_filesnapshot.cc +++ b/db/db_filesnapshot.cc @@ -29,8 +29,11 @@ Status DBImpl::DisableFileDeletions() { MutexLock l(&mutex_); ++disable_delete_obsolete_files_; if (disable_delete_obsolete_files_ == 1) { - // if not, it has already been disabled, so don't log anything Log(options_.info_log, "File Deletions Disabled"); + } else { + Log(options_.info_log, + "File Deletions Disabled, but already disabled. Counter: %d", + disable_delete_obsolete_files_); } return Status::OK(); } @@ -50,6 +53,10 @@ Status DBImpl::EnableFileDeletions(bool force) { Log(options_.info_log, "File Deletions Enabled"); should_purge_files = true; FindObsoleteFiles(deletion_state, true); + } else { + Log(options_.info_log, + "File Deletions Enable, but not really enabled. Counter: %d", + disable_delete_obsolete_files_); } } if (should_purge_files) { diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index e743b4c88..33b443f40 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -396,7 +396,7 @@ class DB { // times have the same effect as calling it once. virtual Status DisableFileDeletions() = 0; - // Allow compactions to delete obselete files. + // Allow compactions to delete obsolete files. // If force == true, the call to EnableFileDeletions() will guarantee that // file deletions are enabled after the call, even if DisableFileDeletions() // was called multiple times before. diff --git a/utilities/backupable/backupable_db.cc b/utilities/backupable/backupable_db.cc index 87901e0ef..3ac1d90a1 100644 --- a/utilities/backupable/backupable_db.cc +++ b/utilities/backupable/backupable_db.cc @@ -426,7 +426,7 @@ Status BackupEngineImpl::CreateNewBackup(DB* db, bool flush_before_backup) { s = db->GetSortedWalFiles(live_wal_files); } if (!s.ok()) { - db->EnableFileDeletions(); + db->EnableFileDeletions(false); return s; } @@ -495,7 +495,7 @@ Status BackupEngineImpl::CreateNewBackup(DB* db, bool flush_before_backup) { } // we copied all the files, enable file deletions - db->EnableFileDeletions(); + db->EnableFileDeletions(false); if (s.ok()) { // move tmp private backup to real backup folder