From 0229a88dfe4c48ef3edc5115b114cebe7b94d604 Mon Sep 17 00:00:00 2001 From: Baptiste Lemaire Date: Fri, 16 Jul 2021 10:19:33 -0700 Subject: [PATCH] Crashtest mempurge (#8545) Summary: Add `experiemental_allow_mempurge` flag support for `db_stress` and `db_crashtest.py`, with a `false` default value. I succesfully tested locally both `whitebox` and `blackbox` crash tests with `experiemental_allow_mempurge` flag set as true. Pull Request resolved: https://github.com/facebook/rocksdb/pull/8545 Reviewed By: akankshamahajan15 Differential Revision: D29734513 Pulled By: bjlemaire fbshipit-source-id: 24316c0eccf6caf409e95c035f31d822c66714ae --- db_stress_tool/db_stress_common.h | 1 + db_stress_tool/db_stress_gflags.cc | 3 +++ db_stress_tool/db_stress_test_base.cc | 1 + tools/db_crashtest.py | 1 + 4 files changed, 6 insertions(+) diff --git a/db_stress_tool/db_stress_common.h b/db_stress_tool/db_stress_common.h index 810fafa5d..7e57fdd8f 100644 --- a/db_stress_tool/db_stress_common.h +++ b/db_stress_tool/db_stress_common.h @@ -141,6 +141,7 @@ DECLARE_uint64(subcompactions); DECLARE_uint64(periodic_compaction_seconds); DECLARE_uint64(compaction_ttl); DECLARE_bool(allow_concurrent_memtable_write); +DECLARE_bool(experimental_allow_mempurge); DECLARE_bool(enable_write_thread_adaptive_yield); DECLARE_int32(reopen); DECLARE_double(bloom_bits); diff --git a/db_stress_tool/db_stress_gflags.cc b/db_stress_tool/db_stress_gflags.cc index 767bf18b0..f44f508c6 100644 --- a/db_stress_tool/db_stress_gflags.cc +++ b/db_stress_tool/db_stress_gflags.cc @@ -326,6 +326,9 @@ DEFINE_uint64(compaction_ttl, 1000, DEFINE_bool(allow_concurrent_memtable_write, false, "Allow multi-writers to update mem tables in parallel."); +DEFINE_bool(experimental_allow_mempurge, false, + "Allow mempurge process to collect memtable garbage bytes."); + DEFINE_bool(enable_write_thread_adaptive_yield, true, "Use a yielding spin loop for brief writer thread waits."); diff --git a/db_stress_tool/db_stress_test_base.cc b/db_stress_tool/db_stress_test_base.cc index 5d76b5787..fe6f9381d 100644 --- a/db_stress_tool/db_stress_test_base.cc +++ b/db_stress_tool/db_stress_test_base.cc @@ -2259,6 +2259,7 @@ void StressTest::Open() { options_.max_subcompactions = static_cast(FLAGS_subcompactions); options_.allow_concurrent_memtable_write = FLAGS_allow_concurrent_memtable_write; + options_.experimental_allow_mempurge = FLAGS_experimental_allow_mempurge; options_.periodic_compaction_seconds = FLAGS_periodic_compaction_seconds; options_.ttl = FLAGS_compaction_ttl; options_.enable_pipelined_write = FLAGS_enable_pipelined_write; diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index 57dbf65e8..10e5091ac 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -220,6 +220,7 @@ whitebox_default_params = { simple_default_params = { "allow_concurrent_memtable_write": lambda: random.randint(0, 1), "column_families": 1, + "experimental_allow_mempurge": 0, "max_background_compactions": 1, "max_bytes_for_level_base": 67108864, "memtablerep": "skip_list",