From ef181fb2d06d9f0b2010abedeb99854d7d28765e Mon Sep 17 00:00:00 2001 From: Pavel Emelyanov Date: Thu, 7 May 2020 17:06:03 +0300 Subject: [PATCH] test: Add option to flush memtables for perf_simple_query The test in question measures the speed of memtables, not the row_cache. With this option it can do both. Signed-off-by: Pavel Emelyanov Message-Id: <20200507140603.12350-1-xemul@scylladb.com> --- test/perf/perf_simple_query.cc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/perf/perf_simple_query.cc b/test/perf/perf_simple_query.cc index a5a43d8e8d..ffda7b7e33 100644 --- a/test/perf/perf_simple_query.cc +++ b/test/perf/perf_simple_query.cc @@ -68,6 +68,7 @@ struct test_config { bool query_single_key; unsigned duration_in_seconds; bool counters; + bool flush_memtables; unsigned operations_per_shard = 0; }; @@ -98,6 +99,11 @@ static void create_partitions(cql_test_env& env, test_config& cfg) { execute_update_for_key(env, make_key(sequence)); } } + + if (cfg.flush_memtables) { + std::cout << "Flushing partitions..." << std::endl; + env.db().invoke_on_all(&database::flush_all_memtables).get(); + } } static std::vector test_read(cql_test_env& env, test_config& cfg) { @@ -254,6 +260,7 @@ int main(int argc, char** argv) { ("concurrency", bpo::value()->default_value(100), "workers per core") ("operations-per-shard", bpo::value(), "run this many operations per shard (overrides duration)") ("counters", "test counters") + ("flush", "flush memtables before test") ("json-result", bpo::value(), "name of the json result file") ; @@ -273,6 +280,7 @@ int main(int argc, char** argv) { cfg.concurrency = app.configuration()["concurrency"].as(); cfg.query_single_key = app.configuration().count("query-single-key"); cfg.counters = app.configuration().count("counters"); + cfg.flush_memtables = app.configuration().count("flush"); if (app.configuration().count("write")) { cfg.mode = test_config::run_mode::write; } else if (app.configuration().count("delete")) {