Skip to content

Commit

Permalink
Add a flag for testing standalone range deletion file (#13101)
Browse files Browse the repository at this point in the history
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: #13101

Test Plan: Manually tested in stress test

Reviewed By: hx235

Differential Revision: D65361004

Pulled By: jowlyzhang

fbshipit-source-id: 21882e7cc5918aff45449acaeb33b696ab1e37f0
  • Loading branch information
jowlyzhang authored and facebook-github-bot committed Nov 2, 2024
1 parent 1006edd commit 2404554
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 3 deletions.
1 change: 1 addition & 0 deletions db_stress_tool/db_stress_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 4 additions & 0 deletions db_stress_tool/db_stress_gflags.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
5 changes: 2 additions & 3 deletions db_stress_tool/no_batched_ops_stress.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
3 changes: 3 additions & 0 deletions tools/db_crashtest.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@
# 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),
Expand Down Expand Up @@ -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


Expand Down

0 comments on commit 2404554

Please sign in to comment.