From 9a136e18b353e6d9c1b325103a4cef7d85a3ceea Mon Sep 17 00:00:00 2001 From: Changyu Bi Date: Wed, 13 Nov 2024 12:41:56 -0800 Subject: [PATCH] Fix a valgrind unit test failure (#13137) Summary: fix the valgrind failure from https://github.com/facebook/rocksdb/actions/runs/11813904728/job/32911902535?fbclid=IwZXh0bgNhZW0CMTEAAR2GJs1U6mNwNv3zwPzU8rpCmBHqfStV3dupj2o_-686RneLKXADaSZH5-U_aem_ADUQy7bzknoseVpjrOc5SQ ``` [ RUN ] WBWIMemTableTest.ReadFromWBWIMemtable ==1150870== Conditional jump or move depends on uninitialised value(s) ==1150870== at 0x50FE67A: rocksdb::WBWIMemTable::Get(rocksdb::LookupKey const&, std::__cxx11::basic_string, std::allocator >*, rocksdb::PinnableWideColumns*, std::__cxx11::basic_string, std::allocator >*, rocksdb::Status*, rocksdb::MergeContext*, unsigned long*, unsigned long*, rocksdb::ReadOptions const&, bool, rocksdb::ReadCallback*, bool*, bool) (wbwi_memtable.cc:60) ==1150870== by 0x50FF92A: rocksdb::WBWIMemTable::MultiGet(rocksdb::ReadOptions const&, rocksdb::MultiGetContext::Range*, rocksdb::ReadCallback*, bool) (wbwi_memtable.cc:120) ==1150870== by 0x1879EF: rocksdb::WBWIMemTableTest_ReadFromWBWIMemtable_Test::TestBody() (write_batch_with_index_test.cc:3580) ``` Pull Request resolved: https://github.com/facebook/rocksdb/pull/13137 Test Plan: `valgrind ./write_batch_with_index_test --gtest_filter="*ReadFromWBWIMemtable*"` Reviewed By: ltamasi Differential Revision: D65892657 Pulled By: cbi42 fbshipit-source-id: 0b44a5a06b8cc64173ad36966339877e2f508d52 --- memtable/wbwi_memtable.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/memtable/wbwi_memtable.cc b/memtable/wbwi_memtable.cc index 9774842119..dc06c1736c 100644 --- a/memtable/wbwi_memtable.cc +++ b/memtable/wbwi_memtable.cc @@ -115,7 +115,7 @@ void WBWIMemTable::MultiGet(const ReadOptions& read_options, assert(immutable_memtable); // TODO: reuse the InternalIterator created in Get(). for (auto iter = range->begin(); iter != range->end(); ++iter) { - SequenceNumber dummy_seq; + SequenceNumber dummy_seq = 0; bool found_final_value = Get(*iter->lkey, iter->value ? iter->value->GetSelf() : nullptr, iter->columns, iter->timestamp, iter->s, &(iter->merge_context),