Avoid unnecessary unlock and lock mutex when notifying events.

Summary: Avoid unnecessary unlock and lock mutex when notifying events.

Test Plan: ./listener_test

Reviewers: igor

Reviewed By: igor

Subscribers: sdong, dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D30267
This commit is contained in:
Yueh-Hsuan Chiang 2014-12-16 17:10:23 -08:00
parent 7661e5a76e
commit 25f70a5abb
1 changed files with 3 additions and 0 deletions

View File

@ -1112,6 +1112,9 @@ Status DBImpl::FlushMemTableToOutputFile(
void DBImpl::NotifyOnFlushCompleted(
ColumnFamilyData* cfd, uint64_t file_number,
const MutableCFOptions& mutable_cf_options) {
if (cfd->ioptions()->listeners.size() == 0U) {
return;
}
mutex_.AssertHeld();
if (shutting_down_.load(std::memory_order_acquire)) {
return;