From f6ca226c1748fe75c3302246f6720f356f7dfa56 Mon Sep 17 00:00:00 2001 From: Lei Jin Date: Mon, 28 Jul 2014 12:10:49 -0700 Subject: [PATCH] make statistics forward-able Summary: Make StatisticsImpl being able to forward stats to provided statistics implementation. The main purpose is to allow us to collect internal stats in the future even when user supplies custom statistics implementation. It avoids intrumenting 2 sets of stats collection code. One immediate use case is tuning advisor, which needs to collect some internal stats, users may not be interested. Test Plan: ran db_bench and see stats show up at the end of run Will run make all check since some tests rely on statistics Reviewers: yhchiang, sdong, igor Reviewed By: sdong Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D20145 --- db/db_impl.cc | 1 + util/statistics.h | 1 + 2 files changed, 2 insertions(+) diff --git a/db/db_impl.cc b/db/db_impl.cc index 641825ee8a..6edd62f936 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -276,6 +276,7 @@ Options SanitizeOptions(const std::string& dbname, DBOptions SanitizeOptions(const std::string& dbname, const DBOptions& src) { DBOptions result = src; + // result.max_open_files means an "infinite" open files. if (result.max_open_files != -1) { ClipToRange(&result.max_open_files, 20, 1000000); diff --git a/util/statistics.h b/util/statistics.h index ae00663517..c56900accb 100644 --- a/util/statistics.h +++ b/util/statistics.h @@ -86,4 +86,5 @@ inline void SetTickerCount(Statistics* statistics, uint32_t ticker_type, statistics->setTickerCount(ticker_type, count); } } + }