mirror of https://gitee.com/bigwinds/arangodb
fix access to cache object if cache is turned off (#2782)
This commit is contained in:
parent
71434ef566
commit
722870b70c
|
@ -1593,10 +1593,19 @@ void RocksDBEngine::getStatistics(VPackBuilder& builder) const {
|
|||
if (_options.table_factory) {
|
||||
void* options = _options.table_factory->GetOptions();
|
||||
if (options != nullptr) {
|
||||
builder.add(
|
||||
"rocksdb.block-cache-used",
|
||||
VPackValue(static_cast<rocksdb::BlockBasedTableOptions*>(options)
|
||||
->block_cache->GetUsage()));
|
||||
auto* bto = static_cast<rocksdb::BlockBasedTableOptions*>(options);
|
||||
|
||||
if (bto != nullptr && bto->block_cache != nullptr) {
|
||||
// block cache is present
|
||||
builder.add(
|
||||
"rocksdb.block-cache-used",
|
||||
VPackValue(bto->block_cache->GetUsage()));
|
||||
} else {
|
||||
// no block cache present
|
||||
builder.add(
|
||||
"rocksdb.block-cache-used",
|
||||
VPackValue(0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue