From 289efe992257f6e6bda379181a78506658661e0a Mon Sep 17 00:00:00 2001 From: Dhruba Borthakur Date: Tue, 9 Jul 2013 16:17:00 -0700 Subject: [PATCH] Update statistics only if needed. Summary: Update statistics only if needed. Test Plan: Reviewers: CC: Task ID: # Blame Rev: --- db/version_set.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/db/version_set.cc b/db/version_set.cc index 088550120..876e41e84 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -2169,8 +2169,10 @@ Compaction* VersionSet::PickCompactionUniversal(int level, double score) { } // update statistics - options_->statistics->measureTime(NUM_FILES_IN_SINGLE_COMPACTION, - c->inputs_[0].size()); + if (options_->statistics != nullptr) { + options_->statistics->measureTime(NUM_FILES_IN_SINGLE_COMPACTION, + c->inputs_[0].size()); + } c->input_version_ = current_; c->input_version_->Ref();