Ensure Correct Behavior of StatsLevel kExceptDetailedTimers and kExceptTimeForMutex (#1308)
* Fix StatsLevel so that kExceptTimeForMutex leaves compression stats enabled and kExceptDetailedTimers disables mutex lock stats. Also change default stats level to kExceptDetailedTimers (disabling both compression and mutex timing). * Changed order of StatsLevel enum to simplify logic for determining what stats to record.
This commit is contained in:
parent
e14fbaae26
commit
4fd08f4b8b
@ -4718,7 +4718,7 @@ TEST_F(DBTest, CompressionStatsTest) {
|
||||
Options options = CurrentOptions();
|
||||
options.compression = type;
|
||||
options.statistics = rocksdb::CreateDBStatistics();
|
||||
options.statistics->stats_level_ = StatsLevel::kAll;
|
||||
options.statistics->stats_level_ = StatsLevel::kExceptTimeForMutex;
|
||||
DestroyAndReopen(options);
|
||||
|
||||
int kNumKeysWritten = 100000;
|
||||
|
@ -393,12 +393,12 @@ struct HistogramData {
|
||||
};
|
||||
|
||||
enum StatsLevel {
|
||||
// Collect all stats except time inside mutex lock AND time spent on
|
||||
// compression.
|
||||
kExceptDetailedTimers,
|
||||
// Collect all stats except the counters requiring to get time inside the
|
||||
// mutex lock.
|
||||
kExceptTimeForMutex,
|
||||
// Collect all stats expect time inside mutex lock AND time spent on
|
||||
// compression
|
||||
kExceptDetailedTimers,
|
||||
// Collect all stats, including measuring duration of mutex operations.
|
||||
// If getting time is expensive on the platform to run, it can
|
||||
// reduce scalability to more threads, especially for writes.
|
||||
@ -429,7 +429,7 @@ class Statistics {
|
||||
return type < HISTOGRAM_ENUM_MAX;
|
||||
}
|
||||
|
||||
StatsLevel stats_level_ = kExceptTimeForMutex;
|
||||
StatsLevel stats_level_ = kExceptDetailedTimers;
|
||||
};
|
||||
|
||||
// Create a concrete DBStatistics object
|
||||
|
@ -11,7 +11,7 @@ namespace rocksdb {
|
||||
namespace {
|
||||
bool ShouldReportToStats(Env* env, Statistics* stats) {
|
||||
return env != nullptr && stats != nullptr &&
|
||||
stats->stats_level_ != kExceptTimeForMutex;
|
||||
stats->stats_level_ > kExceptTimeForMutex;
|
||||
}
|
||||
} // namespace
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user