pmem / kvdk

Key Value Development Kit

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

get_timestamp() malfunction

ZiyanShi opened this issue · comments

Bug Report

KVDK version

1c35049

System configuration

CPU: Intel(R) Xeon(R) Platinum 8358 CPU @ 2.60GHz x2
DRAM: DIMM DDR4 Synchronous Registered (Buffered) 3200 MHz 16GBx16
PMEM: DIMM Synchronous Non-volatile LRDIMM 3200 MHz 256GBx16

Reproduce steps

--- a/engine/kv_engine.cpp
+++ b/engine/kv_engine.cpp
@@ -1314,7 +1314,7 @@ Status KVEngine::StringSetImpl(const StringView &key, const StringView &value) {
     void *block_base = pmem_allocator_->offset2addr(sized_space_entry.offset);

     uint64_t new_ts = get_timestamp();
-    assert(!found || new_ts > data_entry.meta.timestamp);
+    kvdk_assert(!found || new_ts > data_entry.meta.timestamp, "old record has newer timestamp!");

     StringRecord::PersistStringRecord(block_base, sized_space_entry.size,
                                       new_ts, StringDataRecord, key, value);

Build with DCMAKE_BUILD_TYPE=FastDebug
Then run

python3 run_benchmark.py string

update_random and read_write_random will fail.

Current behavior

Update random string

bench: ../engine/kv_engine.cpp:1317: kvdk::Status kvdk::KVEngine::StringSetImpl(const StringView&, const StringView&): Assertion `(!found || new_ts > data_entry.meta.timestamp) && "old record has newer timestamp!"' failed.
bench: ../engine/kv_engine.cpp:1317: kvdk::Status kvdk::KVEngine::StringSetImpl(const StringView&, const StringView&): Assertion `(!found || new_ts > data_entry.meta.timestamp) && "old record has newer timestamp!"' failed.
Aborted (core dumped)

Good catch and corresponding solution #166