From e88d8935ae6aef2a4f5e01e5f4e027fc5a7306d2 Mon Sep 17 00:00:00 2001 From: zczhu <> Date: Thu, 2 Jun 2022 21:52:35 -0700 Subject: [PATCH] Add comments/permit unchecked error to close_db_dir pull requests (#10093) Summary: In [close_db_dir](https://github.com/facebook/rocksdb/pull/10049) pull request, some merging conflicts occurred (some comments and one line `s.PermitUncheckedError()` are missing). This pull request aims to put them back. Pull Request resolved: https://github.com/facebook/rocksdb/pull/10093 Reviewed By: ajkr Differential Revision: D36884117 Pulled By: littlepig2013 fbshipit-source-id: 8c0e2a8793fc52804067c511843bd1ff4912c1c3 --- db/column_family.cc | 2 ++ env/io_posix.cc | 2 ++ 2 files changed, 4 insertions(+) diff --git a/db/column_family.cc b/db/column_family.cc index e5ec0a6ef..bac4c21a6 100644 --- a/db/column_family.cc +++ b/db/column_family.cc @@ -682,8 +682,10 @@ ColumnFamilyData::~ColumnFamilyData() { if (data_dir_ptr) { s = data_dir_ptr->Close(IOOptions(), nullptr); if (!s.ok()) { + // TODO(zichen): add `Status Close()` and `CloseDirectories() ROCKS_LOG_WARN(ioptions_.logger, "Ignoring error %s", s.ToString().c_str()); + s.PermitUncheckedError(); } } } diff --git a/env/io_posix.cc b/env/io_posix.cc index c0860c376..ef4975de5 100644 --- a/env/io_posix.cc +++ b/env/io_posix.cc @@ -1661,6 +1661,8 @@ IOStatus PosixDirectory::Fsync(const IOOptions& opts, IODebugContext* dbg) { return FsyncWithDirOptions(opts, dbg, DirFsyncOptions()); } +// Users who want the file entries synced in Directory project must call a +// Fsync or FsyncWithDirOptions function before Close IOStatus PosixDirectory::Close(const IOOptions& /*opts*/, IODebugContext* /*dbg*/) { IOStatus s = IOStatus::OK();