From 9b41082d4a21a4f8cc8be2c1df84a3ea3b407f3d Mon Sep 17 00:00:00 2001 From: sdong Date: Wed, 21 Jul 2021 16:07:18 -0700 Subject: [PATCH] Complete the fix of stress open WAL drop fix (#8570) Summary: https://github.com/facebook/rocksdb/pull/8548 is not complete. We should instead cover all cases writable files are buffered, not just when failures are ingested. Extend it to any case where failures are ingested in DB open. Pull Request resolved: https://github.com/facebook/rocksdb/pull/8570 Test Plan: Run db_stress and see it doesn't break Reviewed By: jay-zhuang Differential Revision: D29830415 fbshipit-source-id: 94449a0468fb2f7eec17423724008c9c63b2445d --- db_stress_tool/db_stress_test_base.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index 777b95813..c2dd8b85b 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -2491,6 +2491,13 @@ void StressTest::Open() { fault_fs_guard ->FileExists(FLAGS_db + "/CURRENT", IOOptions(), nullptr) .ok()) { + if (!FLAGS_sync) { + // When DB Stress is not sync mode, we expect all WAL writes to + // WAL is durable. Buffering unsynced writes will cause false + // positive in crash tests. Before we figure out a way to + // solve it, skip WAL from failure injection. + fault_fs_guard->SetSkipDirectWritableTypes({kWalFile}); + } ingest_meta_error = FLAGS_open_metadata_write_fault_one_in; ingest_write_error = FLAGS_open_write_fault_one_in; ingest_read_error = FLAGS_open_read_fault_one_in; @@ -2500,13 +2507,6 @@ void StressTest::Open() { FLAGS_open_metadata_write_fault_one_in); } if (ingest_write_error) { - if (!FLAGS_sync) { - // When DB Stress is not sync mode, we expect all WAL writes to - // WAL is durable. Buffering unsynced writes will cause false - // positive in crash tests. Before we figure out a way to - // solve it, skip WAL from failure injection. - fault_fs_guard->SetSkipDirectWritableTypes({kWalFile}); - } fault_fs_guard->SetFilesystemDirectWritable(false); fault_fs_guard->EnableWriteErrorInjection(); fault_fs_guard->SetRandomWriteError(