mirror of https://github.com/facebook/rocksdb.git
Add offpeak feature to crash test (#12549)
Summary: As title. Add offpeak feature in stress test. Pull Request resolved: https://github.com/facebook/rocksdb/pull/12549 Test Plan: Ran stress test locally with the flag set ``` Running db_stress with pid=701060: ./db_stress ... --daily_offpeak_time_utc=04:00-08:00 ... --periodic_compaction_seconds=10 ... ... KILLED 701060 stdout: Choosing random keys with no overwrite Creating 6250000 locks 2024/04/16-11:38:19 Initializing db_stress RocksDB version : 9.2 Format version : 5 TransactionDB : false Stacked BlobDB : false Read only mode : false Atomic flush : false Manual WAL flush : true Column families : 1 Clear CFs one in : 0 Number of threads : 32 Ops per thread : 100000000 Time to live(sec) : unused Read percentage : 60% Prefix percentage : 0% Write percentage : 35% Delete percentage : 4% Delete range percentage : 1% No overwrite percentage : 1% Iterate percentage : 0% Custom ops percentage : 0% DB-write-buffer-size : 0 Write-buffer-size : 4194304 Iterations : 10 Max key : 25000000 Ratio #ops/#keys : 128.000000 Num times DB reopens : 0 Batches/snapshots : 0 Do update in place : 0 Num keys per lock : 4 Compression : LZ4 Bottommost Compression : DisableOption Checksum type : kxxHash File checksum impl : none Bloom bits / key : 18.000000 Max subcompactions : 4 Use MultiGet : false Use GetEntity : false Use MultiGetEntity : false Verification only : false Memtablerep : skip_list Test kill odd : 0 Periodic Compaction Secs : 10 Daily Offpeak UTC : 04:00-08:00 <<<<<<<<<<<<<<< Newly added Compaction TTL : 0 Compaction Pri : kMinOverlappingRatio Background Purge : 0 Write DB ID to manifest : 0 Max Write Batch Group Size: 16 Use dynamic level : 1 Read fault one in : 0 Write fault one in : 1000 Open metadata write fault one in: 8 Sync fault injection : 0 Best efforts recovery : 0 Fail if OPTIONS file error: 0 User timestamp size bytes : 0 Persist user defined timestamps : 1 WAL compression : zstd Try verify sst unique id : 1 ------------------------------------------------ ``` Reviewed By: hx235 Differential Revision: D56203102 Pulled By: jaykorean fbshipit-source-id: 11a9be7362b3b26940d74d41c8bf4ebac3f03a2d
This commit is contained in:
parent
c0aef2a28e
commit
dfdc3b158e
|
@ -156,6 +156,7 @@ DECLARE_int32(unpartitioned_pinning);
|
|||
DECLARE_string(cache_type);
|
||||
DECLARE_uint64(subcompactions);
|
||||
DECLARE_uint64(periodic_compaction_seconds);
|
||||
DECLARE_string(daily_offpeak_time_utc);
|
||||
DECLARE_uint64(compaction_ttl);
|
||||
DECLARE_bool(fifo_allow_compaction);
|
||||
DECLARE_bool(allow_concurrent_memtable_write);
|
||||
|
|
|
@ -395,6 +395,8 @@ DEFINE_uint64(subcompactions, 1,
|
|||
|
||||
DEFINE_uint64(periodic_compaction_seconds, 1000,
|
||||
"Files older than this value will be picked up for compaction.");
|
||||
DEFINE_string(daily_offpeak_time_utc, "",
|
||||
"If set, process periodic compactions during this period only");
|
||||
|
||||
DEFINE_uint64(compaction_ttl, 1000,
|
||||
"Files older than TTL will be compacted to the next level.");
|
||||
|
|
|
@ -2781,6 +2781,8 @@ void StressTest::PrintEnv() const {
|
|||
#endif
|
||||
fprintf(stdout, "Periodic Compaction Secs : %" PRIu64 "\n",
|
||||
FLAGS_periodic_compaction_seconds);
|
||||
fprintf(stdout, "Daily Offpeak UTC : %s\n",
|
||||
FLAGS_daily_offpeak_time_utc.c_str());
|
||||
fprintf(stdout, "Compaction TTL : %" PRIu64 "\n",
|
||||
FLAGS_compaction_ttl);
|
||||
const char* compaction_pri = "";
|
||||
|
@ -3529,6 +3531,7 @@ void InitializeOptionsFromFlags(
|
|||
options.experimental_mempurge_threshold =
|
||||
FLAGS_experimental_mempurge_threshold;
|
||||
options.periodic_compaction_seconds = FLAGS_periodic_compaction_seconds;
|
||||
options.daily_offpeak_time_utc = FLAGS_daily_offpeak_time_utc;
|
||||
options.stats_dump_period_sec =
|
||||
static_cast<unsigned int>(FLAGS_stats_dump_period_sec);
|
||||
options.ttl = FLAGS_compaction_ttl;
|
||||
|
|
|
@ -148,6 +148,15 @@ default_params = {
|
|||
"use_get_entity": lambda: random.choice([0] * 7 + [1]),
|
||||
"use_multi_get_entity": lambda: random.choice([0] * 7 + [1]),
|
||||
"periodic_compaction_seconds": lambda: random.choice([0, 0, 1, 2, 10, 100, 1000]),
|
||||
"daily_offpeak_time_utc": lambda: random.choice(
|
||||
[
|
||||
"",
|
||||
"",
|
||||
"00:00-23:59",
|
||||
"04:00-08:00",
|
||||
"23:30-03:15"
|
||||
]
|
||||
),
|
||||
# 0 = never (used by some), 10 = often (for threading bugs), 600 = default
|
||||
"stats_dump_period_sec": lambda: random.choice([0, 10, 600]),
|
||||
"compaction_ttl": lambda: random.choice([0, 0, 1, 2, 10, 100, 1000]),
|
||||
|
@ -799,6 +808,9 @@ def finalize_and_sanitize(src_params):
|
|||
# Enabling block_align with compression is not supported
|
||||
if dest_params.get("block_align") == 1:
|
||||
dest_params["compression_type"] = "none"
|
||||
# If periodic_compaction_seconds is not set, daily_offpeak_time_utc doesn't do anything
|
||||
if dest_params.get("periodic_compaction_seconds") == 0:
|
||||
dest_params["daily_offpeak_time_utc"] = ""
|
||||
return dest_params
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue