Add a flag for testing standalone range deletion file (#13101)

Summary:
As titled. This flag controls how frequent standalone range deletion file is tested in the file ingestion flow, for better debuggability.

Pull Request resolved: https://github.com/facebook/rocksdb/pull/13101

Test Plan: Manually tested in stress test

Reviewed By: hx235

Differential Revision: D65361004

Pulled By: jowlyzhang

fbshipit-source-id: 21882e7cc5918aff45449acaeb33b696ab1e37f0
This commit is contained in:
Yu Zhang 2024-11-01 17:07:34 -07:00 committed by Facebook GitHub Bot
parent 1006eddd63
commit 24045549a6
4 changed files with 10 additions and 3 deletions

View File

@ -417,6 +417,7 @@ DECLARE_bool(check_multiget_consistency);
DECLARE_bool(check_multiget_entity_consistency);
DECLARE_bool(inplace_update_support);
DECLARE_uint32(uncache_aggressiveness);
DECLARE_int32(test_ingest_standalone_range_deletion_one_in);
constexpr long KB = 1024;
constexpr int kRandomValueMaxFactor = 3;

View File

@ -835,6 +835,10 @@ DEFINE_bool(use_get_entity, false, "If set, use the GetEntity API for reads");
DEFINE_bool(use_multi_get_entity, false,
"If set, use the MultiGetEntity API for reads");
DEFINE_int32(test_ingest_standalone_range_deletion_one_in, 0,
"If non-zero, file ingestion flow will test standalone range "
"deletion file once every N file ingestion operations.");
static bool ValidateInt32Percent(const char* flagname, int32_t value) {
if (value < 0 || value > 100) {
fprintf(stderr, "Invalid value for --%s: %d, 0<= pct <=100 \n", flagname,

View File

@ -1994,9 +1994,8 @@ class NonBatchedOpsStressTest : public StressTest {
// a continuous range of keys, the second one with a standalone range
// deletion for all the keys. This is to exercise the standalone range
// deletion file's compaction input optimization.
// TODO(yuzhangyu): make this an option.
bool test_standalone_range_deletion =
thread->rand.OneInOpt(10) && FLAGS_delrangepercent > 0;
bool test_standalone_range_deletion = thread->rand.OneInOpt(
FLAGS_test_ingest_standalone_range_deletion_one_in);
std::vector<std::string> external_files;
const std::string sst_filename =
FLAGS_db + "/." + std::to_string(thread->tid) + ".sst";

View File

@ -104,6 +104,7 @@ default_params = {
# Temporarily disable hash index
"index_type": lambda: random.choice([0, 0, 0, 2, 2, 3]),
"ingest_external_file_one_in": lambda: random.choice([1000, 1000000]),
"test_ingest_standalone_range_deletion_one_in": lambda: random.choice([0, 5, 10]),
"iterpercent": 10,
"lock_wal_one_in": lambda: random.choice([10000, 1000000]),
"mark_for_compaction_one_file_in": lambda: 10 * random.randint(0, 1),
@ -971,6 +972,8 @@ def finalize_and_sanitize(src_params):
# can cause checkpoint verification to fail. So make the two mutually exclusive.
if dest_params.get("checkpoint_one_in") != 0:
dest_params["lock_wal_one_in"] = 0
if dest_params.get("ingest_external_file_one_in") == 0 or dest_params.get("delrangepercent") == 0:
dest_params["test_ingest_standalone_range_deletion_one_in"] = 0
return dest_params