io.prestosql.spi.NodeManager Java Examples

The following examples show how to use io.prestosql.spi.NodeManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ShardRecoveryManager.java    From presto with Apache License 2.0 6 votes vote down vote up
public ShardRecoveryManager(
        StorageService storageService,
        Optional<BackupStore> backupStore,
        NodeManager nodeManager,
        ShardManager shardManager,
        Duration missingShardDiscoveryInterval,
        int recoveryThreads)
{
    this.storageService = requireNonNull(storageService, "storageService is null");
    this.backupStore = requireNonNull(backupStore, "backupStore is null");
    this.nodeIdentifier = requireNonNull(nodeManager, "nodeManager is null").getCurrentNode().getNodeIdentifier();
    this.shardManager = requireNonNull(shardManager, "shardManager is null");
    this.missingShardDiscoveryInterval = requireNonNull(missingShardDiscoveryInterval, "missingShardDiscoveryInterval is null");
    this.shardQueue = new MissingShardsQueue(new PrioritizedFifoExecutor<>(executorService, recoveryThreads, new MissingShardComparator()));
    this.stats = new ShardRecoveryStats();
}
 
Example #2
Source File: DefaultThriftMetastoreClientFactory.java    From presto with Apache License 2.0 6 votes vote down vote up
@Inject
public DefaultThriftMetastoreClientFactory(
        ThriftMetastoreConfig config,
        HiveMetastoreAuthentication metastoreAuthentication,
        NodeManager nodeManager)
{
    this(
            buildSslContext(
                    config.isTlsEnabled(),
                    Optional.ofNullable(config.getKeystorePath()),
                    Optional.ofNullable(config.getKeystorePassword()),
                    config.getTruststorePath()),
            Optional.ofNullable(config.getSocksProxy()),
            config.getMetastoreTimeout(),
            metastoreAuthentication,
            nodeManager.getCurrentNode().getHost());
}
 
Example #3
Source File: JdbcConnectorFactory.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> requiredConfig, ConnectorContext context)
{
    requireNonNull(requiredConfig, "requiredConfig is null");

    Bootstrap app = new Bootstrap(
            binder -> binder.bind(TypeManager.class).toInstance(context.getTypeManager()),
            binder -> binder.bind(NodeManager.class).toInstance(context.getNodeManager()),
            binder -> binder.bind(VersionEmbedder.class).toInstance(context.getVersionEmbedder()),
            new JdbcModule(catalogName),
            moduleProvider.getModule(catalogName));

    Injector injector = app
            .strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(requiredConfig)
            .initialize();

    return injector.getInstance(JdbcConnector.class);
}
 
Example #4
Source File: JmxConnectorFactory.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    Bootstrap app = new Bootstrap(
            new MBeanServerModule(),
            binder -> {
                configBinder(binder).bindConfig(JmxConnectorConfig.class);
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
                binder.bind(JmxConnector.class).in(Scopes.SINGLETON);
                binder.bind(JmxHistoricalData.class).in(Scopes.SINGLETON);
                binder.bind(JmxMetadata.class).in(Scopes.SINGLETON);
                binder.bind(JmxSplitManager.class).in(Scopes.SINGLETON);
                binder.bind(JmxPeriodicSampler.class).in(Scopes.SINGLETON);
                binder.bind(JmxRecordSetProvider.class).in(Scopes.SINGLETON);
            });

    Injector injector = app
            .strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(JmxConnector.class);
}
 
Example #5
Source File: RubixInitializer.java    From presto with Apache License 2.0 6 votes vote down vote up
@VisibleForTesting
RubixInitializer(
        RetryDriver coordinatorRetryDriver,
        RubixConfig rubixConfig,
        NodeManager nodeManager,
        CatalogName catalogName,
        HdfsConfigurationInitializer hdfsConfigurationInitializer,
        Optional<ConfigurationInitializer> extraConfigInitializer)
{
    this.coordinatorRetryDriver = coordinatorRetryDriver;
    this.startServerOnCoordinator = rubixConfig.isStartServerOnCoordinator();
    this.parallelWarmupEnabled = rubixConfig.getReadMode().isParallelWarmupEnabled();
    this.cacheLocation = rubixConfig.getCacheLocation();
    this.cacheTtlMillis = rubixConfig.getCacheTtl().toMillis();
    this.diskUsagePercentage = rubixConfig.getDiskUsagePercentage();
    this.bookKeeperServerPort = rubixConfig.getBookKeeperServerPort();
    this.dataTransferServerPort = rubixConfig.getDataTransferServerPort();
    this.nodeManager = nodeManager;
    this.catalogName = catalogName;
    this.hdfsConfigurationInitializer = hdfsConfigurationInitializer;
    this.extraConfigInitializer = extraConfigInitializer;
}
 
