From b8936261b5df070800876ebda0a46856c5b14bee Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Sun, 19 Aug 2018 01:14:54 -0700 Subject: [PATCH] ircd::db: Add some exception handlers on these envs. --- ircd/db.cc | 37 ++++++++++++++++++++++++++++++++++--- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/ircd/db.cc b/ircd/db.cc index 62d4ff4e1..20c8f3e3e 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -2921,7 +2921,7 @@ noexcept rocksdb::Status ircd::db::database::env::random_access_file::Prefetch(uint64_t offset, size_t length) -noexcept +noexcept try { #ifdef RB_DEBUG_DB_ENV log::debug @@ -2934,16 +2934,32 @@ noexcept }; #endif + fs::prefetch(fd, length, offset); return Status::OK(); } +catch(const fs::filesystem_error &e) +{ + log::error + { + log, "'%s': rfile:%p prefetch offset:%zu length:%zu :%s", + d.name, + this, + offset, + length, + e.what() + }; + + return Status::InvalidArgument(); +} rocksdb::Status ircd::db::database::env::random_access_file::Read(uint64_t offset, size_t length, Slice *result, char *scratch) -const noexcept +const noexcept try { + assert(result); #ifdef RB_DEBUG_DB_ENV log::debug { @@ -2957,7 +2973,6 @@ const noexcept }; #endif - assert(result); const mutable_buffer buf { scratch, length @@ -2972,6 +2987,22 @@ const noexcept return Status::OK(); } +catch(const fs::filesystem_error &e) +{ + log::error + { + log, "'%s': rfile:%p read:%p offset:%zu length:%zu scratch:%p :%s", + d.name, + this, + result, + offset, + length, + scratch, + e.what() + }; + + return Status::InvalidArgument(); +} rocksdb::Status ircd::db::database::env::random_access_file::InvalidateCache(size_t offset,