Change Property name from "rocksdb.current_version_number" to "rocksdb.current-super-version-number"

Summary: I realized I again is wrong about the naming convention. Let me change it to the correct one.

Test Plan: Run unit tests.

Reviewers: IslamAbdelRahman, kradhakrishnan, yhchiang, andrewkr

Reviewed By: andrewkr

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D55041
This commit is contained in:
sdong 2016-03-03 13:18:56 -08:00
parent bf1c4089db
commit 294bdf9ee2
9 changed files with 42 additions and 30 deletions

View File

@ -144,7 +144,7 @@ class DBIter: public Iterator {
if (prop == nullptr) {
return Status::InvalidArgument("prop is nullptr");
}
if (prop_name == "rocksdb.iterator.version-number") {
if (prop_name == "rocksdb.iterator.super-version-number") {
// First try to pass the value returned from inner iterator.
if (!iter_->GetProperty(prop_name, prop).ok()) {
*prop = ToString(version_number_);

View File

@ -92,11 +92,14 @@ TEST_F(DBPropertiesTest, Empty) {
TEST_F(DBPropertiesTest, CurrentVersionNumber) {
uint64_t v1, v2, v3;
ASSERT_TRUE(dbfull()->GetIntProperty("rocksdb.current_version_number", &v1));
ASSERT_TRUE(
dbfull()->GetIntProperty("rocksdb.current-super-version-number", &v1));
Put("12345678", "");
ASSERT_TRUE(dbfull()->GetIntProperty("rocksdb.current_version_number", &v2));
ASSERT_TRUE(
dbfull()->GetIntProperty("rocksdb.current-super-version-number", &v2));
Flush();
ASSERT_TRUE(dbfull()->GetIntProperty("rocksdb.current_version_number", &v3));
ASSERT_TRUE(
dbfull()->GetIntProperty("rocksdb.current-super-version-number", &v3));
ASSERT_EQ(v1, v2);
ASSERT_GT(v3, v2);

View File

@ -668,21 +668,21 @@ TEST_F(DBTestTailingIterator, ForwardIteratorVersionProperty) {
std::unique_ptr<Iterator> iter(db_->NewIterator(read_options));
iter->Seek("foo");
std::string prop_value;
ASSERT_OK(
iter->GetProperty("rocksdb.iterator.version-number", &prop_value));
ASSERT_OK(iter->GetProperty("rocksdb.iterator.super-version-number",
&prop_value));
v1 = static_cast<uint64_t>(std::atoi(prop_value.c_str()));
Put("foo1", "bar1");
Flush();
ASSERT_OK(
iter->GetProperty("rocksdb.iterator.version-number", &prop_value));
ASSERT_OK(iter->GetProperty("rocksdb.iterator.super-version-number",
&prop_value));
v2 = static_cast<uint64_t>(std::atoi(prop_value.c_str()));
iter->Seek("f");
ASSERT_OK(
iter->GetProperty("rocksdb.iterator.version-number", &prop_value));
ASSERT_OK(iter->GetProperty("rocksdb.iterator.super-version-number",
&prop_value));
v3 = static_cast<uint64_t>(std::atoi(prop_value.c_str()));
ASSERT_EQ(v1, v2);
@ -693,8 +693,8 @@ TEST_F(DBTestTailingIterator, ForwardIteratorVersionProperty) {
std::unique_ptr<Iterator> iter(db_->NewIterator(read_options));
iter->Seek("foo");
std::string prop_value;
ASSERT_OK(
iter->GetProperty("rocksdb.iterator.version-number", &prop_value));
ASSERT_OK(iter->GetProperty("rocksdb.iterator.super-version-number",
&prop_value));
v4 = static_cast<uint64_t>(std::atoi(prop_value.c_str()));
}
ASSERT_EQ(v3, v4);

View File

@ -21,7 +21,8 @@ TEST_F(DBTest2, IteratorPropertyVersionNumber) {
Put("", "");
Iterator* iter1 = db_->NewIterator(ReadOptions());
std::string prop_value;
ASSERT_OK(iter1->GetProperty("rocksdb.iterator.version-number", &prop_value));
ASSERT_OK(
iter1->GetProperty("rocksdb.iterator.super-version-number", &prop_value));
uint64_t version_number1 =
static_cast<uint64_t>(std::atoi(prop_value.c_str()));
@ -29,7 +30,8 @@ TEST_F(DBTest2, IteratorPropertyVersionNumber) {
Flush();
Iterator* iter2 = db_->NewIterator(ReadOptions());
ASSERT_OK(iter2->GetProperty("rocksdb.iterator.version-number", &prop_value));
ASSERT_OK(
iter2->GetProperty("rocksdb.iterator.super-version-number", &prop_value));
uint64_t version_number2 =
static_cast<uint64_t>(std::atoi(prop_value.c_str()));
@ -38,14 +40,16 @@ TEST_F(DBTest2, IteratorPropertyVersionNumber) {
Put("", "");
Iterator* iter3 = db_->NewIterator(ReadOptions());
ASSERT_OK(iter3->GetProperty("rocksdb.iterator.version-number", &prop_value));
ASSERT_OK(
iter3->GetProperty("rocksdb.iterator.super-version-number", &prop_value));
uint64_t version_number3 =
static_cast<uint64_t>(std::atoi(prop_value.c_str()));
ASSERT_EQ(version_number2, version_number3);
iter1->SeekToFirst();
ASSERT_OK(iter1->GetProperty("rocksdb.iterator.version-number", &prop_value));
ASSERT_OK(
iter1->GetProperty("rocksdb.iterator.super-version-number", &prop_value));
uint64_t version_number1_new =
static_cast<uint64_t>(std::atoi(prop_value.c_str()));
ASSERT_EQ(version_number1, version_number1_new);

View File

@ -474,7 +474,7 @@ Status ForwardIterator::status() const {
Status ForwardIterator::GetProperty(std::string prop_name, std::string* prop) {
assert(prop != nullptr);
if (prop_name == "rocksdb.iterator.version-number") {
if (prop_name == "rocksdb.iterator.super-version-number") {
*prop = ToString(sv_->version_number);
return Status::OK();
}

View File

@ -132,7 +132,8 @@ static const std::string is_file_deletions_enabled =
static const std::string num_snapshots = "num-snapshots";
static const std::string oldest_snapshot_time = "oldest-snapshot-time";
static const std::string num_live_versions = "num-live-versions";
static const std::string current_version_number = "current_version_number";
static const std::string current_version_number =
"current-super-version-number";
static const std::string estimate_live_data_size = "estimate-live-data-size";
static const std::string base_level = "base-level";
static const std::string total_sst_files_size = "total-sst-files-size";
@ -192,7 +193,7 @@ const std::string DB::Properties::kOldestSnapshotTime =
rocksdb_prefix + oldest_snapshot_time;
const std::string DB::Properties::kNumLiveVersions =
rocksdb_prefix + num_live_versions;
const std::string DB::Properties::kCurrentVersionNumber =
const std::string DB::Properties::kCurrentSuperVersionNumber =
rocksdb_prefix + current_version_number;
const std::string DB::Properties::kEstimateLiveDataSize =
rocksdb_prefix + estimate_live_data_size;
@ -257,8 +258,8 @@ const std::unordered_map<std::string,
{false, nullptr, &InternalStats::HandleOldestSnapshotTime}},
{DB::Properties::kNumLiveVersions,
{false, nullptr, &InternalStats::HandleNumLiveVersions}},
{DB::Properties::kCurrentVersionNumber,
{false, nullptr, &InternalStats::HandleCurrentVersionNumber}},
{DB::Properties::kCurrentSuperVersionNumber,
{false, nullptr, &InternalStats::HandleCurrentSuperVersionNumber}},
{DB::Properties::kEstimateLiveDataSize,
{true, nullptr, &InternalStats::HandleEstimateLiveDataSize}},
{DB::Properties::kBaseLevel,
@ -524,8 +525,8 @@ bool InternalStats::HandleNumLiveVersions(uint64_t* value, DBImpl* db,
return true;
}
bool InternalStats::HandleCurrentVersionNumber(uint64_t* value, DBImpl* db,
Version* version) {
bool InternalStats::HandleCurrentSuperVersionNumber(uint64_t* value, DBImpl* db,
Version* version) {
*value = cfd_->GetSuperVersionNumber();
return true;
}

View File

@ -328,8 +328,8 @@ class InternalStats {
bool HandleNumSnapshots(uint64_t* value, DBImpl* db, Version* version);
bool HandleOldestSnapshotTime(uint64_t* value, DBImpl* db, Version* version);
bool HandleNumLiveVersions(uint64_t* value, DBImpl* db, Version* version);
bool HandleCurrentVersionNumber(uint64_t* value, DBImpl* db,
Version* version);
bool HandleCurrentSuperVersionNumber(uint64_t* value, DBImpl* db,
Version* version);
bool HandleIsFileDeletionsEnabled(uint64_t* value, DBImpl* db,
Version* version);
bool HandleBaseLevel(uint64_t* value, DBImpl* db, Version* version);

View File

@ -444,8 +444,11 @@ class DB {
// by iterators or unfinished compactions.
static const std::string kNumLiveVersions;
// "rocksdb.current-version-number" - returns number of curent LSM version.
static const std::string kCurrentVersionNumber;
// "rocksdb.current-super-version-number" - returns number of curent LSM
// version. It is a uint64_t integer number, incremented after there is
// any change to the LSM tree. The number is not preserved after restarting
// the DB. After DB restart, it will start from 0 again.
static const std::string kCurrentSuperVersionNumber;
// "rocksdb.estimate-live-data-size" - returns an estimate of the amount of
// live data in bytes.
@ -507,7 +510,7 @@ class DB {
// "rocksdb.num-snapshots"
// "rocksdb.oldest-snapshot-time"
// "rocksdb.num-live-versions"
// "rocksdb.current_version_number"
// "rocksdb.current-super-version-number"
// "rocksdb.estimate-live-data-size"
// "rocksdb.total-sst-files-size"
// "rocksdb.base-level"

View File

@ -105,8 +105,9 @@ class Iterator : public Cleanable {
// - DB tables were created with
// BlockBasedTableOptions::use_delta_encoding
// set to false.
// Property "rocksdb.iterator.version-number":
// Number of LSM version used by the iterator.
// Property "rocksdb.iterator.super-version-number":
// LSM version used by the iterator. The same format as DB Property
// kCurrentSuperVersionNumber. See its comment for more information.
virtual Status GetProperty(std::string prop_name, std::string* prop);
private: