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,