Example #6
Source File: KafkaConnectorFactory.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            new JsonModule(),
            new KafkaConnectorModule(),
            extension,
            binder -> {
                binder.bind(ClassLoader.class).toInstance(KafkaConnectorFactory.class.getClassLoader());
                binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            });

    Injector injector = app
            .strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(KafkaConnector.class);
}
 
Example #7
Source File: LocalFileConnectorFactory.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            binder -> binder.bind(NodeManager.class).toInstance(context.getNodeManager()),
            new LocalFileModule());

    Injector injector = app
            .strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(LocalFileConnector.class);
}
 
Example #8
Source File: TestingElasticsearchConnectorFactory.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            new JsonModule(),
            new ElasticsearchConnectorModule(),
            binder -> {
                binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            });

    Injector injector = app.strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(ElasticsearchConnector.class);
}
 
Example #9
Source File: ShardOrganizationManager.java    From presto with Apache License 2.0 6 votes vote down vote up
@Inject
public ShardOrganizationManager(
        @ForMetadata IDBI dbi,
        NodeManager nodeManager,
        ShardManager shardManager,
        ShardOrganizer organizer,
        TemporalFunction temporalFunction,
        StorageManagerConfig config)
{
    this(dbi,
            nodeManager.getCurrentNode().getNodeIdentifier(),
            shardManager,
            organizer,
            temporalFunction,
            config.isOrganizationEnabled(),
            config.getOrganizationInterval(),
            config.getOrganizationDiscoveryInterval());
}
 
Example #10
Source File: ElasticsearchConnectorFactory.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            new MBeanModule(),
            new MBeanServerModule(),
            new ConnectorObjectNameGeneratorModule(catalogName, "io.prestosql.elasticsearch", "presto.plugin.elasticsearch"),
            new JsonModule(),
            new ElasticsearchConnectorModule(),
            binder -> {
                binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            });

    Injector injector = app.strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(ElasticsearchConnector.class);
}
 
Example #11
Source File: ShardCompactionManager.java    From presto with Apache License 2.0 6 votes vote down vote up
@Inject
public ShardCompactionManager(@ForMetadata IDBI dbi,
        NodeManager nodeManager,
        ShardManager shardManager,
        ShardOrganizer organizer,
        TemporalFunction temporalFunction,
        StorageManagerConfig config)
{
    this(dbi,
            nodeManager.getCurrentNode().getNodeIdentifier(),
            shardManager,
            organizer,
            temporalFunction,
            config.getCompactionInterval(),
            config.getMaxShardSize(),
            config.getMaxShardRows(),
            config.isCompactionEnabled());
}
 
Example #12
Source File: ShardCleaner.java    From presto with Apache License 2.0 6 votes vote down vote up
@Inject
public ShardCleaner(
        DaoSupplier<ShardDao> shardDaoSupplier,
        Ticker ticker,
        NodeManager nodeManager,
        StorageService storageService,
        Optional<BackupStore> backupStore,
        ShardCleanerConfig config)
{
    this(
            shardDaoSupplier,
            nodeManager.getCurrentNode().getNodeIdentifier(),
            nodeManager.getCurrentNode().isCoordinator(),
            ticker,
            storageService,
            backupStore,
            config.getMaxTransactionAge(),
            config.getTransactionCleanerInterval(),
            config.getLocalCleanerInterval(),
            config.getLocalCleanTime(),
            config.getBackupCleanerInterval(),
            config.getBackupCleanTime(),
            config.getBackupDeletionThreads(),
            config.getMaxCompletedTransactionAge());
}
 
