From 772bc97f1357aab07bcf1434e7b505c29498fe48 Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Thu, 13 Nov 2014 16:45:33 -0500 Subject: [PATCH] No CompactFiles in ROCKSDB_LITE Summary: It adds lots of code. Test Plan: compile for iOS, compile for mac. works. Reviewers: rven, sdong, ljin, yhchiang Reviewed By: yhchiang Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D28857 --- db/column_family.cc | 2 ++ db/column_family.h | 2 ++ db/compaction_picker.cc | 2 ++ db/compaction_picker.h | 4 ++++ db/db_impl.cc | 11 +++++++++++ db/db_impl.h | 2 ++ 6 files changed, 23 insertions(+) diff --git a/db/column_family.cc b/db/column_family.cc index 7d203fdbea..5261acc8c6 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -580,6 +580,7 @@ void ColumnFamilyData::ResetThreadLocalSuperVersions() { } } +#ifndef ROCKSDB_LITE Status ColumnFamilyData::SetOptions( const std::unordered_map& options_map) { MutableCFOptions new_mutable_cf_options; @@ -591,6 +592,7 @@ Status ColumnFamilyData::SetOptions( } return s; } +#endif // ROCKSDB_LITE ColumnFamilySet::ColumnFamilySet(const std::string& dbname, const DBOptions* db_options, diff --git a/db/column_family.h b/db/column_family.h index eef7e93b55..b421e44c6c 100644 --- a/db/column_family.h +++ b/db/column_family.h @@ -187,9 +187,11 @@ class ColumnFamilyData { const MutableCFOptions* GetLatestMutableCFOptions() const { return &mutable_cf_options_; } +#ifndef ROCKSDB_LITE // REQUIRES: DB mutex held Status SetOptions( const std::unordered_map& options_map); +#endif // ROCKSDB_LITE InternalStats* internal_stats() { return internal_stats_.get(); } diff --git a/db/compaction_picker.cc b/db/compaction_picker.cc index 2e9144e297..5b7e50bfea 100644 --- a/db/compaction_picker.cc +++ b/db/compaction_picker.cc @@ -446,6 +446,7 @@ Compaction* CompactionPicker::CompactRange( return c; } +#ifndef ROCKSDB_LITE namespace { // Test whether two files have overlapping key-ranges. bool HaveOverlappingKeyRanges( @@ -674,6 +675,7 @@ Status CompactionPicker::SanitizeCompactionInputFiles( return Status::OK(); } +#endif // ROCKSDB_LITE bool LevelCompactionPicker::NeedsCompaction( const VersionStorageInfo* vstorage, diff --git a/db/compaction_picker.h b/db/compaction_picker.h index 94c661293b..aba70f08db 100644 --- a/db/compaction_picker.h +++ b/db/compaction_picker.h @@ -83,10 +83,12 @@ class CompactionPicker { // files. If it's not possible to conver an invalid input_files // into a valid one by adding more files, the function will return a // non-ok status with specific reason. +#ifndef ROCKSDB_LITE Status SanitizeCompactionInputFiles( std::unordered_set* input_files, const ColumnFamilyMetaData& cf_meta, const int output_level) const; +#endif // ROCKSDB_LITE // Free up the files that participated in a compaction void ReleaseCompactionFiles(Compaction* c, Status status); @@ -156,10 +158,12 @@ class CompactionPicker { // A helper function to SanitizeCompactionInputFiles() that // sanitizes "input_files" by adding necessary files. +#ifndef ROCKSDB_LITE virtual Status SanitizeCompactionInputFilesForAllLevels( std::unordered_set* input_files, const ColumnFamilyMetaData& cf_meta, const int output_level) const; +#endif // ROCKSDB_LITE // record all the ongoing compactions for all levels std::vector> compactions_in_progress_; diff --git a/db/db_impl.cc b/db/db_impl.cc index 16438302c7..122a92aae2 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1191,6 +1191,10 @@ Status DBImpl::CompactFiles( ColumnFamilyHandle* column_family, const std::vector& input_file_names, const int output_level, const int output_path_id) { +#ifdef ROCKSDB_LITE + // not supported in lite version + return Status::NotSupported("Not supported in ROCKSDB LITE"); +#else MutexLock l(&mutex_); if (column_family == nullptr) { return Status::InvalidArgument("ColumnFamilyHandle must be non-null."); @@ -1210,8 +1214,10 @@ Status DBImpl::CompactFiles( // TODO(yhchiang): cfd should be deleted after its last reference. cfd->Unref(); return s; +#endif // ROCKSDB_LITE } +#ifndef ROCKSDB_LITE Status DBImpl::CompactFilesImpl( const CompactionOptions& compact_options, ColumnFamilyData* cfd, Version* version, const std::vector& input_file_names, @@ -1344,9 +1350,13 @@ Status DBImpl::CompactFilesImpl( return status; } +#endif // ROCKSDB_LITE Status DBImpl::SetOptions(ColumnFamilyHandle* column_family, const std::unordered_map& options_map) { +#ifdef ROCKSDB_LITE + return Status::NotSupported("Not supported in ROCKSDB LITE"); +#else auto* cfd = reinterpret_cast(column_family)->cfd(); if (options_map.empty()) { Log(InfoLogLevel::WARN_LEVEL, @@ -1382,6 +1392,7 @@ Status DBImpl::SetOptions(ColumnFamilyHandle* column_family, "[%s] SetOptions failed", cfd->GetName().c_str()); } return s; +#endif // ROCKSDB_LITE } // return the same level if it cannot be moved diff --git a/db/db_impl.h b/db/db_impl.h index f7a655cb60..400f207b8d 100644 --- a/db/db_impl.h +++ b/db/db_impl.h @@ -337,10 +337,12 @@ class DBImpl : public DB { void RecordFlushIOStats(); void RecordCompactionIOStats(); +#ifndef ROCKSDB_LITE Status CompactFilesImpl( const CompactionOptions& compact_options, ColumnFamilyData* cfd, Version* version, const std::vector& input_file_names, const int output_level, int output_path_id); +#endif // ROCKSDB_LITE ColumnFamilyData* GetColumnFamilyDataByName(const std::string& cf_name);