From 34cf2a167199f49370d509c3fb76e6c7dbead76e Mon Sep 17 00:00:00 2001 From: serxa Date: Sun, 3 Mar 2024 17:27:37 +0000 Subject: [PATCH] Fix scheduler fairness test --- src/Common/Scheduler/Nodes/tests/ResourceTest.h | 2 +- .../Scheduler/Nodes/tests/gtest_dynamic_resource_manager.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Common/Scheduler/Nodes/tests/ResourceTest.h b/src/Common/Scheduler/Nodes/tests/ResourceTest.h index ee168a76102..ea3f9edf765 100644 --- a/src/Common/Scheduler/Nodes/tests/ResourceTest.h +++ b/src/Common/Scheduler/Nodes/tests/ResourceTest.h @@ -282,7 +282,7 @@ struct ResourceTestManager : public ResourceTestBase return link_data[link]; } - // Use at least two threads for each queue to avoid queue being deactivated: + // Use exactly two threads for each queue to avoid queue being deactivated (happens with 1 thread) and reordering (happens with >2 threads): // while the first request is executing, the second request is in queue - holding it active. // use onEnqueue() and onExecute() functions for this purpose. void onEnqueue(ResourceLink link) diff --git a/src/Common/Scheduler/Nodes/tests/gtest_dynamic_resource_manager.cpp b/src/Common/Scheduler/Nodes/tests/gtest_dynamic_resource_manager.cpp index 961a3b6f713..dbf94df8c18 100644 --- a/src/Common/Scheduler/Nodes/tests/gtest_dynamic_resource_manager.cpp +++ b/src/Common/Scheduler/Nodes/tests/gtest_dynamic_resource_manager.cpp @@ -56,7 +56,7 @@ TEST(SchedulerDynamicResourceManager, Fairness) EXPECT_NEAR(cur_unfairness, 0, 1); }; - constexpr size_t threads_per_queue = 3; + constexpr size_t threads_per_queue = 2; int requests_per_thread = 100; ResourceTest t(2 * threads_per_queue + 1);