Example #13
Source File: ShardEjector.java    From presto with Apache License 2.0 6 votes vote down vote up
@Inject
public ShardEjector(
        NodeManager nodeManager,
        NodeSupplier nodeSupplier,
        ShardManager shardManager,
        StorageService storageService,
        StorageManagerConfig config,
        Optional<BackupStore> backupStore,
        RaptorConnectorId connectorId)
{
    this(nodeManager.getCurrentNode().getNodeIdentifier(),
            nodeSupplier,
            shardManager,
            storageService,
            config.getShardEjectorInterval(),
            backupStore,
            connectorId.toString());
}
 
Example #14
Source File: BucketBalancer.java    From presto with Apache License 2.0 6 votes vote down vote up
@Inject
public BucketBalancer(
        NodeManager nodeManager,
        NodeSupplier nodeSupplier,
        ShardManager shardManager,
        BucketBalancerConfig config,
        BackupService backupService,
        RaptorConnectorId connectorId)
{
    this(nodeSupplier,
            shardManager,
            config.isBalancerEnabled(),
            config.getBalancerInterval(),
            backupService.isBackupAvailable(),
            nodeManager.getCurrentNode().isCoordinator(),
            connectorId.toString());
}
 
Example #15
Source File: BigQueryConnectorFactory.java    From presto with Apache License 2.0 6 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    Bootstrap app = new Bootstrap(
            new JsonModule(),
            new BigQueryConnectorModule(context.getNodeManager()),
            binder -> {
                binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                binder.bind(NodeManager.class).toInstance(context.getNodeManager());
            });

    Injector injector = app.strictConfig()
            .doNotInitializeLogging()
            .setRequiredConfigurationProperties(config)
            .initialize();

    return injector.getInstance(BigQueryConnector.class);
}
 
Example #16
Source File: BigQuerySplitManager.java    From presto with Apache License 2.0 5 votes vote down vote up
@Inject
public BigQuerySplitManager(
        BigQueryConfig config,
        BigQueryClient bigQueryClient,
        BigQueryStorageClientFactory bigQueryStorageClientFactory,
        NodeManager nodeManager)
{
    requireNonNull(config, "config cannot be null");

    this.bigQueryClient = requireNonNull(bigQueryClient, "bigQueryClient cannot be null");
    this.bigQueryStorageClientFactory = requireNonNull(bigQueryStorageClientFactory, "bigQueryStorageClientFactory cannot be null");
    this.parallelism = config.getParallelism();
    this.readSessionCreatorConfig = config.createReadSessionCreatorConfig();
    this.nodeManager = requireNonNull(nodeManager, "nodeManager cannot be null");
}
 
Example #17
Source File: TestShardEjector.java    From presto with Apache License 2.0 5 votes vote down vote up
private static NodeManager createNodeManager(String current, String... others)
{
    Node currentNode = createTestingNode(current);
    TestingNodeManager nodeManager = new TestingNodeManager(currentNode);
    for (String other : others) {
        nodeManager.addNode(createTestingNode(other));
    }
    return nodeManager;
}
 
Example #18
Source File: RubixInitializer.java    From presto with Apache License 2.0 5 votes vote down vote up
@Inject
public RubixInitializer(
        RubixConfig rubixConfig,
        NodeManager nodeManager,
        CatalogName catalogName,
        HdfsConfigurationInitializer hdfsConfigurationInitializer,
        @ForRubix Optional<ConfigurationInitializer> extraConfigInitializer)
{
    this(DEFAULT_COORDINATOR_RETRY_DRIVER, rubixConfig, nodeManager, catalogName, hdfsConfigurationInitializer, extraConfigInitializer);
}
 
Example #19
Source File: NodesSystemTable.java    From presto with Apache License 2.0 5 votes vote down vote up
@Inject
public NodesSystemTable(NodeManager nodeManager, ElasticsearchClient client)
{
    requireNonNull(nodeManager, "nodeManager is null");

    this.client = requireNonNull(client, "client is null");
    currentNode = nodeManager.getCurrentNode();
}
 
