|
|
|
@ -750,9 +750,9 @@ TEST_F(DBTest, FlushSchedule) { |
|
|
|
|
namespace { |
|
|
|
|
class KeepFilter : public CompactionFilter { |
|
|
|
|
public: |
|
|
|
|
virtual bool Filter(int /*level*/, const Slice& /*key*/, |
|
|
|
|
const Slice& /*value*/, std::string* /*new_value*/, |
|
|
|
|
bool* /*value_changed*/) const override { |
|
|
|
|
virtual bool Filter(int level, const Slice& key, const Slice& value, |
|
|
|
|
std::string* new_value, |
|
|
|
|
bool* value_changed) const override { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -782,9 +782,9 @@ class KeepFilterFactory : public CompactionFilterFactory { |
|
|
|
|
class DelayFilter : public CompactionFilter { |
|
|
|
|
public: |
|
|
|
|
explicit DelayFilter(DBTestBase* d) : db_test(d) {} |
|
|
|
|
virtual bool Filter(int /*level*/, const Slice& /*key*/, |
|
|
|
|
const Slice& /*value*/, std::string* /*new_value*/, |
|
|
|
|
bool* /*value_changed*/) const override { |
|
|
|
|
virtual bool Filter(int level, const Slice& key, const Slice& value, |
|
|
|
|
std::string* new_value, |
|
|
|
|
bool* value_changed) const override { |
|
|
|
|
db_test->env_->addon_time_.fetch_add(1000); |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
@ -799,7 +799,7 @@ class DelayFilterFactory : public CompactionFilterFactory { |
|
|
|
|
public: |
|
|
|
|
explicit DelayFilterFactory(DBTestBase* d) : db_test(d) {} |
|
|
|
|
virtual std::unique_ptr<CompactionFilter> CreateCompactionFilter( |
|
|
|
|
const CompactionFilter::Context& /*context*/) override { |
|
|
|
|
const CompactionFilter::Context& context) override { |
|
|
|
|
return std::unique_ptr<CompactionFilter>(new DelayFilter(db_test)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2247,17 +2247,17 @@ class ModelDB : public DB { |
|
|
|
|
return Write(o, &batch); |
|
|
|
|
} |
|
|
|
|
using DB::Get; |
|
|
|
|
virtual Status Get(const ReadOptions& /*options*/, ColumnFamilyHandle* /*cf*/, |
|
|
|
|
const Slice& key, PinnableSlice* /*value*/) override { |
|
|
|
|
virtual Status Get(const ReadOptions& options, ColumnFamilyHandle* cf, |
|
|
|
|
const Slice& key, PinnableSlice* value) override { |
|
|
|
|
return Status::NotSupported(key); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
using DB::MultiGet; |
|
|
|
|
virtual std::vector<Status> MultiGet( |
|
|
|
|
const ReadOptions& /*options*/, |
|
|
|
|
const std::vector<ColumnFamilyHandle*>& /*column_family*/, |
|
|
|
|
const ReadOptions& options, |
|
|
|
|
const std::vector<ColumnFamilyHandle*>& column_family, |
|
|
|
|
const std::vector<Slice>& keys, |
|
|
|
|
std::vector<std::string>* /*values*/) override { |
|
|
|
|
std::vector<std::string>* values) override { |
|
|
|
|
std::vector<Status> s(keys.size(), |
|
|
|
|
Status::NotSupported("Not implemented.")); |
|
|
|
|
return s; |
|
|
|
@ -2266,9 +2266,9 @@ class ModelDB : public DB { |
|
|
|
|
#ifndef ROCKSDB_LITE |
|
|
|
|
using DB::IngestExternalFile; |
|
|
|
|
virtual Status IngestExternalFile( |
|
|
|
|
ColumnFamilyHandle* /*column_family*/, |
|
|
|
|
const std::vector<std::string>& /*external_files*/, |
|
|
|
|
const IngestExternalFileOptions& /*options*/) override { |
|
|
|
|
ColumnFamilyHandle* column_family, |
|
|
|
|
const std::vector<std::string>& external_files, |
|
|
|
|
const IngestExternalFileOptions& options) override { |
|
|
|
|
return Status::NotSupported("Not implemented."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2278,22 +2278,22 @@ class ModelDB : public DB { |
|
|
|
|
|
|
|
|
|
using DB::GetPropertiesOfAllTables; |
|
|
|
|
virtual Status GetPropertiesOfAllTables( |
|
|
|
|
ColumnFamilyHandle* /*column_family*/, |
|
|
|
|
TablePropertiesCollection* /*props*/) override { |
|
|
|
|
ColumnFamilyHandle* column_family, |
|
|
|
|
TablePropertiesCollection* props) override { |
|
|
|
|
return Status(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual Status GetPropertiesOfTablesInRange( |
|
|
|
|
ColumnFamilyHandle* /*column_family*/, const Range* /*range*/, |
|
|
|
|
std::size_t /*n*/, TablePropertiesCollection* /*props*/) override { |
|
|
|
|
ColumnFamilyHandle* column_family, const Range* range, std::size_t n, |
|
|
|
|
TablePropertiesCollection* props) override { |
|
|
|
|
return Status(); |
|
|
|
|
} |
|
|
|
|
#endif // ROCKSDB_LITE
|
|
|
|
|
|
|
|
|
|
using DB::KeyMayExist; |
|
|
|
|
virtual bool KeyMayExist(const ReadOptions& /*options*/, |
|
|
|
|
ColumnFamilyHandle* /*column_family*/, |
|
|
|
|
const Slice& /*key*/, std::string* /*value*/, |
|
|
|
|
virtual bool KeyMayExist(const ReadOptions& options, |
|
|
|
|
ColumnFamilyHandle* column_family, const Slice& key, |
|
|
|
|
std::string* value, |
|
|
|
|
bool* value_found = nullptr) override { |
|
|
|
|
if (value_found != nullptr) { |
|
|
|
|
*value_found = false; |
|
|
|
@ -2301,9 +2301,8 @@ class ModelDB : public DB { |
|
|
|
|
return true; // Not Supported directly
|
|
|
|
|
} |
|
|
|
|
using DB::NewIterator; |
|
|
|
|
virtual Iterator* NewIterator( |
|
|
|
|
const ReadOptions& options, |
|
|
|
|
ColumnFamilyHandle* /*column_family*/) override { |
|
|
|
|
virtual Iterator* NewIterator(const ReadOptions& options, |
|
|
|
|
ColumnFamilyHandle* column_family) override { |
|
|
|
|
if (options.snapshot == nullptr) { |
|
|
|
|
KVMap* saved = new KVMap; |
|
|
|
|
*saved = map_; |
|
|
|
@ -2315,9 +2314,9 @@ class ModelDB : public DB { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
virtual Status NewIterators( |
|
|
|
|
const ReadOptions& /*options*/, |
|
|
|
|
const std::vector<ColumnFamilyHandle*>& /*column_family*/, |
|
|
|
|
std::vector<Iterator*>* /*iterators*/) override { |
|
|
|
|
const ReadOptions& options, |
|
|
|
|
const std::vector<ColumnFamilyHandle*>& column_family, |
|
|
|
|
std::vector<Iterator*>* iterators) override { |
|
|
|
|
return Status::NotSupported("Not supported yet"); |
|
|
|
|
} |
|
|
|
|
virtual const Snapshot* GetSnapshot() override { |
|
|
|
@ -2330,7 +2329,7 @@ class ModelDB : public DB { |
|
|
|
|
delete reinterpret_cast<const ModelSnapshot*>(snapshot); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual Status Write(const WriteOptions& /*options*/, |
|
|
|
|
virtual Status Write(const WriteOptions& options, |
|
|
|
|
WriteBatch* batch) override { |
|
|
|
|
class Handler : public WriteBatch::Handler { |
|
|
|
|
public: |
|
|
|
@ -2338,8 +2337,7 @@ class ModelDB : public DB { |
|
|
|
|
virtual void Put(const Slice& key, const Slice& value) override { |
|
|
|
|
(*map_)[key.ToString()] = value.ToString(); |
|
|
|
|
} |
|
|
|
|
virtual void Merge(const Slice& /*key*/, |
|
|
|
|
const Slice& /*value*/) override { |
|
|
|
|
virtual void Merge(const Slice& key, const Slice& value) override { |
|
|
|
|
// ignore merge for now
|
|
|
|
|
// (*map_)[key.ToString()] = value.ToString();
|
|
|
|
|
} |
|
|
|
@ -2353,65 +2351,62 @@ class ModelDB : public DB { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
using DB::GetProperty; |
|
|
|
|
virtual bool GetProperty(ColumnFamilyHandle* /*column_family*/, |
|
|
|
|
const Slice& /*property*/, |
|
|
|
|
std::string* /*value*/) override { |
|
|
|
|
virtual bool GetProperty(ColumnFamilyHandle* column_family, |
|
|
|
|
const Slice& property, std::string* value) override { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
using DB::GetIntProperty; |
|
|
|
|
virtual bool GetIntProperty(ColumnFamilyHandle* /*column_family*/, |
|
|
|
|
const Slice& /*property*/, |
|
|
|
|
uint64_t* /*value*/) override { |
|
|
|
|
virtual bool GetIntProperty(ColumnFamilyHandle* column_family, |
|
|
|
|
const Slice& property, uint64_t* value) override { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
using DB::GetMapProperty; |
|
|
|
|
virtual bool GetMapProperty( |
|
|
|
|
ColumnFamilyHandle* /*column_family*/, const Slice& /*property*/, |
|
|
|
|
std::map<std::string, std::string>* /*value*/) override { |
|
|
|
|
ColumnFamilyHandle* column_family, const Slice& property, |
|
|
|
|
std::map<std::string, std::string>* value) override { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
using DB::GetAggregatedIntProperty; |
|
|
|
|
virtual bool GetAggregatedIntProperty(const Slice& /*property*/, |
|
|
|
|
uint64_t* /*value*/) override { |
|
|
|
|
virtual bool GetAggregatedIntProperty(const Slice& property, |
|
|
|
|
uint64_t* value) override { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
using DB::GetApproximateSizes; |
|
|
|
|
virtual void GetApproximateSizes(ColumnFamilyHandle* /*column_family*/, |
|
|
|
|
const Range* /*range*/, int n, |
|
|
|
|
uint64_t* sizes, |
|
|
|
|
uint8_t /*include_flags*/ |
|
|
|
|
virtual void GetApproximateSizes(ColumnFamilyHandle* column_family, |
|
|
|
|
const Range* range, int n, uint64_t* sizes, |
|
|
|
|
uint8_t include_flags |
|
|
|
|
= INCLUDE_FILES) override { |
|
|
|
|
for (int i = 0; i < n; i++) { |
|
|
|
|
sizes[i] = 0; |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
using DB::GetApproximateMemTableStats; |
|
|
|
|
virtual void GetApproximateMemTableStats( |
|
|
|
|
ColumnFamilyHandle* /*column_family*/, const Range& /*range*/, |
|
|
|
|
uint64_t* const count, uint64_t* const size) override { |
|
|
|
|
virtual void GetApproximateMemTableStats(ColumnFamilyHandle* column_family, |
|
|
|
|
const Range& range, |
|
|
|
|
uint64_t* const count, |
|
|
|
|
uint64_t* const size) override { |
|
|
|
|
*count = 0; |
|
|
|
|
*size = 0; |
|
|
|
|
} |
|
|
|
|
using DB::CompactRange; |
|
|
|
|
virtual Status CompactRange(const CompactRangeOptions& /*options*/, |
|
|
|
|
ColumnFamilyHandle* /*column_family*/, |
|
|
|
|
const Slice* /*start*/, |
|
|
|
|
const Slice* /*end*/) override { |
|
|
|
|
virtual Status CompactRange(const CompactRangeOptions& options, |
|
|
|
|
ColumnFamilyHandle* column_family, |
|
|
|
|
const Slice* start, const Slice* end) override { |
|
|
|
|
return Status::NotSupported("Not supported operation."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual Status SetDBOptions( |
|
|
|
|
const std::unordered_map<std::string, std::string>& /*new_options*/) |
|
|
|
|
const std::unordered_map<std::string, std::string>& new_options) |
|
|
|
|
override { |
|
|
|
|
return Status::NotSupported("Not supported operation."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
using DB::CompactFiles; |
|
|
|
|
virtual Status CompactFiles( |
|
|
|
|
const CompactionOptions& /*compact_options*/, |
|
|
|
|
ColumnFamilyHandle* /*column_family*/, |
|
|
|
|
const std::vector<std::string>& /*input_file_names*/, |
|
|
|
|
const int /*output_level*/, const int /*output_path_id*/ = -1) override { |
|
|
|
|
virtual Status CompactFiles(const CompactionOptions& compact_options, |
|
|
|
|
ColumnFamilyHandle* column_family, |
|
|
|
|
const std::vector<std::string>& input_file_names, |
|
|
|
|
const int output_level, |
|
|
|
|
const int output_path_id = -1) override { |
|
|
|
|
return Status::NotSupported("Not supported operation."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2424,25 +2419,24 @@ class ModelDB : public DB { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
Status EnableAutoCompaction( |
|
|
|
|
const std::vector<ColumnFamilyHandle*>& /*column_family_handles*/) |
|
|
|
|
override { |
|
|
|
|
const std::vector<ColumnFamilyHandle*>& column_family_handles) override { |
|
|
|
|
return Status::NotSupported("Not supported operation."); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
using DB::NumberLevels; |
|
|
|
|
virtual int NumberLevels(ColumnFamilyHandle* /*column_family*/) override { |
|
|
|
|
virtual int NumberLevels(ColumnFamilyHandle* column_family) override { |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
using DB::MaxMemCompactionLevel; |
|
|
|
|
virtual int MaxMemCompactionLevel( |
|
|
|
|
ColumnFamilyHandle* /*column_family*/) override { |
|
|
|
|
ColumnFamilyHandle* column_family) override { |
|
|
|
|
return 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
using DB::Level0StopWriteTrigger; |
|
|
|
|
virtual int Level0StopWriteTrigger( |
|
|
|
|
ColumnFamilyHandle* /*column_family*/) override { |
|
|
|
|
ColumnFamilyHandle* column_family) override { |
|
|
|
|
return -1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2451,8 +2445,7 @@ class ModelDB : public DB { |
|
|
|
|
virtual Env* GetEnv() const override { return nullptr; } |
|
|
|
|
|
|
|
|
|
using DB::GetOptions; |
|
|
|
|
virtual Options GetOptions( |
|
|
|
|
ColumnFamilyHandle* /*column_family*/) const override { |
|
|
|
|
virtual Options GetOptions(ColumnFamilyHandle* column_family) const override { |
|
|
|
|
return options_; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -2460,8 +2453,8 @@ class ModelDB : public DB { |
|
|
|
|
virtual DBOptions GetDBOptions() const override { return options_; } |
|
|
|
|
|
|
|
|
|
using DB::Flush; |
|
|
|
|
virtual Status Flush(const rocksdb::FlushOptions& /*options*/, |
|
|
|
|
ColumnFamilyHandle* /*column_family*/) override { |
|
|
|
|
virtual Status Flush(const rocksdb::FlushOptions& options, |
|
|
|
|
ColumnFamilyHandle* column_family) override { |
|
|
|
|
Status ret; |
|
|
|
|
return ret; |
|
|
|
|
} |
|
|
|
@ -2471,42 +2464,39 @@ class ModelDB : public DB { |
|
|
|
|
#ifndef ROCKSDB_LITE |
|
|
|
|
virtual Status DisableFileDeletions() override { return Status::OK(); } |
|
|
|
|
|
|
|
|
|
virtual Status EnableFileDeletions(bool /*force*/) override { |
|
|
|
|
virtual Status EnableFileDeletions(bool force) override { |
|
|
|
|
return Status::OK(); |
|
|
|
|
} |
|
|
|
|
virtual Status GetLiveFiles(std::vector<std::string>&, uint64_t* /*size*/, |
|
|
|
|
bool /*flush_memtable*/ = true) override { |
|
|
|
|
virtual Status GetLiveFiles(std::vector<std::string>&, uint64_t* size, |
|
|
|
|
bool flush_memtable = true) override { |
|
|
|
|
return Status::OK(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual Status GetSortedWalFiles(VectorLogPtr& /*files*/) override { |
|
|
|
|
virtual Status GetSortedWalFiles(VectorLogPtr& files) override { |
|
|
|
|
return Status::OK(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual Status DeleteFile(std::string /*name*/) override { |
|
|
|
|
return Status::OK(); |
|
|
|
|
} |
|
|
|
|
virtual Status DeleteFile(std::string name) override { return Status::OK(); } |
|
|
|
|
|
|
|
|
|
virtual Status GetUpdatesSince( |
|
|
|
|
rocksdb::SequenceNumber, unique_ptr<rocksdb::TransactionLogIterator>*, |
|
|
|
|
const TransactionLogIterator::ReadOptions& /*read_options*/ = |
|
|
|
|
const TransactionLogIterator::ReadOptions& read_options = |
|
|
|
|
TransactionLogIterator::ReadOptions()) override { |
|
|
|
|
return Status::NotSupported("Not supported in Model DB"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual void GetColumnFamilyMetaData( |
|
|
|
|
ColumnFamilyHandle* /*column_family*/, |
|
|
|
|
ColumnFamilyMetaData* /*metadata*/) override {} |
|
|
|
|
ColumnFamilyHandle* column_family, |
|
|
|
|
ColumnFamilyMetaData* metadata) override {} |
|
|
|
|
#endif // ROCKSDB_LITE
|
|
|
|
|
|
|
|
|
|
virtual Status GetDbIdentity(std::string& /*identity*/) const override { |
|
|
|
|
virtual Status GetDbIdentity(std::string& identity) const override { |
|
|
|
|
return Status::OK(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
virtual SequenceNumber GetLatestSequenceNumber() const override { return 0; } |
|
|
|
|
|
|
|
|
|
virtual bool SetPreserveDeletesSequenceNumber( |
|
|
|
|
SequenceNumber /*seqnum*/) override { |
|
|
|
|
virtual bool SetPreserveDeletesSequenceNumber(SequenceNumber seqnum) override { |
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -4786,7 +4776,7 @@ class DelayedMergeOperator : public MergeOperator { |
|
|
|
|
public: |
|
|
|
|
explicit DelayedMergeOperator(DBTest* d) : db_test_(d) {} |
|
|
|
|
|
|
|
|
|
virtual bool FullMergeV2(const MergeOperationInput& /*merge_in*/, |
|
|
|
|
virtual bool FullMergeV2(const MergeOperationInput& merge_in, |
|
|
|
|
MergeOperationOutput* merge_out) const override { |
|
|
|
|
db_test_->env_->addon_time_.fetch_add(1000); |
|
|
|
|
merge_out->new_value = ""; |
|
|
|
|