From 73d72ed5c7b45342e28a47d9ccad3ba1a790c80c Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Wed, 26 Nov 2014 11:37:59 -0800 Subject: [PATCH] Block ReadOnlyDB in ROCKSDB_LITE Summary: db_imp_readonly.o is one of the big obj file. If it's not a necessary feature, we should probably block it in ROCKSDB_LITE. 1322704 Nov 24 16:55 db/db_impl_readonly.o Test Plan: make shared_lib -j32 make ROCKSDB_LITE shared_lib -j32 Reviewers: ljin, igor Reviewed By: igor Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D29583 --- db/db_impl_readonly.cc | 20 ++++++++++++++++++-- db/db_impl_readonly.h | 5 +++++ include/rocksdb/db.h | 6 ++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/db/db_impl_readonly.cc b/db/db_impl_readonly.cc index 298944f62..8b0beb7e0 100644 --- a/db/db_impl_readonly.cc +++ b/db/db_impl_readonly.cc @@ -3,6 +3,7 @@ // LICENSE file in the root directory of this source tree. An additional grant // of patent rights can be found in the PATENTS file in the same directory. + #include "db/db_impl_readonly.h" #include "utilities/compacted_db/compacted_db_impl.h" #include "db/db_impl.h" @@ -13,6 +14,8 @@ namespace rocksdb { +#ifndef ROCKSDB_LITE + DBImplReadOnly::DBImplReadOnly(const DBOptions& db_options, const std::string& dbname) : DBImpl(db_options, dbname) { @@ -97,12 +100,10 @@ Status DB::OpenForReadOnly(const Options& options, const std::string& dbname, // Try to first open DB as fully compacted DB Status s; -#ifndef ROCKSDB_LITE s = CompactedDBImpl::Open(options, dbname, dbptr); if (s.ok()) { return s; } -#endif DBOptions db_options(options); ColumnFamilyOptions cf_options(options); @@ -167,5 +168,20 @@ Status DB::OpenForReadOnly( return s; } +#else // !ROCKSDB_LITE + +Status DB::OpenForReadOnly(const Options& options, const std::string& dbname, + DB** dbptr, bool error_if_log_file_exist) { + return Status::NotSupported("Not supported in ROCKSDB_LITE."); +} + +Status DB::OpenForReadOnly( + const DBOptions& db_options, const std::string& dbname, + const std::vector& column_families, + std::vector* handles, DB** dbptr, + bool error_if_log_file_exist) { + return Status::NotSupported("Not supported in ROCKSDB_LITE."); +} +#endif // !ROCKSDB_LITE } // namespace rocksdb diff --git a/db/db_impl_readonly.h b/db/db_impl_readonly.h index d84b23f18..25fcb4350 100644 --- a/db/db_impl_readonly.h +++ b/db/db_impl_readonly.h @@ -4,6 +4,9 @@ // of patent rights can be found in the PATENTS file in the same directory. #pragma once + +#ifndef ROCKSDB_LITE + #include "db/db_impl.h" #include #include @@ -100,3 +103,5 @@ class DBImplReadOnly : public DBImpl { void operator=(const DBImplReadOnly&); }; } + +#endif // !ROCKSDB_LITE diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index 326989418..72878ff57 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -101,6 +101,9 @@ class DB { // that modify data, like put/delete, will return error. // If the db is opened in read only mode, then no compactions // will happen. + // + // Not supported in ROCKSDB_LITE, in which case the function will + // return Status::NotSupported. static Status OpenForReadOnly(const Options& options, const std::string& name, DB** dbptr, bool error_if_log_file_exist = false); @@ -110,6 +113,9 @@ class DB { // database that should be opened. However, you always need to specify default // column family. The default column family name is 'default' and it's stored // in rocksdb::kDefaultColumnFamilyName + // + // Not supported in ROCKSDB_LITE, in which case the function will + // return Status::NotSupported. static Status OpenForReadOnly( const DBOptions& db_options, const std::string& name, const std::vector& column_families, -- GitLab