From a2466c885113daddd05024386fef0a4336f9c3a3 Mon Sep 17 00:00:00 2001 From: Yueh-Hsuan Chiang Date: Mon, 18 Apr 2016 14:43:33 -0700 Subject: [PATCH] [db_stress] Make subcompaction random in crash_test Summary: Make subcompaction random in crash_test Test Plan: make crash_test and verify whether subcompaction changes randomly Reviewers: IslamAbdelRahman, kradhakrishnan, yiwu, sdong, andrewkr Reviewed By: andrewkr Subscribers: andrewkr, dhruba, leveldb Differential Revision: https://reviews.facebook.net/D56571 --- tools/db_crashtest.py | 10 ++++++++-- tools/db_stress.cc | 6 ++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/db_crashtest.py b/tools/db_crashtest.py index 3fab88d88..51cbcbe6d 100644 --- a/tools/db_crashtest.py +++ b/tools/db_crashtest.py @@ -45,6 +45,7 @@ default_params = { "verify_checksum": 1, "write_buffer_size": 4 * 1024 * 1024, "writepercent": 35, + "subcompactions": lambda: random.randint(1, 4), } @@ -75,6 +76,7 @@ whitebox_default_params = { "ops_per_thread": 200000, "test_batches_snapshots": lambda: random.randint(0, 1), "write_buffer_size": 4 * 1024 * 1024, + "subcompactions": lambda: random.randint(1, 4), } simple_default_params = { @@ -107,6 +109,7 @@ simple_default_params = { "verify_checksum": 1, "write_buffer_size": 32 * 1024 * 1024, "writepercent": 35, + "subcompactions": lambda: random.randint(1, 4), } blackbox_simple_default_params = { @@ -125,6 +128,7 @@ whitebox_simple_default_params = { "open_files": 500000, "ops_per_thread": 200000, "write_buffer_size": 32 * 1024 * 1024, + "subcompactions": lambda: random.randint(1, 4), } @@ -182,7 +186,8 @@ def blackbox_crash_main(args): + "total-duration=" + str(cmd_params['duration']) + "\n" + "threads=" + str(cmd_params['threads']) + "\n" + "ops_per_thread=" + str(cmd_params['ops_per_thread']) + "\n" - + "write_buffer_size=" + str(cmd_params['write_buffer_size']) + "\n") + + "write_buffer_size=" + str(cmd_params['write_buffer_size']) + "\n" + + "subcompactions=" + str(cmd_params['subcompactions']) + "\n") while time.time() < exit_time: run_had_errors = False @@ -244,7 +249,8 @@ def whitebox_crash_main(args): + "total-duration=" + str(cmd_params['duration']) + "\n" + "threads=" + str(cmd_params['threads']) + "\n" + "ops_per_thread=" + str(cmd_params['ops_per_thread']) + "\n" - + "write_buffer_size=" + str(cmd_params['write_buffer_size']) + "\n") + + "write_buffer_size=" + str(cmd_params['write_buffer_size']) + "\n" + + "subcompactions=" + str(cmd_params['subcompactions']) + "\n") total_check_mode = 4 check_mode = 0 diff --git a/tools/db_stress.cc b/tools/db_stress.cc index 1d13f00af..f514fbc68 100644 --- a/tools/db_stress.cc +++ b/tools/db_stress.cc @@ -228,8 +228,8 @@ DEFINE_int64(cache_size, 2LL * KB * KB * KB, "Number of bytes to use as a cache of uncompressed data."); DEFINE_uint64(subcompactions, 1, - "Maximum number of subcompactions to divide L0-L1 compactions " - "into."); + "Maximum number of subcompactions to divide L0-L1 compactions " + "into."); DEFINE_bool(allow_concurrent_memtable_write, true, "Allow multi-writers to update mem tables in parallel."); @@ -1929,6 +1929,8 @@ class StressTest { 1 << FLAGS_log2_keys_per_lock); std::string compression = CompressionTypeToString(FLAGS_compression_type_e); fprintf(stdout, "Compression : %s\n", compression.c_str()); + fprintf(stdout, "Max subcompactions : %" PRIu64 "\n", + FLAGS_subcompactions); const char* memtablerep = ""; switch (FLAGS_rep_factory) { -- GitLab