MemoryPool reserved = server.getLocalMemoryManager().getPool(RESERVED_POOL);
MemoryPool reserved = server.getLocalMemoryManager().getPool(RESERVED_POOL); MemoryPool system = server.getLocalMemoryManager().getPool(SYSTEM_POOL); MemoryPool reserved = worker.getLocalMemoryManager().getPool(RESERVED_POOL); assertEquals(reserved.getMaxBytes(), reserved.getFreeBytes()); MemoryPool general = worker.getLocalMemoryManager().getPool(GENERAL_POOL); MemoryPool system = worker.getLocalMemoryManager().getPool(SYSTEM_POOL); assertEquals(system.getMaxBytes(), system.getFreeBytes());
@Override public synchronized void updateMemoryPoolAssignments(MemoryPoolAssignmentsRequest assignments) { if (coordinatorId != null && coordinatorId.equals(assignments.getCoordinatorId()) && assignments.getVersion() <= currentMemoryPoolAssignmentVersion) { return; } currentMemoryPoolAssignmentVersion = assignments.getVersion(); if (coordinatorId != null && !coordinatorId.equals(assignments.getCoordinatorId())) { log.warn("Switching coordinator affinity from " + coordinatorId + " to " + assignments.getCoordinatorId()); } coordinatorId = assignments.getCoordinatorId(); for (MemoryPoolAssignment assignment : assignments.getAssignments()) { queryContexts.getUnchecked(assignment.getQueryId()).setMemoryPool(localMemoryManager.getPool(assignment.getPoolId())); } }
private void testNoLeak(@Language("SQL") String query) throws Exception { Map<String, String> properties = ImmutableMap.<String, String>builder() .put("task.verbose-stats", "true") .put("task.operator-pre-allocated-memory", "0B") .build(); try (DistributedQueryRunner queryRunner = createQueryRunner(TINY_SESSION, properties)) { executor.submit(() -> queryRunner.execute(query)).get(); List<QueryInfo> queryInfos = queryRunner.getCoordinator().getQueryManager().getAllQueryInfo(); for (QueryInfo info : queryInfos) { assertEquals(info.getState(), FINISHED); } // Make sure we didn't leak any memory on the workers for (TestingPrestoServer worker : queryRunner.getServers()) { MemoryPool reserved = worker.getLocalMemoryManager().getPool(RESERVED_POOL); assertEquals(reserved.getMaxBytes(), reserved.getFreeBytes()); MemoryPool general = worker.getLocalMemoryManager().getPool(GENERAL_POOL); assertEquals(general.getMaxBytes(), general.getFreeBytes()); MemoryPool system = worker.getLocalMemoryManager().getPool(SYSTEM_POOL); assertEquals(system.getMaxBytes(), system.getFreeBytes()); } } }