mirror of https://github.com/facebook/rocksdb.git
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:
parent
1006eddd63
commit
24045549a6
|
@ -417,6 +417,7 @@ DECLARE_bool(check_multiget_consistency);
|
||||||
DECLARE_bool(check_multiget_entity_consistency);
|
DECLARE_bool(check_multiget_entity_consistency);
|
||||||
DECLARE_bool(inplace_update_support);
|
DECLARE_bool(inplace_update_support);
|
||||||
DECLARE_uint32(uncache_aggressiveness);
|
DECLARE_uint32(uncache_aggressiveness);
|
||||||
|
DECLARE_int32(test_ingest_standalone_range_deletion_one_in);
|
||||||
|
|
||||||
constexpr long KB = 1024;
|
constexpr long KB = 1024;
|
||||||
constexpr int kRandomValueMaxFactor = 3;
|
constexpr int kRandomValueMaxFactor = 3;
|
||||||
|
|
|
@ -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,
|
DEFINE_bool(use_multi_get_entity, false,
|
||||||
"If set, use the MultiGetEntity API for reads");
|
"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) {
|
static bool ValidateInt32Percent(const char* flagname, int32_t value) {
|
||||||
if (value < 0 || value > 100) {
|
if (value < 0 || value > 100) {
|
||||||
fprintf(stderr, "Invalid value for --%s: %d, 0<= pct <=100 \n", flagname,
|
fprintf(stderr, "Invalid value for --%s: %d, 0<= pct <=100 \n", flagname,
|
||||||
|
|
|
@ -1994,9 +1994,8 @@ class NonBatchedOpsStressTest : public StressTest {
|
||||||
// a continuous range of keys, the second one with a standalone range
|
// 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 for all the keys. This is to exercise the standalone range
|
||||||
// deletion file's compaction input optimization.
|
// deletion file's compaction input optimization.
|
||||||
// TODO(yuzhangyu): make this an option.
|
bool test_standalone_range_deletion = thread->rand.OneInOpt(
|
||||||
bool test_standalone_range_deletion =
|
FLAGS_test_ingest_standalone_range_deletion_one_in);
|
||||||
thread->rand.OneInOpt(10) && FLAGS_delrangepercent > 0;
|
|
||||||
std::vector<std::string> external_files;
|
std::vector<std::string> external_files;
|
||||||
const std::string sst_filename =
|
const std::string sst_filename =
|
||||||
FLAGS_db + "/." + std::to_string(thread->tid) + ".sst";
|
FLAGS_db + "/." + std::to_string(thread->tid) + ".sst";
|
||||||
|
|
|
@ -104,6 +104,7 @@ default_params = {
|
||||||
# Temporarily disable hash index
|
# Temporarily disable hash index
|
||||||
"index_type": lambda: random.choice([0, 0, 0, 2, 2, 3]),
|
"index_type": lambda: random.choice([0, 0, 0, 2, 2, 3]),
|
||||||
"ingest_external_file_one_in": lambda: random.choice([1000, 1000000]),
|
"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,
|
"iterpercent": 10,
|
||||||
"lock_wal_one_in": lambda: random.choice([10000, 1000000]),
|
"lock_wal_one_in": lambda: random.choice([10000, 1000000]),
|
||||||
"mark_for_compaction_one_file_in": lambda: 10 * random.randint(0, 1),
|
"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.
|
# can cause checkpoint verification to fail. So make the two mutually exclusive.
|
||||||
if dest_params.get("checkpoint_one_in") != 0:
|
if dest_params.get("checkpoint_one_in") != 0:
|
||||||
dest_params["lock_wal_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
|
return dest_params
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue