diff --git a/db_stress_tool/no_batched_ops_stress.cc b/db_stress_tool/no_batched_ops_stress.cc index 57d5fb8a75..ff7aaa5d01 100644 --- a/db_stress_tool/no_batched_ops_stress.cc +++ b/db_stress_tool/no_batched_ops_stress.cc @@ -1650,6 +1650,10 @@ class NonBatchedOpsStressTest : public StressTest { ColumnFamilyHandle* const cfh = column_families_[rand_column_family]; assert(cfh); + ColumnFamilyDescriptor cfd; + Status s = cfh->GetDescriptor(&cfd); + assert(s.ok()); + const std::size_t expected_values_size = static_cast(ub - lb); std::vector pre_read_expected_values; @@ -1844,7 +1848,7 @@ class NonBatchedOpsStressTest : public StressTest { op_logs += "P"; } - if (thread->rand.OneIn(2)) { + if (thread->rand.OneIn(2) && cfd.options.memtable_factory->IsRefreshIterSupported()) { pre_read_expected_values.clear(); post_read_expected_values.clear(); // Refresh after forward/backward scan to allow higher chance of SV diff --git a/include/rocksdb/memtablerep.h b/include/rocksdb/memtablerep.h index 6344def611..6bb8baf190 100644 --- a/include/rocksdb/memtablerep.h +++ b/include/rocksdb/memtablerep.h @@ -378,6 +378,7 @@ class MemTableRepFactory : public Customizable { // false when if the already exists. // Default: false virtual bool CanHandleDuplicatedKey() const { return false; } + virtual bool IsRefreshIterSupported() const { return true; } virtual MemTableRep* PreCreateMemTableRep() { return nullptr; } virtual void PostCreateMemTableRep( MemTableRep* /*switch_mem*/, @@ -495,6 +496,7 @@ class VectorRepFactory : public MemTableRepFactory { static const char* kNickName() { return "vector"; } const char* Name() const override { return kClassName(); } const char* NickName() const override { return kNickName(); } + bool IsRefreshIterSupported() const override { return false; } // Methods for MemTableRepFactory class overrides using MemTableRepFactory::CreateMemTableRep; diff --git a/memtable/hash_spdb_rep.cc b/memtable/hash_spdb_rep.cc index be88d3ca77..bfa6c878bd 100644 --- a/memtable/hash_spdb_rep.cc +++ b/memtable/hash_spdb_rep.cc @@ -566,6 +566,7 @@ class HashSpdbRepFactory : public MemTableRepFactory { Logger* logger) override; bool IsInsertConcurrentlySupported() const override { return true; } bool CanHandleDuplicatedKey() const override { return true; } + bool IsRefreshIterSupported() const override { return false; } MemTableRep* PreCreateMemTableRep() override; void PostCreateMemTableRep(MemTableRep* switch_mem, const MemTableRep::KeyComparator& compare,