From d0c31641d22b1bc8ca1bba3eb7f80f0979bfd033 Mon Sep 17 00:00:00 2001 From: sdong Date: Mon, 21 Sep 2015 16:11:26 -0700 Subject: [PATCH] Internal stats WAL file synced to match meaning of the stats of the same name Summary: https://reviews.facebook.net/D23343 changed WAL sync bytes to extra fsync. This change does the same for internal stats. Test Plan: Run all existing unit tests and verify results in db_bench. Reviewers: anthony, rven, igor, MarkCallaghan, kradhakrishnan, yhchiang Reviewed By: yhchiang Subscribers: leveldb, dhruba Differential Revision: https://reviews.facebook.net/D47349 --- db/db_impl.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index 3e1d3c703..c2219b1f7 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -3708,8 +3708,10 @@ Status DBImpl::WriteImpl(const WriteOptions& write_options, default_cf_internal_stats_->AddDBStats(InternalStats::NUMBER_KEYS_WRITTEN, my_batch_count); if (!write_options.disableWAL) { - default_cf_internal_stats_->AddDBStats( - InternalStats::WAL_FILE_SYNCED, 1); + if (write_options.sync) { + default_cf_internal_stats_->AddDBStats(InternalStats::WAL_FILE_SYNCED, + 1); + } default_cf_internal_stats_->AddDBStats( InternalStats::WAL_FILE_BYTES, log_size); }