From 6ed450a58cd0bf9f299b0e279ce762125b79deea Mon Sep 17 00:00:00 2001 From: Igor Canadi Date: Mon, 24 Feb 2014 16:00:13 -0800 Subject: [PATCH] DeleteFile should schedule Flush or Compaction Summary: More info here: https://github.com/facebook/rocksdb/issues/89 If flush fails because of ENOSPC, we have a deadlock problem. This is a quick fix that will continue the normal operation when user deletes the file and frees up the space on the device. We need to address the issue more broadly with bg_error_ cleanup. Test Plan: make check Reviewers: dhruba, haobo, ljin Reviewed By: ljin CC: leveldb Differential Revision: https://reviews.facebook.net/D16275 --- db/db_impl.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/db/db_impl.cc b/db/db_impl.cc index 041c62107..12042585b 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -3623,6 +3623,12 @@ Status DBImpl::DeleteFile(std::string name) { LogFlush(options_.info_log); // remove files outside the db-lock PurgeObsoleteFiles(deletion_state); + { + MutexLock l(&mutex_); + // schedule flush if file deletion means we freed the space for flushes to + // continue + MaybeScheduleFlushOrCompaction(); + } return status; }