Skip to content

Commit 4209516

Browse files
committed
Schedule flush when waiting on flush
Summary: This will also help with avoiding the deadlock. If a flush failed and we're waiting for a memtable to be flushed, we should schedule a new flush and hope a new one succeedes. If paranoid_checks = false, Wait() will still hang on ENOSPC, but at least it will automatically continue when the space frees up. Current behavior both hangs and deadlocks. Also, I renamed some 'compaction' to 'flush'. 'compaction' was leveldb way of saying things. Test Plan: make check Reviewers: dhruba, haobo, ljin Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D16281
1 parent dea894e commit 4209516

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

db/db_impl.cc

+4-3
Original file line numberDiff line numberDiff line change
@@ -3364,9 +3364,10 @@ Status DBImpl::MakeRoomForWrite(bool force,
33643364
break;
33653365
} else if (imm_.size() == options_.max_write_buffer_number - 1) {
33663366
// We have filled up the current memtable, but the previous
3367-
// ones are still being compacted, so we wait.
3367+
// ones are still being flushed, so we wait.
33683368
DelayLoggingAndReset();
3369-
Log(options_.info_log, "wait for memtable compaction...\n");
3369+
Log(options_.info_log, "wait for memtable flush...\n");
3370+
MaybeScheduleFlushOrCompaction();
33703371
uint64_t stall;
33713372
{
33723373
StopWatch sw(env_, options_.statistics.get(),
@@ -3440,7 +3441,7 @@ Status DBImpl::MakeRoomForWrite(bool force,
34403441
unique_ptr<WritableFile> lfile;
34413442
MemTable* new_mem = nullptr;
34423443

3443-
// Attempt to switch to a new memtable and trigger compaction of old.
3444+
// Attempt to switch to a new memtable and trigger flush of old.
34443445
// Do this without holding the dbmutex lock.
34453446
assert(versions_->PrevLogNumber() == 0);
34463447
uint64_t new_log_number = versions_->NewFileNumber();

0 commit comments

Comments
 (0)