Search in sources :

Example 6 with InMemoryNodeManager

use of com.facebook.presto.metadata.InMemoryNodeManager in project presto by prestodb.

the class TestAccessControlManager method registerBogusConnector.

private static ConnectorId registerBogusConnector(CatalogManager catalogManager, TransactionManager transactionManager, AccessControl accessControl, String catalogName) {
    ConnectorId connectorId = new ConnectorId(catalogName);
    Connector connector = new TpchConnectorFactory().create(catalogName, ImmutableMap.of(), new TestingConnectorContext());
    InMemoryNodeManager nodeManager = new InMemoryNodeManager();
    MetadataManager metadata = MetadataManager.createTestMetadataManager(catalogManager);
    ConnectorId systemId = createSystemTablesConnectorId(connectorId);
    catalogManager.registerCatalog(new Catalog(catalogName, connectorId, connector, createInformationSchemaConnectorId(connectorId), new InformationSchemaConnector(catalogName, nodeManager, metadata, accessControl), systemId, new SystemConnector(systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))));
    return connectorId;
}
Also used : SystemConnector(com.facebook.presto.connector.system.SystemConnector) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) Connector(com.facebook.presto.spi.connector.Connector) SystemConnector(com.facebook.presto.connector.system.SystemConnector) TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) MetadataManager(com.facebook.presto.metadata.MetadataManager) TestingConnectorContext(com.facebook.presto.testing.TestingConnectorContext) Catalog(com.facebook.presto.metadata.Catalog) ConnectorId.createInformationSchemaConnectorId(com.facebook.presto.connector.ConnectorId.createInformationSchemaConnectorId) ConnectorId.createSystemTablesConnectorId(com.facebook.presto.connector.ConnectorId.createSystemTablesConnectorId) ConnectorId(com.facebook.presto.connector.ConnectorId) InMemoryNodeManager(com.facebook.presto.metadata.InMemoryNodeManager)

Example 7 with InMemoryNodeManager

use of com.facebook.presto.metadata.InMemoryNodeManager in project presto by prestodb.

the class TestSourcePartitionedScheduler method testNoNodes.

@Test
public void testNoNodes() throws Exception {
    try {
        NodeTaskMap nodeTaskMap = new NodeTaskMap(finalizerService);
        InMemoryNodeManager nodeManager = new InMemoryNodeManager();
        NodeScheduler nodeScheduler = new NodeScheduler(new LegacyNetworkTopology(), nodeManager, new NodeSchedulerConfig().setIncludeCoordinator(false), nodeTaskMap);
        StageExecutionPlan plan = createPlan(createFixedSplitSource(20, TestingSplit::createRemoteSplit));
        SqlStageExecution stage = createSqlStageExecution(plan, nodeTaskMap);
        SourcePartitionedScheduler scheduler = new SourcePartitionedScheduler(stage, Iterables.getOnlyElement(plan.getSplitSources().keySet()), Iterables.getOnlyElement(plan.getSplitSources().values()), new DynamicSplitPlacementPolicy(nodeScheduler.createNodeSelector(CONNECTOR_ID), stage::getAllTasks), 2);
        scheduler.schedule();
        fail("expected PrestoException");
    } catch (PrestoException e) {
        assertEquals(e.getErrorCode(), NO_NODES_AVAILABLE.toErrorCode());
    }
}
Also used : NodeTaskMap(com.facebook.presto.execution.NodeTaskMap) StageExecutionPlan(com.facebook.presto.sql.planner.StageExecutionPlan) PrestoException(com.facebook.presto.spi.PrestoException) SqlStageExecution(com.facebook.presto.execution.SqlStageExecution) InMemoryNodeManager(com.facebook.presto.metadata.InMemoryNodeManager) Test(org.testng.annotations.Test)

Example 8 with InMemoryNodeManager

use of com.facebook.presto.metadata.InMemoryNodeManager in project presto by prestodb.

the class TestTransactionManager method registerConnector.

private static void registerConnector(CatalogManager catalogManager, TransactionManager transactionManager, String catalogName, ConnectorId connectorId, Connector connector) {
    ConnectorId systemId = createSystemTablesConnectorId(connectorId);
    InternalNodeManager nodeManager = new InMemoryNodeManager();
    MetadataManager metadata = MetadataManager.createTestMetadataManager(catalogManager);
    catalogManager.registerCatalog(new Catalog(catalogName, connectorId, connector, createInformationSchemaConnectorId(connectorId), new InformationSchemaConnector(catalogName, nodeManager, metadata, new AllowAllAccessControl()), systemId, new SystemConnector(systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))));
}
Also used : SystemConnector(com.facebook.presto.connector.system.SystemConnector) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) MetadataManager(com.facebook.presto.metadata.MetadataManager) AllowAllAccessControl(com.facebook.presto.security.AllowAllAccessControl) Catalog(com.facebook.presto.metadata.Catalog) ConnectorId.createInformationSchemaConnectorId(com.facebook.presto.connector.ConnectorId.createInformationSchemaConnectorId) ConnectorId.createSystemTablesConnectorId(com.facebook.presto.connector.ConnectorId.createSystemTablesConnectorId) ConnectorId(com.facebook.presto.connector.ConnectorId) InMemoryNodeManager(com.facebook.presto.metadata.InMemoryNodeManager)

Aggregations

InMemoryNodeManager (com.facebook.presto.metadata.InMemoryNodeManager)8 MetadataManager (com.facebook.presto.metadata.MetadataManager)4 Test (org.testng.annotations.Test)4 ConnectorId (com.facebook.presto.connector.ConnectorId)3 ConnectorId.createInformationSchemaConnectorId (com.facebook.presto.connector.ConnectorId.createInformationSchemaConnectorId)3 ConnectorId.createSystemTablesConnectorId (com.facebook.presto.connector.ConnectorId.createSystemTablesConnectorId)3 InformationSchemaConnector (com.facebook.presto.connector.informationSchema.InformationSchemaConnector)3 SystemConnector (com.facebook.presto.connector.system.SystemConnector)3 NodeScheduler (com.facebook.presto.execution.scheduler.NodeScheduler)3 NodeSchedulerConfig (com.facebook.presto.execution.scheduler.NodeSchedulerConfig)3 Catalog (com.facebook.presto.metadata.Catalog)3 PrestoNode (com.facebook.presto.metadata.PrestoNode)3 Node (com.facebook.presto.spi.Node)3 ImmutableList (com.google.common.collect.ImmutableList)3 BlockEncodingManager (com.facebook.presto.block.BlockEncodingManager)2 NodeTaskMap (com.facebook.presto.execution.NodeTaskMap)2 SqlStageExecution (com.facebook.presto.execution.SqlStageExecution)2 LegacyNetworkTopology (com.facebook.presto.execution.scheduler.LegacyNetworkTopology)2 InternalNodeManager (com.facebook.presto.metadata.InternalNodeManager)2 Connector (com.facebook.presto.spi.connector.Connector)2