ebf16f57c9
Summary: SizeBeingCompacted was called without any lock protection. This causes crashes, especially when running db_bench with value_size=128K. The fix is to compute SizeUnderCompaction while holding the mutex and passing in these values into the call to Finalize. (gdb) where #4 leveldb::VersionSet::SizeBeingCompacted (this=this@entry=0x7f0b490931c0, level=level@entry=4) at db/version_set.cc:1827 #5 0x000000000043a3c8 in leveldb::VersionSet::Finalize (this=this@entry=0x7f0b490931c0, v=v@entry=0x7f0b3b86b480) at db/version_set.cc:1420 #6 0x00000000004418d1 in leveldb::VersionSet::LogAndApply (this=0x7f0b490931c0, edit=0x7f0b3dc8c200, mu=0x7f0b490835b0, new_descriptor_log=<optimized out>) at db/version_set.cc:1016 #7 0x00000000004222b2 in leveldb::DBImpl::InstallCompactionResults (this=this@entry=0x7f0b49083400, compact=compact@entry=0x7f0b2b8330f0) at db/db_impl.cc:1473 #8 0x0000000000426027 in leveldb::DBImpl::DoCompactionWork (this=this@entry=0x7f0b49083400, compact=compact@entry=0x7f0b2b8330f0) at db/db_impl.cc:1757 #9 0x0000000000426690 in leveldb::DBImpl::BackgroundCompaction (this=this@entry=0x7f0b49083400, madeProgress=madeProgress@entry=0x7f0b41bf2d1e, deletion_state=...) at db/db_impl.cc:1268 #10 0x0000000000428f42 in leveldb::DBImpl::BackgroundCall (this=0x7f0b49083400) at db/db_impl.cc:1170 #11 0x000000000045348e in BGThread (this=0x7f0b49023100) at util/env_posix.cc:941 #12 leveldb::(anonymous namespace)::PosixEnv::BGThreadWrapper (arg=0x7f0b49023100) at util/env_posix.cc:874 #13 0x00007f0b4a7cf10d in start_thread (arg=0x7f0b41bf3700) at pthread_create.c:301 #14 0x00007f0b49b4b11d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115 Test Plan: make check I am running db_bench with a value size of 128K to see if the segfault is fixed. Reviewers: MarkCallaghan, sheki, emayanke Reviewed By: sheki CC: leveldb Differential Revision: https://reviews.facebook.net/D9279 |
||
---|---|---|
.. | ||
builder.cc | ||
builder.h | ||
c_test.c | ||
c.cc | ||
corruption_test.cc | ||
db_bench.cc | ||
db_filesnapshot.cc | ||
db_impl_readonly.cc | ||
db_impl_readonly.h | ||
db_impl.cc | ||
db_impl.h | ||
db_iter.cc | ||
db_iter.h | ||
db_statistics.h | ||
db_stats_logger.cc | ||
db_test.cc | ||
dbformat_test.cc | ||
dbformat.cc | ||
dbformat.h | ||
filename_test.cc | ||
filename.cc | ||
filename.h | ||
log_file.h | ||
log_format.h | ||
log_reader.cc | ||
log_reader.h | ||
log_test.cc | ||
log_writer.cc | ||
log_writer.h | ||
memtable.cc | ||
memtable.h | ||
memtablelist.cc | ||
memtablelist.h | ||
repair.cc | ||
skiplist_test.cc | ||
skiplist.h | ||
snapshot.h | ||
table_cache.cc | ||
table_cache.h | ||
transaction_log_iterator_impl.cc | ||
transaction_log_iterator_impl.h | ||
version_edit_test.cc | ||
version_edit.cc | ||
version_edit.h | ||
version_set_reduce_num_levels.cc | ||
version_set_test.cc | ||
version_set.cc | ||
version_set.h | ||
write_batch_internal.h | ||
write_batch_test.cc | ||
write_batch.cc |