From aedcaaef99a3ed55de799219d9e30fcea53189cc Mon Sep 17 00:00:00 2001 From: sdong Date: Wed, 30 Sep 2020 14:39:47 -0700 Subject: [PATCH] Stress test to support paranoid_file_checks (#7473) Summary: It's important to make sure no false positive is reported when options.paranoid_file_checks is used. Add it to stress test and a place holder in crash test. It is disabled in crash test as there appears to be a bug causing false positive. Pull Request resolved: https://github.com/facebook/rocksdb/pull/7473 Test Plan: Run crash test Reviewed By: ajkr Differential Revision: D24026939 fbshipit-source-id: 89102acb45cf041776775ce44a4eef4b0f3a380c --- db_stress_tool/db_stress_common.h | 1 + db_stress_tool/db_stress_gflags.cc | 4 ++++ db_stress_tool/db_stress_test_base.cc | 1 + tools/db_crashtest.py | 4 ++++ 4 files changed, 10 insertions(+) diff --git a/db_stress_tool/db_stress_common.h b/db_stress_tool/db_stress_common.h index c6d9cf719..67d4530c5 100644 --- a/db_stress_tool/db_stress_common.h +++ b/db_stress_tool/db_stress_common.h @@ -241,6 +241,7 @@ DECLARE_bool(sync_fault_injection); DECLARE_bool(best_efforts_recovery); DECLARE_bool(skip_verifydb); DECLARE_bool(enable_compaction_filter); +DECLARE_bool(paranoid_file_checks); const long KB = 1024; const int kRandomValueMaxFactor = 3; diff --git a/db_stress_tool/db_stress_gflags.cc b/db_stress_tool/db_stress_gflags.cc index e83c0557f..7dcdeefce 100644 --- a/db_stress_tool/db_stress_gflags.cc +++ b/db_stress_tool/db_stress_gflags.cc @@ -728,6 +728,10 @@ DEFINE_bool(enable_compaction_filter, false, "If true, configures a compaction filter that returns a kRemove " "decision for deleted keys."); +DEFINE_bool(paranoid_file_checks, true, + "After writing every SST file, reopen it and read all the keys " + "and validate checksums"); + DEFINE_string(file_checksum_impl, "none", "Name of an implementation for file_checksum_gen_factory, or " "\"none\" for null."); diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index e5e9084e0..38f435b6e 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -2145,6 +2145,7 @@ void StressTest::Open() { std::make_shared()); options_.best_efforts_recovery = FLAGS_best_efforts_recovery; + options_.paranoid_file_checks = FLAGS_paranoid_file_checks; fprintf(stdout, "DB path: [%s]\n", FLAGS_db.c_str()); diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index 2e2ecc1fc..cd36c663c 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -134,6 +134,8 @@ default_params = { "read_fault_one_in": lambda: random.choice([0, 1000]), "sync_fault_injection": False, "get_property_one_in": 1000000, + # paranoid_file_checks has a bug so it's not yet passed. + "paranoid_file_checks": 0, } _TEST_DIR_ENV_VAR = 'TEST_TMPDIR' @@ -198,6 +200,8 @@ simple_default_params = { "test_batches_snapshots": 0, "write_buffer_size": 32 * 1024 * 1024, "level_compaction_dynamic_level_bytes": False, + # "paranoid_file_checks" has a bug so it's not yet passed. + "paranoid_file_checks": 0, } blackbox_simple_default_params = {