Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assertion `!ShouldScheduleFlush()' failed when constructing a memtable. #10713

Open
wqshr12345 opened this issue Sep 21, 2022 · 0 comments
Open

Comments

@wqshr12345
Copy link

Recently I used YCSB to do some database benchmarking. I tried to change some default options, when I changed write_buffer_size to 2M, the database always made an error when construct Memtable.

Expected behavior

Execute the constructor of Memtable correctly.

Actual behavior

Error:/rocksdb/db/memtable.cc:117: rocksdb::MemTable::MemTable(const rocksdb::InternalKeyComparator&, const rocksdb::ImmutableOptions&, const rocksdb::MutableCFOptions&, rocksdb::WriteBufferManager*, rocksdb::SequenceNumber, uint32_t): Assertion `!ShouldScheduleFlush()' failed.

When a Memtable is constructed, the state of flush_state_ will be checked first, which cannot be FLUSH_REQUESTED.
image
However, in the previous UpdateFlushState(), since ShouldFlushNow() returned true, flush_state_ was set to FLUSH_REQUESTED, which caused it to fail in the asset below.
image
I read the source code of ShouleFlushNow() carefully, when I debug to this function, the kArenaBlockSize is 16M and the write_buffer_size is 2M. ShouldFlushNow() will not return through the following two logics.
image
Instead return the result with this line of code at the end. I noticed the comment, which states that this means Arena has already allocated his "last block". At this time, my arena_.AllocatedAndUnused() is 1384, which is much smaller than 0.25*kArenaBlockSize.
image

Steps to reproduce the behavior

Simply, just set write_buffer_size to 2M or less, or a slightly larger number.(:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant