Skip to content

Commit

Permalink
Make default abort time ratio small in MockSharedArbitrationTest (fac…
Browse files Browse the repository at this point in the history
…ebookincubator#11464)

Summary:
As we see more tests timeout, we change the default abort threshold to be 1.5s (300s*0.005) so that abort triggered test timeout can be addressed in a single fix.

Pull Request resolved: facebookincubator#11464

Reviewed By: bikramSingh91

Differential Revision: D65565396

Pulled By: tanjialiang

fbshipit-source-id: ac67535df416f639b4255769448a5343af3448a4
  • Loading branch information
tanjialiang authored and facebook-github-bot committed Nov 11, 2024
1 parent bed3184 commit f69b852
Showing 1 changed file with 6 additions and 65 deletions.
71 changes: 6 additions & 65 deletions velox/common/memory/tests/MockSharedArbitratorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ constexpr uint64_t kFastExponentialGrowthCapacityLimit = 32 * MB;
constexpr double kSlowCapacityGrowPct = 0.25;
constexpr uint64_t kMemoryPoolMinFreeCapacity = 8 * MB;
constexpr double kMemoryPoolMinFreeCapacityPct = 0.25;
// constexpr uint64_t kMemoryPoolMinReclaimBytes = 8 * MB;
// constexpr uint64_t kMemoryPoolAbortCapacityLimit = 16 * MB;
constexpr double kGlobalArbitrationReclaimPct = 10;
constexpr double kMemoryReclaimThreadsHwMultiplier = 0.5;

Expand Down Expand Up @@ -450,7 +448,9 @@ class MockSharedArbitrationTest : public testing::Test {
bool globalArtbitrationEnabled = true,
uint64_t arbitrationTimeoutNs = 5 * 60 * 1'000'000'000UL,
bool globalArbitrationWithoutSpill = false,
double globalArbitrationAbortTimeRatio = 0.5) {
// Set the globalArbitrationAbortTimeRatio to be very small so that the
// query can be aborted sooner and the test would not timeout.
double globalArbitrationAbortTimeRatio = 0.005) {
MemoryManagerOptions options;
options.allocatorCapacity = memoryCapacity;
std::string arbitratorKind = "SHARED";
Expand Down Expand Up @@ -858,26 +858,6 @@ TEST_F(MockSharedArbitrationTest, asyncArbitrationWork) {

// Test different kinds of arbitraton failures.
TEST_F(MockSharedArbitrationTest, arbitrationFailures) {
// Set the globalArbitrationAbortTimeRatio to be very small so that the query
// can be aborted sooner and the test would not timeout.
setupMemory(
kMemoryCapacity,
0,
0,
0,
0,
0,
0,
0,
0,
0,
0,
kMemoryReclaimThreadsHwMultiplier,
nullptr,
true,
5 * 60 * 1'000'000'000UL,
false,
0.005);
// Local arbitration failure with exceeded capacity limit.
{
auto task = addTask(64 * MB);
Expand Down Expand Up @@ -3048,28 +3028,8 @@ TEST_F(MockSharedArbitrationTest, minReclaimBytes) {

for (const auto& testData : testSettings) {
SCOPED_TRACE(testData.debugString());

// Make simple settings to focus shrink capacity logic testing. Set the
// globalArbitrationAbortTimeRatio to be very small so that the query
// can be aborted sooner and the test would not timeout.
setupMemory(
memoryCapacity,
0,
0,
0,
0,
0,
0,
0,
testData.minReclaimBytes,
0,
0,
kMemoryReclaimThreadsHwMultiplier,
nullptr,
true,
5 * 60 * 1'000'000'000UL,
false,
0.005);
// Make simple settings to focus shrink capacity logic testing.
setupMemory(memoryCapacity, 0, 0, 0, 0, 0, 0, 0, testData.minReclaimBytes);
std::vector<TestTaskContainer> taskContainers;
for (const auto& testTask : testData.testTasks) {
auto task = addTask();
Expand Down Expand Up @@ -3943,26 +3903,7 @@ TEST_F(MockSharedArbitrationTest, arbitrationFailure) {

for (const auto& testData : testSettings) {
SCOPED_TRACE(testData.debugString());
// Set the globalArbitrationAbortTimeRatio to be very small so that the
// query can be aborted sooner and the test would not timeout.
setupMemory(
maxCapacity,
0,
initialCapacity,
0,
0,
0,
0,
0,
0,
0,
0,
kMemoryReclaimThreadsHwMultiplier,
nullptr,
true,
5 * 60 * 1'000'000'000UL,
false,
0.005);
setupMemory(maxCapacity, 0, initialCapacity);
std::shared_ptr<MockTask> requestorTask = addTask();
MockMemoryOperator* requestorOp = addMemoryOp(requestorTask, false);
requestorOp->allocate(testData.requestorCapacity);
Expand Down

0 comments on commit f69b852

Please sign in to comment.