Remove specific filenames from RocksDB IOErrors

This commit is contained in:
Teddy Reed 2015-11-02 15:12:52 -08:00
parent e501507c87
commit 5728c93392
2 changed files with 10 additions and 2 deletions

View File

@ -272,6 +272,15 @@ Status DBHandle::Put(const std::string& domain,
return Status(1, "Could not get column family for " + domain);
}
auto s = getDB()->Put(rocksdb::WriteOptions(), cfh, key, value);
if (s.code() != 0 && s.IsIOError()) {
// An error occurred, check if it is an IO error and remove the offending
// specific filename or log name.
std::string error_string = s.ToString();
size_t error_pos = error_string.find_last_of(":");
if (error_pos != std::string::npos) {
return Status(s.code(), "IOError: " + error_string.substr(error_pos + 2));
}
}
return Status(s.code(), s.ToString());
}

View File

@ -356,8 +356,7 @@ Status EventSubscriberPlugin::recordEvent(EventID& eid, EventTime time) {
status = db->Put(
kEvents, record_key + "." + list_key + "." + list_id, record_value);
if (!status.ok()) {
LOG(ERROR) << "Could not put Event Record key: " << record_key << "."
<< list_key << "." << list_id;
LOG(ERROR) << "Could not put Event Record key: " << record_key;
}
}
}