diff --git a/HISTORY.md b/HISTORY.md index f2e6fafce..7a5416459 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -1,5 +1,8 @@ # Rocksdb Change Log +## Public API changes +* DB::GetDbIdentity() is now a const function. If this function is overridden in your application, be sure to also make GetDbIdentity() const to avoid compile error. + ## 3.11.0 (5/19/2015) ### New Features diff --git a/db/db_impl.cc b/db/db_impl.cc index 757571dc7..11895b0c7 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -3820,7 +3820,7 @@ Status DBImpl::CheckConsistency() { } } -Status DBImpl::GetDbIdentity(std::string& identity) { +Status DBImpl::GetDbIdentity(std::string& identity) const { std::string idfilename = IdentityFileName(dbname_); unique_ptr idfile; const EnvOptions soptions; diff --git a/db/db_impl.h b/db/db_impl.h index 91a59635e..ebcaec3dd 100644 --- a/db/db_impl.h +++ b/db/db_impl.h @@ -197,7 +197,7 @@ class DBImpl : public DB { // match to our in-memory records virtual Status CheckConsistency(); - virtual Status GetDbIdentity(std::string& identity) override; + virtual Status GetDbIdentity(std::string& identity) const override; Status RunManualCompaction(ColumnFamilyData* cfd, int input_level, int output_level, uint32_t output_path_id, diff --git a/db/db_test.cc b/db/db_test.cc index 9f0bd43d2..f11d9827a 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -8797,7 +8797,7 @@ class ModelDB: public DB { virtual Status DeleteFile(std::string name) override { return Status::OK(); } - virtual Status GetDbIdentity(std::string& identity) override { + virtual Status GetDbIdentity(std::string& identity) const override { return Status::OK(); } diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index e5b4838c8..8e203094f 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -590,7 +590,7 @@ class DB { // Sets the globally unique ID created at database creation time by invoking // Env::GenerateUniqueId(), in identity. Returns Status::OK if identity could // be set properly - virtual Status GetDbIdentity(std::string& identity) = 0; + virtual Status GetDbIdentity(std::string& identity) const = 0; // Returns default column family handle virtual ColumnFamilyHandle* DefaultColumnFamily() const = 0; diff --git a/include/rocksdb/utilities/stackable_db.h b/include/rocksdb/utilities/stackable_db.h index 158aa329e..1f615162a 100644 --- a/include/rocksdb/utilities/stackable_db.h +++ b/include/rocksdb/utilities/stackable_db.h @@ -226,7 +226,7 @@ class StackableDB : public DB { return db_->DeleteFile(name); } - virtual Status GetDbIdentity(std::string& identity) override { + virtual Status GetDbIdentity(std::string& identity) const override { return db_->GetDbIdentity(identity); }