private synchronized void registerCatalog(Catalog catalog) { catalogsByConnectorId.put(catalog.getConnectorId(), catalog); catalogsByConnectorId.put(catalog.getInformationSchemaId(), catalog); catalogsByConnectorId.put(catalog.getSystemTablesId(), catalog); }
public synchronized ConnectorTransactionMetadata createConnectorTransactionMetadata(ConnectorId connectorId, Catalog catalog) { Connector connector = catalog.getConnector(connectorId); ConnectorTransactionMetadata transactionMetadata = new ConnectorTransactionMetadata(connectorId, connector, beginTransaction(connector)); checkState(connectorIdToMetadata.put(connectorId, transactionMetadata) == null); return transactionMetadata; }
private synchronized Map<String, ConnectorId> getCatalogNames() { // todo if repeatable read, this must be recorded Map<String, ConnectorId> catalogNames = new HashMap<>(); catalogByName.values().stream() .filter(Optional::isPresent) .map(Optional::get) .forEach(catalog -> catalogNames.put(catalog.getCatalogName(), catalog.getConnectorId())); catalogManager.getCatalogs().stream() .forEach(catalog -> catalogNames.putIfAbsent(catalog.getCatalogName(), catalog.getConnectorId())); return ImmutableMap.copyOf(catalogNames); }
sessionPropertyManager.addConnectorSessionProperties(bogusTestingCatalog.getConnectorId(), TEST_CATALOG_PROPERTIES);
public static Catalog createBogusTestingCatalog(String catalogName) { ConnectorId connectorId = new ConnectorId(catalogName); return new Catalog( catalogName, connectorId, createTestSessionConnector(), createInformationSchemaConnectorId(connectorId), createTestSessionConnector(), createSystemTablesConnectorId(connectorId), createTestSessionConnector()); }
transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))); Catalog catalog = new Catalog( catalogName, connector.getConnectorId(), catalogManager.removeCatalog(catalog.getCatalogName()); removeConnectorInternal(systemConnector.getConnectorId()); removeConnectorInternal(informationSchemaConnector.getConnectorId());
public synchronized void registerCatalog(Catalog catalog) { requireNonNull(catalog, "catalog is null"); checkState(catalogs.put(catalog.getCatalogName(), catalog) == null, "Catalog '%s' is already registered", catalog.getCatalogName()); }
@BeforeMethod public void setUp() { catalogManager = new CatalogManager(); typeManager = new TypeRegistry(); transactionManager = createTestTransactionManager(catalogManager); tablePropertyManager = new TablePropertyManager(); columnPropertyManager = new ColumnPropertyManager(); testCatalog = createBogusTestingCatalog(CATALOG_NAME); catalogManager.registerCatalog(testCatalog); tablePropertyManager.addProperties(testCatalog.getConnectorId(), ImmutableList.of(stringProperty("baz", "test property", null, false))); columnPropertyManager.addProperties(testCatalog.getConnectorId(), ImmutableList.of()); testSession = testSessionBuilder() .setTransactionId(transactionManager.beginTransaction(false)) .build(); metadata = new MockMetadata(typeManager, tablePropertyManager, columnPropertyManager, testCatalog.getConnectorId()); }
public static Catalog createBogusTestingCatalog(String catalogName) { ConnectorId connectorId = new ConnectorId(catalogName); return new Catalog( catalogName, connectorId, createTestSessionConnector(), createInformationSchemaConnectorId(connectorId), createTestSessionConnector(), createSystemTablesConnectorId(connectorId), createTestSessionConnector()); }
transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))); Catalog catalog = new Catalog( catalogName, connector.getConnectorId(), catalogManager.removeCatalog(catalog.getCatalogName()); removeConnectorInternal(systemConnector.getConnectorId()); removeConnectorInternal(informationSchemaConnector.getConnectorId());
public synchronized void registerCatalog(Catalog catalog) { requireNonNull(catalog, "catalog is null"); checkState(catalogs.put(catalog.getCatalogName(), catalog) == null, "Catalog '%s' is already registered", catalog.getCatalogName()); }
private synchronized void registerCatalog(Catalog catalog) { catalogsByConnectorId.put(catalog.getConnectorId(), catalog); catalogsByConnectorId.put(catalog.getInformationSchemaId(), catalog); catalogsByConnectorId.put(catalog.getSystemTablesId(), catalog); }
@BeforeMethod public void setUp() { catalogManager = new CatalogManager(); typeManager = new TypeRegistry(); transactionManager = createTestTransactionManager(catalogManager); tablePropertyManager = new TablePropertyManager(); columnPropertyManager = new ColumnPropertyManager(); testCatalog = createBogusTestingCatalog(CATALOG_NAME); catalogManager.registerCatalog(testCatalog); tablePropertyManager.addProperties(testCatalog.getConnectorId(), ImmutableList.of(stringProperty("baz", "test property", null, false))); columnPropertyManager.addProperties(testCatalog.getConnectorId(), ImmutableList.of()); testSession = testSessionBuilder() .setTransactionId(transactionManager.beginTransaction(false)) .build(); metadata = new MockMetadata(typeManager, tablePropertyManager, columnPropertyManager, testCatalog.getConnectorId()); }
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))); }
private synchronized Map<String, ConnectorId> getCatalogNames() { // todo if repeatable read, this must be recorded Map<String, ConnectorId> catalogNames = new HashMap<>(); catalogByName.values().stream() .filter(Optional::isPresent) .map(Optional::get) .forEach(catalog -> catalogNames.put(catalog.getCatalogName(), catalog.getConnectorId())); catalogManager.getCatalogs().stream() .forEach(catalog -> catalogNames.putIfAbsent(catalog.getCatalogName(), catalog.getConnectorId())); return ImmutableMap.copyOf(catalogNames); }
public synchronized ConnectorTransactionMetadata createConnectorTransactionMetadata(ConnectorId connectorId, Catalog catalog) { Connector connector = catalog.getConnector(connectorId); ConnectorTransactionMetadata transactionMetadata = new ConnectorTransactionMetadata(connectorId, connector, beginTransaction(connector)); checkState(connectorIdToMetadata.put(connectorId, transactionMetadata) == null); return transactionMetadata; }
private synchronized CatalogMetadata getTransactionCatalogMetadata(ConnectorId connectorId) { checkOpenTransaction(); CatalogMetadata catalogMetadata = this.catalogMetadata.get(connectorId); if (catalogMetadata == null) { Catalog catalog = catalogsByConnectorId.get(connectorId); verify(catalog != null, "Unknown connectorId: %s", connectorId); ConnectorTransactionMetadata metadata = createConnectorTransactionMetadata(catalog.getConnectorId(), catalog); ConnectorTransactionMetadata informationSchema = createConnectorTransactionMetadata(catalog.getInformationSchemaId(), catalog); ConnectorTransactionMetadata systemTables = createConnectorTransactionMetadata(catalog.getSystemTablesId(), catalog); catalogMetadata = new CatalogMetadata( metadata.getConnectorId(), metadata.getConnectorMetadata(), metadata.getTransactionHandle(), informationSchema.getConnectorId(), informationSchema.getConnectorMetadata(), informationSchema.getTransactionHandle(), systemTables.getConnectorId(), systemTables.getConnectorMetadata(), systemTables.getTransactionHandle()); this.catalogMetadata.put(catalog.getConnectorId(), catalogMetadata); this.catalogMetadata.put(catalog.getInformationSchemaId(), catalogMetadata); this.catalogMetadata.put(catalog.getSystemTablesId(), catalogMetadata); } return catalogMetadata; }
public TestResetSessionTask() { CatalogManager catalogManager = new CatalogManager(); transactionManager = createTestTransactionManager(catalogManager); accessControl = new AllowAllAccessControl(); metadata = new MetadataManager( new FeaturesConfig(), new TypeRegistry(), new BlockEncodingManager(new TypeRegistry()), new SessionPropertyManager(), new SchemaPropertyManager(), new TablePropertyManager(), new ColumnPropertyManager(), new AnalyzePropertyManager(), transactionManager); metadata.getSessionPropertyManager().addSystemSessionProperty(stringProperty( "foo", "test property", null, false)); Catalog bogusTestingCatalog = createBogusTestingCatalog(CATALOG_NAME); metadata.getSessionPropertyManager().addConnectorSessionProperties(bogusTestingCatalog.getConnectorId(), ImmutableList.of(stringProperty( "baz", "test property", null, false))); catalogManager.registerCatalog(bogusTestingCatalog); }
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))); }
metadata.getAnalyzePropertyManager().addProperties(TPCH_CONNECTOR_ID, tpchTestCatalog.getConnector(TPCH_CONNECTOR_ID).getAnalyzeProperties());