diff --git a/presto-native-execution/presto_cpp/main/QueryContextManager.cpp b/presto-native-execution/presto_cpp/main/QueryContextManager.cpp index 3ffa0fc5d97bc..73af354a94ea5 100644 --- a/presto-native-execution/presto_cpp/main/QueryContextManager.cpp +++ b/presto-native-execution/presto_cpp/main/QueryContextManager.cpp @@ -83,13 +83,12 @@ std::shared_ptr QueryContextManager::findOrCreateQueryCtx( {entry.first, std::make_shared(entry.second)}); } - const int64_t maxTotalMemoryPerNode = getMaxMemoryPerNode( - kQueryMaxTotalMemoryPerNode, kDefaultMaxMemoryPerNode); - + const int64_t maxQueryMemoryPerNode = + getMaxMemoryPerNode(kQueryMaxMemoryPerNode, kDefaultMaxMemoryPerNode); auto pool = memory::getProcessDefaultMemoryManager().getRoot().addChild("query_root"); pool->setMemoryUsageTracker( - velox::memory::MemoryUsageTracker::create(maxTotalMemoryPerNode)); + velox::memory::MemoryUsageTracker::create(maxQueryMemoryPerNode)); auto queryCtx = std::make_shared( executor().get(), diff --git a/presto-native-execution/presto_cpp/main/QueryContextManager.h b/presto-native-execution/presto_cpp/main/QueryContextManager.h index c6ef47ef690d3..da461dc950973 100644 --- a/presto-native-execution/presto_cpp/main/QueryContextManager.h +++ b/presto-native-execution/presto_cpp/main/QueryContextManager.h @@ -127,8 +127,6 @@ class QueryContextManager { static constexpr const char* kQueryMaxMemoryPerNode = "query.max-memory-per-node"; - static constexpr const char* kQueryMaxTotalMemoryPerNode = - "query.max-total-memory-per-node"; static constexpr int64_t kDefaultMaxMemoryPerNode = std::numeric_limits::max(); diff --git a/presto-native-execution/presto_cpp/main/tests/TaskManagerTest.cpp b/presto-native-execution/presto_cpp/main/tests/TaskManagerTest.cpp index 5691b7ef40651..4c5f86cba2d8f 100644 --- a/presto-native-execution/presto_cpp/main/tests/TaskManagerTest.cpp +++ b/presto-native-execution/presto_cpp/main/tests/TaskManagerTest.cpp @@ -476,6 +476,7 @@ class TaskManagerTest : public testing::Test { } else { auto resultsOrFailures = fetchAllResults(outputTaskInfo->taskId, finalOutputType, allTaskIds); + EXPECT_TRUE(resultsOrFailures.status != nullptr); EXPECT_EQ(resultsOrFailures.status->state, protocol::TaskState::FAILED); for (const auto& taskId : allTaskIds) { taskManager_->deleteTask(taskId, true); @@ -512,13 +513,10 @@ class TaskManagerTest : public testing::Test { taskInfo->stats.peakTotalMemoryInBytes); } - void setMemoryLimits(uint64_t userMax, uint64_t totalMax) { + void setMemoryLimits(uint64_t maxMemory) { taskManager_->getQueryContextManager()->overrideProperties( QueryContextManager::kQueryMaxMemoryPerNode, - fmt::format("{}B", userMax)); - taskManager_->getQueryContextManager()->overrideProperties( - QueryContextManager::kQueryMaxTotalMemoryPerNode, - fmt::format("{}B", totalMax)); + fmt::format("{}B", maxMemory)); } // Setup the temporary spilling directory and initialize the system config @@ -696,15 +694,11 @@ TEST_F(TaskManagerTest, outOfQueryUserMemory) { auto [peakUser, peakTotal] = testCountAggregation("initial", filePaths); - setMemoryLimits(peakUser - 1, 20 * kGB); + setMemoryLimits(peakUser - 1); testCountAggregation("max-memory", filePaths, {}, true); - // Verify query.max-total-memory-per-node is respected. - setMemoryLimits(20 * kGB, peakTotal - 1); - testCountAggregation("max-total-memory", filePaths, {}, true); - // Verify the query is successful with some limits. - setMemoryLimits(20 * kGB, 20 * kGB); + setMemoryLimits(20 * kGB); testCountAggregation("test-count-aggr", filePaths); // Wait a little to allow for futures to complete.