Skip to content

Commit 4036d58

Browse files
committed
Fix a Statistics-related unit test faulure
Summary: In my MacOS, the member variables are populated with random numbers after initialization. This diff fixes it by fill these arrays with 0. Test Plan: make && ./table_test Reviewers: igor CC: leveldb Differential Revision: https://reviews.facebook.net/D15315
1 parent 4e8321b commit 4036d58

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

util/statistics.cc

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
//
66
#include "util/statistics.h"
77
#include "rocksdb/statistics.h"
8+
#include <algorithm>
89
#include <cstdio>
910

1011
namespace rocksdb {
@@ -13,7 +14,11 @@ std::shared_ptr<Statistics> CreateDBStatistics() {
1314
return std::make_shared<StatisticsImpl>();
1415
}
1516

16-
StatisticsImpl::StatisticsImpl() {}
17+
StatisticsImpl::StatisticsImpl() {
18+
// Fill tickers_ with "zero". To ensure plasform indepedent, we used
19+
// uint_fast64_t() instead literal `0` to represent zero.
20+
std::fill(tickers_, tickers_ + TICKER_ENUM_MAX, uint_fast64_t());
21+
}
1722

1823
StatisticsImpl::~StatisticsImpl() {}
1924

0 commit comments

Comments
 (0)