From 5aacef971252af35402ec2abac4aa7a30cc8f877 Mon Sep 17 00:00:00 2001 From: sdong Date: Mon, 24 Aug 2020 13:20:32 -0700 Subject: [PATCH] Disable fsync in SeqAdvanceConcurrentTest (#7302) Summary: SeqAdvanceConcurrentTest sometimes runs too long on some platforms. Disable fsync to speed it up. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7302 Test Plan: Run the tests and watch CI. Reviewed By: ajkr Differential Revision: D23298192 fbshipit-source-id: 2185eed4e0958c3de5e8a3f94ceed5be5945ed37 --- utilities/transactions/transaction_test.h | 9 +++++++-- .../transactions/write_prepared_transaction_test.cc | 4 +++- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/utilities/transactions/transaction_test.h b/utilities/transactions/transaction_test.h index 2f3ab2ba8..1b5f549db 100644 --- a/utilities/transactions/transaction_test.h +++ b/utilities/transactions/transaction_test.h @@ -12,6 +12,7 @@ #include #include "db/db_impl/db_impl.h" +#include "db/db_test_util.h" #include "port/port.h" #include "rocksdb/db.h" #include "rocksdb/options.h" @@ -40,6 +41,7 @@ enum WriteOrdering : bool { kOrderedWrite, kUnorderedWrite }; class TransactionTestBase : public ::testing::Test { public: TransactionDB* db; + SpecialEnv special_env; FaultInjectionTestEnv* env; std::string dbname; Options options; @@ -50,14 +52,17 @@ class TransactionTestBase : public ::testing::Test { TransactionTestBase(bool use_stackable_db, bool two_write_queue, TxnDBWritePolicy write_policy, WriteOrdering write_ordering) - : db(nullptr), env(nullptr), use_stackable_db_(use_stackable_db) { + : db(nullptr), + special_env(Env::Default()), + env(nullptr), + use_stackable_db_(use_stackable_db) { options.create_if_missing = true; options.max_write_buffer_number = 2; options.write_buffer_size = 4 * 1024; options.unordered_write = write_ordering == kUnorderedWrite; options.level0_file_num_compaction_trigger = 2; options.merge_operator = MergeOperators::CreateFromStringId("stringappend"); - env = new FaultInjectionTestEnv(Env::Default()); + env = new FaultInjectionTestEnv(&special_env); options.env = env; options.two_write_queues = two_write_queue; dbname = test::PerThreadDBPath("transaction_testdb"); diff --git a/utilities/transactions/write_prepared_transaction_test.cc b/utilities/transactions/write_prepared_transaction_test.cc index a999c71d4..686d985c2 100644 --- a/utilities/transactions/write_prepared_transaction_test.cc +++ b/utilities/transactions/write_prepared_transaction_test.cc @@ -573,7 +573,9 @@ class SeqAdvanceConcurrentTest std::get<0>(GetParam()), std::get<1>(GetParam()), std::get<2>(GetParam()), std::get<3>(GetParam())), split_id_(std::get<4>(GetParam())), - split_cnt_(std::get<5>(GetParam())){}; + split_cnt_(std::get<5>(GetParam())) { + special_env.skip_fsync_ = true; + }; protected: // A test is split into split_cnt_ tests, each identified with split_id_ where