Call EnableFileDeletions with false as argument

main
Igor Canadi 11 years ago
parent bd1105aa5a
commit b2cf95fe38
  1. 9
      db/db_filesnapshot.cc
  2. 2
      include/rocksdb/db.h
  3. 4
      utilities/backupable/backupable_db.cc

@ -29,8 +29,11 @@ Status DBImpl::DisableFileDeletions() {
MutexLock l(&mutex_); MutexLock l(&mutex_);
++disable_delete_obsolete_files_; ++disable_delete_obsolete_files_;
if (disable_delete_obsolete_files_ == 1) { 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"); 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(); return Status::OK();
} }
@ -50,6 +53,10 @@ Status DBImpl::EnableFileDeletions(bool force) {
Log(options_.info_log, "File Deletions Enabled"); Log(options_.info_log, "File Deletions Enabled");
should_purge_files = true; should_purge_files = true;
FindObsoleteFiles(deletion_state, 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) { if (should_purge_files) {

@ -396,7 +396,7 @@ class DB {
// times have the same effect as calling it once. // times have the same effect as calling it once.
virtual Status DisableFileDeletions() = 0; 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 // If force == true, the call to EnableFileDeletions() will guarantee that
// file deletions are enabled after the call, even if DisableFileDeletions() // file deletions are enabled after the call, even if DisableFileDeletions()
// was called multiple times before. // was called multiple times before.

@ -426,7 +426,7 @@ Status BackupEngineImpl::CreateNewBackup(DB* db, bool flush_before_backup) {
s = db->GetSortedWalFiles(live_wal_files); s = db->GetSortedWalFiles(live_wal_files);
} }
if (!s.ok()) { if (!s.ok()) {
db->EnableFileDeletions(); db->EnableFileDeletions(false);
return s; return s;
} }
@ -495,7 +495,7 @@ Status BackupEngineImpl::CreateNewBackup(DB* db, bool flush_before_backup) {
} }
// we copied all the files, enable file deletions // we copied all the files, enable file deletions
db->EnableFileDeletions(); db->EnableFileDeletions(false);
if (s.ok()) { if (s.ok()) {
// move tmp private backup to real backup folder // move tmp private backup to real backup folder

Loading…
Cancel
Save