From bbcddbcf5b842a588082bd44e54f42bd39a3c8c2 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 23 Aug 2018 04:20:42 -0700 Subject: [PATCH] ircd::db: Use our fs::size() for file sizing env callback. --- ircd/db.cc | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/ircd/db.cc b/ircd/db.cc index 4157cb869..962b30dc4 100644 --- a/ircd/db.cc +++ b/ircd/db.cc @@ -2106,17 +2106,30 @@ noexcept } rocksdb::Status -ircd::db::database::env::GetFileSize(const std::string& name, - uint64_t* s) -noexcept +ircd::db::database::env::GetFileSize(const std::string &name, + uint64_t *const s) +noexcept try { #ifdef RB_DEBUG_DB_ENV - log.debug("'%s': get file size '%s'", - d.name, - name); + log::debug + { + log, "'%s': get file size '%s'", + d.name, + name + }; #endif - return defaults.GetFileSize(name, s); + assert(s); + *s = fs::size(name); + return Status::OK(); +} +catch(const fs::error &e) +{ + return error_to_status{e}; +} +catch(const std::exception &e) +{ + return error_to_status{e}; } rocksdb::Status