Example #20
Source File: KinesisConnectorFactory.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "catalogName is null");
    requireNonNull(config, "config is null");

    try {
        Bootstrap app = new Bootstrap(
                new JsonModule(),
                new KinesisModule(),
                binder -> {
                    binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                    binder.bind(NodeManager.class).toInstance(context.getNodeManager());
                    binder.bind(KinesisHandleResolver.class).toInstance(new KinesisHandleResolver());
                    binder.bind(KinesisClientProvider.class).to(KinesisClientManager.class).in(Scopes.SINGLETON);
                    binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KinesisStreamDescription>>>() {}).to(KinesisTableDescriptionSupplier.class).in(Scopes.SINGLETON);
                });

        Injector injector = app.strictConfig()
                .doNotInitializeLogging()
                .setRequiredConfigurationProperties(config)
                .initialize();

        KinesisConnector connector = injector.getInstance(KinesisConnector.class);
        return connector;
    }
    catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
 
Example #21
Source File: TestingKinesisConnectorFactory.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public Connector create(String catalogName, Map<String, String> config, ConnectorContext context)
{
    requireNonNull(catalogName, "connectorId is null");
    requireNonNull(config, "config is null");

    try {
        Bootstrap app = new Bootstrap(
                new JsonModule(),
                new KinesisModule(),
                binder -> {
                    binder.bind(TypeManager.class).toInstance(context.getTypeManager());
                    binder.bind(NodeManager.class).toInstance(context.getNodeManager());
                    binder.bind(KinesisHandleResolver.class).toInstance(new KinesisHandleResolver());
                    binder.bind(KinesisClientProvider.class).toInstance(kinesisClientProvider);
                    binder.bind(new TypeLiteral<Supplier<Map<SchemaTableName, KinesisStreamDescription>>>() {}).to(KinesisTableDescriptionSupplier.class).in(Scopes.SINGLETON);
                });

        Injector injector = app.strictConfig()
                .doNotInitializeLogging()
                .setRequiredConfigurationProperties(config)
                .initialize();

        KinesisConnector connector = injector.getInstance(KinesisConnector.class);
        return connector;
    }
    catch (Exception e) {
        throwIfUnchecked(e);
        throw new RuntimeException(e);
    }
}
 
Example #22
Source File: HivePageSinkProvider.java    From presto with Apache License 2.0 5 votes vote down vote up
@Inject
public HivePageSinkProvider(
        Set<HiveFileWriterFactory> fileWriterFactories,
        HdfsEnvironment hdfsEnvironment,
        PageSorter pageSorter,
        HiveMetastore metastore,
        PageIndexerFactory pageIndexerFactory,
        TypeManager typeManager,
        HiveConfig config,
        LocationService locationService,
        JsonCodec<PartitionUpdate> partitionUpdateCodec,
        NodeManager nodeManager,
        EventClient eventClient,
        HiveSessionProperties hiveSessionProperties,
        HiveWriterStats hiveWriterStats)
{
    this.fileWriterFactories = ImmutableSet.copyOf(requireNonNull(fileWriterFactories, "fileWriterFactories is null"));
    this.hdfsEnvironment = requireNonNull(hdfsEnvironment, "hdfsEnvironment is null");
    this.pageSorter = requireNonNull(pageSorter, "pageSorter is null");
    this.metastore = requireNonNull(metastore, "metastore is null");
    this.pageIndexerFactory = requireNonNull(pageIndexerFactory, "pageIndexerFactory is null");
    this.typeManager = requireNonNull(typeManager, "typeManager is null");
    this.maxOpenPartitions = config.getMaxPartitionsPerWriter();
    this.maxOpenSortFiles = config.getMaxOpenSortFiles();
    this.writerSortBufferSize = requireNonNull(config.getWriterSortBufferSize(), "writerSortBufferSize is null");
    this.immutablePartitions = config.isImmutablePartitions();
    this.locationService = requireNonNull(locationService, "locationService is null");
    this.writeVerificationExecutor = listeningDecorator(newFixedThreadPool(config.getWriteValidationThreads(), daemonThreadsNamed("hive-write-validation-%s")));
    this.partitionUpdateCodec = requireNonNull(partitionUpdateCodec, "partitionUpdateCodec is null");
    this.nodeManager = requireNonNull(nodeManager, "nodeManager is null");
    this.eventClient = requireNonNull(eventClient, "eventClient is null");
    this.hiveSessionProperties = requireNonNull(hiveSessionProperties, "hiveSessionProperties is null");
    this.hiveWriterStats = requireNonNull(hiveWriterStats, "stats is null");
    this.perTransactionMetastoreCacheMaximumSize = config.getPerTransactionMetastoreCacheMaximumSize();
}
 
