Add FLAGS_compaction_pri into crash_test (#10255)

Summary:
Add FLAGS_compaction_pri into correctness test

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

Test Plan: run crash_test with FLAGS_compaction_pri

Reviewed By: ajkr

Differential Revision: D37510372

Pulled By: littlepig2013

fbshipit-source-id: 73d93a0a047d0c3993c8a512383dd6ee6acef641
main
zczhu 3 years ago committed by Facebook GitHub Bot
parent 11215e0f3a
commit e716bda010
  1. 1
      db_stress_tool/db_stress_common.h
  2. 4
      db_stress_tool/db_stress_gflags.cc
  3. 21
      db_stress_tool/db_stress_test_base.cc
  4. 1
      tools/db_crashtest.py

@ -110,6 +110,7 @@ DECLARE_int32(open_files);
DECLARE_int64(compressed_cache_size);
DECLARE_int32(compressed_cache_numshardbits);
DECLARE_int32(compaction_style);
DECLARE_int32(compaction_pri);
DECLARE_int32(num_levels);
DECLARE_int32(level0_file_num_compaction_trigger);
DECLARE_int32(level0_slowdown_writes_trigger);

@ -200,6 +200,10 @@ DEFINE_int32(
DEFINE_int32(compaction_style, ROCKSDB_NAMESPACE::Options().compaction_style,
"");
DEFINE_int32(compaction_pri, ROCKSDB_NAMESPACE::Options().compaction_pri,
"Which file from a level should be picked to merge to the next "
"level in level-based compaction");
DEFINE_int32(num_levels, ROCKSDB_NAMESPACE::Options().num_levels,
"Number of levels in the DB");

@ -2271,6 +2271,25 @@ void StressTest::PrintEnv() const {
FLAGS_periodic_compaction_seconds);
fprintf(stdout, "Compaction TTL : %" PRIu64 "\n",
FLAGS_compaction_ttl);
const char* compaction_pri = "";
switch (FLAGS_compaction_pri) {
case kByCompensatedSize:
compaction_pri = "kByCompensatedSize";
break;
case kOldestLargestSeqFirst:
compaction_pri = "kOldestLargestSeqFirst";
break;
case kOldestSmallestSeqFirst:
compaction_pri = "kOldestSmallestSeqFirst";
break;
case kMinOverlappingRatio:
compaction_pri = "kMinOverlappingRatio";
break;
case kRoundRobin:
compaction_pri = "kRoundRobin";
break;
}
fprintf(stdout, "Compaction Pri : %s\n", compaction_pri);
fprintf(stdout, "Background Purge : %d\n",
static_cast<int>(FLAGS_avoid_unnecessary_blocking_io));
fprintf(stdout, "Write DB ID to manifest : %d\n",
@ -2820,6 +2839,8 @@ void InitializeOptionsFromFlags(
options.max_background_flushes = FLAGS_max_background_flushes;
options.compaction_style =
static_cast<ROCKSDB_NAMESPACE::CompactionStyle>(FLAGS_compaction_style);
options.compaction_pri =
static_cast<ROCKSDB_NAMESPACE::CompactionPri>(FLAGS_compaction_pri);
if (FLAGS_prefix_size >= 0) {
options.prefix_extractor.reset(NewFixedPrefixTransform(FLAGS_prefix_size));
}

@ -63,6 +63,7 @@ default_params = {
"clear_column_family_one_in": 0,
"compact_files_one_in": 1000000,
"compact_range_one_in": 1000000,
"compaction_pri": random.randint(0, 4),
"data_block_index_type": lambda: random.choice([0, 1]),
"delpercent": 4,
"delrangepercent": 1,

Loading…
Cancel
Save