diff --git a/db/db_filesnapshot.cc b/db/db_filesnapshot.cc index 1f1a0f449..010f9fbe8 100644 --- a/db/db_filesnapshot.cc +++ b/db/db_filesnapshot.cc @@ -74,7 +74,7 @@ Status DBImpl::EnableFileDeletions(bool force) { } int DBImpl::IsFileDeletionsEnabled() const { - return disable_delete_obsolete_files_; + return !disable_delete_obsolete_files_; } Status DBImpl::GetLiveFiles(std::vector& ret, diff --git a/db/db_properties_test.cc b/db/db_properties_test.cc index f8b35b2c7..c683a5a12 100644 --- a/db/db_properties_test.cc +++ b/db/db_properties_test.cc @@ -69,27 +69,27 @@ TEST_F(DBPropertiesTest, Empty) { ASSERT_OK(db_->DisableFileDeletions()); ASSERT_TRUE( dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num)); - ASSERT_EQ("1", num); + ASSERT_EQ("0", num); ASSERT_OK(db_->DisableFileDeletions()); ASSERT_TRUE( dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num)); - ASSERT_EQ("2", num); + ASSERT_EQ("0", num); ASSERT_OK(db_->DisableFileDeletions()); ASSERT_TRUE( dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num)); - ASSERT_EQ("3", num); + ASSERT_EQ("0", num); ASSERT_OK(db_->EnableFileDeletions(false)); ASSERT_TRUE( dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num)); - ASSERT_EQ("2", num); + ASSERT_EQ("0", num); ASSERT_OK(db_->EnableFileDeletions()); ASSERT_TRUE( dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num)); - ASSERT_EQ("0", num); + ASSERT_EQ("1", num); } while (ChangeOptions()); }