From 10ce3d345841e97a3aa6114412e0e6669cdc3e2a Mon Sep 17 00:00:00 2001 From: Alvaro Alda Date: Mon, 25 Mar 2019 10:43:11 +0100 Subject: [PATCH 1/4] Add cgo bindings for RocksDB statistics Former-commit-id: 1640a8c54db034ac78aa2780d9ce69585cb2eb42 [formerly ce186ff0915fb5edf4d2b294f9d75944e88a885f] Former-commit-id: 40f23be8415d474e158e645d21574e6a80c6fa41 --- rocksdb/extended.cpp | 139 ++++++++++ rocksdb/extended.h | 518 +++++++++++++++++++++++++++++++++++++ rocksdb/flags.go | 1 + rocksdb/options.go | 6 + rocksdb/statistics.go | 150 +++++++++++ rocksdb/statistics_test.go | 139 ++++++++++ 6 files changed, 953 insertions(+) create mode 100644 rocksdb/extended.cpp create mode 100644 rocksdb/extended.h create mode 100644 rocksdb/statistics.go create mode 100644 rocksdb/statistics_test.go diff --git a/rocksdb/extended.cpp b/rocksdb/extended.cpp new file mode 100644 index 000000000..d0740aae6 --- /dev/null +++ b/rocksdb/extended.cpp @@ -0,0 +1,139 @@ +/* + Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +#include "extended.h" + +#include "rocksdb/c.h" +#include "rocksdb/statistics.h" +#include "rocksdb/options.h" + +using rocksdb::Statistics; +using rocksdb::HistogramData; +using rocksdb::StatsLevel; +using rocksdb::Options; +using std::shared_ptr; + +extern "C" { + +struct rocksdb_statistics_t { std::shared_ptr rep; }; +struct rocksdb_histogram_data_t { rocksdb::HistogramData* rep; }; +struct rocksdb_options_t { Options rep; }; + +rocksdb_statistics_t* rocksdb_create_statistics() { + rocksdb_statistics_t* result = new rocksdb_statistics_t; + result->rep = rocksdb::CreateDBStatistics(); + return result; +} + +void rocksdb_options_set_statistics( + rocksdb_options_t* opts, + rocksdb_statistics_t* stats) { + if (stats) { + opts->rep.statistics = stats->rep; + } +} + +rocksdb_stats_level_t rocksdb_statistics_stats_level( + rocksdb_statistics_t* stats) { + return static_cast(stats->rep->stats_level_); +} + +void rocksdb_statistics_set_stats_level( + rocksdb_statistics_t* stats, + rocksdb_stats_level_t level) { + stats->rep->stats_level_ = static_cast(level); +} + +void rocksdb_statistics_reset( + rocksdb_statistics_t* stats) { + stats->rep->Reset(); +} + +uint64_t rocksdb_statistics_get_ticker_count( + rocksdb_statistics_t* stats, + rocksdb_tickers_t ticker_type) { + return stats->rep->getTickerCount(ticker_type); +} + +uint64_t rocksdb_statistics_get_and_reset_ticker_count( + rocksdb_statistics_t* stats, + rocksdb_tickers_t ticker_type) { + return stats->rep->getAndResetTickerCount(ticker_type); +} + +void rocksdb_statistics_destroy(rocksdb_statistics_t* stats) { + delete stats; +} + +void rocksdb_statistics_histogram_data( + const rocksdb_statistics_t* stats, + rocksdb_histograms_t type, + const rocksdb_histogram_data_t* data) { + stats->rep->histogramData(type, data->rep); +} + +// Histogram + +rocksdb_histogram_data_t* rocksdb_histogram_create_data() { + rocksdb_histogram_data_t* result = new rocksdb_histogram_data_t; + rocksdb::HistogramData hData; + result->rep = &hData; + return result; +} + +double rocksdb_histogram_get_average(rocksdb_histogram_data_t* data) { + return data->rep->average; +} + +double rocksdb_histogram_get_median(rocksdb_histogram_data_t* data) { + return data->rep->median; +} + +double rocksdb_histogram_get_percentile95(rocksdb_histogram_data_t* data) { + return data->rep->percentile95; +} + +double rocksdb_histogram_get_percentile99(rocksdb_histogram_data_t* data) { + return data->rep->percentile99; +} + +double rocksdb_histogram_get_stdev(rocksdb_histogram_data_t* data) { + return data->rep->standard_deviation; +} + +double rocksdb_histogram_get_max(rocksdb_histogram_data_t* data) { + return data->rep->max; +} + +uint64_t rocksdb_histogram_get_count(rocksdb_histogram_data_t* data) { + return data->rep->count; +} + +uint64_t rocksdb_histogram_get_sum(rocksdb_histogram_data_t* data) { + return data->rep->sum; +} + +double rocksdb_histogram_get_min(rocksdb_histogram_data_t* data) { + return data->rep->min; +} + +void rocksdb_histogram_data_destroy(rocksdb_histogram_data_t* data); + +void rocksdb_histogram_data_destroy(rocksdb_histogram_data_t* data) { + delete data; +} + +} // end extern "C" diff --git a/rocksdb/extended.h b/rocksdb/extended.h new file mode 100644 index 000000000..817293dcf --- /dev/null +++ b/rocksdb/extended.h @@ -0,0 +1,518 @@ +/* + Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/* + + C bindings for missing rocksdb features + +*/ + +#pragma once + +#ifndef ROCKSDB_EXTENDED_H +#define ROCKSDB_EXTENDED_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "rocksdb/c.h" +#include + +/* Exported types */ + +typedef struct rocksdb_statistics_t rocksdb_statistics_t; +typedef struct rocksdb_histogram_data_t rocksdb_histogram_data_t; + +/* DB operations */ + +extern rocksdb_statistics_t* rocksdb_create_statistics(); + +/* Options */ + +extern void rocksdb_options_set_statistics( + rocksdb_options_t* opt, + rocksdb_statistics_t* stats); + +/* Statistics */ + +typedef enum { + // total block cache misses + // REQUIRES: BLOCK_CACHE_MISS == BLOCK_CACHE_INDEX_MISS + + // BLOCK_CACHE_FILTER_MISS + + // BLOCK_CACHE_DATA_MISS; + BLOCK_CACHE_MISS = 0, + // total block cache hit + // REQUIRES: BLOCK_CACHE_HIT == BLOCK_CACHE_INDEX_HIT + + // BLOCK_CACHE_FILTER_HIT + + // BLOCK_CACHE_DATA_HIT; + BLOCK_CACHE_HIT, + // # of blocks added to block cache. + BLOCK_CACHE_ADD, + // # of failures when adding blocks to block cache. + BLOCK_CACHE_ADD_FAILURES, + // # of times cache miss when accessing index block from block cache. + BLOCK_CACHE_INDEX_MISS, + // # of times cache hit when accessing index block from block cache. + BLOCK_CACHE_INDEX_HIT, + // # of index blocks added to block cache. + BLOCK_CACHE_INDEX_ADD, + // # of bytes of index blocks inserted into cache + BLOCK_CACHE_INDEX_BYTES_INSERT, + // # of bytes of index block erased from cache + BLOCK_CACHE_INDEX_BYTES_EVICT, + // # of times cache miss when accessing filter block from block cache. + BLOCK_CACHE_FILTER_MISS, + // # of times cache hit when accessing filter block from block cache. + BLOCK_CACHE_FILTER_HIT, + // # of filter blocks added to block cache. + BLOCK_CACHE_FILTER_ADD, + // # of bytes of bloom filter blocks inserted into cache + BLOCK_CACHE_FILTER_BYTES_INSERT, + // # of bytes of bloom filter block erased from cache + BLOCK_CACHE_FILTER_BYTES_EVICT, + // # of times cache miss when accessing data block from block cache. + BLOCK_CACHE_DATA_MISS, + // # of times cache hit when accessing data block from block cache. + BLOCK_CACHE_DATA_HIT, + // # of data blocks added to block cache. + BLOCK_CACHE_DATA_ADD, + // # of bytes of data blocks inserted into cache + BLOCK_CACHE_DATA_BYTES_INSERT, + // # of bytes read from cache. + BLOCK_CACHE_BYTES_READ, + // # of bytes written into cache. + BLOCK_CACHE_BYTES_WRITE, + + // # of times bloom filter has avoided file reads, i.e., negatives. + BLOOM_FILTER_USEFUL, + // # of times bloom FullFilter has not avoided the reads. + BLOOM_FILTER_FULL_POSITIVE, + // # of times bloom FullFilter has not avoided the reads and data actually + // exist. + BLOOM_FILTER_FULL_TRUE_POSITIVE, + + // # persistent cache hit + PERSISTENT_CACHE_HIT, + // # persistent cache miss + PERSISTENT_CACHE_MISS, + + // # total simulation block cache hits + SIM_BLOCK_CACHE_HIT, + // # total simulation block cache misses + SIM_BLOCK_CACHE_MISS, + + // # of memtable hits. + MEMTABLE_HIT, + // # of memtable misses. + MEMTABLE_MISS, + + // # of Get() queries served by L0 + GET_HIT_L0, + // # of Get() queries served by L1 + GET_HIT_L1, + // # of Get() queries served by L2 and up + GET_HIT_L2_AND_UP, + + /** + * COMPACTION_KEY_DROP_* count the reasons for key drop during compaction + * There are 4 reasons currently. + */ + COMPACTION_KEY_DROP_NEWER_ENTRY, // key was written with a newer value. + // Also includes keys dropped for range del. + COMPACTION_KEY_DROP_OBSOLETE, // The key is obsolete. + COMPACTION_KEY_DROP_RANGE_DEL, // key was covered by a range tombstone. + COMPACTION_KEY_DROP_USER, // user compaction function has dropped the key. + COMPACTION_RANGE_DEL_DROP_OBSOLETE, // all keys in range were deleted. + // Deletions obsoleted before bottom level due to file gap optimization. + COMPACTION_OPTIMIZED_DEL_DROP_OBSOLETE, + // If a compaction was cancelled in sfm to prevent ENOSPC + COMPACTION_CANCELLED, + + // Number of keys written to the database via the Put and Write call's + NUMBER_KEYS_WRITTEN, + // Number of Keys read, + NUMBER_KEYS_READ, + // Number keys updated, if inplace update is enabled + NUMBER_KEYS_UPDATED, + // The number of uncompressed bytes issued by DB::Put(), DB::Delete(), + // DB::Merge(), and DB::Write(). + BYTES_WRITTEN, + // The number of uncompressed bytes read from DB::Get(). It could be + // either from memtables, cache, or table files. + // For the number of logical bytes read from DB::MultiGet(), + // please use NUMBER_MULTIGET_BYTES_READ. + BYTES_READ, + // The number of calls to seek/next/prev + NUMBER_DB_SEEK, + NUMBER_DB_NEXT, + NUMBER_DB_PREV, + // The number of calls to seek/next/prev that returned data + NUMBER_DB_SEEK_FOUND, + NUMBER_DB_NEXT_FOUND, + NUMBER_DB_PREV_FOUND, + // The number of uncompressed bytes read from an iterator. + // Includes size of key and value. + ITER_BYTES_READ, + NO_FILE_CLOSES, + NO_FILE_OPENS, + NO_FILE_ERRORS, + // DEPRECATED Time system had to wait to do LO-L1 compactions + STALL_L0_SLOWDOWN_MICROS, + // DEPRECATED Time system had to wait to move memtable to L1. + STALL_MEMTABLE_COMPACTION_MICROS, + // DEPRECATED write throttle because of too many files in L0 + STALL_L0_NUM_FILES_MICROS, + // Writer has to wait for compaction or flush to finish. + STALL_MICROS, + // The wait time for db mutex. + // Disabled by default. To enable it set stats level to kAll + DB_MUTEX_WAIT_MICROS, + RATE_LIMIT_DELAY_MILLIS, + // DEPRECATED number of iterators currently open + NO_ITERATORS, + + // Number of MultiGet calls, keys read, and bytes read + NUMBER_MULTIGET_CALLS, + NUMBER_MULTIGET_KEYS_READ, + NUMBER_MULTIGET_BYTES_READ, + + // Number of deletes records that were not required to be + // written to storage because key does not exist + NUMBER_FILTERED_DELETES, + NUMBER_MERGE_FAILURES, + + // number of times bloom was checked before creating iterator on a + // file, and the number of times the check was useful in avoiding + // iterator creation (and thus likely IOPs). + BLOOM_FILTER_PREFIX_CHECKED, + BLOOM_FILTER_PREFIX_USEFUL, + + // Number of times we had to reseek inside an iteration to skip + // over large number of keys with same userkey. + NUMBER_OF_RESEEKS_IN_ITERATION, + + // Record the number of calls to GetUpadtesSince. Useful to keep track of + // transaction log iterator refreshes + GET_UPDATES_SINCE_CALLS, + BLOCK_CACHE_COMPRESSED_MISS, // miss in the compressed block cache + BLOCK_CACHE_COMPRESSED_HIT, // hit in the compressed block cache + // Number of blocks added to compressed block cache + BLOCK_CACHE_COMPRESSED_ADD, + // Number of failures when adding blocks to compressed block cache + BLOCK_CACHE_COMPRESSED_ADD_FAILURES, + WAL_FILE_SYNCED, // Number of times WAL sync is done + WAL_FILE_BYTES, // Number of bytes written to WAL + + // Writes can be processed by requesting thread or by the thread at the + // head of the writers queue. + WRITE_DONE_BY_SELF, + WRITE_DONE_BY_OTHER, // Equivalent to writes done for others + WRITE_TIMEDOUT, // Number of writes ending up with timed-out. + WRITE_WITH_WAL, // Number of Write calls that request WAL + COMPACT_READ_BYTES, // Bytes read during compaction + COMPACT_WRITE_BYTES, // Bytes written during compaction + FLUSH_WRITE_BYTES, // Bytes written during flush + + // Number of table's properties loaded directly from file, without creating + // table reader object. + NUMBER_DIRECT_LOAD_TABLE_PROPERTIES, + NUMBER_SUPERVERSION_ACQUIRES, + NUMBER_SUPERVERSION_RELEASES, + NUMBER_SUPERVERSION_CLEANUPS, + + // # of compressions/decompressions executed + NUMBER_BLOCK_COMPRESSED, + NUMBER_BLOCK_DECOMPRESSED, + + NUMBER_BLOCK_NOT_COMPRESSED, + MERGE_OPERATION_TOTAL_TIME, + FILTER_OPERATION_TOTAL_TIME, + + // Row cache. + ROW_CACHE_HIT, + ROW_CACHE_MISS, + + // Read amplification statistics. + // Read amplification can be calculated using this formula + // (READ_AMP_TOTAL_READ_BYTES / READ_AMP_ESTIMATE_USEFUL_BYTES) + // + // REQUIRES: ReadOptions::read_amp_bytes_per_bit to be enabled + READ_AMP_ESTIMATE_USEFUL_BYTES, // Estimate of total bytes actually used. + READ_AMP_TOTAL_READ_BYTES, // Total size of loaded data blocks. + + // Number of refill intervals where rate limiter's bytes are fully consumed. + NUMBER_RATE_LIMITER_DRAINS, + + // Number of internal keys skipped by Iterator + NUMBER_ITER_SKIP, + + // BlobDB specific stats + // # of Put/PutTTL/PutUntil to BlobDB. + BLOB_DB_NUM_PUT, + // # of Write to BlobDB. + BLOB_DB_NUM_WRITE, + // # of Get to BlobDB. + BLOB_DB_NUM_GET, + // # of MultiGet to BlobDB. + BLOB_DB_NUM_MULTIGET, + // # of Seek/SeekToFirst/SeekToLast/SeekForPrev to BlobDB iterator. + BLOB_DB_NUM_SEEK, + // # of Next to BlobDB iterator. + BLOB_DB_NUM_NEXT, + // # of Prev to BlobDB iterator. + BLOB_DB_NUM_PREV, + // # of keys written to BlobDB. + BLOB_DB_NUM_KEYS_WRITTEN, + // # of keys read from BlobDB. + BLOB_DB_NUM_KEYS_READ, + // # of bytes (key + value) written to BlobDB. + BLOB_DB_BYTES_WRITTEN, + // # of bytes (keys + value) read from BlobDB. + BLOB_DB_BYTES_READ, + // # of keys written by BlobDB as non-TTL inlined value. + BLOB_DB_WRITE_INLINED, + // # of keys written by BlobDB as TTL inlined value. + BLOB_DB_WRITE_INLINED_TTL, + // # of keys written by BlobDB as non-TTL blob value. + BLOB_DB_WRITE_BLOB, + // # of keys written by BlobDB as TTL blob value. + BLOB_DB_WRITE_BLOB_TTL, + // # of bytes written to blob file. + BLOB_DB_BLOB_FILE_BYTES_WRITTEN, + // # of bytes read from blob file. + BLOB_DB_BLOB_FILE_BYTES_READ, + // # of times a blob files being synced. + BLOB_DB_BLOB_FILE_SYNCED, + // # of blob index evicted from base DB by BlobDB compaction filter because + // of expiration. + BLOB_DB_BLOB_INDEX_EXPIRED_COUNT, + // size of blob index evicted from base DB by BlobDB compaction filter + // because of expiration. + BLOB_DB_BLOB_INDEX_EXPIRED_SIZE, + // # of blob index evicted from base DB by BlobDB compaction filter because + // of corresponding file deleted. + BLOB_DB_BLOB_INDEX_EVICTED_COUNT, + // size of blob index evicted from base DB by BlobDB compaction filter + // because of corresponding file deleted. + BLOB_DB_BLOB_INDEX_EVICTED_SIZE, + // # of blob files being garbage collected. + BLOB_DB_GC_NUM_FILES, + // # of blob files generated by garbage collection. + BLOB_DB_GC_NUM_NEW_FILES, + // # of BlobDB garbage collection failures. + BLOB_DB_GC_FAILURES, + // # of keys drop by BlobDB garbage collection because they had been + // overwritten. + BLOB_DB_GC_NUM_KEYS_OVERWRITTEN, + // # of keys drop by BlobDB garbage collection because of expiration. + BLOB_DB_GC_NUM_KEYS_EXPIRED, + // # of keys relocated to new blob file by garbage collection. + BLOB_DB_GC_NUM_KEYS_RELOCATED, + // # of bytes drop by BlobDB garbage collection because they had been + // overwritten. + BLOB_DB_GC_BYTES_OVERWRITTEN, + // # of bytes drop by BlobDB garbage collection because of expiration. + BLOB_DB_GC_BYTES_EXPIRED, + // # of bytes relocated to new blob file by garbage collection. + BLOB_DB_GC_BYTES_RELOCATED, + // # of blob files evicted because of BlobDB is full. + BLOB_DB_FIFO_NUM_FILES_EVICTED, + // # of keys in the blob files evicted because of BlobDB is full. + BLOB_DB_FIFO_NUM_KEYS_EVICTED, + // # of bytes in the blob files evicted because of BlobDB is full. + BLOB_DB_FIFO_BYTES_EVICTED, + + // These counters indicate a performance issue in WritePrepared transactions. + // We should not seem them ticking them much. + // # of times prepare_mutex_ is acquired in the fast path. + TXN_PREPARE_MUTEX_OVERHEAD, + // # of times old_commit_map_mutex_ is acquired in the fast path. + TXN_OLD_COMMIT_MAP_MUTEX_OVERHEAD, + // # of times we checked a batch for duplicate keys. + TXN_DUPLICATE_KEY_OVERHEAD, + // # of times snapshot_mutex_ is acquired in the fast path. + TXN_SNAPSHOT_MUTEX_OVERHEAD, + + // Number of keys actually found in MultiGet calls (vs number requested by + // caller) + // NUMBER_MULTIGET_KEYS_READ gives the number requested by caller + NUMBER_MULTIGET_KEYS_FOUND, + + NO_ITERATOR_CREATED, // number of iterators created + NO_ITERATOR_DELETED, // number of iterators deleted + + BLOCK_CACHE_COMPRESSION_DICT_MISS, + BLOCK_CACHE_COMPRESSION_DICT_HIT, + BLOCK_CACHE_COMPRESSION_DICT_ADD, + BLOCK_CACHE_COMPRESSION_DICT_BYTES_INSERT, + BLOCK_CACHE_COMPRESSION_DICT_BYTES_EVICT, + TICKER_ENUM_MAX +} rocksdb_tickers_t; + +typedef enum { + /** + * Keep adding histogram's here. + * Any histogram should have value less than HISTOGRAM_ENUM_MAX + * Add a new Histogram by assigning it the current value of HISTOGRAM_ENUM_MAX + * Add a string representation in HistogramsNameMap below + * And increment HISTOGRAM_ENUM_MAX + * Add a corresponding enum value to HistogramType.java in the java API + */ + DB_GET = 0, + DB_WRITE, + COMPACTION_TIME, + COMPACTION_CPU_TIME, + SUBCOMPACTION_SETUP_TIME, + TABLE_SYNC_MICROS, + COMPACTION_OUTFILE_SYNC_MICROS, + WAL_FILE_SYNC_MICROS, + MANIFEST_FILE_SYNC_MICROS, + // TIME SPENT IN IO DURING TABLE OPEN + TABLE_OPEN_IO_MICROS, + DB_MULTIGET, + READ_BLOCK_COMPACTION_MICROS, + READ_BLOCK_GET_MICROS, + WRITE_RAW_BLOCK_MICROS, + STALL_L0_SLOWDOWN_COUNT, + STALL_MEMTABLE_COMPACTION_COUNT, + STALL_L0_NUM_FILES_COUNT, + HARD_RATE_LIMIT_DELAY_COUNT, + SOFT_RATE_LIMIT_DELAY_COUNT, + NUM_FILES_IN_SINGLE_COMPACTION, + DB_SEEK, + WRITE_STALL, + SST_READ_MICROS, + // The number of subcompactions actually scheduled during a compaction + NUM_SUBCOMPACTIONS_SCHEDULED, + // Value size distribution in each operation + BYTES_PER_READ, + BYTES_PER_WRITE, + BYTES_PER_MULTIGET, + + // number of bytes compressed/decompressed + // number of bytes is when uncompressed; i.e. before/after respectively + BYTES_COMPRESSED, + BYTES_DECOMPRESSED, + COMPRESSION_TIMES_NANOS, + DECOMPRESSION_TIMES_NANOS, + // Number of merge operands passed to the merge operator in user read + // requests. + READ_NUM_MERGE_OPERANDS, + + // BlobDB specific stats + // Size of keys written to BlobDB. + BLOB_DB_KEY_SIZE, + // Size of values written to BlobDB. + BLOB_DB_VALUE_SIZE, + // BlobDB Put/PutWithTTL/PutUntil/Write latency. + BLOB_DB_WRITE_MICROS, + // BlobDB Get lagency. + BLOB_DB_GET_MICROS, + // BlobDB MultiGet latency. + BLOB_DB_MULTIGET_MICROS, + // BlobDB Seek/SeekToFirst/SeekToLast/SeekForPrev latency. + BLOB_DB_SEEK_MICROS, + // BlobDB Next latency. + BLOB_DB_NEXT_MICROS, + // BlobDB Prev latency. + BLOB_DB_PREV_MICROS, + // Blob file write latency. + BLOB_DB_BLOB_FILE_WRITE_MICROS, + // Blob file read latency. + BLOB_DB_BLOB_FILE_READ_MICROS, + // Blob file sync latency. + BLOB_DB_BLOB_FILE_SYNC_MICROS, + // BlobDB garbage collection time. + BLOB_DB_GC_MICROS, + // BlobDB compression time. + BLOB_DB_COMPRESSION_MICROS, + // BlobDB decompression time. + BLOB_DB_DECOMPRESSION_MICROS, + // Time spent flushing memtable to disk + FLUSH_TIME, + + HISTOGRAM_ENUM_MAX, +} rocksdb_histograms_t; + +typedef enum { + // Disable timer stats, and skip histogram stats + EXCEPT_HISTOGRAM_OR_TIMERS = 0, + // Skip timer stats + EXCEPT_TIMERS, + // Collect all stats except time inside mutex lock AND time spent on + // compression. + EXCEPT_DETAILED_TIMERS, + // Collect all stats except the counters requiring to get time inside the + // mutex lock. + EXCEPT_TIME_FOR_MUTEX, + // 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. + ALL +} rocksdb_stats_level_t; + +extern rocksdb_stats_level_t rocksdb_statistics_stats_level( + rocksdb_statistics_t* stats); + +extern void rocksdb_statistics_set_stats_level( + rocksdb_statistics_t* stats, + rocksdb_stats_level_t level); + +extern void rocksdb_statistics_reset(rocksdb_statistics_t* stats); + +extern uint64_t rocksdb_statistics_get_ticker_count( + rocksdb_statistics_t* stats, + rocksdb_tickers_t ticker_type); + +extern uint64_t rocksdb_statistics_get_and_reset_ticker_count( + rocksdb_statistics_t* stats, + rocksdb_tickers_t ticker_type); + +extern void rocksdb_statistics_destroy(rocksdb_statistics_t* stats); + +extern void rocksdb_statistics_histogram_data( + const rocksdb_statistics_t* stats, + rocksdb_histograms_t type, + const rocksdb_histogram_data_t* data); + +extern rocksdb_histogram_data_t* rocksdb_histogram_create_data(); + +extern double rocksdb_histogram_get_average(rocksdb_histogram_data_t* data); + +extern double rocksdb_histogram_get_median(rocksdb_histogram_data_t* data); + +extern double rocksdb_histogram_get_percentile95(rocksdb_histogram_data_t* data); + +extern double rocksdb_histogram_get_percentile99(rocksdb_histogram_data_t* data); + +extern double rocksdb_histogram_get_stdev(rocksdb_histogram_data_t* data); + +extern double rocksdb_histogram_get_max(rocksdb_histogram_data_t* data); + +extern uint64_t rocksdb_histogram_get_count(rocksdb_histogram_data_t* data); + +extern uint64_t rocksdb_histogram_get_sum(rocksdb_histogram_data_t* data); + +extern double rocksdb_histogram_get_min(rocksdb_histogram_data_t* data); + +extern void rocksdb_histogram_data_destroy(rocksdb_histogram_data_t* data); + +#ifdef __cplusplus +} +#endif + +#endif // ROCKSDB_EXTENDED_H \ No newline at end of file diff --git a/rocksdb/flags.go b/rocksdb/flags.go index 773edd01f..2557130e1 100644 --- a/rocksdb/flags.go +++ b/rocksdb/flags.go @@ -17,6 +17,7 @@ package rocksdb // #cgo CFLAGS: -I${SRCDIR}/../c-deps/rocksdb/include +// #cgo CXXFLAGS: -std=c++11 -O3 -I${SRCDIR} // #cgo LDFLAGS: -L${SRCDIR}/../c-deps/libs // #cgo LDFLAGS: -lrocksdb // #cgo LDFLAGS: -ljemalloc diff --git a/rocksdb/options.go b/rocksdb/options.go index 8ef7add0a..56b9448f6 100644 --- a/rocksdb/options.go +++ b/rocksdb/options.go @@ -18,6 +18,7 @@ package rocksdb // #include // #include +// #include import "C" import "unsafe" @@ -315,6 +316,11 @@ func (o *Options) SetMaxBackgroundFlushes(value int) { C.rocksdb_options_set_max_background_flushes(o.c, C.int(value)) } +// SetStatistics sets a statistics object to pass to the DB. +func (o *Options) SetStatistics(s *Statistics) { + C.rocksdb_options_set_statistics(o.c, s.c) +} + // Destroy deallocates the Options object. func (o *Options) Destroy() { C.rocksdb_options_destroy(o.c) diff --git a/rocksdb/statistics.go b/rocksdb/statistics.go new file mode 100644 index 000000000..e81a8806d --- /dev/null +++ b/rocksdb/statistics.go @@ -0,0 +1,150 @@ +/* + Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package rocksdb + +// #include "extended.h" +// #include +import ( + "C" +) + +type TickerType uint32 + +const ( + // The number of uncompressed bytes issued by db.Put(), db.Delete(), + // db.Merge(), and db.Write(). + TickerBytesWritten = TickerType(C.BYTES_WRITTEN) + // TickerBytesRead is the number of uncompressed bytes read from db.Get(). + // It could be either from memtables, cache, or table files. + // For the number of logical bytes read from db.MultiGet(), + // please use NumberMultiGetBytesRead. + TickerBytesRead = TickerType(C.BYTES_READ) +) + +type HistogramType uint32 + +const ( + HistogramBytesPerRead = HistogramType(C.BYTES_PER_READ) +) + +type StatsLevel uint32 + +const ( + // All 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. + LevelAll = StatsLevel(C.ALL) +) + +type Statistics struct { + c *C.rocksdb_statistics_t +} + +func NewStatistics() *Statistics { + return &Statistics{c: C.rocksdb_create_statistics()} +} + +func (s *Statistics) GetTickerCount(tickerType TickerType) uint64 { + return uint64(C.rocksdb_statistics_get_ticker_count( + s.c, + C.rocksdb_tickers_t(tickerType), + )) +} + +func (s *Statistics) GetAndResetTickerCount(tickerType TickerType) uint64 { + return uint64(C.rocksdb_statistics_get_and_reset_ticker_count( + s.c, + C.rocksdb_tickers_t(tickerType), + )) +} + +func (s *Statistics) GetHistogramData(histogramType HistogramType) *HistogramData { + data := NewHistogramData() + C.rocksdb_statistics_histogram_data( + s.c, + C.rocksdb_histograms_t(histogramType), + data.c, + ) + return data +} + +func (s *Statistics) Reset() { + C.rocksdb_statistics_reset(s.c) +} + +func (s *Statistics) StatsLevel() StatsLevel { + return StatsLevel(C.rocksdb_statistics_stats_level(s.c)) +} + +func (s *Statistics) SetStatsLevel(statsLevel StatsLevel) { + C.rocksdb_statistics_set_stats_level( + s.c, C.rocksdb_stats_level_t(statsLevel)) +} + +func (s *Statistics) Destroy() { + C.rocksdb_statistics_destroy(s.c) + s.c = nil +} + +type HistogramData struct { + c *C.rocksdb_histogram_data_t +} + +func NewHistogramData() *HistogramData { + return &HistogramData{c: C.rocksdb_histogram_create_data()} +} + +func (d *HistogramData) GetAverage() float64 { + return float64(C.rocksdb_histogram_get_average(d.c)) +} + +func (d *HistogramData) GetMedian() float64 { + return float64(C.rocksdb_histogram_get_median(d.c)) +} + +func (d *HistogramData) GetPercentile95() float64 { + return float64(C.rocksdb_histogram_get_percentile95(d.c)) +} + +func (d *HistogramData) GetPercentile99() float64 { + return float64(C.rocksdb_histogram_get_percentile99(d.c)) +} + +func (d *HistogramData) GetStandardDeviation() float64 { + return float64(C.rocksdb_histogram_get_stdev(d.c)) +} + +func (d *HistogramData) GetMax() float64 { + return float64(C.rocksdb_histogram_get_max(d.c)) +} + +func (d *HistogramData) GetCount() uint64 { + return uint64(C.rocksdb_histogram_get_count(d.c)) +} + +func (d *HistogramData) GetSum() uint64 { + return uint64(C.rocksdb_histogram_get_sum(d.c)) +} + +func (d *HistogramData) GetMin() float64 { + return float64(C.rocksdb_histogram_get_min(d.c)) +} + +func (d *HistogramData) Destroy() { + C.rocksdb_histogram_data_destroy(d.c) + d.c = nil +} diff --git a/rocksdb/statistics_test.go b/rocksdb/statistics_test.go new file mode 100644 index 000000000..9f323fc6e --- /dev/null +++ b/rocksdb/statistics_test.go @@ -0,0 +1,139 @@ +/* + Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package rocksdb + +import ( + "testing" + + "github.com/stretchr/testify/require" +) + +func TestStatsLevel(t *testing.T) { + stats := NewStatistics() + stats.SetStatsLevel(LevelAll) + require.Equal(t, stats.StatsLevel(), LevelAll) +} + +func TestStatsGetTickerCount(t *testing.T) { + + stats := NewStatistics() + db := newTestDB(t, "TestStatsGetTickerCount", func(opts *Options) { + opts.SetStatistics(stats) + }) + defer db.Close() + defer stats.Destroy() + + key := []byte("some-key") + val := []byte("some-value") + + require.NoError(t, db.Put(NewDefaultWriteOptions(), key, val)) + ro := NewDefaultReadOptions() + defer ro.Destroy() + for i := 0; i < 10; i++ { + db.Get(ro, key) + } + + require.True(t, stats.GetTickerCount(TickerBytesRead) > 0) + +} + +func TestGetAndResetTickerCount(t *testing.T) { + + stats := NewStatistics() + db := newTestDB(t, "TestGetAndResetTickerCount", func(opts *Options) { + opts.SetStatistics(stats) + }) + defer db.Close() + defer stats.Destroy() + + key := []byte("some-key") + val := []byte("some-value") + + require.NoError(t, db.Put(NewDefaultWriteOptions(), key, val)) + ro := NewDefaultReadOptions() + defer ro.Destroy() + for i := 0; i < 10; i++ { + db.Get(ro, key) + } + + read := stats.GetAndResetTickerCount(TickerBytesRead) + require.True(t, read > 0) + require.True(t, stats.GetAndResetTickerCount(TickerBytesRead) < read) + +} + +func TestGetHistogramData(t *testing.T) { + + t.Skip() // not working + + stats := NewStatistics() + db := newTestDB(t, "TestGetHistogramData", func(opts *Options) { + opts.SetStatistics(stats) + }) + defer db.Close() + defer stats.Destroy() + + key := []byte("some-key") + val := []byte("some-value") + + require.NoError(t, db.Put(NewDefaultWriteOptions(), key, val)) + ro := NewDefaultReadOptions() + defer ro.Destroy() + for i := 0; i < 10; i++ { + db.Get(ro, key) + } + + histogramData := stats.GetHistogramData(HistogramBytesPerRead) + defer histogramData.Destroy() + require.NotNil(t, histogramData) + require.True(t, histogramData.GetAverage() > 0) + require.True(t, histogramData.GetMedian() > 0) + require.True(t, histogramData.GetPercentile95() > 0) + require.True(t, histogramData.GetPercentile99() > 0) + require.True(t, histogramData.GetStandardDeviation() == 0.00) + require.True(t, histogramData.GetMax() > 0) + require.True(t, histogramData.GetCount() > 0) + require.True(t, histogramData.GetSum() > 0) + require.True(t, histogramData.GetMin() > 0) +} + +func TestReset(t *testing.T) { + stats := NewStatistics() + db := newTestDB(t, "TestReset", func(opts *Options) { + opts.SetStatistics(stats) + }) + defer db.Close() + defer stats.Destroy() + + key := []byte("some-key") + val := []byte("some-value") + + require.NoError(t, db.Put(NewDefaultWriteOptions(), key, val)) + ro := NewDefaultReadOptions() + defer ro.Destroy() + for i := 0; i < 10; i++ { + db.Get(ro, key) + } + + read := stats.GetAndResetTickerCount(TickerBytesRead) + require.True(t, read > 0) + + stats.Reset() + + readAfterReset := stats.GetAndResetTickerCount(TickerBytesRead) + require.True(t, readAfterReset < read) +} From 57e72afa3aa67f7ea841ac102a37719b57243ad8 Mon Sep 17 00:00:00 2001 From: Alvaro Alda Date: Mon, 25 Mar 2019 11:09:14 +0100 Subject: [PATCH 2/4] Add missing godocs Former-commit-id: 43a96423b6a8e5c5092df8137b5db3b75b7368a0 [formerly 12c6586896f20a062a92f1029747df0dfba164ce] Former-commit-id: 0d38d8b882bd7060595b64ddfd34847fecbfc363 --- rocksdb/histogram.go | 82 +++++++++++++++++++++++++++++++++++ rocksdb/histogram_type.go | 30 +++++++++++++ rocksdb/statistics.go | 91 ++++++++++----------------------------- rocksdb/ticker_type.go | 36 ++++++++++++++++ 4 files changed, 170 insertions(+), 69 deletions(-) create mode 100644 rocksdb/histogram.go create mode 100644 rocksdb/histogram_type.go create mode 100644 rocksdb/ticker_type.go diff --git a/rocksdb/histogram.go b/rocksdb/histogram.go new file mode 100644 index 000000000..0bc55933f --- /dev/null +++ b/rocksdb/histogram.go @@ -0,0 +1,82 @@ +/* + Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package rocksdb + +// #include "extended.h" +import ( + "C" +) + +type HistogramData struct { + c *C.rocksdb_histogram_data_t +} + +// NewHistogramData constructs a HistogramData object. +func NewHistogramData() *HistogramData { + return &HistogramData{c: C.rocksdb_histogram_create_data()} +} + +// GetAverage returns the average value. +func (d *HistogramData) GetAverage() float64 { + return float64(C.rocksdb_histogram_get_average(d.c)) +} + +// GetMedian returns the median value. +func (d *HistogramData) GetMedian() float64 { + return float64(C.rocksdb_histogram_get_median(d.c)) +} + +// GetPercentile95 returns the value of the percentile 95. +func (d *HistogramData) GetPercentile95() float64 { + return float64(C.rocksdb_histogram_get_percentile95(d.c)) +} + +// GetPercentile99 returns the value of the percentile 99. +func (d *HistogramData) GetPercentile99() float64 { + return float64(C.rocksdb_histogram_get_percentile99(d.c)) +} + +// GetStandardDeviation returns the value of the standard deviation. +func (d *HistogramData) GetStandardDeviation() float64 { + return float64(C.rocksdb_histogram_get_stdev(d.c)) +} + +// GetMax returns the max value. +func (d *HistogramData) GetMax() float64 { + return float64(C.rocksdb_histogram_get_max(d.c)) +} + +// GetCount returns the total number of measure. +func (d *HistogramData) GetCount() uint64 { + return uint64(C.rocksdb_histogram_get_count(d.c)) +} + +// GetSum returns the sum of all measures. +func (d *HistogramData) GetSum() uint64 { + return uint64(C.rocksdb_histogram_get_sum(d.c)) +} + +// GetMin returns the min value. +func (d *HistogramData) GetMin() float64 { + return float64(C.rocksdb_histogram_get_min(d.c)) +} + +// Destroy deallocates the HistogramData object. +func (d *HistogramData) Destroy() { + C.rocksdb_histogram_data_destroy(d.c) + d.c = nil +} diff --git a/rocksdb/histogram_type.go b/rocksdb/histogram_type.go new file mode 100644 index 000000000..86e838d2d --- /dev/null +++ b/rocksdb/histogram_type.go @@ -0,0 +1,30 @@ +/* + Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package rocksdb + +// #include "extended.h" +import ( + "C" +) + +// HistogramType is the logical mapping of histograms defined in rocksdb:Histogram. +type HistogramType uint32 + +const ( + // HistogramBytesPerRead is value size distribution in read operations. + HistogramBytesPerRead = HistogramType(C.BYTES_PER_READ) +) diff --git a/rocksdb/statistics.go b/rocksdb/statistics.go index e81a8806d..fd87d03df 100644 --- a/rocksdb/statistics.go +++ b/rocksdb/statistics.go @@ -22,42 +22,38 @@ import ( "C" ) -type TickerType uint32 - -const ( - // The number of uncompressed bytes issued by db.Put(), db.Delete(), - // db.Merge(), and db.Write(). - TickerBytesWritten = TickerType(C.BYTES_WRITTEN) - // TickerBytesRead is the number of uncompressed bytes read from db.Get(). - // It could be either from memtables, cache, or table files. - // For the number of logical bytes read from db.MultiGet(), - // please use NumberMultiGetBytesRead. - TickerBytesRead = TickerType(C.BYTES_READ) -) - -type HistogramType uint32 - -const ( - HistogramBytesPerRead = HistogramType(C.BYTES_PER_READ) -) - +// StatsLevel is the level of Statistics to report. type StatsLevel uint32 const ( - // All collect all stats, including measuring duration of mutex operations. + // LevelExceptHistogramOrTimers disables timer stats, and skip histogram stats. + LevelExceptHistogramOrTimers = StatsLevel(C.EXCEPT_HISTOGRAM_OR_TIMERS) + // LevelExceptTimers skips timer stats. + LevelExceptTimers = StatsLevel(C.EXCEPT_TIMERS) + // LevelExceptDetailedTimers collects all stats except time inside mutex lock + // AND time spent on compression. + LevelExceptDetailedTimers = StatsLevel(C.EXCEPT_DETAILED_TIMERS) + // LevelExceptTimeForMutex collect all stats except the counters requiring to get time + // inside the mutex lock. + LevelExceptTimeForMutex = StatsLevel(C.EXCEPT_TIME_FOR_MUTEX) + // LevelAll collects 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. LevelAll = StatsLevel(C.ALL) ) +// Statistics is used to analyze the performance of a db. Pointer for +// statistics object is managed by Option class. type Statistics struct { c *C.rocksdb_statistics_t } +// NewStatistics is the constructor for a Statistics struct. func NewStatistics() *Statistics { return &Statistics{c: C.rocksdb_create_statistics()} } +// GetTickerCount gets the count for a ticker. func (s *Statistics) GetTickerCount(tickerType TickerType) uint64 { return uint64(C.rocksdb_statistics_get_ticker_count( s.c, @@ -65,6 +61,7 @@ func (s *Statistics) GetTickerCount(tickerType TickerType) uint64 { )) } +// GetAndResetTickerCount get the count for a ticker and reset the tickers count. func (s *Statistics) GetAndResetTickerCount(tickerType TickerType) uint64 { return uint64(C.rocksdb_statistics_get_and_reset_ticker_count( s.c, @@ -72,6 +69,7 @@ func (s *Statistics) GetAndResetTickerCount(tickerType TickerType) uint64 { )) } +// GetHistogramData gets the histogram data for a particular histogram. func (s *Statistics) GetHistogramData(histogramType HistogramType) *HistogramData { data := NewHistogramData() C.rocksdb_statistics_histogram_data( @@ -82,69 +80,24 @@ func (s *Statistics) GetHistogramData(histogramType HistogramType) *HistogramDat return data } +// Reset resets all ticker and histogram stats. func (s *Statistics) Reset() { C.rocksdb_statistics_reset(s.c) } +// StatsLevel gets the current stats level. func (s *Statistics) StatsLevel() StatsLevel { return StatsLevel(C.rocksdb_statistics_stats_level(s.c)) } +// SetStatsLevel sets the stats level. func (s *Statistics) SetStatsLevel(statsLevel StatsLevel) { C.rocksdb_statistics_set_stats_level( s.c, C.rocksdb_stats_level_t(statsLevel)) } +// Destroy deallocates the Statistics object. func (s *Statistics) Destroy() { C.rocksdb_statistics_destroy(s.c) s.c = nil } - -type HistogramData struct { - c *C.rocksdb_histogram_data_t -} - -func NewHistogramData() *HistogramData { - return &HistogramData{c: C.rocksdb_histogram_create_data()} -} - -func (d *HistogramData) GetAverage() float64 { - return float64(C.rocksdb_histogram_get_average(d.c)) -} - -func (d *HistogramData) GetMedian() float64 { - return float64(C.rocksdb_histogram_get_median(d.c)) -} - -func (d *HistogramData) GetPercentile95() float64 { - return float64(C.rocksdb_histogram_get_percentile95(d.c)) -} - -func (d *HistogramData) GetPercentile99() float64 { - return float64(C.rocksdb_histogram_get_percentile99(d.c)) -} - -func (d *HistogramData) GetStandardDeviation() float64 { - return float64(C.rocksdb_histogram_get_stdev(d.c)) -} - -func (d *HistogramData) GetMax() float64 { - return float64(C.rocksdb_histogram_get_max(d.c)) -} - -func (d *HistogramData) GetCount() uint64 { - return uint64(C.rocksdb_histogram_get_count(d.c)) -} - -func (d *HistogramData) GetSum() uint64 { - return uint64(C.rocksdb_histogram_get_sum(d.c)) -} - -func (d *HistogramData) GetMin() float64 { - return float64(C.rocksdb_histogram_get_min(d.c)) -} - -func (d *HistogramData) Destroy() { - C.rocksdb_histogram_data_destroy(d.c) - d.c = nil -} diff --git a/rocksdb/ticker_type.go b/rocksdb/ticker_type.go new file mode 100644 index 000000000..17b45bf2f --- /dev/null +++ b/rocksdb/ticker_type.go @@ -0,0 +1,36 @@ +/* + Copyright 2018-2019 Banco Bilbao Vizcaya Argentaria, S.A. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package rocksdb + +// #include "extended.h" +import ( + "C" +) + +// TickerType is the logical mapping of tickers defined in rocksdb::Tickers. +type TickerType uint32 + +const ( + // TickerBytesWritten is the number of uncompressed bytes issued by db.Put(), + // db.Delete(), db.Merge(), and db.Write(). + TickerBytesWritten = TickerType(C.BYTES_WRITTEN) + // TickerBytesRead is the number of uncompressed bytes read from db.Get(). + // It could be either from memtables, cache, or table files. + // For the number of logical bytes read from db.MultiGet(), + // please use NumberMultiGetBytesRead. + TickerBytesRead = TickerType(C.BYTES_READ) +) From fb0b41378de41f42aea93dbf115ee4df81568280 Mon Sep 17 00:00:00 2001 From: Alvaro Alda Date: Mon, 25 Mar 2019 11:46:28 +0100 Subject: [PATCH 3/4] Configure azure pipelines to fail tests task on test failures Former-commit-id: f68ee4908936a0be42e7a75a13d88f67dd5cc780 [formerly 1da0db6eef3b7d859d1d36fabd0b9e7e22f4ccd6] Former-commit-id: f6963a85d1d292f7f78590613214af2c50cbcbb3 --- azure-pipelines.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index dc8e3b7d9..5ac692a5e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -48,7 +48,7 @@ steps: - script: | GO111MODULE=auto go get github.com/jstemmer/go-junit-report GO111MODULE=auto go get github.com/axw/gocov/gocov - GO111MODULE=auto go get github.com/AlekSi/gocov-xml + GO111MODULE=auto go get github.com/AlekSi/gocov-xml GO111MODULE=auto go get gopkg.in/matm/v1/gocov-html workingDirectory: '$(modulePath)' displayName: 'Download code coverage tools' @@ -70,7 +70,7 @@ steps: inputs: testRunner: JUnit testResultsFiles: $(System.DefaultWorkingDirectory)/**/report.xml - failOnStandardError: 'true' + failTaskOnFailedTests: true - task: PublishCodeCoverageResults@1 inputs: From 8397fd80bd8aa96a8cdcf5723193796318ccbfbd Mon Sep 17 00:00:00 2001 From: Alvaro Alda Date: Mon, 25 Mar 2019 15:05:27 +0100 Subject: [PATCH 4/4] Fix rocksdb include path for CXXFLAGS Former-commit-id: 7bdc25e75696c87a0771d5421c288bc5c504edca [formerly 6cae8c3e60dbbe32be2d40daa944fff61f31d19a] Former-commit-id: fd8678b44a440ddffac3f082084ca29d470baed0 --- rocksdb/extended.cpp | 4 ---- rocksdb/extended.h | 2 -- rocksdb/flags.go | 2 +- rocksdb/histogram.go | 5 ----- rocksdb/statistics_test.go | 1 - 5 files changed, 1 insertion(+), 13 deletions(-) diff --git a/rocksdb/extended.cpp b/rocksdb/extended.cpp index d0740aae6..d945fa361 100644 --- a/rocksdb/extended.cpp +++ b/rocksdb/extended.cpp @@ -126,10 +126,6 @@ uint64_t rocksdb_histogram_get_sum(rocksdb_histogram_data_t* data) { return data->rep->sum; } -double rocksdb_histogram_get_min(rocksdb_histogram_data_t* data) { - return data->rep->min; -} - void rocksdb_histogram_data_destroy(rocksdb_histogram_data_t* data); void rocksdb_histogram_data_destroy(rocksdb_histogram_data_t* data) { diff --git a/rocksdb/extended.h b/rocksdb/extended.h index 817293dcf..2674eedae 100644 --- a/rocksdb/extended.h +++ b/rocksdb/extended.h @@ -507,8 +507,6 @@ extern uint64_t rocksdb_histogram_get_count(rocksdb_histogram_data_t* data); extern uint64_t rocksdb_histogram_get_sum(rocksdb_histogram_data_t* data); -extern double rocksdb_histogram_get_min(rocksdb_histogram_data_t* data); - extern void rocksdb_histogram_data_destroy(rocksdb_histogram_data_t* data); #ifdef __cplusplus diff --git a/rocksdb/flags.go b/rocksdb/flags.go index 2557130e1..0862ff705 100644 --- a/rocksdb/flags.go +++ b/rocksdb/flags.go @@ -17,7 +17,7 @@ package rocksdb // #cgo CFLAGS: -I${SRCDIR}/../c-deps/rocksdb/include -// #cgo CXXFLAGS: -std=c++11 -O3 -I${SRCDIR} +// #cgo CXXFLAGS: -std=c++11 -O3 -I${SRCDIR}/../c-deps/rocksdb/include // #cgo LDFLAGS: -L${SRCDIR}/../c-deps/libs // #cgo LDFLAGS: -lrocksdb // #cgo LDFLAGS: -ljemalloc diff --git a/rocksdb/histogram.go b/rocksdb/histogram.go index 0bc55933f..fdd40c201 100644 --- a/rocksdb/histogram.go +++ b/rocksdb/histogram.go @@ -70,11 +70,6 @@ func (d *HistogramData) GetSum() uint64 { return uint64(C.rocksdb_histogram_get_sum(d.c)) } -// GetMin returns the min value. -func (d *HistogramData) GetMin() float64 { - return float64(C.rocksdb_histogram_get_min(d.c)) -} - // Destroy deallocates the HistogramData object. func (d *HistogramData) Destroy() { C.rocksdb_histogram_data_destroy(d.c) diff --git a/rocksdb/statistics_test.go b/rocksdb/statistics_test.go index 9f323fc6e..386257847 100644 --- a/rocksdb/statistics_test.go +++ b/rocksdb/statistics_test.go @@ -108,7 +108,6 @@ func TestGetHistogramData(t *testing.T) { require.True(t, histogramData.GetMax() > 0) require.True(t, histogramData.GetCount() > 0) require.True(t, histogramData.GetSum() > 0) - require.True(t, histogramData.GetMin() > 0) } func TestReset(t *testing.T) {