Fix statistics in RocksJava sample

Summary:
I observed while doing a `make jtest` that the java sample was broken, due to the changes in #2551 .
Closes https://github.com/facebook/rocksdb/pull/2674

Differential Revision: D5539807

Pulled By: sagar0

fbshipit-source-id: 2c7e9d84778099dfa1c611996b444efe3c9fd466
This commit is contained in:
Sagar Vemuri 2017-08-01 16:42:42 -07:00 committed by Facebook Github Bot
parent 1900771bd2
commit 3453870677

View File

@ -31,6 +31,7 @@ public class RocksDBSample {
final Filter bloomFilter = new BloomFilter(10);
final ReadOptions readOptions = new ReadOptions()
.setFillCache(false);
final Statistics stats = new Statistics();
final RateLimiter rateLimiter = new RateLimiter(10000000,10000, 10)) {
try (final RocksDB db = RocksDB.open(options, db_path_not_found)) {
@ -41,7 +42,7 @@ public class RocksDBSample {
try {
options.setCreateIfMissing(true)
.createStatistics()
.setStatistics(stats)
.setWriteBufferSize(8 * SizeUnit.KB)
.setMaxWriteBufferNumber(3)
.setMaxBackgroundCompactions(10)
@ -51,8 +52,6 @@ public class RocksDBSample {
assert (false);
}
final Statistics stats = options.statisticsPtr();
assert (options.createIfMissing() == true);
assert (options.writeBufferSize() == 8 * SizeUnit.KB);
assert (options.maxWriteBufferNumber() == 3);
@ -221,8 +220,10 @@ public class RocksDBSample {
try {
for (final TickerType statsType : TickerType.values()) {
if (statsType != TickerType.TICKER_ENUM_MAX) {
stats.getTickerCount(statsType);
}
}
System.out.println("getTickerCount() passed.");
} catch (final Exception e) {
System.out.println("Failed in call to getTickerCount()");
@ -231,8 +232,10 @@ public class RocksDBSample {
try {
for (final HistogramType histogramType : HistogramType.values()) {
if (histogramType != HistogramType.HISTOGRAM_ENUM_MAX) {
HistogramData data = stats.getHistogramData(histogramType);
}
}
System.out.println("getHistogramData() passed.");
} catch (final Exception e) {
System.out.println("Failed in call to getHistogramData()");