Merge pull request #6122 from neethuhaneesha/enableMetricsLogger

Enabling rocksdb metrics logger in simulation.
This commit is contained in:
neethuhaneesha 2021-12-08 11:00:26 -08:00 committed by GitHub
commit 50ed545706
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 4 deletions

View File

@ -267,10 +267,12 @@ struct RocksDBKeyValueStore : IKeyValueStore {
a.done.sendError(statusToError(status));
} else {
TraceEvent(SevInfo, "RocksDB").detail("Path", a.path).detail("Method", "Open");
// The current thread and main thread are same when the code runs in simulation.
// blockUntilReady() is getting the thread into deadlock state, so avoiding the
// metric logger in simulation.
if (!g_network->isSimulated()) {
if (g_network->isSimulated()) {
// The current thread and main thread are same when the code runs in simulation.
// blockUntilReady() is getting the thread into deadlock state, so directly calling
// the metricsLogger.
a.metrics = rocksDBMetricLogger(options.statistics, db) && flowLockLogger(a.readLock, a.fetchLock);
} else {
onMainThread([&] {
a.metrics =
rocksDBMetricLogger(options.statistics, db) && flowLockLogger(a.readLock, a.fetchLock);