Clean up RocksDB error logging

This commit is contained in:
Daniel Smith 2021-11-12 12:14:12 -05:00
parent 80d6debe14
commit 9dccb0131e

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));
}
}