Skip to content

Commit

Permalink
Refresh exit iterator isnot supported in hash spdb and vector memtabl…
Browse files Browse the repository at this point in the history
…erep should avoid that (#802)
  • Loading branch information
ayulas committed Jan 21, 2024
1 parent bcbed0d commit 07e991a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
6 changes: 5 additions & 1 deletion db_stress_tool/no_batched_ops_stress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<std::size_t>(ub - lb);
std::vector<ExpectedValue> pre_read_expected_values;
Expand Down Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions include/rocksdb/memtablerep.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ class MemTableRepFactory : public Customizable {
// false when if the <key,seq> 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*/,
Expand Down Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions memtable/hash_spdb_rep.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 07e991a

Please sign in to comment.