fix behavior does not match name for "IsFileDeletionsEnabled"

Summary:
for PR https://github.com/facebook/rocksdb/pull/3598
I deleted the original repo for some reason. Sorry for the inconvenience.
Closes https://github.com/facebook/rocksdb/pull/3612

Differential Revision: D7291671

Pulled By: ajkr

fbshipit-source-id: 918490ba86b13fe450d232af436cbe259d847c64
main
QingpingWang 7 years ago committed by Facebook Github Bot
parent 2ce8f63f81
commit 70282cf876
  1. 2
      db/db_filesnapshot.cc
  2. 10
      db/db_properties_test.cc

@ -74,7 +74,7 @@ Status DBImpl::EnableFileDeletions(bool force) {
} }
int DBImpl::IsFileDeletionsEnabled() const { int DBImpl::IsFileDeletionsEnabled() const {
return disable_delete_obsolete_files_; return !disable_delete_obsolete_files_;
} }
Status DBImpl::GetLiveFiles(std::vector<std::string>& ret, Status DBImpl::GetLiveFiles(std::vector<std::string>& ret,

@ -69,27 +69,27 @@ TEST_F(DBPropertiesTest, Empty) {
ASSERT_OK(db_->DisableFileDeletions()); ASSERT_OK(db_->DisableFileDeletions());
ASSERT_TRUE( ASSERT_TRUE(
dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num)); dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num));
ASSERT_EQ("1", num); ASSERT_EQ("0", num);
ASSERT_OK(db_->DisableFileDeletions()); ASSERT_OK(db_->DisableFileDeletions());
ASSERT_TRUE( ASSERT_TRUE(
dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num)); dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num));
ASSERT_EQ("2", num); ASSERT_EQ("0", num);
ASSERT_OK(db_->DisableFileDeletions()); ASSERT_OK(db_->DisableFileDeletions());
ASSERT_TRUE( ASSERT_TRUE(
dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num)); dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num));
ASSERT_EQ("3", num); ASSERT_EQ("0", num);
ASSERT_OK(db_->EnableFileDeletions(false)); ASSERT_OK(db_->EnableFileDeletions(false));
ASSERT_TRUE( ASSERT_TRUE(
dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num)); dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num));
ASSERT_EQ("2", num); ASSERT_EQ("0", num);
ASSERT_OK(db_->EnableFileDeletions()); ASSERT_OK(db_->EnableFileDeletions());
ASSERT_TRUE( ASSERT_TRUE(
dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num)); dbfull()->GetProperty("rocksdb.is-file-deletions-enabled", &num));
ASSERT_EQ("0", num); ASSERT_EQ("1", num);
} while (ChangeOptions()); } while (ChangeOptions());
} }

Loading…
Cancel
Save