Merge pull request #5971 from Daniel-B-Smith/rocksdb-error-logging

Clean up RocksDB error logging
This commit is contained in:
Daniel Smith 2021-11-12 13:17:10 -05:00 committed by GitHub
commit 019fd50f46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 2 deletions

View File

@ -206,7 +206,8 @@ ACTOR Future<Void> rocksDBMetricLogger(std::shared_ptr<rocksdb::Statistics> stat
}
void logRocksDBError(const rocksdb::Status& status, const std::string& method) {
TraceEvent e(SevError, "RocksDBError");
auto level = status.IsTimedOut() ? SevWarn : SevError;
TraceEvent e(level, "RocksDBError");
e.detail("Error", status.ToString()).detail("Method", method).detail("RocksDBSeverity", status.severity());
if (status.IsIOError()) {
e.detail("SubCode", status.subcode());
@ -414,7 +415,7 @@ struct RocksDBKeyValueStore : IKeyValueStore {
} else if (s.IsNotFound()) {
a.result.send(Optional<Value>());
} else {
TraceEvent(SevError, "RocksDBError").detail("Error", s.ToString()).detail("Method", "ReadValue");
logRocksDBError(s, "ReadValue");
a.result.sendError(statusToError(s));
}
}