From f4f4668c7a8b6f67b78da281a3f70a6f2734f3e4 Mon Sep 17 00:00:00 2001 From: Roman Gershman Date: Thu, 1 May 2025 00:17:29 +0300 Subject: [PATCH] chore: bump up max_busy_read_usec in tests (#5039) cycle clock like most clocks is affected by thread context switching, and maybe this is what causes test failures. Try to increase the parameter to even further. Also, add benchmarks for the clock as well as fix some compiler warnings around parser.cc Signed-off-by: Roman Gershman --- src/core/dfly_core_test.cc | 15 +++++++++++++++ src/core/search/CMakeLists.txt | 2 ++ tests/dragonfly/connection_test.py | 4 ++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/core/dfly_core_test.cc b/src/core/dfly_core_test.cc index e8ca8a669..5ecb5ca41 100644 --- a/src/core/dfly_core_test.cc +++ b/src/core/dfly_core_test.cc @@ -223,6 +223,21 @@ static void BM_ParseDoubleAbsl(benchmark::State& state) { } BENCHMARK(BM_ParseDoubleAbsl); +template void BM_ClockType(benchmark::State& state) { + timespec ts; + while (state.KeepRunning()) { + DoNotOptimize(clock_gettime(cid, &ts)); + } +} +BENCHMARK_TEMPLATE(BM_ClockType, CLOCK_REALTIME); +BENCHMARK_TEMPLATE(BM_ClockType, CLOCK_REALTIME_COARSE); +BENCHMARK_TEMPLATE(BM_ClockType, CLOCK_MONOTONIC); +BENCHMARK_TEMPLATE(BM_ClockType, CLOCK_MONOTONIC_COARSE); +BENCHMARK_TEMPLATE(BM_ClockType, CLOCK_BOOTTIME); +BENCHMARK_TEMPLATE(BM_ClockType, CLOCK_PROCESS_CPUTIME_ID); +BENCHMARK_TEMPLATE(BM_ClockType, CLOCK_THREAD_CPUTIME_ID); +BENCHMARK_TEMPLATE(BM_ClockType, CLOCK_BOOTTIME_ALARM); + static void BM_MatchGlob(benchmark::State& state) { string random_val = GetRandomHex(state.range(0)); GlobMatcher matcher("*foobar*", true); diff --git a/src/core/search/CMakeLists.txt b/src/core/search/CMakeLists.txt index eb2ccd091..687a0c44d 100644 --- a/src/core/search/CMakeLists.txt +++ b/src/core/search/CMakeLists.txt @@ -3,6 +3,8 @@ gen_bison(parser) cur_gen_dir(gen_dir) +set_source_files_properties(${gen_dir}/parser.cc PROPERTIES + COMPILE_FLAGS "-Wno-maybe-uninitialized") add_library(query_parser base.cc ast_expr.cc query_driver.cc search.cc indices.cc sort_indices.cc vector_utils.cc compressed_sorted_set.cc block_list.cc synonyms.cc ${gen_dir}/parser.cc ${gen_dir}/lexer.cc) diff --git a/tests/dragonfly/connection_test.py b/tests/dragonfly/connection_test.py index 7d829f267..fabfdece9 100755 --- a/tests/dragonfly/connection_test.py +++ b/tests/dragonfly/connection_test.py @@ -525,7 +525,7 @@ async def test_keyspace_events_config_set(async_client: aioredis.Redis): await collect_expiring_events(pclient, keys) -@dfly_args({"max_busy_read_usec": 10000}) +@dfly_args({"max_busy_read_usec": 50000}) async def test_reply_count(async_client: aioredis.Redis): """Make sure reply aggregations reduce reply counts for common cases""" @@ -1122,7 +1122,7 @@ async def test_send_timeout(df_server, async_client: aioredis.Redis): # Test that the cache pipeline does not grow or shrink under constant pipeline load. -@dfly_args({"proactor_threads": 1, "pipeline_squash": 9, "max_busy_read_usec": 10000}) +@dfly_args({"proactor_threads": 1, "pipeline_squash": 9, "max_busy_read_usec": 50000}) async def test_pipeline_cache_only_async_squashed_dispatches(df_factory): server = df_factory.create() server.start()