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) {
|
if (_options.table_factory) {
|
||||||
void* options = _options.table_factory->GetOptions();
|
void* options = _options.table_factory->GetOptions();
|
||||||
if (options != nullptr) {
|
if (options != nullptr) {
|
||||||
builder.add(
|
auto* bto = static_cast<rocksdb::BlockBasedTableOptions*>(options);
|
||||||
"rocksdb.block-cache-used",
|
|
||||||
VPackValue(static_cast<rocksdb::BlockBasedTableOptions*>(options)
|
if (bto != nullptr && bto->block_cache != nullptr) {
|
||||||
->block_cache->GetUsage()));
|
// 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