1
0
Fork 0

added option `--rocksdb.use-file-logging` (#6308)

This commit is contained in:
Jan 2018-08-31 17:23:00 +02:00 committed by GitHub
parent 191ae2dc43
commit 840ad8c20d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 52 additions and 11 deletions

View File

@ -9,6 +9,12 @@ devel
on path (vertices and edges) have not been applied. In SmartGraphs the checks on path (vertices and edges) have not been applied. In SmartGraphs the checks
have been executed properly. have been executed properly.
* added option `--rocksdb.use-file-logging` to enable writing of RocksDB's own
informational LOG files into RocksDB's database directory.
This option is turned off by default, but can be enabled for debugging RocksDB
internals and performance.
* improved error messages when managing Foxx services * improved error messages when managing Foxx services
Install/replace/upgrade will now provide additional information when an error Install/replace/upgrade will now provide additional information when an error

View File

@ -240,3 +240,20 @@ have been executed without the *waitForSync* attribute.
Note: this option is not supported on Windows platforms. Setting the option to Note: this option is not supported on Windows platforms. Setting the option to
a value greater 0 will produce a startup warning. a value greater 0 will produce a startup warning.
`--rocksdb.use-file-logging`
When set to *true*, enables writing of RocksDB's own informational LOG files into
RocksDB's database directory.
This option is turned off by default, but can be enabled for debugging RocksDB
internals and performance.
`--rocksdb.debug-logging`
When set to *true*, enables verbose logging of RocksDB's actions into the logfile
written by ArangoDB (if option `--rocksdb.use-file-logging` is off) or RocksDB's
own log (if option `--rocksdb.use-file-logging` is on).
This option is turned off by default, but can be enabled for debugging RocksDB
internals and performance.

View File

@ -420,18 +420,28 @@ 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
if (!_debugLogging) { if (_debugLogging) {
_options.info_log_level = rocksdb::InfoLogLevel::ERROR_LEVEL;
} else {
_options.info_log_level = rocksdb::InfoLogLevel::DEBUG_LEVEL; _options.info_log_level = rocksdb::InfoLogLevel::DEBUG_LEVEL;
} // else } else {
if (!opts->_useFileLogging) {
// if we don't use file logging but log into ArangoDB's logfile,
// we only want real errors
_options.info_log_level = rocksdb::InfoLogLevel::ERROR_LEVEL;
}
}
auto logger = std::make_shared<RocksDBLogger>(_options.info_log_level); std::shared_ptr<RocksDBLogger> logger;
if (!opts->_useFileLogging) {
// if option "--rocksdb.use-file-logging" is set to false, we will use
// our own logger that logs to ArangoDB's logfile
logger = std::make_shared<RocksDBLogger>(_options.info_log_level);
_options.info_log = logger; _options.info_log = logger;
if (!_debugLogging) { if (!_debugLogging) {
logger->disable(); logger->disable();
} // if } // if
}
if (opts->_enableStatistics) { if (opts->_enableStatistics) {
_options.statistics = rocksdb::CreateDBStatistics(); _options.statistics = rocksdb::CreateDBStatistics();
@ -629,7 +639,9 @@ void RocksDBEngine::start() {
arangodb::rocksdbStartupVersionCheck(_db, dbExisted); arangodb::rocksdbStartupVersionCheck(_db, dbExisted);
// only enable logger after RocksDB start // only enable logger after RocksDB start
if (logger != nullptr) {
logger->enable(); logger->enable();
}
if (_syncInterval > 0) { if (_syncInterval > 0) {
_syncThread.reset( _syncThread.reset(

View File

@ -79,7 +79,8 @@ RocksDBOptionFeature::RocksDBOptionFeature(
_useFSync(rocksDBDefaults.use_fsync), _useFSync(rocksDBDefaults.use_fsync),
_skipCorrupted(false), _skipCorrupted(false),
_dynamicLevelBytes(true), _dynamicLevelBytes(true),
_enableStatistics(false) { _enableStatistics(false),
_useFileLogging(false) {
// setting the number of background jobs to // setting the number of background jobs to
_maxBackgroundJobs = static_cast<int32_t>(std::max((size_t)2, _maxBackgroundJobs = static_cast<int32_t>(std::max((size_t)2,
std::min(TRI_numberProcessors(), (size_t)8))); std::min(TRI_numberProcessors(), (size_t)8)));
@ -262,6 +263,10 @@ void RocksDBOptionFeature::collectOptions(
"reads.", "reads.",
new UInt64Parameter(&_compactionReadaheadSize)); new UInt64Parameter(&_compactionReadaheadSize));
options->addHiddenOption("--rocksdb.use-file-logging",
"use a file-base logger for RocksDB's own logs",
new BooleanParameter(&_useFileLogging));
options->addHiddenOption("--rocksdb.wal-recovery-skip-corrupted", options->addHiddenOption("--rocksdb.wal-recovery-skip-corrupted",
"skip corrupted records in WAL recovery", "skip corrupted records in WAL recovery",
new BooleanParameter(&_skipCorrupted)); new BooleanParameter(&_skipCorrupted));

View File

@ -80,6 +80,7 @@ class RocksDBOptionFeature final
bool _skipCorrupted; bool _skipCorrupted;
bool _dynamicLevelBytes; bool _dynamicLevelBytes;
bool _enableStatistics; bool _enableStatistics;
bool _useFileLogging;
}; };
} // namespace arangodb } // namespace arangodb