From 1efddc228d3289596a3bbcd394a650fa098158ed Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Fri, 24 Nov 2023 15:42:22 +0300 Subject: [PATCH] sstable: Do not nest io-check wrappers into each other When sealing an sstable on local storage the storage driver performs several flushes on a file that is directory open via checked-file. Flush calls are wrapped with sstable_write_io_check, but that's excessive, the checked file will wrap flushes with io-checks on its own Signed-off-by: Pavel Emelyanov Closes scylladb/scylladb#16173 --- sstables/storage.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sstables/storage.cc b/sstables/storage.cc index 2bfa524ea5..af9fb56a3e 100644 --- a/sstables/storage.cc +++ b/sstables/storage.cc @@ -167,11 +167,11 @@ future<> filesystem_storage::seal(const sstable& sst) { co_await remove_temp_dir(); auto dir_f = co_await open_checked_directory(sst._write_error_handler, _dir); // Guarantee that every component of this sstable reached the disk. - co_await sst.sstable_write_io_check([&] { return dir_f.flush(); }); + co_await dir_f.flush(); // Rename TOC because it's no longer temporary. co_await sst.sstable_write_io_check(rename_file, sst.filename(component_type::TemporaryTOC), sst.filename(component_type::TOC)); - co_await sst.sstable_write_io_check([&] { return dir_f.flush(); }); - co_await sst.sstable_write_io_check([&] { return dir_f.close(); }); + co_await dir_f.flush(); + co_await dir_f.close(); // If this point was reached, sstable should be safe in disk. sstlog.debug("SSTable with generation {} of {}.{} was sealed successfully.", sst._generation, sst._schema->ks_name(), sst._schema->cf_name()); }