use of io.trino.metadata.InMemoryNodeManager in project trino by trinodb.
the class TestFullNodeCapableNodeAllocator method testAllocateSharedReleaseBeforeAcquired.
@Test(timeOut = TEST_TIMEOUT)
public void testAllocateSharedReleaseBeforeAcquired() throws Exception {
InMemoryNodeManager nodeManager = testingNodeManager(basicNodesMap(NODE_1));
setupNodeAllocatorService(nodeManager, 1);
try (NodeAllocator nodeAllocator = nodeAllocatorService.getNodeAllocator(Q1_SESSION)) {
// first two allocation should not block
NodeAllocator.NodeLease acquire1 = nodeAllocator.acquire(NO_REQUIREMENTS);
assertAcquired(acquire1, NODE_1);
NodeAllocator.NodeLease acquire2 = nodeAllocator.acquire(NO_REQUIREMENTS);
assertAcquired(acquire2, NODE_1);
// another two should block
NodeAllocator.NodeLease acquire3 = nodeAllocator.acquire(NO_REQUIREMENTS);
assertNotAcquired(acquire3);
NodeAllocator.NodeLease acquire4 = nodeAllocator.acquire(NO_REQUIREMENTS);
assertNotAcquired(acquire4);
// releasing a blocked one should not unblock anything
acquire3.release();
assertNotAcquired(acquire4);
// releasing an acquired one should unblock one which is still blocked
acquire2.release();
assertEventually(() -> assertAcquired(acquire4, NODE_1));
}
}
use of io.trino.metadata.InMemoryNodeManager in project trino by trinodb.
the class TestDetermineTableScanNodePartitioning method setUp.
@BeforeClass
public void setUp() {
tester = defaultRuleTester();
tester.getQueryRunner().createCatalog(MOCK_CATALOG, createMockFactory(), ImmutableMap.of());
tester.getQueryRunner().getNodePartitioningManager().addPartitioningProvider(new CatalogName(MOCK_CATALOG), new TestPartitioningProvider(new InMemoryNodeManager()));
}
use of io.trino.metadata.InMemoryNodeManager in project trino by trinodb.
the class TestHashJoinOperator method setUp.
@BeforeMethod
public void setUp() {
// Before/AfterMethod is chosen here because the executor needs to be shutdown
// after every single test case to terminate outstanding threads, if any.
// The line below is the same as newCachedThreadPool(daemonThreadsNamed(...)) except RejectionExecutionHandler.
// RejectionExecutionHandler is set to DiscardPolicy (instead of the default AbortPolicy) here.
// Otherwise, a large number of RejectedExecutionException will flood logging, resulting in Travis failure.
executor = new ThreadPoolExecutor(0, Integer.MAX_VALUE, 60L, SECONDS, new SynchronousQueue<>(), daemonThreadsNamed("test-executor-%s"), new ThreadPoolExecutor.DiscardPolicy());
scheduledExecutor = newScheduledThreadPool(2, daemonThreadsNamed(getClass().getSimpleName() + "-scheduledExecutor-%s"));
NodeScheduler nodeScheduler = new NodeScheduler(new UniformNodeSelectorFactory(new InMemoryNodeManager(), new NodeSchedulerConfig().setIncludeCoordinator(true), new NodeTaskMap(new FinalizerService())));
nodePartitioningManager = new NodePartitioningManager(nodeScheduler, new BlockTypeOperators(new TypeOperators()));
}
Aggregations