use of com.facebook.presto.connector.system.SystemConnector in project presto by prestodb.
the class TestAnalyzer method createTestingCatalog.
private Catalog createTestingCatalog(String catalogName, ConnectorId connectorId) {
ConnectorId systemId = createSystemTablesConnectorId(connectorId);
Connector connector = createTestingConnector();
InternalNodeManager nodeManager = new InMemoryNodeManager();
return 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)));
}
use of com.facebook.presto.connector.system.SystemConnector 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, ImmutableList.of()), systemId, new SystemConnector(systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))));
return connectorId;
}
use of com.facebook.presto.connector.system.SystemConnector in project presto by prestodb.
the class ConnectorManager method addCatalogConnector.
private synchronized void addCatalogConnector(String catalogName, ConnectorId connectorId, ConnectorFactory factory, Map<String, String> properties) {
// create all connectors before adding, so a broken connector does not leave the system half updated
MaterializedConnector connector = new MaterializedConnector(connectorId, createConnector(connectorId, factory, properties));
MaterializedConnector informationSchemaConnector = new MaterializedConnector(createInformationSchemaConnectorId(connectorId), new InformationSchemaConnector(catalogName, nodeManager, metadataManager, accessControlManager, connector.getSessionProperties()));
ConnectorId systemId = createSystemTablesConnectorId(connectorId);
SystemTablesProvider systemTablesProvider;
if (nodeManager.getCurrentNode().isCoordinator()) {
systemTablesProvider = new DelegatingSystemTablesProvider(new StaticSystemTablesProvider(connector.getSystemTables()), new MetadataBasedSystemTablesProvider(metadataManager, catalogName));
} else {
systemTablesProvider = new StaticSystemTablesProvider(connector.getSystemTables());
}
MaterializedConnector systemConnector = new MaterializedConnector(systemId, new SystemConnector(systemId, nodeManager, systemTablesProvider, transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId), connector.getSessionProperties()));
Catalog catalog = new Catalog(catalogName, connector.getConnectorId(), connector.getConnector(), informationSchemaConnector.getConnectorId(), informationSchemaConnector.getConnector(), systemConnector.getConnectorId(), systemConnector.getConnector());
try {
addConnectorInternal(connector);
addConnectorInternal(informationSchemaConnector);
addConnectorInternal(systemConnector);
catalogManager.registerCatalog(catalog);
} catch (Throwable e) {
catalogManager.removeCatalog(catalog.getCatalogName());
removeConnectorInternal(systemConnector.getConnectorId());
removeConnectorInternal(informationSchemaConnector.getConnectorId());
removeConnectorInternal(connector.getConnectorId());
throw e;
}
}
use of com.facebook.presto.connector.system.SystemConnector 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(), ImmutableList.of()), systemId, new SystemConnector(systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))));
}
use of com.facebook.presto.connector.system.SystemConnector in project presto by prestodb.
the class AbstractAnalyzerTest method createTestingCatalog.
private Catalog createTestingCatalog(String catalogName, ConnectorId connectorId) {
ConnectorId systemId = createSystemTablesConnectorId(connectorId);
Connector connector = AbstractAnalyzerTest.createTestingConnector();
InternalNodeManager nodeManager = new InMemoryNodeManager();
return new Catalog(catalogName, connectorId, connector, createInformationSchemaConnectorId(connectorId), new InformationSchemaConnector(catalogName, nodeManager, metadata, accessControl, ImmutableList.of()), systemId, new SystemConnector(systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId)));
}
Aggregations