Remove info logging in db mutex inside EnableFileDeletions() (#4604)
Summary: EnableFileDeletions() does info logging inside db mutex. This is not recommended in the code base, since there could be I/O involved. Move this outside the DB mutex. Pull Request resolved: https://github.com/facebook/rocksdb/pull/4604 Differential Revision: D12834432 Pulled By: siying fbshipit-source-id: ffe5c2626fcfdb4c54a661a3c3b0bc95054816cf
This commit is contained in:
parent
cae540ebef
commit
9da88a8321
@ -44,7 +44,7 @@ Status DBImpl::EnableFileDeletions(bool force) {
|
|||||||
// Job id == 0 means that this is not our background process, but rather
|
// Job id == 0 means that this is not our background process, but rather
|
||||||
// user thread
|
// user thread
|
||||||
JobContext job_context(0);
|
JobContext job_context(0);
|
||||||
bool should_purge_files = false;
|
bool file_deletion_enabled = false;
|
||||||
{
|
{
|
||||||
InstrumentedMutexLock l(&mutex_);
|
InstrumentedMutexLock l(&mutex_);
|
||||||
if (force) {
|
if (force) {
|
||||||
@ -54,20 +54,19 @@ Status DBImpl::EnableFileDeletions(bool force) {
|
|||||||
--disable_delete_obsolete_files_;
|
--disable_delete_obsolete_files_;
|
||||||
}
|
}
|
||||||
if (disable_delete_obsolete_files_ == 0) {
|
if (disable_delete_obsolete_files_ == 0) {
|
||||||
ROCKS_LOG_INFO(immutable_db_options_.info_log, "File Deletions Enabled");
|
file_deletion_enabled = true;
|
||||||
should_purge_files = true;
|
|
||||||
FindObsoleteFiles(&job_context, true);
|
FindObsoleteFiles(&job_context, true);
|
||||||
bg_cv_.SignalAll();
|
bg_cv_.SignalAll();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (file_deletion_enabled) {
|
||||||
|
ROCKS_LOG_INFO(immutable_db_options_.info_log, "File Deletions Enabled");
|
||||||
|
PurgeObsoleteFiles(job_context);
|
||||||
} else {
|
} else {
|
||||||
ROCKS_LOG_WARN(
|
ROCKS_LOG_WARN(immutable_db_options_.info_log,
|
||||||
immutable_db_options_.info_log,
|
|
||||||
"File Deletions Enable, but not really enabled. Counter: %d",
|
"File Deletions Enable, but not really enabled. Counter: %d",
|
||||||
disable_delete_obsolete_files_);
|
disable_delete_obsolete_files_);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (should_purge_files) {
|
|
||||||
PurgeObsoleteFiles(job_context);
|
|
||||||
}
|
|
||||||
job_context.Clean();
|
job_context.Clean();
|
||||||
LogFlush(immutable_db_options_.info_log);
|
LogFlush(immutable_db_options_.info_log);
|
||||||
return Status::OK();
|
return Status::OK();
|
||||||
|
Loading…
Reference in New Issue
Block a user