From 65d27f327e6b90fe24cfcfaa472950ba94bcd3d0 Mon Sep 17 00:00:00 2001 From: Jason Volk Date: Thu, 23 Jun 2022 09:38:46 -0700 Subject: [PATCH] ircd::db::database::env: Fix missing at-end semantics for ReopenWritableFile(). --- ircd/db_env.cc | 17 ++++++++++------- ircd/db_env.h | 4 ++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/ircd/db_env.cc b/ircd/db_env.cc index d873697f5..201225604 100644 --- a/ircd/db_env.cc +++ b/ircd/db_env.cc @@ -121,9 +121,9 @@ noexcept try #endif if(options.use_direct_writes) - *r = std::make_unique(&d, name, options, true); + *r = std::make_unique(&d, name, options, true, false); else - *r = std::make_unique(&d, name, options, true); + *r = std::make_unique(&d, name, options, true, false); return Status::OK(); } @@ -155,9 +155,9 @@ noexcept try #endif if(options.use_direct_writes) - *r = std::make_unique(&d, name, options, false); + *r = std::make_unique(&d, name, options, false, true); else - *r = std::make_unique(&d, name, options, false); + *r = std::make_unique(&d, name, options, false, true); return Status::OK(); } @@ -1244,7 +1244,8 @@ ircd::db::database::env::make_nice(const IOPriority &prio) ircd::db::database::env::writable_file::writable_file(database *const &d, const std::string &name, const EnvOptions &env_opts, - const bool &trunc) + const bool &trunc, + const bool &ate) try :d { @@ -1257,6 +1258,7 @@ try ,opts { .mode = std::ios::out | (trunc? std::ios::trunc : std::ios::openmode(0)), + .ate = ate, .direct = this->env_opts.use_direct_writes, .cloexec = this->env_opts.set_fd_cloexec, .dontneed = true, @@ -2220,10 +2222,11 @@ catch(...) ircd::db::database::env::writable_file_direct::writable_file_direct(database *const &d, const std::string &name, const EnvOptions &env_opts, - const bool &trunc) + const bool &trunc, + const bool &ate) :writable_file { - d, name, env_opts, trunc + d, name, env_opts, trunc, ate } ,alignment { diff --git a/ircd/db_env.h b/ircd/db_env.h index 266c43a83..5027576db 100644 --- a/ircd/db_env.h +++ b/ircd/db_env.h @@ -253,7 +253,7 @@ ircd::db::database::env::writable_file Status Flush() noexcept override; Status Close() noexcept override; - writable_file(database *const &d, const std::string &name, const EnvOptions &, const bool &trunc); + writable_file(database *const &d, const std::string &name, const EnvOptions &, const bool &trunc, const bool &ate); writable_file(const writable_file &) = delete; writable_file(writable_file &&) = delete; ~writable_file() noexcept; @@ -291,5 +291,5 @@ ircd::db::database::env::writable_file_direct final Status Truncate(uint64_t size) noexcept override; Status Close() noexcept override; - writable_file_direct(database *const &d, const std::string &name, const EnvOptions &, const bool &trunc); + writable_file_direct(database *const &d, const std::string &name, const EnvOptions &, const bool &trunc, const bool &ate); };