From 4ada9d089777f149bf2ddaccb92bbbec6f241835 Mon Sep 17 00:00:00 2001 From: Wesley <10225102463@stu.ecnu.edu.cn> Date: Wed, 6 Nov 2024 21:29:22 +0800 Subject: [PATCH] modify modeldb --- db/db_impl.cc | 28 ---------------------------- db/db_test.cc | 3 +++ 2 files changed, 3 insertions(+), 28 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index 058ef78..6d7af36 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -622,34 +622,6 @@ void DBImpl::TEST_CompactRange(int level, const Slice* begin, manual.end = &end_storage; } - if (level == config::kNumLevels - 1) { - // TTL: TODO: update files in the last level - mutex_.AssertHeld(); - - Compaction* c; - c = versions_->CompactRange(level, nullptr, nullptr); - - Iterator* files = versions_->MakeInputIterator(c); - - while (files->Valid() && !shutting_down_.load(std::memory_order_acquire)) { - std::string value = files->value().ToString(); - uint64_t ddl; - DecodeDeadLineValue(&value, ddl); - - if (ddl != 0) { - if (ddl <= std::time(nullptr)) { - c->edit()->RemoveFile(c->level(), number); - versions_->LogAndApply(c->edit(), &mutex_); - } - } - - - files->Next(); - } - - return; - } // ttl end - MutexLock l(&mutex_); while (!manual.done && !shutting_down_.load(std::memory_order_acquire) && bg_error_.ok()) { diff --git a/db/db_test.cc b/db/db_test.cc index a4a84cd..32d2892 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -2117,6 +2117,9 @@ class ModelDB : public DB { Status Put(const WriteOptions& o, const Slice& k, const Slice& v) override { return DB::Put(o, k, v); } + Status Put(const WriteOptions& o, const Slice& k, const Slice& v, uint64_t ttl) override { + return DB::Put(o, k, v, ttl); + } Status Delete(const WriteOptions& o, const Slice& key) override { return DB::Delete(o, key); }