mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-26 16:30:56 +00:00
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
This commit is contained in:
parent
1d1a64f58a
commit
772bc97f13
|
@ -580,6 +580,7 @@ void ColumnFamilyData::ResetThreadLocalSuperVersions() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
Status ColumnFamilyData::SetOptions(
|
Status ColumnFamilyData::SetOptions(
|
||||||
const std::unordered_map<std::string, std::string>& options_map) {
|
const std::unordered_map<std::string, std::string>& options_map) {
|
||||||
MutableCFOptions new_mutable_cf_options;
|
MutableCFOptions new_mutable_cf_options;
|
||||||
|
@ -591,6 +592,7 @@ Status ColumnFamilyData::SetOptions(
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
#endif // ROCKSDB_LITE
|
||||||
|
|
||||||
ColumnFamilySet::ColumnFamilySet(const std::string& dbname,
|
ColumnFamilySet::ColumnFamilySet(const std::string& dbname,
|
||||||
const DBOptions* db_options,
|
const DBOptions* db_options,
|
||||||
|
|
|
@ -187,9 +187,11 @@ class ColumnFamilyData {
|
||||||
const MutableCFOptions* GetLatestMutableCFOptions() const {
|
const MutableCFOptions* GetLatestMutableCFOptions() const {
|
||||||
return &mutable_cf_options_;
|
return &mutable_cf_options_;
|
||||||
}
|
}
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
// REQUIRES: DB mutex held
|
// REQUIRES: DB mutex held
|
||||||
Status SetOptions(
|
Status SetOptions(
|
||||||
const std::unordered_map<std::string, std::string>& options_map);
|
const std::unordered_map<std::string, std::string>& options_map);
|
||||||
|
#endif // ROCKSDB_LITE
|
||||||
|
|
||||||
InternalStats* internal_stats() { return internal_stats_.get(); }
|
InternalStats* internal_stats() { return internal_stats_.get(); }
|
||||||
|
|
||||||
|
|
|
@ -446,6 +446,7 @@ Compaction* CompactionPicker::CompactRange(
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
namespace {
|
namespace {
|
||||||
// Test whether two files have overlapping key-ranges.
|
// Test whether two files have overlapping key-ranges.
|
||||||
bool HaveOverlappingKeyRanges(
|
bool HaveOverlappingKeyRanges(
|
||||||
|
@ -674,6 +675,7 @@ Status CompactionPicker::SanitizeCompactionInputFiles(
|
||||||
|
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
}
|
}
|
||||||
|
#endif // ROCKSDB_LITE
|
||||||
|
|
||||||
bool LevelCompactionPicker::NeedsCompaction(
|
bool LevelCompactionPicker::NeedsCompaction(
|
||||||
const VersionStorageInfo* vstorage,
|
const VersionStorageInfo* vstorage,
|
||||||
|
|
|
@ -83,10 +83,12 @@ class CompactionPicker {
|
||||||
// files. If it's not possible to conver an invalid input_files
|
// 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
|
// into a valid one by adding more files, the function will return a
|
||||||
// non-ok status with specific reason.
|
// non-ok status with specific reason.
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
Status SanitizeCompactionInputFiles(
|
Status SanitizeCompactionInputFiles(
|
||||||
std::unordered_set<uint64_t>* input_files,
|
std::unordered_set<uint64_t>* input_files,
|
||||||
const ColumnFamilyMetaData& cf_meta,
|
const ColumnFamilyMetaData& cf_meta,
|
||||||
const int output_level) const;
|
const int output_level) const;
|
||||||
|
#endif // ROCKSDB_LITE
|
||||||
|
|
||||||
// Free up the files that participated in a compaction
|
// Free up the files that participated in a compaction
|
||||||
void ReleaseCompactionFiles(Compaction* c, Status status);
|
void ReleaseCompactionFiles(Compaction* c, Status status);
|
||||||
|
@ -156,10 +158,12 @@ class CompactionPicker {
|
||||||
|
|
||||||
// A helper function to SanitizeCompactionInputFiles() that
|
// A helper function to SanitizeCompactionInputFiles() that
|
||||||
// sanitizes "input_files" by adding necessary files.
|
// sanitizes "input_files" by adding necessary files.
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
virtual Status SanitizeCompactionInputFilesForAllLevels(
|
virtual Status SanitizeCompactionInputFilesForAllLevels(
|
||||||
std::unordered_set<uint64_t>* input_files,
|
std::unordered_set<uint64_t>* input_files,
|
||||||
const ColumnFamilyMetaData& cf_meta,
|
const ColumnFamilyMetaData& cf_meta,
|
||||||
const int output_level) const;
|
const int output_level) const;
|
||||||
|
#endif // ROCKSDB_LITE
|
||||||
|
|
||||||
// record all the ongoing compactions for all levels
|
// record all the ongoing compactions for all levels
|
||||||
std::vector<std::set<Compaction*>> compactions_in_progress_;
|
std::vector<std::set<Compaction*>> compactions_in_progress_;
|
||||||
|
|
|
@ -1191,6 +1191,10 @@ Status DBImpl::CompactFiles(
|
||||||
ColumnFamilyHandle* column_family,
|
ColumnFamilyHandle* column_family,
|
||||||
const std::vector<std::string>& input_file_names,
|
const std::vector<std::string>& input_file_names,
|
||||||
const int output_level, const int output_path_id) {
|
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_);
|
MutexLock l(&mutex_);
|
||||||
if (column_family == nullptr) {
|
if (column_family == nullptr) {
|
||||||
return Status::InvalidArgument("ColumnFamilyHandle must be non-null.");
|
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.
|
// TODO(yhchiang): cfd should be deleted after its last reference.
|
||||||
cfd->Unref();
|
cfd->Unref();
|
||||||
return s;
|
return s;
|
||||||
|
#endif // ROCKSDB_LITE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
Status DBImpl::CompactFilesImpl(
|
Status DBImpl::CompactFilesImpl(
|
||||||
const CompactionOptions& compact_options, ColumnFamilyData* cfd,
|
const CompactionOptions& compact_options, ColumnFamilyData* cfd,
|
||||||
Version* version, const std::vector<std::string>& input_file_names,
|
Version* version, const std::vector<std::string>& input_file_names,
|
||||||
|
@ -1344,9 +1350,13 @@ Status DBImpl::CompactFilesImpl(
|
||||||
|
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
#endif // ROCKSDB_LITE
|
||||||
|
|
||||||
Status DBImpl::SetOptions(ColumnFamilyHandle* column_family,
|
Status DBImpl::SetOptions(ColumnFamilyHandle* column_family,
|
||||||
const std::unordered_map<std::string, std::string>& options_map) {
|
const std::unordered_map<std::string, std::string>& options_map) {
|
||||||
|
#ifdef ROCKSDB_LITE
|
||||||
|
return Status::NotSupported("Not supported in ROCKSDB LITE");
|
||||||
|
#else
|
||||||
auto* cfd = reinterpret_cast<ColumnFamilyHandleImpl*>(column_family)->cfd();
|
auto* cfd = reinterpret_cast<ColumnFamilyHandleImpl*>(column_family)->cfd();
|
||||||
if (options_map.empty()) {
|
if (options_map.empty()) {
|
||||||
Log(InfoLogLevel::WARN_LEVEL,
|
Log(InfoLogLevel::WARN_LEVEL,
|
||||||
|
@ -1382,6 +1392,7 @@ Status DBImpl::SetOptions(ColumnFamilyHandle* column_family,
|
||||||
"[%s] SetOptions failed", cfd->GetName().c_str());
|
"[%s] SetOptions failed", cfd->GetName().c_str());
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
|
#endif // ROCKSDB_LITE
|
||||||
}
|
}
|
||||||
|
|
||||||
// return the same level if it cannot be moved
|
// return the same level if it cannot be moved
|
||||||
|
|
|
@ -337,10 +337,12 @@ class DBImpl : public DB {
|
||||||
void RecordFlushIOStats();
|
void RecordFlushIOStats();
|
||||||
void RecordCompactionIOStats();
|
void RecordCompactionIOStats();
|
||||||
|
|
||||||
|
#ifndef ROCKSDB_LITE
|
||||||
Status CompactFilesImpl(
|
Status CompactFilesImpl(
|
||||||
const CompactionOptions& compact_options, ColumnFamilyData* cfd,
|
const CompactionOptions& compact_options, ColumnFamilyData* cfd,
|
||||||
Version* version, const std::vector<std::string>& input_file_names,
|
Version* version, const std::vector<std::string>& input_file_names,
|
||||||
const int output_level, int output_path_id);
|
const int output_level, int output_path_id);
|
||||||
|
#endif // ROCKSDB_LITE
|
||||||
|
|
||||||
ColumnFamilyData* GetColumnFamilyDataByName(const std::string& cf_name);
|
ColumnFamilyData* GetColumnFamilyDataByName(const std::string& cf_name);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue