-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Description
DEBUG_LEVEL=0 build is broken ?!
I have the main tree at commit: 6f9d826
If I run below command:
DEBUG_LEVEL=0 make -j48 db_bench
compilation fails with following error:
=======================
In file included from memtable/wbwi_memtable.cc:6:
./memtable/wbwi_memtable.h: In member function ‘void rocksdb::WBWIMemTableIterator::UpdateKey()’:
./memtable/wbwi_memtable.h:127:49: error: array subscript 0 is outside array bounds of ‘std::aligned_storage<8, 4>::type [0]’ [-Werror=array-bounds=]
127 | std::to_string(t->second));
| ~~~^~~~~~
cc1plus: note: source object is likely at address zero
======================
Looks like it is complaining because we are trying to access t->second after verifying that
t == WriteTypeToValueTypeMap.end(). (Basically t has reached end, at this point)
This seems to be introduced from below commit.
=========================
commit id: 1c7652f
Author: Changyu Bi changyubi@meta.com
Date: Tue Nov 12 09:27:11 2024 -0800
Introduce a WriteBatchWithIndex-based implementation of ReadOnlyMemTable (#13123)
Summary:
introduce the class WBWIMemTable that implements ReadOnlyMemTable interface with data stored in a WriteBatchWithIndex object.
========================
However, compilation does not fail if DEBUG_LEVEL=1.
The following change fixes the compilation error.
$ git diff
diff --git a/memtable/wbwi_memtable.h b/memtable/wbwi_memtable.h
index 1daf5d779..b48abf993 100644
--- a/memtable/wbwi_memtable.h
+++ b/memtable/wbwi_memtable.h
@@ -122,8 +122,7 @@ class WBWIMemTableIterator final : public InternalIterator {
if (t == WriteTypeToValueTypeMap.end()) {
key_.clear();
valid_ = false;
- s_ = Status::Corruption("Unexpected write_batch_with_index entry type " +
- std::to_string(t->second));
+ s_ = Status::Corruption("Unexpected write_batch_with_index entry type.");
return;
}
key_buf_.SetInternalKey(it_->Entry().key, global_seqno_, t->second);
I can send a PR if above change is acceptable.
Although I am a little bit surprised that the nightly builds haven't caught this. Or please let me know if I am missing something here.