use of com.facebook.presto.spi.ConnectorSplitSource in project presto by prestodb.
the class TestRaptorSplitManager method testAssignRandomNodeWhenBackupAvailable.
@Test
public void testAssignRandomNodeWhenBackupAvailable() throws InterruptedException, URISyntaxException {
TestingNodeManager nodeManager = new TestingNodeManager();
RaptorConnectorId connectorId = new RaptorConnectorId("raptor");
NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
PrestoNode node = new PrestoNode(UUID.randomUUID().toString(), new URI("http://127.0.0.1/"), NodeVersion.UNKNOWN, false);
nodeManager.addNode(node);
RaptorSplitManager raptorSplitManagerWithBackup = new RaptorSplitManager(connectorId, nodeSupplier, shardManager, true);
deleteShardNodes();
ConnectorTableLayoutResult layout = getOnlyElement(metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty()));
ConnectorSplitSource partitionSplit = getSplits(raptorSplitManagerWithBackup, layout);
List<ConnectorSplit> batch = getFutureValue(partitionSplit.getNextBatch(1), PrestoException.class);
assertEquals(getOnlyElement(getOnlyElement(batch).getAddresses()), node.getHostAndPort());
}
use of com.facebook.presto.spi.ConnectorSplitSource in project presto by prestodb.
the class TestRaptorSplitManager method testNoNodes.
@Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "No nodes available to run query")
public void testNoNodes() throws InterruptedException, URISyntaxException {
deleteShardNodes();
RaptorSplitManager raptorSplitManagerWithBackup = new RaptorSplitManager(new RaptorConnectorId("fbraptor"), ImmutableSet::of, shardManager, true);
ConnectorTableLayoutResult layout = getOnlyElement(metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty()));
ConnectorSplitSource splitSource = getSplits(raptorSplitManagerWithBackup, layout);
getFutureValue(splitSource.getNextBatch(1000), PrestoException.class);
}
use of com.facebook.presto.spi.ConnectorSplitSource in project presto by prestodb.
the class TestRaptorSplitManager method testNoHostForShard.
@Test(expectedExceptions = PrestoException.class, expectedExceptionsMessageRegExp = "No host for shard .* found: \\[\\]")
public void testNoHostForShard() throws InterruptedException {
deleteShardNodes();
ConnectorTableLayoutResult layout = getOnlyElement(metadata.getTableLayouts(SESSION, tableHandle, Constraint.alwaysTrue(), Optional.empty()));
ConnectorSplitSource splitSource = getSplits(raptorSplitManager, layout);
getFutureValue(splitSource.getNextBatch(1000));
}
Aggregations