MemTable::PostProcess() can skip updating num_deletes if the delta is 0

Summary: In many use cases there is no deletes. No need to pay the overhead of atomically updating num_deletes.

Test Plan: Run existing test.

Reviewers: ngbronson, yiwu, andrewkr, igor

Reviewed By: andrewkr

Subscribers: leveldb, andrewkr, dhruba

Differential Revision: https://reviews.facebook.net/D60555
This commit is contained in:
sdong 2016-07-08 12:51:24 -07:00
parent 2a282e5f54
commit e70ba4e40e

View File

@ -232,8 +232,10 @@ class MemTable {
num_entries_.fetch_add(update_counters.num_entries, num_entries_.fetch_add(update_counters.num_entries,
std::memory_order_relaxed); std::memory_order_relaxed);
data_size_.fetch_add(update_counters.data_size, std::memory_order_relaxed); data_size_.fetch_add(update_counters.data_size, std::memory_order_relaxed);
num_deletes_.fetch_add(update_counters.num_deletes, if (update_counters.num_deletes != 0) {
std::memory_order_relaxed); num_deletes_.fetch_add(update_counters.num_deletes,
std::memory_order_relaxed);
}
UpdateFlushState(); UpdateFlushState();
} }