From 643df920d8831ddf72bc4d340c20317a881ef304 Mon Sep 17 00:00:00 2001 From: Yanqin Jin Date: Fri, 27 Sep 2019 17:15:48 -0700 Subject: [PATCH] Explicitly declare atomic flush incompatible with pipelined write (#5860) Summary: Atomic flush is incompatible with pipelined write. At least now. If pipelined write is enabled, a thread performing write can exit the write thread and start inserting into memtables. Consequently a thread performing flush will enter write thread and race with memtable insertion by the former. This will cause undefined result in terms of data persistence. Pull Request resolved: https://github.com/facebook/rocksdb/pull/5860 Test Plan: ``` $make all && make check ``` Differential Revision: D17638944 Pulled By: riversand963 fbshipit-source-id: abc578dc49a5dbe41bc5adcecf448f8e042a6d49 --- db/db_impl/db_impl_open.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/db/db_impl/db_impl_open.cc b/db/db_impl/db_impl_open.cc index 92281df50..b02676bb4 100644 --- a/db/db_impl/db_impl_open.cc +++ b/db/db_impl/db_impl_open.cc @@ -228,6 +228,11 @@ Status DBImpl::ValidateOptions(const DBOptions& db_options) { "unordered_write is incompatible with enable_pipelined_write"); } + if (db_options.atomic_flush && db_options.enable_pipelined_write) { + return Status::InvalidArgument( + "atomic_flush is incompatible with enable_pipelined_write"); + } + return Status::OK(); }