Summary:
In case of IO uring bugs, we need to provide a way for users to turn it off.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/8931
Test Plan: Manually run db_bench with/without the option and verify the behavior
Reviewed By: pdillinger
Differential Revision:
D31040252
Pulled By: anand1976
fbshipit-source-id:
56f2537d6ac8488c9e126296d8190ad9e0158f70
* Fix the implementation of `prepopulate_block_cache = kFlushOnly` to only apply to flushes rather than to all generated files.
* Fix WAL log data corruption when using DBOptions.manual_wal_flush(true) and WriteOptions.sync(true) together. The sync WAL should work with locked log_write_mutex_.
* Add checks for validity of the IO uring completion queue entries, and fail the BlockBasedTableReader MultiGet sub-batch if there's an invalid completion
+* Add an interface RocksDbIOUringEnable() that, if defined by the user, will allow them to enable/disable the use of IO uring by RocksDB
### New Features
* RemoteCompaction's interface now includes `db_name`, `db_id`, `session_id`, which could help the user uniquely identify compaction job between db instances and sessions.
#define EXT4_SUPER_MAGIC 0xEF53
#endif
+extern "C" bool RocksDbIOUringEnable() __attribute__((__weak__));
+
namespace ROCKSDB_NAMESPACE {
namespace {
options
#if defined(ROCKSDB_IOURING_PRESENT)
,
- thread_local_io_urings_.get()
+ !IsIOUringEnabled() ? nullptr : thread_local_io_urings_.get()
#endif
));
}
#endif
}
+#ifdef ROCKSDB_IOURING_PRESENT
+ bool IsIOUringEnabled() {
+ if (RocksDbIOUringEnable && RocksDbIOUringEnable()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+#endif // ROCKSDB_IOURING_PRESENT
+
#if defined(ROCKSDB_IOURING_PRESENT)
// io_uring instance
std::unique_ptr<ThreadLocalPtr> thread_local_io_urings_;
DEFINE_int32(trace_replay_threads, 1,
"The number of threads to replay, must >=1.");
+DEFINE_bool(io_uring_enabled, true,
+ "If true, enable the use of IO uring if the platform supports it");
+extern "C" bool RocksDbIOUringEnable() { return FLAGS_io_uring_enabled; }
#endif // ROCKSDB_LITE
static enum ROCKSDB_NAMESPACE::CompressionType StringToCompressionType(