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
main
Sagar Vemuri 7 years ago committed by Facebook Github Bot
parent 1900771bd2
commit 3453870677
  1. 13
      java/samples/src/main/java/RocksDBSample.java

@ -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,7 +220,9 @@ public class RocksDBSample {
try {
for (final TickerType statsType : TickerType.values()) {
stats.getTickerCount(statsType);
if (statsType != TickerType.TICKER_ENUM_MAX) {
stats.getTickerCount(statsType);
}
}
System.out.println("getTickerCount() passed.");
} catch (final Exception e) {
@ -231,7 +232,9 @@ public class RocksDBSample {
try {
for (final HistogramType histogramType : HistogramType.values()) {
HistogramData data = stats.getHistogramData(histogramType);
if (histogramType != HistogramType.HISTOGRAM_ENUM_MAX) {
HistogramData data = stats.getHistogramData(histogramType);
}
}
System.out.println("getHistogramData() passed.");
} catch (final Exception e) {

Loading…
Cancel
Save