Example #23
Source File: RedisJedisManager.java    From presto with Apache License 2.0 5 votes vote down vote up
@Inject
RedisJedisManager(
        RedisConnectorConfig redisConnectorConfig,
        NodeManager nodeManager)
{
    this.redisConnectorConfig = requireNonNull(redisConnectorConfig, "redisConfig is null");
    this.jedisPoolCache = CacheBuilder.newBuilder().build(CacheLoader.from(this::createConsumer));
    this.jedisPoolConfig = new JedisPoolConfig();
}
 
Example #24
Source File: TestHttpBackupStore.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setup()
{
    temporary = createTempDir();

    Map<String, String> properties = ImmutableMap.<String, String>builder()
            .put("backup.http.uri", "http://localhost:8080")
            .build();

    Bootstrap app = new Bootstrap(
            new TestingNodeModule(),
            new TestingHttpServerModule(),
            new JsonModule(),
            new JaxrsModule(),
            binder -> jaxrsBinder(binder).bind(TestingHttpBackupResource.class),
            binder -> binder.bind(NodeManager.class).toInstance(new TestingNodeManager()),
            override(new HttpBackupModule()).with(new TestingModule()));

    Injector injector = app
            .strictConfig()
            .setRequiredConfigurationProperties(properties)
            .doNotInitializeLogging()
            .quiet()
            .initialize();

    lifeCycleManager = injector.getInstance(LifeCycleManager.class);

    store = injector.getInstance(BackupStore.class);
}
 
Example #25
Source File: TestRaptorMetadata.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setupDatabase()
{
    TypeManager typeManager = new InternalTypeManager(createTestMetadataManager());
    dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + ThreadLocalRandom.current().nextLong());
    dbi.registerMapper(new TableColumn.Mapper(typeManager));
    dbi.registerMapper(new Distribution.Mapper(typeManager));
    dummyHandle = dbi.open();
    createTablesWithRetry(dbi);

    NodeManager nodeManager = new TestingNodeManager();
    NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
    shardManager = createShardManager(dbi, nodeSupplier, systemTicker());
    metadata = new RaptorMetadata(dbi, shardManager);
}
 
Example #26
Source File: AtopModule.java    From presto with Apache License 2.0 5 votes vote down vote up
public AtopModule(Class<? extends AtopFactory> atopFactoryClass, TypeManager typeManager, NodeManager nodeManager, String environment, String catalogName)
{
    this.atopFactoryClass = requireNonNull(atopFactoryClass, "atopFactoryClass is null");
    this.typeManager = requireNonNull(typeManager, "typeManager is null");
    this.nodeManager = requireNonNull(nodeManager, "nodeManager is null");
    this.environment = requireNonNull(environment, "environment is null");
    this.catalogName = requireNonNull(catalogName, "catalogName is null");
}
 
