1
0
Fork 0

(devel) add bool option rocksdb.debug-logging to easily enable rocksdb logging (#6016)

This commit is contained in:
Matthew Von-Maszewski 2018-07-30 08:30:20 -04:00 committed by Jan
parent cda104475f
commit 9f880dd529
2 changed files with 41 additions and 25 deletions

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2014-2017 ArangoDB GmbH, Cologne, Germany /// Copyright 2014-2018 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
@ -142,7 +142,8 @@ RocksDBEngine::RocksDBEngine(application_features::ApplicationServer* server)
_pruneWaitTimeInitial(180.0), _pruneWaitTimeInitial(180.0),
_releasedTick(0), _releasedTick(0),
_syncInterval(100), _syncInterval(100),
_useThrottle(true) { _useThrottle(true),
_debugLogging(false) {
startsAfter("BasicsPhase"); startsAfter("BasicsPhase");
#ifdef _WIN32 #ifdef _WIN32
@ -247,6 +248,10 @@ void RocksDBEngine::collectOptions(
"enable write-throttling", "enable write-throttling",
new BooleanParameter(&_useThrottle)); new BooleanParameter(&_useThrottle));
options->addHiddenOption("--rocksdb.debug-logging",
"true to enable rocksdb debug logging",
new BooleanParameter(&_debugLogging));
#ifdef USE_ENTERPRISE #ifdef USE_ENTERPRISE
collectEnterpriseOptions(options); collectEnterpriseOptions(options);
#endif #endif
@ -414,10 +419,18 @@ void RocksDBEngine::start() {
// intentionally set the RocksDB logger to warning because it will // intentionally set the RocksDB logger to warning because it will
// log lots of things otherwise // log lots of things otherwise
_options.info_log_level = rocksdb::InfoLogLevel::ERROR_LEVEL; if (!_debugLogging) {
_options.info_log_level = rocksdb::InfoLogLevel::ERROR_LEVEL;
} else {
_options.info_log_level = rocksdb::InfoLogLevel::DEBUG_LEVEL;
} // else
auto logger = std::make_shared<RocksDBLogger>(_options.info_log_level); auto logger = std::make_shared<RocksDBLogger>(_options.info_log_level);
_options.info_log = logger; _options.info_log = logger;
logger->disable();
if (!_debugLogging) {
logger->disable();
} // if
if (opts->_enableStatistics) { if (opts->_enableStatistics) {
_options.statistics = rocksdb::CreateDBStatistics(); _options.statistics = rocksdb::CreateDBStatistics();

View File

@ -1,7 +1,7 @@
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
/// DISCLAIMER /// DISCLAIMER
/// ///
/// Copyright 2014-2016 ArangoDB GmbH, Cologne, Germany /// Copyright 2014-2018 ArangoDB GmbH, Cologne, Germany
/// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany /// Copyright 2004-2014 triAGENS GmbH, Cologne, Germany
/// ///
/// Licensed under the Apache License, Version 2.0 (the "License"); /// Licensed under the Apache License, Version 2.0 (the "License");
@ -465,6 +465,9 @@ class RocksDBEngine final : public StorageEngine {
// use write-throttling // use write-throttling
bool _useThrottle; bool _useThrottle;
// activate rocksdb's debug logging
bool _debugLogging;
// code to pace ingest rate of writes to reduce chances of compactions getting // code to pace ingest rate of writes to reduce chances of compactions getting
// too far behind and blocking incoming writes // too far behind and blocking incoming writes
// (will only be set if _useThrottle is true) // (will only be set if _useThrottle is true)