diff options
author | Peter Dillinger <peterd@meta.com> | 2023-10-16 08:58:47 -0700 |
---|---|---|
committer | Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com> | 2023-10-16 08:58:47 -0700 |
commit | 2fd850c7ebb6498a972a7b528408bca2ec697b9e (patch) | |
tree | 6187d372ce60c0217d15e39d86472d61b1c14dd7 /db/db_impl/db_impl.h | |
parent | 9ded9f789ff9805236669963c3f4bde811d71f54 (diff) |
Remove write queue synchronization from WriteOptionsFile (#11951)
Summary:
This has become obsolete with the new `options_mutex_` in https://github.com/facebook/rocksdb/pull/11929
* Remove now-unnecessary parameter from WriteOptionsFile
* Rename (and negate) other parameter for better clarity (the caller shouldn't tell the callee what the callee needs, just what the caller knows, provides, and requests)
* Move a ROCKS_LOG_WARN (I/O) in WriteOptionsFile to outside of holding DB mutex.
* Also *avoid* (but not always eliminate) write queue synchronization in SetDBOptions. Still needed if there was a change to WAL size limit or other configuration.
* Improve some comments
Pull Request resolved: https://github.com/facebook/rocksdb/pull/11951
Test Plan: existing unit tests and TSAN crash test local run
Reviewed By: ajkr
Differential Revision: D50247904
Pulled By: pdillinger
fbshipit-source-id: 7dfe445c705ec013886a2adb7c50abe50d83af69
Diffstat (limited to 'db/db_impl/db_impl.h')
-rw-r--r-- | db/db_impl/db_impl.h | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/db/db_impl/db_impl.h b/db/db_impl/db_impl.h index 4c595076c..cf6d1d300 100644 --- a/db/db_impl/db_impl.h +++ b/db/db_impl/db_impl.h @@ -1397,11 +1397,9 @@ class DBImpl : public DB { std::unordered_set<std::string> files_to_delete_; }; - // Except in DB::Open(), WriteOptionsFile can only be called when: - // Persist options to options file. - // If need_mutex_lock = false, the method will lock DB mutex. - // If need_enter_write_thread = false, the method will enter write thread. - Status WriteOptionsFile(bool need_mutex_lock, bool need_enter_write_thread); + // Persist options to options file. Must be holding options_mutex_. + // Will lock DB mutex if !db_mutex_already_held. + Status WriteOptionsFile(bool db_mutex_already_held); Status CompactRangeInternal(const CompactRangeOptions& options, ColumnFamilyHandle* column_family, |