Skip to content

Commit

Permalink
Change sleep time for sanitizer build type of gtest_compute_server (#…
Browse files Browse the repository at this point in the history
…9194)

ref #8285

Signed-off-by: yibin <[email protected]>
  • Loading branch information
yibin87 authored Jul 8, 2024
1 parent cc1bf74 commit ce637fe
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions dbms/src/Flash/tests/gtest_compute_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ class ComputeServerRunner : public DB::tests::MPPTaskTestUtils

#define WRAP_FOR_SERVER_TEST_END }

#ifdef SANITIZER
#define ADAPTIVE_SLEEP(X, Y) std::this_thread::sleep_for(Y)
#else
#define ADAPTIVE_SLEEP(X, Y) std::this_thread::sleep_for(X)
#endif // SANITIZER

TEST_F(ComputeServerRunner, simpleExchange)
try
{
Expand Down Expand Up @@ -995,7 +1001,7 @@ try
addOneQuery(i + 10, running_queries, gather_ids);
}
using namespace std::literals::chrono_literals;
std::this_thread::sleep_for(4s);
ADAPTIVE_SLEEP(4s, 8s);
ASSERT_TRUE(
TiFlashMetrics::instance()
.tiflash_task_scheduler.get(tiflash_task_scheduler_metrics::type_active_queries_count, "")
Expand All @@ -1007,7 +1013,7 @@ try
.Value()
== 0);
addOneQuery(1, running_queries, gather_ids);
std::this_thread::sleep_for(4s);
ADAPTIVE_SLEEP(4s, 8s);
ASSERT_TRUE(
TiFlashMetrics::instance()
.tiflash_task_scheduler.get(tiflash_task_scheduler_metrics::type_active_queries_count, "")
Expand All @@ -1030,7 +1036,7 @@ try
addOneQuery((i + 1) * 20, running_queries, gather_ids);
}
using namespace std::literals::chrono_literals;
std::this_thread::sleep_for(4s);
ADAPTIVE_SLEEP(4s, 8s);
ASSERT_TRUE(
TiFlashMetrics::instance()
.tiflash_task_scheduler.get(tiflash_task_scheduler_metrics::type_active_queries_count, "")
Expand All @@ -1042,7 +1048,7 @@ try
.Value()
== 0);
addOneQuery(30, running_queries, gather_ids);
std::this_thread::sleep_for(4s);
ADAPTIVE_SLEEP(4s, 8s);
ASSERT_TRUE(
TiFlashMetrics::instance()
.tiflash_task_scheduler.get(tiflash_task_scheduler_metrics::type_active_queries_count, "")
Expand All @@ -1056,7 +1062,7 @@ try
/// cancel 1 running query
MockComputeServerManager::instance().cancelGather(gather_ids[0]);
running_queries[0].join();
std::this_thread::sleep_for(4s);
ADAPTIVE_SLEEP(4s, 8s);
ASSERT_TRUE(
TiFlashMetrics::instance()
.tiflash_task_scheduler.get(tiflash_task_scheduler_metrics::type_active_queries_count, "")
Expand Down Expand Up @@ -1113,7 +1119,7 @@ try
single_gather_properties.gather_id = 1;
addOneGather(running_queries, gather_ids, single_gather_properties);
using namespace std::literals::chrono_literals;
std::this_thread::sleep_for(4s);
ADAPTIVE_SLEEP(4s, 8s);
/// 6 gathers, but two query
ASSERT_TRUE(
TiFlashMetrics::instance()
Expand Down

0 comments on commit ce637fe

Please sign in to comment.