Example #27
Source File: AtopModule.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(Binder binder)
{
    binder.bind(TypeManager.class).toInstance(typeManager);
    binder.bind(NodeManager.class).toInstance(nodeManager);
    binder.bind(Environment.class).toInstance(new Environment(environment));
    binder.bind(CatalogName.class).toInstance(new CatalogName(catalogName));
    binder.bind(AtopConnector.class).in(Scopes.SINGLETON);
    binder.bind(AtopMetadata.class).in(Scopes.SINGLETON);
    binder.bind(AtopSplitManager.class).in(Scopes.SINGLETON);
    binder.bind(AtopFactory.class).to(atopFactoryClass).in(Scopes.SINGLETON);
    binder.bind(AtopPageSourceProvider.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(AtopConnectorConfig.class);
}
 
Example #28
Source File: AtopSplitManager.java    From presto with Apache License 2.0 5 votes vote down vote up
@Inject
public AtopSplitManager(NodeManager nodeManager, AtopConnectorConfig config)
{
    this.nodeManager = requireNonNull(nodeManager, "nodeManager is null");
    requireNonNull(config, "config is null");
    timeZone = config.getTimeZoneId();
    maxHistoryDays = config.getMaxHistoryDays();
}
 
Example #29
Source File: PinotModule.java    From presto with Apache License 2.0 5 votes vote down vote up
@Override
public void configure(Binder binder)
{
    configBinder(binder).bindConfig(PinotConfig.class);
    binder.bind(PinotConnector.class).in(Scopes.SINGLETON);
    binder.bind(PinotMetadata.class).in(Scopes.SINGLETON);
    binder.bind(PinotSplitManager.class).in(Scopes.SINGLETON);
    binder.bind(PinotPageSourceProvider.class).in(Scopes.SINGLETON);
    binder.bind(PinotClient.class).in(Scopes.SINGLETON);
    binder.bind(Executor.class).annotatedWith(ForPinot.class)
            .toInstance(newCachedThreadPool(threadsNamed("pinot-metadata-fetcher-" + catalogName)));

    binder.bind(PinotSessionProperties.class).in(Scopes.SINGLETON);
    binder.bind(PinotNodePartitioningProvider.class).in(Scopes.SINGLETON);
    httpClientBinder(binder).bindHttpClient("pinot", ForPinot.class)
            .withConfigDefaults(cfg -> {
                cfg.setIdleTimeout(new Duration(300, SECONDS));
                cfg.setConnectTimeout(new Duration(300, SECONDS));
                cfg.setRequestTimeout(new Duration(300, SECONDS));
                cfg.setMaxConnectionsPerServer(250);
                cfg.setMaxContentLength(DataSize.of(32, MEGABYTE));
                cfg.setSelectorCount(10);
                cfg.setTimeoutThreads(8);
                cfg.setTimeoutConcurrency(4);
            });

    jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class);
    jsonBinder(binder).addDeserializerBinding(DataSchema.class).to(DataSchemaDeserializer.class);
    PinotClient.addJsonBinders(jsonCodecBinder(binder));
    binder.bind(MBeanServer.class).toInstance(new RebindSafeMBeanServer(getPlatformMBeanServer()));
    binder.bind(TypeManager.class).toInstance(typeManager);
    binder.bind(NodeManager.class).toInstance(nodeManager);
    binder.bind(PinotMetrics.class).in(Scopes.SINGLETON);
    newExporter(binder).export(PinotMetrics.class).as(generatedNameOf(PinotMetrics.class, catalogName));
    binder.bind(ConnectorNodePartitioningProvider.class).to(PinotNodePartitioningProvider.class).in(Scopes.SINGLETON);
}
 
Example #30
Source File: TestRaptorConnector.java    From presto with Apache License 2.0 5 votes vote down vote up
@BeforeMethod
public void setup()
{
    TypeManager typeManager = new InternalTypeManager(createTestMetadataManager());
    DBI dbi = new DBI("jdbc:h2:mem:test" + System.nanoTime() + ThreadLocalRandom.current().nextLong());
    dbi.registerMapper(new TableColumn.Mapper(typeManager));
    dummyHandle = dbi.open();
    metadataDao = dbi.onDemand(MetadataDao.class);
    createTablesWithRetry(dbi);
    dataDir = Files.createTempDir();

    RaptorConnectorId connectorId = new RaptorConnectorId("test");
    NodeManager nodeManager = new TestingNodeManager();
    NodeSupplier nodeSupplier = nodeManager::getWorkerNodes;
    ShardManager shardManager = createShardManager(dbi);
    StorageManager storageManager = createOrcStorageManager(dbi, dataDir);
    StorageManagerConfig config = new StorageManagerConfig();
    connector = new RaptorConnector(
            new LifeCycleManager(ImmutableList.of(), null),
            new TestingNodeManager(),
            new RaptorMetadataFactory(dbi, shardManager),
            new RaptorSplitManager(connectorId, nodeSupplier, shardManager, false),
            new RaptorPageSourceProvider(storageManager),
            new RaptorPageSinkProvider(storageManager,
                    new PagesIndexPageSorter(new PagesIndex.TestingFactory(false)),
                    new TemporalFunction(DateTimeZone.forID("America/Los_Angeles")),
                    config),
            new RaptorNodePartitioningProvider(nodeSupplier),
            new RaptorSessionProperties(config),
            new RaptorTableProperties(typeManager),
            ImmutableSet.of(),
            new AllowAllAccessControl(),
            dbi);
}