Search in sources :

Example 1 with NodeVersion

use of com.facebook.presto.client.NodeVersion in project presto by prestodb.

the class PrestoSparkModule method setup.

@Override
protected void setup(Binder binder) {
    // configs
    // TODO: decouple configuration properties that don't make sense on Spark
    configBinder(binder).bindConfig(NodeSchedulerConfig.class);
    configBinder(binder).bindConfig(SimpleTtlNodeSelectorConfig.class);
    configBinder(binder).bindConfig(QueryManagerConfig.class);
    configBinder(binder).bindConfigGlobalDefaults(QueryManagerConfig.class, PrestoSparkSettingsRequirements::setDefaults);
    configBinder(binder).bindConfig(FeaturesConfig.class);
    configBinder(binder).bindConfigGlobalDefaults(FeaturesConfig.class, PrestoSparkSettingsRequirements::setDefaults);
    configBinder(binder).bindConfig(MemoryManagerConfig.class);
    configBinder(binder).bindConfig(TaskManagerConfig.class);
    configBinder(binder).bindConfig(TransactionManagerConfig.class);
    configBinder(binder).bindConfig(NodeMemoryConfig.class);
    configBinder(binder).bindConfig(WarningCollectorConfig.class);
    configBinder(binder).bindConfig(NodeSpillConfig.class);
    configBinder(binder).bindConfig(CompilerConfig.class);
    configBinder(binder).bindConfig(SqlEnvironmentConfig.class);
    configBinder(binder).bindConfig(StaticFunctionNamespaceStoreConfig.class);
    configBinder(binder).bindConfig(PrestoSparkConfig.class);
    configBinder(binder).bindConfig(TracingConfig.class);
    // json codecs
    jsonCodecBinder(binder).bindJsonCodec(ViewDefinition.class);
    jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(PrestoSparkTaskDescriptor.class);
    jsonCodecBinder(binder).bindJsonCodec(PlanFragment.class);
    jsonCodecBinder(binder).bindJsonCodec(TaskSource.class);
    jsonCodecBinder(binder).bindJsonCodec(TableCommitContext.class);
    jsonCodecBinder(binder).bindJsonCodec(ExplainAnalyzeContext.class);
    jsonCodecBinder(binder).bindJsonCodec(ExecutionFailureInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(StageInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(OperatorStats.class);
    jsonCodecBinder(binder).bindJsonCodec(QueryInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(PrestoSparkQueryStatusInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(PrestoSparkQueryData.class);
    jsonCodecBinder(binder).bindListJsonCodec(TaskMemoryReservationSummary.class);
    // smile codecs
    smileCodecBinder(binder).bindSmileCodec(TaskSource.class);
    smileCodecBinder(binder).bindSmileCodec(TaskInfo.class);
    PrestoSparkConfig prestoSparkConfig = buildConfigObject(PrestoSparkConfig.class);
    if (prestoSparkConfig.isSmileSerializationEnabled()) {
        binder.bind(new TypeLiteral<Codec<TaskSource>>() {
        }).to(new TypeLiteral<SmileCodec<TaskSource>>() {
        }).in(Scopes.SINGLETON);
        binder.bind(new TypeLiteral<Codec<TaskInfo>>() {
        }).to(new TypeLiteral<SmileCodec<TaskInfo>>() {
        }).in(Scopes.SINGLETON);
    } else {
        binder.bind(new TypeLiteral<Codec<TaskSource>>() {
        }).to(new TypeLiteral<JsonCodec<TaskSource>>() {
        }).in(Scopes.SINGLETON);
        binder.bind(new TypeLiteral<Codec<TaskInfo>>() {
        }).to(new TypeLiteral<JsonCodec<TaskInfo>>() {
        }).in(Scopes.SINGLETON);
    }
    // index manager
    binder.bind(IndexManager.class).in(Scopes.SINGLETON);
    // handle resolver
    binder.install(new HandleJsonModule());
    // plugin manager
    configBinder(binder).bindConfig(PluginManagerConfig.class);
    binder.bind(PluginManager.class).in(Scopes.SINGLETON);
    // catalog manager
    binder.bind(StaticCatalogStore.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(StaticCatalogStoreConfig.class);
    // catalog
    binder.bind(ConnectorManager.class).in(Scopes.SINGLETON);
    binder.bind(CatalogManager.class).in(Scopes.SINGLETON);
    // property managers
    binder.bind(SessionPropertyManager.class).toProvider(PrestoSparkSessionPropertyManagerProvider.class).in(Scopes.SINGLETON);
    binder.bind(SystemSessionProperties.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkSessionProperties.class).in(Scopes.SINGLETON);
    binder.bind(SessionPropertyDefaults.class).in(Scopes.SINGLETON);
    binder.bind(SchemaPropertyManager.class).in(Scopes.SINGLETON);
    binder.bind(TablePropertyManager.class).in(Scopes.SINGLETON);
    binder.bind(ColumnPropertyManager.class).in(Scopes.SINGLETON);
    binder.bind(AnalyzePropertyManager.class).in(Scopes.SINGLETON);
    binder.bind(QuerySessionSupplier.class).in(Scopes.SINGLETON);
    // block encodings
    binder.bind(BlockEncodingManager.class).in(Scopes.SINGLETON);
    binder.bind(BlockEncodingSerde.class).to(BlockEncodingManager.class).in(Scopes.SINGLETON);
    newSetBinder(binder, BlockEncoding.class);
    jsonBinder(binder).addSerializerBinding(Block.class).to(BlockJsonSerde.Serializer.class);
    jsonBinder(binder).addDeserializerBinding(Block.class).to(BlockJsonSerde.Deserializer.class);
    // metadata
    binder.bind(FunctionAndTypeManager.class).in(Scopes.SINGLETON);
    binder.bind(MetadataManager.class).in(Scopes.SINGLETON);
    binder.bind(Metadata.class).to(MetadataManager.class).in(Scopes.SINGLETON);
    binder.bind(StaticFunctionNamespaceStore.class).in(Scopes.SINGLETON);
    // type
    newSetBinder(binder, Type.class);
    binder.bind(TypeManager.class).to(FunctionAndTypeManager.class).in(Scopes.SINGLETON);
    jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class);
    // PageSorter
    binder.bind(PageSorter.class).to(PagesIndexPageSorter.class).in(Scopes.SINGLETON);
    // PageIndexer
    binder.bind(PagesIndex.Factory.class).to(PagesIndex.DefaultFactory.class);
    binder.bind(PageIndexerFactory.class).to(GroupByHashPageIndexerFactory.class).in(Scopes.SINGLETON);
    // compilers
    binder.bind(JoinFilterFunctionCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(JoinFilterFunctionCompiler.class).withGeneratedName();
    binder.bind(JoinCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(JoinCompiler.class).withGeneratedName();
    binder.bind(OrderingCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(OrderingCompiler.class).withGeneratedName();
    binder.bind(LookupJoinOperators.class).in(Scopes.SINGLETON);
    binder.bind(DomainTranslator.class).to(RowExpressionDomainTranslator.class).in(Scopes.SINGLETON);
    binder.bind(PredicateCompiler.class).to(RowExpressionPredicateCompiler.class).in(Scopes.SINGLETON);
    binder.bind(DeterminismEvaluator.class).to(RowExpressionDeterminismEvaluator.class).in(Scopes.SINGLETON);
    binder.bind(ExpressionCompiler.class).in(Scopes.SINGLETON);
    binder.bind(PageFunctionCompiler.class).in(Scopes.SINGLETON);
    // split manager
    binder.bind(SplitManager.class).in(Scopes.SINGLETON);
    // partitioning provider manager
    binder.bind(PartitioningProviderManager.class).in(Scopes.SINGLETON);
    // executors
    ExecutorService executor = newCachedThreadPool(daemonThreadsNamed("presto-spark-executor-%s"));
    binder.bind(Executor.class).toInstance(executor);
    binder.bind(ExecutorService.class).toInstance(executor);
    binder.bind(ScheduledExecutorService.class).toInstance(newScheduledThreadPool(0, daemonThreadsNamed("presto-spark-scheduled-executor-%s")));
    // task executor
    binder.bind(EmbedVersion.class).in(Scopes.SINGLETON);
    binder.bind(MultilevelSplitQueue.class).in(Scopes.SINGLETON);
    binder.bind(TaskExecutor.class).in(Scopes.SINGLETON);
    // data stream provider
    binder.bind(PageSourceManager.class).in(Scopes.SINGLETON);
    binder.bind(PageSourceProvider.class).to(PageSourceManager.class).in(Scopes.SINGLETON);
    // connector distributed metadata manager
    binder.bind(ConnectorMetadataUpdaterManager.class).in(Scopes.SINGLETON);
    // page sink provider
    binder.bind(PageSinkManager.class).in(Scopes.SINGLETON);
    binder.bind(PageSinkProvider.class).to(PageSinkManager.class).in(Scopes.SINGLETON);
    // query explainer
    binder.bind(QueryExplainer.class).in(Scopes.SINGLETON);
    // parser
    binder.bind(PlanChecker.class).in(Scopes.SINGLETON);
    binder.bind(SqlParser.class).in(Scopes.SINGLETON);
    binder.bind(SqlParserOptions.class).toInstance(sqlParserOptions);
    // planner
    binder.bind(PlanFragmenter.class).in(Scopes.SINGLETON);
    binder.bind(PlanOptimizers.class).in(Scopes.SINGLETON);
    binder.bind(ConnectorPlanOptimizerManager.class).in(Scopes.SINGLETON);
    binder.bind(LocalExecutionPlanner.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(FileFragmentResultCacheConfig.class);
    binder.bind(FragmentCacheStats.class).in(Scopes.SINGLETON);
    binder.bind(IndexJoinLookupStats.class).in(Scopes.SINGLETON);
    binder.bind(QueryIdGenerator.class).in(Scopes.SINGLETON);
    binder.bind(QueryPreparer.class).in(Scopes.SINGLETON);
    jsonBinder(binder).addKeySerializerBinding(VariableReferenceExpression.class).to(VariableReferenceExpressionSerializer.class);
    jsonBinder(binder).addKeyDeserializerBinding(VariableReferenceExpression.class).to(VariableReferenceExpressionDeserializer.class);
    // statistics calculator / cost calculator
    binder.install(new StatsCalculatorModule());
    binder.bind(CostCalculator.class).to(CostCalculatorUsingExchanges.class).in(Scopes.SINGLETON);
    binder.bind(CostCalculator.class).annotatedWith(CostCalculator.EstimatedExchanges.class).to(CostCalculatorWithEstimatedExchanges.class).in(Scopes.SINGLETON);
    binder.bind(CostComparator.class).in(Scopes.SINGLETON);
    // JMX (Do not export to the real MXBean server, as the Presto context may be created multiple times per JVM)
    binder.bind(MBeanServer.class).toInstance(new TestingMBeanServer());
    binder.bind(MBeanExporter.class).in(Scopes.SINGLETON);
    // spill
    binder.bind(SpillerFactory.class).to(GenericSpillerFactory.class).in(Scopes.SINGLETON);
    binder.bind(SingleStreamSpillerFactory.class).to(TempStorageSingleStreamSpillerFactory.class).in(Scopes.SINGLETON);
    binder.bind(PartitioningSpillerFactory.class).to(GenericPartitioningSpillerFactory.class).in(Scopes.SINGLETON);
    binder.bind(SpillerStats.class).in(Scopes.SINGLETON);
    binder.bind(StandaloneSpillerFactory.class).to(TempStorageStandaloneSpillerFactory.class).in(Scopes.SINGLETON);
    // monitoring
    jsonCodecBinder(binder).bindJsonCodec(OperatorInfo.class);
    binder.bind(QueryMonitor.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(QueryMonitorConfig.class);
    binder.bind(SplitMonitor.class).in(Scopes.SINGLETON);
    // Determine the NodeVersion
    ServerConfig serverConfig = buildConfigObject(ServerConfig.class);
    NodeVersion nodeVersion = new NodeVersion(serverConfig.getPrestoVersion());
    binder.bind(NodeVersion.class).toInstance(nodeVersion);
    // Support DDL statements. Helper class binds DDL statements to DataDefinitionTasks
    PrestoDataDefBindingHelper.bindDDLDefinitionTasks(binder);
    // TODO: Decouple node specific system tables
    binder.bind(QueryManager.class).to(PrestoSparkQueryManager.class).in(Scopes.SINGLETON);
    binder.bind(TaskManager.class).to(PrestoSparkTaskManager.class).in(Scopes.SINGLETON);
    binder.install(new SystemConnectorModule());
    // TODO: support explain analyze for Spark
    binder.bind(new TypeLiteral<Optional<ExplainAnalyzeContext>>() {
    }).toInstance(Optional.of(new ExplainAnalyzeContext((queryId) -> {
        throw new UnsupportedOperationException("explain analyze is not supported");
    })));
    // TODO: support CBO, supply real nodes count
    binder.bind(TaskCountEstimator.class).toInstance(new TaskCountEstimator(() -> 1000));
    // TODO: Decouple and remove: required by ConnectorManager
    binder.bind(InternalNodeManager.class).toInstance(new PrestoSparkInternalNodeManager());
    // TODO: Decouple and remove: required by PluginManager
    binder.bind(InternalResourceGroupManager.class).in(Scopes.SINGLETON);
    binder.bind(ResourceGroupManager.class).to(InternalResourceGroupManager.class);
    binder.bind(new TypeLiteral<ResourceGroupManager<?>>() {
    }).to(new TypeLiteral<InternalResourceGroupManager<?>>() {
    });
    binder.bind(LegacyResourceGroupConfigurationManager.class).in(Scopes.SINGLETON);
    binder.bind(ClusterMemoryPoolManager.class).toInstance(((poolId, listener) -> {
    }));
    binder.bind(QueryPrerequisitesManager.class).in(Scopes.SINGLETON);
    binder.bind(ResourceGroupService.class).to(NoopResourceGroupService.class).in(Scopes.SINGLETON);
    binder.bind(NodeTtlFetcherManager.class).to(ThrowingNodeTtlFetcherManager.class).in(Scopes.SINGLETON);
    binder.bind(ClusterTtlProviderManager.class).to(ThrowingClusterTtlProviderManager.class).in(Scopes.SINGLETON);
    // TODO: Decouple and remove: required by SessionPropertyDefaults, PluginManager, InternalResourceGroupManager, ConnectorManager
    configBinder(binder).bindConfig(NodeConfig.class);
    binder.bind(NodeInfo.class).in(Scopes.SINGLETON);
    // TODO: Decouple and remove: required by LocalExecutionPlanner, PlanFragmenter
    binder.bind(NodePartitioningManager.class).to(PrestoSparkNodePartitioningManager.class).in(Scopes.SINGLETON);
    // TODO: Decouple and remove: required by PluginManager
    install(new ServerSecurityModule());
    // spark specific
    binder.bind(SparkProcessType.class).toInstance(sparkProcessType);
    binder.bind(PrestoSparkExecutionExceptionFactory.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkSettingsRequirements.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkQueryPlanner.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkPlanFragmenter.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkRddFactory.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkTaskExecutorFactory.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkQueryExecutionFactory.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkService.class).in(Scopes.SINGLETON);
    binder.bind(PrestoSparkBroadcastTableCacheManager.class).in(Scopes.SINGLETON);
    newSetBinder(binder, PrestoSparkServiceWaitTimeMetrics.class);
    // extra credentials and authenticator for Presto-on-Spark
    newSetBinder(binder, PrestoSparkCredentialsProvider.class);
    newSetBinder(binder, PrestoSparkAuthenticatorProvider.class);
}
Also used : RowExpressionDomainTranslator(com.facebook.presto.sql.relational.RowExpressionDomainTranslator) PrestoSparkBroadcastTableCacheManager(com.facebook.presto.spark.execution.PrestoSparkBroadcastTableCacheManager) PageSourceProvider(com.facebook.presto.split.PageSourceProvider) PluginManagerConfig(com.facebook.presto.server.PluginManagerConfig) QueryExplainer(com.facebook.presto.sql.analyzer.QueryExplainer) ConnectorPlanOptimizerManager(com.facebook.presto.sql.planner.ConnectorPlanOptimizerManager) ColumnPropertyManager(com.facebook.presto.metadata.ColumnPropertyManager) OperatorStats(com.facebook.presto.operator.OperatorStats) StageInfo(com.facebook.presto.execution.StageInfo) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) PrestoSparkTaskExecutorFactory(com.facebook.presto.spark.execution.PrestoSparkTaskExecutorFactory) ThrowingNodeTtlFetcherManager(com.facebook.presto.ttl.nodettlfetchermanagers.ThrowingNodeTtlFetcherManager) NoOpFragmentResultCacheManager(com.facebook.presto.operator.NoOpFragmentResultCacheManager) Executors.newScheduledThreadPool(java.util.concurrent.Executors.newScheduledThreadPool) Multibinder.newSetBinder(com.google.inject.multibindings.Multibinder.newSetBinder) QueryManagerConfig(com.facebook.presto.execution.QueryManagerConfig) FragmentResultCacheManager(com.facebook.presto.operator.FragmentResultCacheManager) PageFunctionCompiler(com.facebook.presto.sql.gen.PageFunctionCompiler) TaskCountEstimator(com.facebook.presto.cost.TaskCountEstimator) ServerConfig(com.facebook.presto.server.ServerConfig) ClusterTtlProviderManager(com.facebook.presto.ttl.clusterttlprovidermanagers.ClusterTtlProviderManager) SessionPropertyDefaults(com.facebook.presto.server.SessionPropertyDefaults) EmbedVersion(com.facebook.presto.version.EmbedVersion) PageSinkManager(com.facebook.presto.split.PageSinkManager) GenericPartitioningSpillerFactory(com.facebook.presto.spiller.GenericPartitioningSpillerFactory) StandaloneSpillerFactory(com.facebook.presto.spiller.StandaloneSpillerFactory) DomainTranslator(com.facebook.presto.spi.relation.DomainTranslator) QueryIdGenerator(com.facebook.presto.execution.QueryIdGenerator) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) QueryInfo(com.facebook.presto.execution.QueryInfo) QueryPreparer(com.facebook.presto.execution.QueryPreparer) QuerySessionSupplier(com.facebook.presto.server.QuerySessionSupplier) RowExpressionPredicateCompiler(com.facebook.presto.sql.gen.RowExpressionPredicateCompiler) FragmentCacheStats(com.facebook.presto.operator.FragmentCacheStats) PrestoSparkInternalNodeManager(com.facebook.presto.spark.node.PrestoSparkInternalNodeManager) TaskMemoryReservationSummary(com.facebook.presto.operator.TaskMemoryReservationSummary) InternalResourceGroupManager(com.facebook.presto.execution.resourceGroups.InternalResourceGroupManager) TypeLiteral(com.google.inject.TypeLiteral) SystemSessionProperties(com.facebook.presto.SystemSessionProperties) ViewDefinition(com.facebook.presto.metadata.ViewDefinition) NodeInfo(com.facebook.airlift.node.NodeInfo) TempStorageSingleStreamSpillerFactory(com.facebook.presto.spiller.TempStorageSingleStreamSpillerFactory) VariableReferenceExpressionDeserializer(com.facebook.presto.sql.Serialization.VariableReferenceExpressionDeserializer) ResourceGroupService(com.facebook.presto.resourcemanager.ResourceGroupService) LookupJoinOperators(com.facebook.presto.operator.LookupJoinOperators) NoopResourceGroupService(com.facebook.presto.resourcemanager.NoopResourceGroupService) StaticCatalogStore(com.facebook.presto.metadata.StaticCatalogStore) Binder(com.google.inject.Binder) BlockEncodingManager(com.facebook.presto.common.block.BlockEncodingManager) StaticFunctionNamespaceStoreConfig(com.facebook.presto.metadata.StaticFunctionNamespaceStoreConfig) GenericSpillerFactory(com.facebook.presto.spiller.GenericSpillerFactory) PrestoSparkExecutionExceptionFactory(com.facebook.presto.spark.execution.PrestoSparkExecutionExceptionFactory) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) PageSorter(com.facebook.presto.spi.PageSorter) AnalyzePropertyManager(com.facebook.presto.metadata.AnalyzePropertyManager) IndexJoinLookupStats(com.facebook.presto.operator.index.IndexJoinLookupStats) TransactionManager(com.facebook.presto.transaction.TransactionManager) ResourceGroupManager(com.facebook.presto.execution.resourceGroups.ResourceGroupManager) LegacyResourceGroupConfigurationManager(com.facebook.presto.execution.resourceGroups.LegacyResourceGroupConfigurationManager) TableCommitContext(com.facebook.presto.operator.TableCommitContext) ClusterMemoryPoolManager(com.facebook.presto.spi.memory.ClusterMemoryPoolManager) PrestoSparkTaskManager(com.facebook.presto.spark.node.PrestoSparkTaskManager) Executor(java.util.concurrent.Executor) SystemConnectorModule(com.facebook.presto.connector.system.SystemConnectorModule) ServerSecurityModule(com.facebook.presto.server.security.ServerSecurityModule) PrestoSparkNodePartitioningManager(com.facebook.presto.spark.node.PrestoSparkNodePartitioningManager) PrestoSparkRddFactory(com.facebook.presto.spark.planner.PrestoSparkRddFactory) SqlEnvironmentConfig(com.facebook.presto.sql.SqlEnvironmentConfig) PrestoSparkQueryPlanner(com.facebook.presto.spark.planner.PrestoSparkQueryPlanner) MultilevelSplitQueue(com.facebook.presto.execution.executor.MultilevelSplitQueue) StaticCatalogStoreConfig(com.facebook.presto.metadata.StaticCatalogStoreConfig) TracingConfig(com.facebook.presto.tracing.TracingConfig) QueryMonitor(com.facebook.presto.event.QueryMonitor) StaticFunctionNamespaceStore(com.facebook.presto.metadata.StaticFunctionNamespaceStore) InMemoryTransactionManager(com.facebook.presto.transaction.InMemoryTransactionManager) ThrowingClusterTtlProviderManager(com.facebook.presto.ttl.clusterttlprovidermanagers.ThrowingClusterTtlProviderManager) SpillerFactory(com.facebook.presto.spiller.SpillerFactory) TaskInfo(com.facebook.presto.execution.TaskInfo) Metadata(com.facebook.presto.metadata.Metadata) PartitioningProviderManager(com.facebook.presto.sql.planner.PartitioningProviderManager) FunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager) PartitioningSpillerFactory(com.facebook.presto.spiller.PartitioningSpillerFactory) LocalExecutionPlanner(com.facebook.presto.sql.planner.LocalExecutionPlanner) JsonCodec(com.facebook.airlift.json.JsonCodec) TablePropertyManager(com.facebook.presto.metadata.TablePropertyManager) SqlParserOptions(com.facebook.presto.sql.parser.SqlParserOptions) CostCalculatorWithEstimatedExchanges(com.facebook.presto.cost.CostCalculatorWithEstimatedExchanges) MetadataManager(com.facebook.presto.metadata.MetadataManager) TestingMBeanServer(org.weakref.jmx.testing.TestingMBeanServer) BlockEncoding(com.facebook.presto.common.block.BlockEncoding) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) NodeVersion(com.facebook.presto.client.NodeVersion) TaskManagerConfig(com.facebook.presto.execution.TaskManagerConfig) PagesIndex(com.facebook.presto.operator.PagesIndex) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) PlanFragment(com.facebook.presto.sql.planner.PlanFragment) WarningCollectorConfig(com.facebook.presto.execution.warnings.WarningCollectorConfig) AbstractConfigurationAwareModule(com.facebook.airlift.configuration.AbstractConfigurationAwareModule) ConnectorManager(com.facebook.presto.connector.ConnectorManager) PrestoSparkPlanFragmenter(com.facebook.presto.spark.planner.PrestoSparkPlanFragmenter) ExportBinder.newExporter(org.weakref.jmx.guice.ExportBinder.newExporter) HandleJsonModule(com.facebook.presto.metadata.HandleJsonModule) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) OperatorInfo(com.facebook.presto.operator.OperatorInfo) ConnectorMetadataUpdaterManager(com.facebook.presto.metadata.ConnectorMetadataUpdaterManager) FileFragmentResultCacheManager(com.facebook.presto.operator.FileFragmentResultCacheManager) NodeMemoryConfig(com.facebook.presto.memory.NodeMemoryConfig) CostCalculatorUsingExchanges(com.facebook.presto.cost.CostCalculatorUsingExchanges) CostCalculator(com.facebook.presto.cost.CostCalculator) JsonBinder.jsonBinder(com.facebook.airlift.json.JsonBinder.jsonBinder) NodeSpillConfig(com.facebook.presto.spiller.NodeSpillConfig) SplitManager(com.facebook.presto.split.SplitManager) SchemaPropertyManager(com.facebook.presto.metadata.SchemaPropertyManager) Codec(com.facebook.airlift.json.Codec) NodeConfig(com.facebook.airlift.node.NodeConfig) SqlParser(com.facebook.presto.sql.parser.SqlParser) PrestoSparkQueryManager(com.facebook.presto.spark.node.PrestoSparkQueryManager) Threads.daemonThreadsNamed(com.facebook.airlift.concurrent.Threads.daemonThreadsNamed) TransactionManagerConfig(com.facebook.presto.transaction.TransactionManagerConfig) NodeTtlFetcherManager(com.facebook.presto.ttl.nodettlfetchermanagers.NodeTtlFetcherManager) TaskExecutor(com.facebook.presto.execution.executor.TaskExecutor) Optional(java.util.Optional) PredicateCompiler(com.facebook.presto.spi.relation.PredicateCompiler) PluginManager(com.facebook.presto.server.PluginManager) ExpressionCompiler(com.facebook.presto.sql.gen.ExpressionCompiler) NodeSchedulerConfig(com.facebook.presto.execution.scheduler.NodeSchedulerConfig) DeterminismEvaluator(com.facebook.presto.spi.relation.DeterminismEvaluator) VariableReferenceExpressionSerializer(com.facebook.presto.sql.Serialization.VariableReferenceExpressionSerializer) SpillerStats(com.facebook.presto.spiller.SpillerStats) QueryPrerequisitesManager(com.facebook.presto.dispatcher.QueryPrerequisitesManager) PrestoDataDefBindingHelper(com.facebook.presto.util.PrestoDataDefBindingHelper) SimpleTtlNodeSelectorConfig(com.facebook.presto.execution.scheduler.nodeSelection.SimpleTtlNodeSelectorConfig) PageSinkProvider(com.facebook.presto.split.PageSinkProvider) RowExpressionDeterminismEvaluator(com.facebook.presto.sql.relational.RowExpressionDeterminismEvaluator) ExecutionFailureInfo(com.facebook.presto.execution.ExecutionFailureInfo) QueryManager(com.facebook.presto.execution.QueryManager) Singleton(javax.inject.Singleton) JsonCodecBinder.jsonCodecBinder(com.facebook.airlift.json.JsonCodecBinder.jsonCodecBinder) BlockJsonSerde(com.facebook.presto.block.BlockJsonSerde) BlockEncodingSerde(com.facebook.presto.common.block.BlockEncodingSerde) StatsCalculatorModule(com.facebook.presto.cost.StatsCalculatorModule) PlanOptimizers(com.facebook.presto.sql.planner.PlanOptimizers) PageSourceManager(com.facebook.presto.split.PageSourceManager) OrderingCompiler(com.facebook.presto.sql.gen.OrderingCompiler) PlanChecker(com.facebook.presto.sql.planner.sanity.PlanChecker) SmileCodec(com.facebook.airlift.json.smile.SmileCodec) TypeManager(com.facebook.presto.common.type.TypeManager) TaskManager(com.facebook.presto.execution.TaskManager) FileFragmentResultCacheConfig(com.facebook.presto.operator.FileFragmentResultCacheConfig) MBeanServer(javax.management.MBeanServer) Objects.requireNonNull(java.util.Objects.requireNonNull) ExplainAnalyzeContext(com.facebook.presto.execution.ExplainAnalyzeContext) IndexManager(com.facebook.presto.index.IndexManager) MemoryManagerConfig(com.facebook.presto.memory.MemoryManagerConfig) SingleStreamSpillerFactory(com.facebook.presto.spiller.SingleStreamSpillerFactory) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) PlanFragmenter(com.facebook.presto.sql.planner.PlanFragmenter) Type(com.facebook.presto.common.type.Type) ExecutorService(java.util.concurrent.ExecutorService) PagesIndexPageSorter(com.facebook.presto.PagesIndexPageSorter) NodePartitioningManager(com.facebook.presto.sql.planner.NodePartitioningManager) SplitMonitor(com.facebook.presto.event.SplitMonitor) TaskSource(com.facebook.presto.execution.TaskSource) JoinFilterFunctionCompiler(com.facebook.presto.sql.gen.JoinFilterFunctionCompiler) SparkProcessType(com.facebook.presto.spark.classloader_interface.SparkProcessType) Scopes(com.google.inject.Scopes) Executors.newFixedThreadPool(java.util.concurrent.Executors.newFixedThreadPool) CatalogManager(com.facebook.presto.metadata.CatalogManager) CompilerConfig(com.facebook.presto.sql.planner.CompilerConfig) SmileCodecBinder.smileCodecBinder(com.facebook.airlift.json.smile.SmileCodecBinder.smileCodecBinder) TypeDeserializer(com.facebook.presto.type.TypeDeserializer) Provides(com.google.inject.Provides) QueryMonitorConfig(com.facebook.presto.event.QueryMonitorConfig) Executors.newCachedThreadPool(java.util.concurrent.Executors.newCachedThreadPool) CostComparator(com.facebook.presto.cost.CostComparator) ConfigBinder.configBinder(com.facebook.airlift.configuration.ConfigBinder.configBinder) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) Block(com.facebook.presto.common.block.Block) MBeanExporter(org.weakref.jmx.MBeanExporter) JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) PrestoSparkPlanFragmenter(com.facebook.presto.spark.planner.PrestoSparkPlanFragmenter) RowExpressionPredicateCompiler(com.facebook.presto.sql.gen.RowExpressionPredicateCompiler) PrestoSparkQueryManager(com.facebook.presto.spark.node.PrestoSparkQueryManager) PrestoSparkTaskExecutorFactory(com.facebook.presto.spark.execution.PrestoSparkTaskExecutorFactory) PluginManager(com.facebook.presto.server.PluginManager) NodeVersion(com.facebook.presto.client.NodeVersion) JsonCodec(com.facebook.airlift.json.JsonCodec) Codec(com.facebook.airlift.json.Codec) SmileCodec(com.facebook.airlift.json.smile.SmileCodec) FunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager) QueryMonitor(com.facebook.presto.event.QueryMonitor) TestingMBeanServer(org.weakref.jmx.testing.TestingMBeanServer) MBeanServer(javax.management.MBeanServer) PrestoSparkRddFactory(com.facebook.presto.spark.planner.PrestoSparkRddFactory) JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) GenericPartitioningSpillerFactory(com.facebook.presto.spiller.GenericPartitioningSpillerFactory) QueryExplainer(com.facebook.presto.sql.analyzer.QueryExplainer) SessionPropertyDefaults(com.facebook.presto.server.SessionPropertyDefaults) StaticFunctionNamespaceStore(com.facebook.presto.metadata.StaticFunctionNamespaceStore) SparkProcessType(com.facebook.presto.spark.classloader_interface.SparkProcessType) BlockJsonSerde(com.facebook.presto.block.BlockJsonSerde) NoopResourceGroupService(com.facebook.presto.resourcemanager.NoopResourceGroupService) MultilevelSplitQueue(com.facebook.presto.execution.executor.MultilevelSplitQueue) NodeInfo(com.facebook.airlift.node.NodeInfo) PlanOptimizers(com.facebook.presto.sql.planner.PlanOptimizers) CostCalculatorWithEstimatedExchanges(com.facebook.presto.cost.CostCalculatorWithEstimatedExchanges) ClusterMemoryPoolManager(com.facebook.presto.spi.memory.ClusterMemoryPoolManager) PrestoSparkPlanFragmenter(com.facebook.presto.spark.planner.PrestoSparkPlanFragmenter) PlanFragmenter(com.facebook.presto.sql.planner.PlanFragmenter) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) PagesIndex(com.facebook.presto.operator.PagesIndex) PrestoSparkBroadcastTableCacheManager(com.facebook.presto.spark.execution.PrestoSparkBroadcastTableCacheManager) Executor(java.util.concurrent.Executor) TaskExecutor(com.facebook.presto.execution.executor.TaskExecutor) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) PrestoSparkInternalNodeManager(com.facebook.presto.spark.node.PrestoSparkInternalNodeManager) TypeLiteral(com.google.inject.TypeLiteral) ServerSecurityModule(com.facebook.presto.server.security.ServerSecurityModule) SystemConnectorModule(com.facebook.presto.connector.system.SystemConnectorModule) CostCalculatorUsingExchanges(com.facebook.presto.cost.CostCalculatorUsingExchanges) EmbedVersion(com.facebook.presto.version.EmbedVersion) ExplainAnalyzeContext(com.facebook.presto.execution.ExplainAnalyzeContext) PrestoSparkQueryPlanner(com.facebook.presto.spark.planner.PrestoSparkQueryPlanner) LookupJoinOperators(com.facebook.presto.operator.LookupJoinOperators) PageSinkManager(com.facebook.presto.split.PageSinkManager) StatsCalculatorModule(com.facebook.presto.cost.StatsCalculatorModule) CostComparator(com.facebook.presto.cost.CostComparator) TaskCountEstimator(com.facebook.presto.cost.TaskCountEstimator) RowExpressionDeterminismEvaluator(com.facebook.presto.sql.relational.RowExpressionDeterminismEvaluator) ConnectorPlanOptimizerManager(com.facebook.presto.sql.planner.ConnectorPlanOptimizerManager) JoinFilterFunctionCompiler(com.facebook.presto.sql.gen.JoinFilterFunctionCompiler) RowExpressionDomainTranslator(com.facebook.presto.sql.relational.RowExpressionDomainTranslator) TempStorageSingleStreamSpillerFactory(com.facebook.presto.spiller.TempStorageSingleStreamSpillerFactory) ConnectorManager(com.facebook.presto.connector.ConnectorManager) CatalogManager(com.facebook.presto.metadata.CatalogManager) Type(com.facebook.presto.common.type.Type) SparkProcessType(com.facebook.presto.spark.classloader_interface.SparkProcessType) ConnectorMetadataUpdaterManager(com.facebook.presto.metadata.ConnectorMetadataUpdaterManager) TablePropertyManager(com.facebook.presto.metadata.TablePropertyManager) TaskSource(com.facebook.presto.execution.TaskSource) PrestoSparkTaskManager(com.facebook.presto.spark.node.PrestoSparkTaskManager) QueryIdGenerator(com.facebook.presto.execution.QueryIdGenerator) PageSourceManager(com.facebook.presto.split.PageSourceManager) TaskInfo(com.facebook.presto.execution.TaskInfo) PagesIndexPageSorter(com.facebook.presto.PagesIndexPageSorter) QueryPreparer(com.facebook.presto.execution.QueryPreparer) ServerConfig(com.facebook.presto.server.ServerConfig) PrestoSparkNodePartitioningManager(com.facebook.presto.spark.node.PrestoSparkNodePartitioningManager) OrderingCompiler(com.facebook.presto.sql.gen.OrderingCompiler) LegacyResourceGroupConfigurationManager(com.facebook.presto.execution.resourceGroups.LegacyResourceGroupConfigurationManager) SqlParserOptions(com.facebook.presto.sql.parser.SqlParserOptions) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) TestingMBeanServer(org.weakref.jmx.testing.TestingMBeanServer) QueryPrerequisitesManager(com.facebook.presto.dispatcher.QueryPrerequisitesManager) StaticCatalogStore(com.facebook.presto.metadata.StaticCatalogStore) IndexJoinLookupStats(com.facebook.presto.operator.index.IndexJoinLookupStats) SplitMonitor(com.facebook.presto.event.SplitMonitor) MBeanExporter(org.weakref.jmx.MBeanExporter) SqlParser(com.facebook.presto.sql.parser.SqlParser) InternalResourceGroupManager(com.facebook.presto.execution.resourceGroups.InternalResourceGroupManager) ResourceGroupManager(com.facebook.presto.execution.resourceGroups.ResourceGroupManager) ThrowingNodeTtlFetcherManager(com.facebook.presto.ttl.nodettlfetchermanagers.ThrowingNodeTtlFetcherManager) SpillerStats(com.facebook.presto.spiller.SpillerStats) IndexManager(com.facebook.presto.index.IndexManager) TaskExecutor(com.facebook.presto.execution.executor.TaskExecutor) BlockEncodingManager(com.facebook.presto.common.block.BlockEncodingManager) PlanChecker(com.facebook.presto.sql.planner.sanity.PlanChecker) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) Block(com.facebook.presto.common.block.Block) ExpressionCompiler(com.facebook.presto.sql.gen.ExpressionCompiler) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) ThrowingClusterTtlProviderManager(com.facebook.presto.ttl.clusterttlprovidermanagers.ThrowingClusterTtlProviderManager) ColumnPropertyManager(com.facebook.presto.metadata.ColumnPropertyManager) PageFunctionCompiler(com.facebook.presto.sql.gen.PageFunctionCompiler) PartitioningProviderManager(com.facebook.presto.sql.planner.PartitioningProviderManager) PrestoSparkTaskExecutorFactory(com.facebook.presto.spark.execution.PrestoSparkTaskExecutorFactory) GenericPartitioningSpillerFactory(com.facebook.presto.spiller.GenericPartitioningSpillerFactory) StandaloneSpillerFactory(com.facebook.presto.spiller.StandaloneSpillerFactory) TempStorageSingleStreamSpillerFactory(com.facebook.presto.spiller.TempStorageSingleStreamSpillerFactory) GenericSpillerFactory(com.facebook.presto.spiller.GenericSpillerFactory) PrestoSparkExecutionExceptionFactory(com.facebook.presto.spark.execution.PrestoSparkExecutionExceptionFactory) PrestoSparkRddFactory(com.facebook.presto.spark.planner.PrestoSparkRddFactory) SpillerFactory(com.facebook.presto.spiller.SpillerFactory) PartitioningSpillerFactory(com.facebook.presto.spiller.PartitioningSpillerFactory) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) SingleStreamSpillerFactory(com.facebook.presto.spiller.SingleStreamSpillerFactory) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) HandleJsonModule(com.facebook.presto.metadata.HandleJsonModule) InternalResourceGroupManager(com.facebook.presto.execution.resourceGroups.InternalResourceGroupManager) SchemaPropertyManager(com.facebook.presto.metadata.SchemaPropertyManager) FragmentCacheStats(com.facebook.presto.operator.FragmentCacheStats) GenericSpillerFactory(com.facebook.presto.spiller.GenericSpillerFactory) AnalyzePropertyManager(com.facebook.presto.metadata.AnalyzePropertyManager) LocalExecutionPlanner(com.facebook.presto.sql.planner.LocalExecutionPlanner) PrestoSparkExecutionExceptionFactory(com.facebook.presto.spark.execution.PrestoSparkExecutionExceptionFactory) PrestoSparkInternalNodeManager(com.facebook.presto.spark.node.PrestoSparkInternalNodeManager) SplitManager(com.facebook.presto.split.SplitManager) CostCalculator(com.facebook.presto.cost.CostCalculator) QuerySessionSupplier(com.facebook.presto.server.QuerySessionSupplier) MetadataManager(com.facebook.presto.metadata.MetadataManager) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutorService(java.util.concurrent.ExecutorService) SystemSessionProperties(com.facebook.presto.SystemSessionProperties)

Example 2 with NodeVersion

use of com.facebook.presto.client.NodeVersion in project presto by prestodb.

the class DiscoveryNodeManager method refreshNodesInternal.

private synchronized void refreshNodesInternal() {
    // This is currently a blacklist.
    // TODO: make it a whitelist (a failure-detecting service selector) and maybe build in support for injecting this in airlift
    Set<ServiceDescriptor> services = serviceSelector.selectAllServices().stream().filter(service -> !failureDetector.getFailed().contains(service)).filter(service -> !nodeStatusService.isPresent() || nodeStatusService.get().isAllowed(service.getLocation()) || isCoordinator(service) || isResourceManager(service)).collect(toImmutableSet());
    ImmutableSet.Builder<InternalNode> activeNodesBuilder = ImmutableSortedSet.orderedBy(comparing(InternalNode::getNodeIdentifier));
    ImmutableSet.Builder<InternalNode> inactiveNodesBuilder = ImmutableSet.builder();
    ImmutableSet.Builder<InternalNode> shuttingDownNodesBuilder = ImmutableSet.builder();
    ImmutableSet.Builder<InternalNode> coordinatorsBuilder = ImmutableSet.builder();
    ImmutableSet.Builder<InternalNode> resourceManagersBuilder = ImmutableSet.builder();
    ImmutableSetMultimap.Builder<ConnectorId, InternalNode> byConnectorIdBuilder = ImmutableSetMultimap.builder();
    Map<String, InternalNode> nodes = new HashMap<>();
    SetMultimap<String, ConnectorId> connectorIdsByNodeId = HashMultimap.create();
    // For a given connectorId, sort the nodes based on their nodeIdentifier
    byConnectorIdBuilder.orderValuesBy(comparing(InternalNode::getNodeIdentifier));
    if (isMemoizeDeadNodesEnabled && this.nodes != null) {
        nodes.putAll(this.nodes);
    }
    if (isMemoizeDeadNodesEnabled && this.connectorIdsByNodeId != null) {
        connectorIdsByNodeId.putAll(this.connectorIdsByNodeId);
    }
    for (ServiceDescriptor service : services) {
        URI uri = getHttpUri(service, httpsRequired);
        OptionalInt thriftPort = getThriftServerPort(service);
        NodeVersion nodeVersion = getNodeVersion(service);
        // Currently, a node may have the roles of both a coordinator and a worker.  In the future, a resource manager may also
        // take the form of a coordinator, hence these flags are not exclusive.
        boolean coordinator = isCoordinator(service);
        boolean resourceManager = isResourceManager(service);
        if (uri != null && nodeVersion != null) {
            InternalNode node = new InternalNode(service.getNodeId(), uri, thriftPort, nodeVersion, coordinator, resourceManager, ALIVE);
            NodeState nodeState = getNodeState(node);
            switch(nodeState) {
                case ACTIVE:
                    activeNodesBuilder.add(node);
                    if (coordinator) {
                        coordinatorsBuilder.add(node);
                    }
                    if (resourceManager) {
                        resourceManagersBuilder.add(node);
                    }
                    nodes.put(node.getNodeIdentifier(), node);
                    // record available active nodes organized by connector id
                    String connectorIds = service.getProperties().get("connectorIds");
                    if (connectorIds != null) {
                        connectorIds = connectorIds.toLowerCase(ENGLISH);
                        for (String id : CONNECTOR_ID_SPLITTER.split(connectorIds)) {
                            ConnectorId connectorId = new ConnectorId(id);
                            byConnectorIdBuilder.put(connectorId, node);
                            connectorIdsByNodeId.put(node.getNodeIdentifier(), connectorId);
                        }
                    }
                    // always add system connector
                    byConnectorIdBuilder.put(new ConnectorId(GlobalSystemConnector.NAME), node);
                    break;
                case INACTIVE:
                    inactiveNodesBuilder.add(node);
                    break;
                case SHUTTING_DOWN:
                    shuttingDownNodesBuilder.add(node);
                    break;
                default:
                    log.error("Unknown state %s for node %s", nodeState, node);
            }
        }
    }
    if (allNodes != null) {
        // log node that are no longer active (but not shutting down)
        SetView<InternalNode> missingNodes = difference(allNodes.getActiveNodes(), Sets.union(activeNodesBuilder.build(), shuttingDownNodesBuilder.build()));
        for (InternalNode missingNode : missingNodes) {
            log.info("Previously active node is missing: %s (last seen at %s)", missingNode.getNodeIdentifier(), missingNode.getHost());
        }
    }
    // nodes by connector id changes anytime a node adds or removes a connector (note: this is not part of the listener system)
    activeNodesByConnectorId = byConnectorIdBuilder.build();
    if (isMemoizeDeadNodesEnabled) {
        SetView<String> deadNodeIds = difference(nodes.keySet(), activeNodesBuilder.build().stream().map(InternalNode::getNodeIdentifier).collect(toImmutableSet()));
        for (String nodeId : deadNodeIds) {
            InternalNode deadNode = nodes.get(nodeId);
            Set<ConnectorId> deadNodeConnectorIds = connectorIdsByNodeId.get(nodeId);
            for (ConnectorId id : deadNodeConnectorIds) {
                byConnectorIdBuilder.put(id, new InternalNode(deadNode.getNodeIdentifier(), deadNode.getInternalUri(), deadNode.getThriftPort(), deadNode.getNodeVersion(), deadNode.isCoordinator(), deadNode.isResourceManager(), DEAD));
            }
        }
    }
    this.nodes = ImmutableMap.copyOf(nodes);
    this.nodesByConnectorId = byConnectorIdBuilder.build();
    this.connectorIdsByNodeId = ImmutableSetMultimap.copyOf(connectorIdsByNodeId);
    AllNodes allNodes = new AllNodes(activeNodesBuilder.build(), inactiveNodesBuilder.build(), shuttingDownNodesBuilder.build(), coordinatorsBuilder.build(), resourceManagersBuilder.build());
    // only update if all nodes actually changed (note: this does not include the connectors registered with the nodes)
    if (!allNodes.equals(this.allNodes)) {
        // assign allNodes to a local variable for use in the callback below
        this.allNodes = allNodes;
        coordinators = coordinatorsBuilder.build();
        resourceManagers = resourceManagersBuilder.build();
        // notify listeners
        List<Consumer<AllNodes>> listeners = ImmutableList.copyOf(this.listeners);
        nodeStateEventExecutor.submit(() -> listeners.forEach(listener -> listener.accept(allNodes)));
    }
}
Also used : ServiceType(com.facebook.airlift.discovery.client.ServiceType) URISyntaxException(java.net.URISyntaxException) DEAD(com.facebook.presto.metadata.InternalNode.NodeStatus.DEAD) NodeVersion(com.facebook.presto.client.NodeVersion) ACTIVE(com.facebook.presto.spi.NodeState.ACTIVE) PreDestroy(javax.annotation.PreDestroy) Sets.difference(com.google.common.collect.Sets.difference) Executors.newSingleThreadScheduledExecutor(java.util.concurrent.Executors.newSingleThreadScheduledExecutor) HashMultimap(com.google.common.collect.HashMultimap) GlobalSystemConnector(com.facebook.presto.connector.system.GlobalSystemConnector) Map(java.util.Map) ServiceSelector(com.facebook.airlift.discovery.client.ServiceSelector) URI(java.net.URI) Splitter(com.google.common.base.Splitter) ENGLISH(java.util.Locale.ENGLISH) ImmutableSetMultimap(com.google.common.collect.ImmutableSetMultimap) CommunicationProtocol(com.facebook.presto.server.InternalCommunicationConfig.CommunicationProtocol) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) Set(java.util.Set) ThreadSafe(javax.annotation.concurrent.ThreadSafe) GuardedBy(javax.annotation.concurrent.GuardedBy) NodeState(com.facebook.presto.spi.NodeState) Sets(com.google.common.collect.Sets) Preconditions.checkState(com.google.common.base.Preconditions.checkState) List(java.util.List) PostConstruct(javax.annotation.PostConstruct) Optional(java.util.Optional) ConnectorId(com.facebook.presto.spi.ConnectorId) INACTIVE(com.facebook.presto.spi.NodeState.INACTIVE) NodeStatusService(com.facebook.presto.statusservice.NodeStatusService) ServiceDescriptor(com.facebook.airlift.discovery.client.ServiceDescriptor) Logger(com.facebook.airlift.log.Logger) NodeInfo(com.facebook.airlift.node.NodeInfo) HashMap(java.util.HashMap) OptionalInt(java.util.OptionalInt) ArrayList(java.util.ArrayList) Inject(javax.inject.Inject) ImmutableList(com.google.common.collect.ImmutableList) Managed(org.weakref.jmx.Managed) Objects.requireNonNull(java.util.Objects.requireNonNull) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) Comparator.comparing(java.util.Comparator.comparing) ExecutorService(java.util.concurrent.ExecutorService) ImmutableSortedSet(com.google.common.collect.ImmutableSortedSet) Threads.threadsNamed(com.facebook.airlift.concurrent.Threads.threadsNamed) SHUTTING_DOWN(com.facebook.presto.spi.NodeState.SHUTTING_DOWN) InternalCommunicationConfig(com.facebook.presto.server.InternalCommunicationConfig) ALIVE(com.facebook.presto.metadata.InternalNode.NodeStatus.ALIVE) SetView(com.google.common.collect.Sets.SetView) DriftClient(com.facebook.drift.client.DriftClient) HttpClient(com.facebook.airlift.http.client.HttpClient) SetMultimap(com.google.common.collect.SetMultimap) TimeUnit(java.util.concurrent.TimeUnit) Consumer(java.util.function.Consumer) HttpUriBuilder.uriBuilderFrom(com.facebook.airlift.http.client.HttpUriBuilder.uriBuilderFrom) Executors.newCachedThreadPool(java.util.concurrent.Executors.newCachedThreadPool) FailureDetector(com.facebook.presto.failureDetector.FailureDetector) ThriftServerInfoClient(com.facebook.presto.server.thrift.ThriftServerInfoClient) NodeState(com.facebook.presto.spi.NodeState) ImmutableSetMultimap(com.google.common.collect.ImmutableSetMultimap) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) HashMap(java.util.HashMap) OptionalInt(java.util.OptionalInt) URI(java.net.URI) NodeVersion(com.facebook.presto.client.NodeVersion) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableSet.toImmutableSet(com.google.common.collect.ImmutableSet.toImmutableSet) Consumer(java.util.function.Consumer) ServiceDescriptor(com.facebook.airlift.discovery.client.ServiceDescriptor) ConnectorId(com.facebook.presto.spi.ConnectorId)

Example 3 with NodeVersion

use of com.facebook.presto.client.NodeVersion in project presto by prestodb.

the class TestDiscoveryNodeManager method setup.

@BeforeMethod
public void setup() {
    testHttpClient = new TestingHttpClient(input -> new TestingResponse(OK, ArrayListMultimap.create(), ACTIVE.name().getBytes()));
    expectedVersion = new NodeVersion("1");
    coordinator = new InternalNode(UUID.randomUUID().toString(), URI.create("https://192.0.2.8"), expectedVersion, true);
    resourceManager = new InternalNode(UUID.randomUUID().toString(), URI.create("https://192.0.2.9"), expectedVersion, false, true);
    currentNode = new InternalNode(nodeInfo.getNodeId(), URI.create("http://192.0.1.1"), expectedVersion, false);
    activeNodes = ImmutableSet.of(currentNode, new InternalNode(UUID.randomUUID().toString(), URI.create("http://192.0.2.1:8080"), expectedVersion, false), new InternalNode(UUID.randomUUID().toString(), URI.create("http://192.0.2.3"), expectedVersion, false), coordinator, resourceManager);
    inactiveNodes = ImmutableSet.of(new InternalNode(UUID.randomUUID().toString(), URI.create("https://192.0.3.9"), NodeVersion.UNKNOWN, false), new InternalNode(UUID.randomUUID().toString(), URI.create("https://192.0.4.9"), new NodeVersion("2"), false));
    selector.announceNodes(activeNodes, inactiveNodes);
}
Also used : ArrayListMultimap(com.google.common.collect.ArrayListMultimap) Iterables(com.google.common.collect.Iterables) ServiceDescriptor(com.facebook.airlift.discovery.client.ServiceDescriptor) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) TestingDriftClient(com.facebook.presto.operator.TestingDriftClient) NodeInfo(com.facebook.airlift.node.NodeInfo) Assert.assertEquals(org.testng.Assert.assertEquals) Test(org.testng.annotations.Test) NodeVersion(com.facebook.presto.client.NodeVersion) ACTIVE(com.facebook.presto.spi.NodeState.ACTIVE) DEFAULT_POOL(com.facebook.airlift.discovery.client.ServiceSelectorConfig.DEFAULT_POOL) ImmutableList(com.google.common.collect.ImmutableList) Assert.assertNotSame(org.testng.Assert.assertNotSame) TestingHttpClient(com.facebook.airlift.http.client.testing.TestingHttpClient) OK(com.facebook.airlift.http.client.HttpStatus.OK) TestingResponse(com.facebook.airlift.http.client.testing.TestingResponse) ServiceSelector(com.facebook.airlift.discovery.client.ServiceSelector) URI(java.net.URI) ImmutableSet(com.google.common.collect.ImmutableSet) Assertions.assertEqualsIgnoreOrder(com.facebook.airlift.testing.Assertions.assertEqualsIgnoreOrder) InternalCommunicationConfig(com.facebook.presto.server.InternalCommunicationConfig) ServiceDescriptor.serviceDescriptor(com.facebook.airlift.discovery.client.ServiceDescriptor.serviceDescriptor) BeforeMethod(org.testng.annotations.BeforeMethod) Set(java.util.Set) BlockingQueue(java.util.concurrent.BlockingQueue) UUID(java.util.UUID) GuardedBy(javax.annotation.concurrent.GuardedBy) HttpClient(com.facebook.airlift.http.client.HttpClient) NodeConfig(com.facebook.airlift.node.NodeConfig) ArrayBlockingQueue(java.util.concurrent.ArrayBlockingQueue) List(java.util.List) NoOpFailureDetector(com.facebook.presto.failureDetector.NoOpFailureDetector) Optional(java.util.Optional) INACTIVE(com.facebook.presto.spi.NodeState.INACTIVE) NodeVersion(com.facebook.presto.client.NodeVersion) TestingResponse(com.facebook.airlift.http.client.testing.TestingResponse) TestingHttpClient(com.facebook.airlift.http.client.testing.TestingHttpClient) BeforeMethod(org.testng.annotations.BeforeMethod)

Example 4 with NodeVersion

use of com.facebook.presto.client.NodeVersion in project presto by prestodb.

the class TestPartialResultQueryTaskTracker method testPartialResultQueryTaskTracker.

@Test
public void testPartialResultQueryTaskTracker() throws Exception {
    PartialResultQueryTaskTracker tracker = new PartialResultQueryTaskTracker(partialResultQueryManager, 0.50, 2.0, warningCollector);
    InternalNode node1 = new InternalNode(UUID.randomUUID().toString(), URI.create("https://192.0.2.8"), new NodeVersion("1"), false, false);
    InternalNode node2 = new InternalNode(UUID.randomUUID().toString(), URI.create("https://192.0.2.9"), new NodeVersion("1"), false, false);
    TaskId taskId1 = new TaskId("test1", 1, 0, 1);
    TaskId taskId2 = new TaskId("test2", 2, 0, 1);
    RemoteTask task1 = taskFactory.createTableScanTask(taskId1, node1, ImmutableList.of(), new NodeTaskMap.NodeStatsTracker(delta -> {
    }, delta -> {
    }, (age, delta) -> {
    }));
    RemoteTask task2 = taskFactory.createTableScanTask(taskId2, node2, ImmutableList.of(), new NodeTaskMap.NodeStatsTracker(delta -> {
    }, delta -> {
    }, (age, delta) -> {
    }));
    tracker.trackTask(task1);
    tracker.trackTask(task2);
    // Assert that completion ratio is 0.0 since the tasks did not complete yet
    assertEquals(0.0, tracker.getTaskCompletionRatio());
    tracker.completeTaskScheduling();
    tracker.recordTaskFinish(task1.getTaskInfo());
    // Assert that completion ratio is 0.5 since we have set that task1 finished in above line
    assertEquals(0.5, tracker.getTaskCompletionRatio());
    // Assert that the query is added to query manager, queue size = 1 since the query reached minCompletion ratio of 0.5 and is eligible for partial results
    assertEquals(1, partialResultQueryManager.getQueueSize());
    // Sleep for 2 seconds so that we give enough time for query manager to cancel tasks and complete the query with partial results
    Thread.sleep(2000);
    assertEquals(0, partialResultQueryManager.getQueueSize());
    // Assert that partial result warning is set correctly
    assertEquals(1, warningCollector.getWarnings().size());
    PrestoWarning prestoWarning = warningCollector.getWarnings().get(0);
    // Assert that warning code is set to PARTIAL_RESULT_WARNING
    assertEquals(PARTIAL_RESULT_WARNING.toWarningCode(), prestoWarning.getWarningCode());
    // Assert that completion percent of 50.00 is specified correctly in the warning message
    assertEquals("Partial results are returned. Only 50.00 percent of the data is read.", prestoWarning.getMessage());
}
Also used : NodeVersion(com.facebook.presto.client.NodeVersion) WarningCollector(com.facebook.presto.spi.WarningCollector) AfterClass(org.testng.annotations.AfterClass) NodeTaskMap(com.facebook.presto.execution.NodeTaskMap) PARTIAL_RESULT_WARNING(com.facebook.presto.spi.StandardWarningCode.PARTIAL_RESULT_WARNING) Assert.assertEquals(org.testng.Assert.assertEquals) Test(org.testng.annotations.Test) NodeVersion(com.facebook.presto.client.NodeVersion) UUID(java.util.UUID) NORMAL(com.facebook.presto.execution.warnings.WarningHandlingLevel.NORMAL) MockRemoteTaskFactory(com.facebook.presto.execution.MockRemoteTaskFactory) InternalNode(com.facebook.presto.metadata.InternalNode) Threads.daemonThreadsNamed(com.facebook.airlift.concurrent.Threads.daemonThreadsNamed) RemoteTask(com.facebook.presto.execution.RemoteTask) WarningCollectorConfig(com.facebook.presto.execution.warnings.WarningCollectorConfig) ImmutableList(com.google.common.collect.ImmutableList) Executors.newCachedThreadPool(java.util.concurrent.Executors.newCachedThreadPool) Executors.newScheduledThreadPool(java.util.concurrent.Executors.newScheduledThreadPool) TaskId(com.facebook.presto.execution.TaskId) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) PrestoWarning(com.facebook.presto.spi.PrestoWarning) DefaultWarningCollector(com.facebook.presto.execution.warnings.DefaultWarningCollector) URI(java.net.URI) ExecutorService(java.util.concurrent.ExecutorService) PartialResultQueryManager(com.facebook.presto.execution.PartialResultQueryManager) TaskId(com.facebook.presto.execution.TaskId) NodeTaskMap(com.facebook.presto.execution.NodeTaskMap) PrestoWarning(com.facebook.presto.spi.PrestoWarning) RemoteTask(com.facebook.presto.execution.RemoteTask) InternalNode(com.facebook.presto.metadata.InternalNode) Test(org.testng.annotations.Test)

Example 5 with NodeVersion

use of com.facebook.presto.client.NodeVersion in project presto by prestodb.

the class ServerMainModule method setup.

@Override
protected void setup(Binder binder) {
    ServerConfig serverConfig = buildConfigObject(ServerConfig.class);
    if (serverConfig.isResourceManager()) {
        install(new ResourceManagerModule());
    } else if (serverConfig.isCoordinator()) {
        install(new CoordinatorModule());
    } else {
        install(new WorkerModule());
    }
    install(new InternalCommunicationModule());
    configBinder(binder).bindConfig(FeaturesConfig.class);
    binder.bind(PlanChecker.class).in(Scopes.SINGLETON);
    binder.bind(SqlParser.class).in(Scopes.SINGLETON);
    binder.bind(SqlParserOptions.class).toInstance(sqlParserOptions);
    sqlParserOptions.useEnhancedErrorHandler(serverConfig.isEnhancedErrorReporting());
    jaxrsBinder(binder).bind(ThrowableMapper.class);
    configBinder(binder).bindConfig(QueryManagerConfig.class);
    configBinder(binder).bindConfig(SqlEnvironmentConfig.class);
    jsonCodecBinder(binder).bindJsonCodec(ViewDefinition.class);
    newOptionalBinder(binder, ExplainAnalyzeContext.class);
    // GC Monitor
    binder.bind(GcMonitor.class).to(JmxGcMonitor.class).in(Scopes.SINGLETON);
    // session properties
    binder.bind(SessionPropertyManager.class).in(Scopes.SINGLETON);
    binder.bind(SystemSessionProperties.class).in(Scopes.SINGLETON);
    binder.bind(SessionPropertyDefaults.class).in(Scopes.SINGLETON);
    // schema properties
    binder.bind(SchemaPropertyManager.class).in(Scopes.SINGLETON);
    // table properties
    binder.bind(TablePropertyManager.class).in(Scopes.SINGLETON);
    // column properties
    binder.bind(ColumnPropertyManager.class).in(Scopes.SINGLETON);
    // analyze properties
    binder.bind(AnalyzePropertyManager.class).in(Scopes.SINGLETON);
    // node manager
    discoveryBinder(binder).bindSelector("presto");
    binder.bind(DiscoveryNodeManager.class).in(Scopes.SINGLETON);
    binder.bind(InternalNodeManager.class).to(DiscoveryNodeManager.class).in(Scopes.SINGLETON);
    newExporter(binder).export(DiscoveryNodeManager.class).withGeneratedName();
    httpClientBinder(binder).bindHttpClient("node-manager", ForNodeManager.class).withTracing().withConfigDefaults(config -> {
        config.setRequestTimeout(new Duration(10, SECONDS));
    });
    driftClientBinder(binder).bindDriftClient(ThriftServerInfoClient.class, ForNodeManager.class).withAddressSelector(((addressSelectorBinder, annotation, prefix) -> addressSelectorBinder.bind(AddressSelector.class).annotatedWith(annotation).to(FixedAddressSelector.class)));
    // node scheduler
    // TODO: remove from NodePartitioningManager and move to CoordinatorModule
    configBinder(binder).bindConfig(NodeSchedulerConfig.class);
    configBinder(binder).bindConfig(SimpleTtlNodeSelectorConfig.class);
    binder.bind(NodeScheduler.class).in(Scopes.SINGLETON);
    binder.bind(NodeSelectionStats.class).in(Scopes.SINGLETON);
    newExporter(binder).export(NodeSelectionStats.class).withGeneratedName();
    binder.bind(NodeSchedulerExporter.class).in(Scopes.SINGLETON);
    binder.bind(NodeTaskMap.class).in(Scopes.SINGLETON);
    newExporter(binder).export(NodeScheduler.class).withGeneratedName();
    // network topology
    // TODO: move to CoordinatorModule when NodeScheduler is moved
    install(installModuleIf(NodeSchedulerConfig.class, config -> LEGACY.equalsIgnoreCase(config.getNetworkTopology()), moduleBinder -> moduleBinder.bind(NetworkTopology.class).to(LegacyNetworkTopology.class).in(Scopes.SINGLETON)));
    install(installModuleIf(NodeSchedulerConfig.class, config -> FLAT.equalsIgnoreCase(config.getNetworkTopology()), moduleBinder -> moduleBinder.bind(NetworkTopology.class).to(FlatNetworkTopology.class).in(Scopes.SINGLETON)));
    // task execution
    jaxrsBinder(binder).bind(TaskResource.class);
    newExporter(binder).export(TaskResource.class).withGeneratedName();
    jaxrsBinder(binder).bind(TaskExecutorResource.class);
    newExporter(binder).export(TaskExecutorResource.class).withGeneratedName();
    binder.bind(TaskManagementExecutor.class).in(Scopes.SINGLETON);
    install(new DefaultThriftCodecsModule());
    thriftCodecBinder(binder).bindCustomThriftCodec(SqlInvokedFunctionCodec.class);
    thriftCodecBinder(binder).bindCustomThriftCodec(SqlFunctionIdCodec.class);
    jsonCodecBinder(binder).bindListJsonCodec(TaskMemoryReservationSummary.class);
    binder.bind(SqlTaskManager.class).in(Scopes.SINGLETON);
    binder.bind(TaskManager.class).to(Key.get(SqlTaskManager.class));
    binder.bind(SpoolingOutputBufferFactory.class).in(Scopes.SINGLETON);
    binder.bind(RandomResourceManagerAddressSelector.class).in(Scopes.SINGLETON);
    driftClientBinder(binder).bindDriftClient(ResourceManagerClient.class, ForResourceManager.class).withAddressSelector((addressSelectorBinder, annotation, prefix) -> addressSelectorBinder.bind(AddressSelector.class).annotatedWith(annotation).to(RandomResourceManagerAddressSelector.class)).withExceptionClassifier(throwable -> {
        if (throwable instanceof ResourceManagerInconsistentException) {
            return new ExceptionClassification(Optional.of(true), DOWN);
        }
        return new ExceptionClassification(Optional.of(true), NORMAL);
    });
    newOptionalBinder(binder, ClusterMemoryManagerService.class);
    install(installModuleIf(ServerConfig.class, ServerConfig::isResourceManagerEnabled, new Module() {

        @Override
        public void configure(Binder moduleBinder) {
            configBinder(moduleBinder).bindConfig(ResourceManagerConfig.class);
            moduleBinder.bind(ClusterStatusSender.class).to(ResourceManagerClusterStatusSender.class).in(Scopes.SINGLETON);
            if (serverConfig.isCoordinator()) {
                moduleBinder.bind(ClusterMemoryManagerService.class).in(Scopes.SINGLETON);
                moduleBinder.bind(ResourceGroupService.class).to(ResourceManagerResourceGroupService.class).in(Scopes.SINGLETON);
            }
        }

        @Provides
        @Singleton
        @ForResourceManager
        public ScheduledExecutorService createResourceManagerScheduledExecutor(ResourceManagerConfig config) {
            return createConcurrentScheduledExecutor("resource-manager-heartbeats", config.getHeartbeatConcurrency(), config.getHeartbeatThreads());
        }

        @Provides
        @Singleton
        @ForResourceManager
        public ListeningExecutorService createResourceManagerExecutor(ResourceManagerConfig config) {
            ExecutorService executor = new ThreadPoolExecutor(0, config.getResourceManagerExecutorThreads(), 60, SECONDS, new LinkedBlockingQueue<>(), daemonThreadsNamed("resource-manager-executor-%s"));
            return listeningDecorator(executor);
        }
    }, moduleBinder -> {
        moduleBinder.bind(ClusterStatusSender.class).toInstance(execution -> {
        });
        moduleBinder.bind(ResourceGroupService.class).to(NoopResourceGroupService.class).in(Scopes.SINGLETON);
    }));
    FeaturesConfig featuresConfig = buildConfigObject(FeaturesConfig.class);
    FeaturesConfig.TaskSpillingStrategy taskSpillingStrategy = featuresConfig.getTaskSpillingStrategy();
    switch(taskSpillingStrategy) {
        case PER_TASK_MEMORY_THRESHOLD:
            binder.bind(TaskThresholdMemoryRevokingScheduler.class).in(Scopes.SINGLETON);
            break;
        default:
            binder.bind(MemoryRevokingScheduler.class).in(Scopes.SINGLETON);
    }
    // Add monitoring for JVM pauses
    binder.bind(PauseMeter.class).in(Scopes.SINGLETON);
    newExporter(binder).export(PauseMeter.class).withGeneratedName();
    binder.bind(GcStatusMonitor.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(MemoryManagerConfig.class);
    configBinder(binder).bindConfig(NodeMemoryConfig.class);
    configBinder(binder).bindConfig(ReservedSystemMemoryConfig.class);
    binder.bind(LocalMemoryManager.class).in(Scopes.SINGLETON);
    binder.bind(LocalMemoryManagerExporter.class).in(Scopes.SINGLETON);
    binder.bind(EmbedVersion.class).in(Scopes.SINGLETON);
    newExporter(binder).export(TaskManager.class).withGeneratedName();
    binder.bind(TaskExecutor.class).in(Scopes.SINGLETON);
    newExporter(binder).export(TaskExecutor.class).withGeneratedName();
    binder.bind(MultilevelSplitQueue.class).in(Scopes.SINGLETON);
    newExporter(binder).export(MultilevelSplitQueue.class).withGeneratedName();
    binder.bind(LocalExecutionPlanner.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(FileFragmentResultCacheConfig.class);
    binder.bind(FragmentCacheStats.class).in(Scopes.SINGLETON);
    newExporter(binder).export(FragmentCacheStats.class).withGeneratedName();
    configBinder(binder).bindConfig(CompilerConfig.class);
    binder.bind(ExpressionCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(ExpressionCompiler.class).withGeneratedName();
    binder.bind(PageFunctionCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(PageFunctionCompiler.class).withGeneratedName();
    configBinder(binder).bindConfig(TaskManagerConfig.class);
    binder.bind(IndexJoinLookupStats.class).in(Scopes.SINGLETON);
    newExporter(binder).export(IndexJoinLookupStats.class).withGeneratedName();
    binder.bind(AsyncHttpExecutionMBean.class).in(Scopes.SINGLETON);
    newExporter(binder).export(AsyncHttpExecutionMBean.class).withGeneratedName();
    binder.bind(JoinFilterFunctionCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(JoinFilterFunctionCompiler.class).withGeneratedName();
    binder.bind(JoinCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(JoinCompiler.class).withGeneratedName();
    binder.bind(OrderingCompiler.class).in(Scopes.SINGLETON);
    newExporter(binder).export(OrderingCompiler.class).withGeneratedName();
    binder.bind(PagesIndex.Factory.class).to(PagesIndex.DefaultFactory.class);
    binder.bind(LookupJoinOperators.class).in(Scopes.SINGLETON);
    jsonCodecBinder(binder).bindJsonCodec(TaskStatus.class);
    jsonCodecBinder(binder).bindJsonCodec(StageInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(TaskInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(OperatorStats.class);
    jsonCodecBinder(binder).bindJsonCodec(ExecutionFailureInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(TableCommitContext.class);
    jsonCodecBinder(binder).bindJsonCodec(SqlInvokedFunction.class);
    smileCodecBinder(binder).bindSmileCodec(TaskStatus.class);
    smileCodecBinder(binder).bindSmileCodec(TaskInfo.class);
    thriftCodecBinder(binder).bindThriftCodec(TaskStatus.class);
    jaxrsBinder(binder).bind(PagesResponseWriter.class);
    // exchange client
    binder.bind(ExchangeClientSupplier.class).to(ExchangeClientFactory.class).in(Scopes.SINGLETON);
    httpClientBinder(binder).bindHttpClient("exchange", ForExchange.class).withTracing().withFilter(GenerateTraceTokenRequestFilter.class).withConfigDefaults(config -> {
        config.setRequestTimeout(new Duration(10, SECONDS));
        config.setMaxConnectionsPerServer(250);
        config.setMaxContentLength(new DataSize(32, MEGABYTE));
    });
    binder.install(new DriftNettyClientModule());
    driftClientBinder(binder).bindDriftClient(ThriftTaskClient.class, ForExchange.class).withAddressSelector(((addressSelectorBinder, annotation, prefix) -> addressSelectorBinder.bind(AddressSelector.class).annotatedWith(annotation).to(FixedAddressSelector.class)));
    configBinder(binder).bindConfig(ExchangeClientConfig.class);
    binder.bind(ExchangeExecutionMBean.class).in(Scopes.SINGLETON);
    newExporter(binder).export(ExchangeExecutionMBean.class).withGeneratedName();
    // execution
    binder.bind(LocationFactory.class).to(HttpLocationFactory.class).in(Scopes.SINGLETON);
    // memory manager
    jaxrsBinder(binder).bind(MemoryResource.class);
    jsonCodecBinder(binder).bindJsonCodec(MemoryInfo.class);
    jsonCodecBinder(binder).bindJsonCodec(MemoryPoolAssignmentsRequest.class);
    smileCodecBinder(binder).bindSmileCodec(MemoryInfo.class);
    smileCodecBinder(binder).bindSmileCodec(MemoryPoolAssignmentsRequest.class);
    // transaction manager
    configBinder(binder).bindConfig(TransactionManagerConfig.class);
    // data stream provider
    binder.bind(PageSourceManager.class).in(Scopes.SINGLETON);
    binder.bind(PageSourceProvider.class).to(PageSourceManager.class).in(Scopes.SINGLETON);
    // connector distributed metadata manager
    binder.bind(ConnectorMetadataUpdaterManager.class).in(Scopes.SINGLETON);
    // page sink provider
    binder.bind(PageSinkManager.class).in(Scopes.SINGLETON);
    binder.bind(PageSinkProvider.class).to(PageSinkManager.class).in(Scopes.SINGLETON);
    // metadata
    binder.bind(StaticCatalogStore.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(StaticCatalogStoreConfig.class);
    binder.bind(StaticFunctionNamespaceStore.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(StaticFunctionNamespaceStoreConfig.class);
    binder.bind(FunctionAndTypeManager.class).in(Scopes.SINGLETON);
    binder.bind(MetadataManager.class).in(Scopes.SINGLETON);
    binder.bind(Metadata.class).to(MetadataManager.class).in(Scopes.SINGLETON);
    // row expression utils
    binder.bind(DomainTranslator.class).to(RowExpressionDomainTranslator.class).in(Scopes.SINGLETON);
    binder.bind(PredicateCompiler.class).to(RowExpressionPredicateCompiler.class).in(Scopes.SINGLETON);
    binder.bind(DeterminismEvaluator.class).to(RowExpressionDeterminismEvaluator.class).in(Scopes.SINGLETON);
    // type
    binder.bind(TypeManager.class).to(FunctionAndTypeManager.class).in(Scopes.SINGLETON);
    jsonBinder(binder).addDeserializerBinding(Type.class).to(TypeDeserializer.class);
    newSetBinder(binder, Type.class);
    // plan
    jsonBinder(binder).addKeySerializerBinding(VariableReferenceExpression.class).to(VariableReferenceExpressionSerializer.class);
    jsonBinder(binder).addKeyDeserializerBinding(VariableReferenceExpression.class).to(VariableReferenceExpressionDeserializer.class);
    // split manager
    binder.bind(SplitManager.class).in(Scopes.SINGLETON);
    // partitioning provider manager
    binder.bind(PartitioningProviderManager.class).in(Scopes.SINGLETON);
    // node partitioning manager
    binder.bind(NodePartitioningManager.class).in(Scopes.SINGLETON);
    // connector plan optimizer manager
    binder.bind(ConnectorPlanOptimizerManager.class).in(Scopes.SINGLETON);
    // index manager
    binder.bind(IndexManager.class).in(Scopes.SINGLETON);
    // handle resolver
    binder.install(new HandleJsonModule());
    binder.bind(ObjectMapper.class).toProvider(JsonObjectMapperProvider.class);
    // connector
    binder.bind(ScalarStatsCalculator.class).in(Scopes.SINGLETON);
    binder.bind(StatsNormalizer.class).in(Scopes.SINGLETON);
    binder.bind(FilterStatsCalculator.class).in(Scopes.SINGLETON);
    binder.bind(ConnectorManager.class).in(Scopes.SINGLETON);
    // system connector
    binder.install(new SystemConnectorModule());
    // splits
    jsonCodecBinder(binder).bindJsonCodec(TaskUpdateRequest.class);
    jsonCodecBinder(binder).bindJsonCodec(ConnectorSplit.class);
    jsonCodecBinder(binder).bindJsonCodec(PlanFragment.class);
    smileCodecBinder(binder).bindSmileCodec(TaskUpdateRequest.class);
    smileCodecBinder(binder).bindSmileCodec(ConnectorSplit.class);
    smileCodecBinder(binder).bindSmileCodec(PlanFragment.class);
    jsonBinder(binder).addSerializerBinding(Slice.class).to(SliceSerializer.class);
    jsonBinder(binder).addDeserializerBinding(Slice.class).to(SliceDeserializer.class);
    jsonBinder(binder).addSerializerBinding(Expression.class).to(ExpressionSerializer.class);
    jsonBinder(binder).addDeserializerBinding(Expression.class).to(ExpressionDeserializer.class);
    jsonBinder(binder).addDeserializerBinding(FunctionCall.class).to(FunctionCallDeserializer.class);
    // metadata updates
    jsonCodecBinder(binder).bindJsonCodec(MetadataUpdates.class);
    smileCodecBinder(binder).bindSmileCodec(MetadataUpdates.class);
    // split monitor
    binder.bind(SplitMonitor.class).in(Scopes.SINGLETON);
    // Determine the NodeVersion
    NodeVersion nodeVersion = new NodeVersion(serverConfig.getPrestoVersion());
    binder.bind(NodeVersion.class).toInstance(nodeVersion);
    // presto announcement
    checkArgument(!(serverConfig.isResourceManager() && serverConfig.isCoordinator()), "Server cannot be configured as both resource manager and coordinator");
    discoveryBinder(binder).bindHttpAnnouncement("presto").addProperty("node_version", nodeVersion.toString()).addProperty("coordinator", String.valueOf(serverConfig.isCoordinator())).addProperty("resource_manager", String.valueOf(serverConfig.isResourceManager())).addProperty("connectorIds", nullToEmpty(serverConfig.getDataSources()));
    // server info resource
    jaxrsBinder(binder).bind(ServerInfoResource.class);
    jsonCodecBinder(binder).bindJsonCodec(ServerInfo.class);
    // node status resource
    jaxrsBinder(binder).bind(StatusResource.class);
    jsonCodecBinder(binder).bindJsonCodec(NodeStatus.class);
    // plugin manager
    binder.bind(PluginManager.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(PluginManagerConfig.class);
    binder.bind(CatalogManager.class).in(Scopes.SINGLETON);
    // block encodings
    binder.bind(BlockEncodingManager.class).in(Scopes.SINGLETON);
    binder.bind(BlockEncodingSerde.class).to(BlockEncodingManager.class).in(Scopes.SINGLETON);
    newSetBinder(binder, BlockEncoding.class);
    jsonBinder(binder).addSerializerBinding(Block.class).to(BlockJsonSerde.Serializer.class);
    jsonBinder(binder).addDeserializerBinding(Block.class).to(BlockJsonSerde.Deserializer.class);
    // thread visualizer
    jaxrsBinder(binder).bind(ThreadResource.class);
    // PageSorter
    binder.bind(PageSorter.class).to(PagesIndexPageSorter.class).in(Scopes.SINGLETON);
    // PageIndexer
    binder.bind(PageIndexerFactory.class).to(GroupByHashPageIndexerFactory.class).in(Scopes.SINGLETON);
    // Finalizer
    binder.bind(FinalizerService.class).in(Scopes.SINGLETON);
    // Spiller
    binder.bind(SpillerFactory.class).to(GenericSpillerFactory.class).in(Scopes.SINGLETON);
    binder.bind(StandaloneSpillerFactory.class).to(TempStorageStandaloneSpillerFactory.class).in(Scopes.SINGLETON);
    binder.bind(PartitioningSpillerFactory.class).to(GenericPartitioningSpillerFactory.class).in(Scopes.SINGLETON);
    binder.bind(SpillerStats.class).in(Scopes.SINGLETON);
    newExporter(binder).export(SpillerFactory.class).withGeneratedName();
    binder.bind(LocalSpillManager.class).in(Scopes.SINGLETON);
    configBinder(binder).bindConfig(NodeSpillConfig.class);
    install(installModuleIf(FeaturesConfig.class, config -> config.getSingleStreamSpillerChoice() == SingleStreamSpillerChoice.LOCAL_FILE, moduleBinder -> moduleBinder.bind(SingleStreamSpillerFactory.class).to(FileSingleStreamSpillerFactory.class).in(Scopes.SINGLETON)));
    install(installModuleIf(FeaturesConfig.class, config -> config.getSingleStreamSpillerChoice() == SingleStreamSpillerChoice.TEMP_STORAGE, moduleBinder -> moduleBinder.bind(SingleStreamSpillerFactory.class).to(TempStorageSingleStreamSpillerFactory.class).in(Scopes.SINGLETON)));
    // Thrift RPC
    binder.install(new DriftNettyServerModule());
    driftServerBinder(binder).bindService(ThriftTaskService.class);
    driftServerBinder(binder).bindService(ThriftServerInfoService.class);
    // Async page transport
    newMapBinder(binder, String.class, Servlet.class, TheServlet.class).addBinding("/v1/task/async/*").to(AsyncPageTransportServlet.class).in(Scopes.SINGLETON);
    // cleanup
    binder.bind(ExecutorCleanup.class).in(Scopes.SINGLETON);
    // Distributed tracing
    configBinder(binder).bindConfig(TracingConfig.class);
    install(installModuleIf(TracingConfig.class, config -> !config.getEnableDistributedTracing() || NOOP.equalsIgnoreCase(config.getTracerType()), moduleBinder -> moduleBinder.bind(TracerProvider.class).to(NoopTracerProvider.class).in(Scopes.SINGLETON)));
    install(installModuleIf(TracingConfig.class, config -> config.getEnableDistributedTracing() && SIMPLE.equalsIgnoreCase(config.getTracerType()), moduleBinder -> moduleBinder.bind(TracerProvider.class).to(SimpleTracerProvider.class).in(Scopes.SINGLETON)));
    // Optional Status Detector
    newOptionalBinder(binder, NodeStatusService.class);
}
Also used : RowExpressionDomainTranslator(com.facebook.presto.sql.relational.RowExpressionDomainTranslator) JaxrsBinder.jaxrsBinder(com.facebook.airlift.jaxrs.JaxrsBinder.jaxrsBinder) AddressSelector(com.facebook.drift.client.address.AddressSelector) TaskStatus(com.facebook.presto.execution.TaskStatus) NodeSelectionStats(com.facebook.presto.execution.scheduler.nodeSelection.NodeSelectionStats) ConnectorPlanOptimizerManager(com.facebook.presto.sql.planner.ConnectorPlanOptimizerManager) ColumnPropertyManager(com.facebook.presto.metadata.ColumnPropertyManager) InternalNodeManager(com.facebook.presto.metadata.InternalNodeManager) DriftNettyClientModule(com.facebook.drift.transport.netty.client.DriftNettyClientModule) LocalMemoryManager(com.facebook.presto.memory.LocalMemoryManager) FragmentResultCacheManager(com.facebook.presto.operator.FragmentResultCacheManager) PageFunctionCompiler(com.facebook.presto.sql.gen.PageFunctionCompiler) DiscoveryNodeManager(com.facebook.presto.metadata.DiscoveryNodeManager) PageSinkManager(com.facebook.presto.split.PageSinkManager) Servlet(javax.servlet.Servlet) FlatNetworkTopology(com.facebook.presto.execution.scheduler.FlatNetworkTopology) StandaloneSpillerFactory(com.facebook.presto.spiller.StandaloneSpillerFactory) DomainTranslator(com.facebook.presto.spi.relation.DomainTranslator) ResourceManagerClient(com.facebook.presto.resourcemanager.ResourceManagerClient) ExpressionDeserializer(com.facebook.presto.sql.Serialization.ExpressionDeserializer) FLAT(com.facebook.presto.execution.scheduler.NodeSchedulerConfig.NetworkTopologyType.FLAT) RowExpressionPredicateCompiler(com.facebook.presto.sql.gen.RowExpressionPredicateCompiler) FragmentCacheStats(com.facebook.presto.operator.FragmentCacheStats) LocalSpillManager(com.facebook.presto.spiller.LocalSpillManager) SystemSessionProperties(com.facebook.presto.SystemSessionProperties) NOOP(com.facebook.presto.tracing.TracingConfig.TracerType.NOOP) ViewDefinition(com.facebook.presto.metadata.ViewDefinition) TempStorageSingleStreamSpillerFactory(com.facebook.presto.spiller.TempStorageSingleStreamSpillerFactory) MEGABYTE(io.airlift.units.DataSize.Unit.MEGABYTE) VariableReferenceExpressionDeserializer(com.facebook.presto.sql.Serialization.VariableReferenceExpressionDeserializer) MemoryResource(com.facebook.presto.memory.MemoryResource) ReservedSystemMemoryConfig(com.facebook.presto.memory.ReservedSystemMemoryConfig) LookupJoinOperators(com.facebook.presto.operator.LookupJoinOperators) StaticCatalogStore(com.facebook.presto.metadata.StaticCatalogStore) RandomResourceManagerAddressSelector(com.facebook.presto.resourcemanager.RandomResourceManagerAddressSelector) Binder(com.google.inject.Binder) GenericSpillerFactory(com.facebook.presto.spiller.GenericSpillerFactory) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) DefaultThriftCodecsModule(com.facebook.drift.codec.utils.DefaultThriftCodecsModule) ExceptionClassification(com.facebook.drift.client.ExceptionClassification) AnalyzePropertyManager(com.facebook.presto.metadata.AnalyzePropertyManager) IndexJoinLookupStats(com.facebook.presto.operator.index.IndexJoinLookupStats) TableCommitContext(com.facebook.presto.operator.TableCommitContext) SystemConnectorModule(com.facebook.presto.connector.system.SystemConnectorModule) SqlEnvironmentConfig(com.facebook.presto.sql.SqlEnvironmentConfig) MultilevelSplitQueue(com.facebook.presto.execution.executor.MultilevelSplitQueue) StaticCatalogStoreConfig(com.facebook.presto.metadata.StaticCatalogStoreConfig) StaticFunctionNamespaceStore(com.facebook.presto.metadata.StaticFunctionNamespaceStore) SpillerFactory(com.facebook.presto.spiller.SpillerFactory) TheServlet(com.facebook.airlift.http.server.TheServlet) TaskInfo(com.facebook.presto.execution.TaskInfo) Metadata(com.facebook.presto.metadata.Metadata) ThriftCodecBinder.thriftCodecBinder(com.facebook.drift.codec.guice.ThriftCodecBinder.thriftCodecBinder) LocalExecutionPlanner(com.facebook.presto.sql.planner.LocalExecutionPlanner) TablePropertyManager(com.facebook.presto.metadata.TablePropertyManager) SqlParserOptions(com.facebook.presto.sql.parser.SqlParserOptions) Inject(com.google.inject.Inject) BlockEncoding(com.facebook.presto.common.block.BlockEncoding) TaskManagerConfig(com.facebook.presto.execution.TaskManagerConfig) Duration(io.airlift.units.Duration) MemoryRevokingScheduler(com.facebook.presto.execution.MemoryRevokingScheduler) MemoryPoolAssignmentsRequest(com.facebook.presto.memory.MemoryPoolAssignmentsRequest) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) ThriftServerInfoService(com.facebook.presto.server.thrift.ThriftServerInfoService) AbstractConfigurationAwareModule(com.facebook.airlift.configuration.AbstractConfigurationAwareModule) ConnectorManager(com.facebook.presto.connector.ConnectorManager) HttpClientBinder.httpClientBinder(com.facebook.airlift.http.client.HttpClientBinder.httpClientBinder) ExportBinder.newExporter(org.weakref.jmx.guice.ExportBinder.newExporter) DOWN(com.facebook.drift.client.ExceptionClassification.HostStatus.DOWN) OptionalBinder.newOptionalBinder(com.google.inject.multibindings.OptionalBinder.newOptionalBinder) FunctionCall(com.facebook.presto.sql.tree.FunctionCall) FileFragmentResultCacheManager(com.facebook.presto.operator.FileFragmentResultCacheManager) StatsNormalizer(com.facebook.presto.cost.StatsNormalizer) ForResourceManager(com.facebook.presto.resourcemanager.ForResourceManager) SIMPLE(com.facebook.presto.tracing.TracingConfig.TracerType.SIMPLE) MetadataUpdates(com.facebook.presto.metadata.MetadataUpdates) ForExchange(com.facebook.presto.operator.ForExchange) ConditionalModule.installModuleIf(com.facebook.airlift.configuration.ConditionalModule.installModuleIf) JsonBinder.jsonBinder(com.facebook.airlift.json.JsonBinder.jsonBinder) NodeSpillConfig(com.facebook.presto.spiller.NodeSpillConfig) SplitManager(com.facebook.presto.split.SplitManager) TransactionManagerConfig(com.facebook.presto.transaction.TransactionManagerConfig) PredicateCompiler(com.facebook.presto.spi.relation.PredicateCompiler) ExpressionCompiler(com.facebook.presto.sql.gen.ExpressionCompiler) NodeStatusService(com.facebook.presto.statusservice.NodeStatusService) MoreExecutors.listeningDecorator(com.google.common.util.concurrent.MoreExecutors.listeningDecorator) DeterminismEvaluator(com.facebook.presto.spi.relation.DeterminismEvaluator) VariableReferenceExpressionSerializer(com.facebook.presto.sql.Serialization.VariableReferenceExpressionSerializer) Strings.nullToEmpty(com.google.common.base.Strings.nullToEmpty) SimpleTtlNodeSelectorConfig(com.facebook.presto.execution.scheduler.nodeSelection.SimpleTtlNodeSelectorConfig) PageSinkProvider(com.facebook.presto.split.PageSinkProvider) RowExpressionDeterminismEvaluator(com.facebook.presto.sql.relational.RowExpressionDeterminismEvaluator) MemoryInfo(com.facebook.presto.memory.MemoryInfo) BlockEncodingSerde(com.facebook.presto.common.block.BlockEncodingSerde) LegacyNetworkTopology(com.facebook.presto.execution.scheduler.LegacyNetworkTopology) ImmutableList(com.google.common.collect.ImmutableList) PageSourceManager(com.facebook.presto.split.PageSourceManager) PlanChecker(com.facebook.presto.sql.planner.sanity.PlanChecker) TaskManager(com.facebook.presto.execution.TaskManager) ResourceManagerInconsistentException(com.facebook.presto.resourcemanager.ResourceManagerInconsistentException) IndexManager(com.facebook.presto.index.IndexManager) SingleStreamSpillerFactory(com.facebook.presto.spiller.SingleStreamSpillerFactory) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) Type(com.facebook.presto.common.type.Type) ExecutorService(java.util.concurrent.ExecutorService) SimpleTracerProvider(com.facebook.presto.tracing.SimpleTracerProvider) MapBinder.newMapBinder(com.google.inject.multibindings.MapBinder.newMapBinder) SplitMonitor(com.facebook.presto.event.SplitMonitor) ResourceManagerClusterStatusSender(com.facebook.presto.resourcemanager.ResourceManagerClusterStatusSender) ExchangeClientSupplier(com.facebook.presto.operator.ExchangeClientSupplier) JoinFilterFunctionCompiler(com.facebook.presto.sql.gen.JoinFilterFunctionCompiler) SingleStreamSpillerChoice(com.facebook.presto.sql.analyzer.FeaturesConfig.SingleStreamSpillerChoice) Executors.newFixedThreadPool(java.util.concurrent.Executors.newFixedThreadPool) CatalogManager(com.facebook.presto.metadata.CatalogManager) SmileCodecBinder.smileCodecBinder(com.facebook.airlift.json.smile.SmileCodecBinder.smileCodecBinder) Provides(com.google.inject.Provides) Expression(com.facebook.presto.sql.tree.Expression) ThriftTaskService(com.facebook.presto.server.thrift.ThriftTaskService) ConfigBinder.configBinder(com.facebook.airlift.configuration.ConfigBinder.configBinder) DiscoveryBinder.discoveryBinder(com.facebook.airlift.discovery.client.DiscoveryBinder.discoveryBinder) ClusterMemoryManagerService(com.facebook.presto.resourcemanager.ClusterMemoryManagerService) ThriftServerInfoClient(com.facebook.presto.server.thrift.ThriftServerInfoClient) GcStatusMonitor(com.facebook.presto.util.GcStatusMonitor) PageSourceProvider(com.facebook.presto.split.PageSourceProvider) ConcurrentScheduledExecutor.createConcurrentScheduledExecutor(com.facebook.airlift.concurrent.ConcurrentScheduledExecutor.createConcurrentScheduledExecutor) SqlInvokedFunction(com.facebook.presto.spi.function.SqlInvokedFunction) ForNodeManager(com.facebook.presto.metadata.ForNodeManager) OperatorStats(com.facebook.presto.operator.OperatorStats) StageInfo(com.facebook.presto.execution.StageInfo) NoOpFragmentResultCacheManager(com.facebook.presto.operator.NoOpFragmentResultCacheManager) FinalizerService(com.facebook.presto.util.FinalizerService) Executors.newScheduledThreadPool(java.util.concurrent.Executors.newScheduledThreadPool) JsonObjectMapperProvider(com.facebook.airlift.json.JsonObjectMapperProvider) Multibinder.newSetBinder(com.google.inject.multibindings.Multibinder.newSetBinder) QueryManagerConfig(com.facebook.presto.execution.QueryManagerConfig) ScalarStatsCalculator(com.facebook.presto.cost.ScalarStatsCalculator) EmbedVersion(com.facebook.presto.version.EmbedVersion) DriftClientBinder.driftClientBinder(com.facebook.drift.client.guice.DriftClientBinder.driftClientBinder) GenericPartitioningSpillerFactory(com.facebook.presto.spiller.GenericPartitioningSpillerFactory) TracerProvider(com.facebook.presto.spi.tracing.TracerProvider) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) ClusterStatusSender(com.facebook.presto.resourcemanager.ClusterStatusSender) TaskMemoryReservationSummary(com.facebook.presto.operator.TaskMemoryReservationSummary) JmxGcMonitor(com.facebook.airlift.stats.JmxGcMonitor) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) Slice(io.airlift.slice.Slice) ResourceGroupService(com.facebook.presto.resourcemanager.ResourceGroupService) NoopResourceGroupService(com.facebook.presto.resourcemanager.NoopResourceGroupService) SqlTaskManager(com.facebook.presto.execution.SqlTaskManager) BlockEncodingManager(com.facebook.presto.common.block.BlockEncodingManager) StaticFunctionNamespaceStoreConfig(com.facebook.presto.metadata.StaticFunctionNamespaceStoreConfig) ExchangeClientFactory(com.facebook.presto.operator.ExchangeClientFactory) PageSorter(com.facebook.presto.spi.PageSorter) SpoolingOutputBufferFactory(com.facebook.presto.execution.buffer.SpoolingOutputBufferFactory) NetworkTopology(com.facebook.presto.execution.scheduler.NetworkTopology) LocationFactory(com.facebook.presto.execution.LocationFactory) ResourceManagerConfig(com.facebook.presto.resourcemanager.ResourceManagerConfig) ConnectorSplit(com.facebook.presto.spi.ConnectorSplit) TracingConfig(com.facebook.presto.tracing.TracingConfig) PartitioningProviderManager(com.facebook.presto.sql.planner.PartitioningProviderManager) FunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager) PartitioningSpillerFactory(com.facebook.presto.spiller.PartitioningSpillerFactory) Module(com.google.inject.Module) NodeTaskMap(com.facebook.presto.execution.NodeTaskMap) MetadataManager(com.facebook.presto.metadata.MetadataManager) Key(com.google.inject.Key) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) NodeVersion(com.facebook.presto.client.NodeVersion) NORMAL(com.facebook.drift.client.ExceptionClassification.HostStatus.NORMAL) NodeScheduler(com.facebook.presto.execution.scheduler.NodeScheduler) FileSingleStreamSpillerFactory(com.facebook.presto.spiller.FileSingleStreamSpillerFactory) PagesIndex(com.facebook.presto.operator.PagesIndex) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) PreDestroy(javax.annotation.PreDestroy) PlanFragment(com.facebook.presto.sql.planner.PlanFragment) GcMonitor(com.facebook.airlift.stats.GcMonitor) HandleJsonModule(com.facebook.presto.metadata.HandleJsonModule) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) ConnectorMetadataUpdaterManager(com.facebook.presto.metadata.ConnectorMetadataUpdaterManager) FilterStatsCalculator(com.facebook.presto.cost.FilterStatsCalculator) TaskManagementExecutor(com.facebook.presto.execution.TaskManagementExecutor) TaskThresholdMemoryRevokingScheduler(com.facebook.presto.execution.TaskThresholdMemoryRevokingScheduler) NodeMemoryConfig(com.facebook.presto.memory.NodeMemoryConfig) NodeSchedulerExporter(com.facebook.presto.execution.scheduler.NodeSchedulerExporter) FixedAddressSelector(com.facebook.presto.server.thrift.FixedAddressSelector) LEGACY(com.facebook.presto.execution.scheduler.NodeSchedulerConfig.NetworkTopologyType.LEGACY) SchemaPropertyManager(com.facebook.presto.metadata.SchemaPropertyManager) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) DriftServerBinder.driftServerBinder(com.facebook.drift.server.guice.DriftServerBinder.driftServerBinder) SqlParser(com.facebook.presto.sql.parser.SqlParser) ExchangeClientConfig(com.facebook.presto.operator.ExchangeClientConfig) Threads.daemonThreadsNamed(com.facebook.airlift.concurrent.Threads.daemonThreadsNamed) DataSize(io.airlift.units.DataSize) List(java.util.List) TaskExecutor(com.facebook.presto.execution.executor.TaskExecutor) Optional(java.util.Optional) NodeSchedulerConfig(com.facebook.presto.execution.scheduler.NodeSchedulerConfig) SpillerStats(com.facebook.presto.spiller.SpillerStats) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) ExecutionFailureInfo(com.facebook.presto.execution.ExecutionFailureInfo) Singleton(javax.inject.Singleton) JsonCodecBinder.jsonCodecBinder(com.facebook.airlift.json.JsonCodecBinder.jsonCodecBinder) PauseMeter(com.facebook.airlift.stats.PauseMeter) BlockJsonSerde(com.facebook.presto.block.BlockJsonSerde) HttpLocationFactory(com.facebook.presto.server.remotetask.HttpLocationFactory) BoundedExecutor(com.facebook.airlift.concurrent.BoundedExecutor) OrderingCompiler(com.facebook.presto.sql.gen.OrderingCompiler) TypeManager(com.facebook.presto.common.type.TypeManager) LocalMemoryManagerExporter(com.facebook.presto.memory.LocalMemoryManagerExporter) FileFragmentResultCacheConfig(com.facebook.presto.operator.FileFragmentResultCacheConfig) Objects.requireNonNull(java.util.Objects.requireNonNull) ExplainAnalyzeContext(com.facebook.presto.execution.ExplainAnalyzeContext) ResourceManagerResourceGroupService(com.facebook.presto.resourcemanager.ResourceManagerResourceGroupService) MemoryManagerConfig(com.facebook.presto.memory.MemoryManagerConfig) FunctionCallDeserializer(com.facebook.presto.sql.Serialization.FunctionCallDeserializer) PagesIndexPageSorter(com.facebook.presto.PagesIndexPageSorter) NoopTracerProvider(com.facebook.presto.tracing.NoopTracerProvider) NodePartitioningManager(com.facebook.presto.sql.planner.NodePartitioningManager) ThriftTaskClient(com.facebook.presto.server.thrift.ThriftTaskClient) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Scopes(com.google.inject.Scopes) CompilerConfig(com.facebook.presto.sql.planner.CompilerConfig) DriftNettyServerModule(com.facebook.drift.transport.netty.server.DriftNettyServerModule) TypeDeserializer(com.facebook.presto.type.TypeDeserializer) Executors.newCachedThreadPool(java.util.concurrent.Executors.newCachedThreadPool) ExpressionSerializer(com.facebook.presto.sql.Serialization.ExpressionSerializer) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) Block(com.facebook.presto.common.block.Block) ServerInfo(com.facebook.presto.client.ServerInfo) JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) SECONDS(java.util.concurrent.TimeUnit.SECONDS) ExceptionClassification(com.facebook.drift.client.ExceptionClassification) ResourceManagerResourceGroupService(com.facebook.presto.resourcemanager.ResourceManagerResourceGroupService) RowExpressionPredicateCompiler(com.facebook.presto.sql.gen.RowExpressionPredicateCompiler) NodeVersion(com.facebook.presto.client.NodeVersion) FunctionAndTypeManager(com.facebook.presto.metadata.FunctionAndTypeManager) DefaultThriftCodecsModule(com.facebook.drift.codec.utils.DefaultThriftCodecsModule) JoinCompiler(com.facebook.presto.sql.gen.JoinCompiler) GenericPartitioningSpillerFactory(com.facebook.presto.spiller.GenericPartitioningSpillerFactory) StaticFunctionNamespaceStore(com.facebook.presto.metadata.StaticFunctionNamespaceStore) ResourceManagerClusterStatusSender(com.facebook.presto.resourcemanager.ResourceManagerClusterStatusSender) ResourceManagerConfig(com.facebook.presto.resourcemanager.ResourceManagerConfig) BlockJsonSerde(com.facebook.presto.block.BlockJsonSerde) MultilevelSplitQueue(com.facebook.presto.execution.executor.MultilevelSplitQueue) LegacyNetworkTopology(com.facebook.presto.execution.scheduler.LegacyNetworkTopology) DriftNettyClientModule(com.facebook.drift.transport.netty.client.DriftNettyClientModule) DefaultThriftCodecsModule(com.facebook.drift.codec.utils.DefaultThriftCodecsModule) SystemConnectorModule(com.facebook.presto.connector.system.SystemConnectorModule) AbstractConfigurationAwareModule(com.facebook.airlift.configuration.AbstractConfigurationAwareModule) Module(com.google.inject.Module) HandleJsonModule(com.facebook.presto.metadata.HandleJsonModule) DriftNettyServerModule(com.facebook.drift.transport.netty.server.DriftNettyServerModule) DriftNettyServerModule(com.facebook.drift.transport.netty.server.DriftNettyServerModule) ScalarStatsCalculator(com.facebook.presto.cost.ScalarStatsCalculator) ForNodeManager(com.facebook.presto.metadata.ForNodeManager) NodeSchedulerConfig(com.facebook.presto.execution.scheduler.NodeSchedulerConfig) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) PagesIndex(com.facebook.presto.operator.PagesIndex) JaxrsBinder.jaxrsBinder(com.facebook.airlift.jaxrs.JaxrsBinder.jaxrsBinder) Binder(com.google.inject.Binder) ThriftCodecBinder.thriftCodecBinder(com.facebook.drift.codec.guice.ThriftCodecBinder.thriftCodecBinder) HttpClientBinder.httpClientBinder(com.facebook.airlift.http.client.HttpClientBinder.httpClientBinder) OptionalBinder.newOptionalBinder(com.google.inject.multibindings.OptionalBinder.newOptionalBinder) JsonBinder.jsonBinder(com.facebook.airlift.json.JsonBinder.jsonBinder) MapBinder.newMapBinder(com.google.inject.multibindings.MapBinder.newMapBinder) SmileCodecBinder.smileCodecBinder(com.facebook.airlift.json.smile.SmileCodecBinder.smileCodecBinder) ConfigBinder.configBinder(com.facebook.airlift.configuration.ConfigBinder.configBinder) DiscoveryBinder.discoveryBinder(com.facebook.airlift.discovery.client.DiscoveryBinder.discoveryBinder) Multibinder.newSetBinder(com.google.inject.multibindings.Multibinder.newSetBinder) DriftClientBinder.driftClientBinder(com.facebook.drift.client.guice.DriftClientBinder.driftClientBinder) DriftServerBinder.driftServerBinder(com.facebook.drift.server.guice.DriftServerBinder.driftServerBinder) JsonCodecBinder.jsonCodecBinder(com.facebook.airlift.json.JsonCodecBinder.jsonCodecBinder) RandomResourceManagerAddressSelector(com.facebook.presto.resourcemanager.RandomResourceManagerAddressSelector) LocalMemoryManager(com.facebook.presto.memory.LocalMemoryManager) Servlet(javax.servlet.Servlet) TheServlet(com.facebook.airlift.http.server.TheServlet) SystemConnectorModule(com.facebook.presto.connector.system.SystemConnectorModule) FunctionCall(com.facebook.presto.sql.tree.FunctionCall) EmbedVersion(com.facebook.presto.version.EmbedVersion) LookupJoinOperators(com.facebook.presto.operator.LookupJoinOperators) PageSinkManager(com.facebook.presto.split.PageSinkManager) RowExpressionDeterminismEvaluator(com.facebook.presto.sql.relational.RowExpressionDeterminismEvaluator) ConnectorPlanOptimizerManager(com.facebook.presto.sql.planner.ConnectorPlanOptimizerManager) StatsNormalizer(com.facebook.presto.cost.StatsNormalizer) SimpleTracerProvider(com.facebook.presto.tracing.SimpleTracerProvider) FlatNetworkTopology(com.facebook.presto.execution.scheduler.FlatNetworkTopology) JoinFilterFunctionCompiler(com.facebook.presto.sql.gen.JoinFilterFunctionCompiler) NodeSchedulerExporter(com.facebook.presto.execution.scheduler.NodeSchedulerExporter) RowExpressionDomainTranslator(com.facebook.presto.sql.relational.RowExpressionDomainTranslator) TempStorageSingleStreamSpillerFactory(com.facebook.presto.spiller.TempStorageSingleStreamSpillerFactory) ConnectorManager(com.facebook.presto.connector.ConnectorManager) CatalogManager(com.facebook.presto.metadata.CatalogManager) Type(com.facebook.presto.common.type.Type) Expression(com.facebook.presto.sql.tree.Expression) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) FinalizerService(com.facebook.presto.util.FinalizerService) TaskManagementExecutor(com.facebook.presto.execution.TaskManagementExecutor) MemoryRevokingScheduler(com.facebook.presto.execution.MemoryRevokingScheduler) TaskThresholdMemoryRevokingScheduler(com.facebook.presto.execution.TaskThresholdMemoryRevokingScheduler) ConnectorMetadataUpdaterManager(com.facebook.presto.metadata.ConnectorMetadataUpdaterManager) TablePropertyManager(com.facebook.presto.metadata.TablePropertyManager) TheServlet(com.facebook.airlift.http.server.TheServlet) PageSourceManager(com.facebook.presto.split.PageSourceManager) PagesIndexPageSorter(com.facebook.presto.PagesIndexPageSorter) ExchangeClientFactory(com.facebook.presto.operator.ExchangeClientFactory) FileSingleStreamSpillerFactory(com.facebook.presto.spiller.FileSingleStreamSpillerFactory) DriftNettyClientModule(com.facebook.drift.transport.netty.client.DriftNettyClientModule) DataSize(io.airlift.units.DataSize) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) OrderingCompiler(com.facebook.presto.sql.gen.OrderingCompiler) NodeScheduler(com.facebook.presto.execution.scheduler.NodeScheduler) TaskThresholdMemoryRevokingScheduler(com.facebook.presto.execution.TaskThresholdMemoryRevokingScheduler) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) SqlParserOptions(com.facebook.presto.sql.parser.SqlParserOptions) ClusterMemoryManagerService(com.facebook.presto.resourcemanager.ClusterMemoryManagerService) ForExchange(com.facebook.presto.operator.ForExchange) ThriftTaskClient(com.facebook.presto.server.thrift.ThriftTaskClient) IndexJoinLookupStats(com.facebook.presto.operator.index.IndexJoinLookupStats) StaticCatalogStore(com.facebook.presto.metadata.StaticCatalogStore) NodeTaskMap(com.facebook.presto.execution.NodeTaskMap) SplitMonitor(com.facebook.presto.event.SplitMonitor) HttpLocationFactory(com.facebook.presto.server.remotetask.HttpLocationFactory) SqlParser(com.facebook.presto.sql.parser.SqlParser) NoopTracerProvider(com.facebook.presto.tracing.NoopTracerProvider) Duration(io.airlift.units.Duration) PauseMeter(com.facebook.airlift.stats.PauseMeter) SpillerStats(com.facebook.presto.spiller.SpillerStats) IndexManager(com.facebook.presto.index.IndexManager) LocalSpillManager(com.facebook.presto.spiller.LocalSpillManager) SqlTaskManager(com.facebook.presto.execution.SqlTaskManager) TaskExecutor(com.facebook.presto.execution.executor.TaskExecutor) GcStatusMonitor(com.facebook.presto.util.GcStatusMonitor) BlockEncodingManager(com.facebook.presto.common.block.BlockEncodingManager) NodeSelectionStats(com.facebook.presto.execution.scheduler.nodeSelection.NodeSelectionStats) PlanChecker(com.facebook.presto.sql.planner.sanity.PlanChecker) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) Slice(io.airlift.slice.Slice) Block(com.facebook.presto.common.block.Block) ExpressionCompiler(com.facebook.presto.sql.gen.ExpressionCompiler) SpoolingOutputBufferFactory(com.facebook.presto.execution.buffer.SpoolingOutputBufferFactory) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) ColumnPropertyManager(com.facebook.presto.metadata.ColumnPropertyManager) PageFunctionCompiler(com.facebook.presto.sql.gen.PageFunctionCompiler) TracingConfig(com.facebook.presto.tracing.TracingConfig) FeaturesConfig(com.facebook.presto.sql.analyzer.FeaturesConfig) PartitioningProviderManager(com.facebook.presto.sql.planner.PartitioningProviderManager) StandaloneSpillerFactory(com.facebook.presto.spiller.StandaloneSpillerFactory) TempStorageSingleStreamSpillerFactory(com.facebook.presto.spiller.TempStorageSingleStreamSpillerFactory) GenericSpillerFactory(com.facebook.presto.spiller.GenericSpillerFactory) SpillerFactory(com.facebook.presto.spiller.SpillerFactory) SingleStreamSpillerFactory(com.facebook.presto.spiller.SingleStreamSpillerFactory) GenericPartitioningSpillerFactory(com.facebook.presto.spiller.GenericPartitioningSpillerFactory) ExchangeClientFactory(com.facebook.presto.operator.ExchangeClientFactory) SpoolingOutputBufferFactory(com.facebook.presto.execution.buffer.SpoolingOutputBufferFactory) LocationFactory(com.facebook.presto.execution.LocationFactory) PartitioningSpillerFactory(com.facebook.presto.spiller.PartitioningSpillerFactory) FileSingleStreamSpillerFactory(com.facebook.presto.spiller.FileSingleStreamSpillerFactory) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) PageIndexerFactory(com.facebook.presto.spi.PageIndexerFactory) HttpLocationFactory(com.facebook.presto.server.remotetask.HttpLocationFactory) GroupByHashPageIndexerFactory(com.facebook.presto.GroupByHashPageIndexerFactory) LocalMemoryManagerExporter(com.facebook.presto.memory.LocalMemoryManagerExporter) NodePartitioningManager(com.facebook.presto.sql.planner.NodePartitioningManager) ResourceGroupService(com.facebook.presto.resourcemanager.ResourceGroupService) NoopResourceGroupService(com.facebook.presto.resourcemanager.NoopResourceGroupService) ResourceManagerResourceGroupService(com.facebook.presto.resourcemanager.ResourceManagerResourceGroupService) ThriftServerInfoClient(com.facebook.presto.server.thrift.ThriftServerInfoClient) HandleJsonModule(com.facebook.presto.metadata.HandleJsonModule) SchemaPropertyManager(com.facebook.presto.metadata.SchemaPropertyManager) FragmentCacheStats(com.facebook.presto.operator.FragmentCacheStats) GenericSpillerFactory(com.facebook.presto.spiller.GenericSpillerFactory) AnalyzePropertyManager(com.facebook.presto.metadata.AnalyzePropertyManager) LocalExecutionPlanner(com.facebook.presto.sql.planner.LocalExecutionPlanner) FilterStatsCalculator(com.facebook.presto.cost.FilterStatsCalculator) StandaloneSpillerFactory(com.facebook.presto.spiller.StandaloneSpillerFactory) TempStorageSingleStreamSpillerFactory(com.facebook.presto.spiller.TempStorageSingleStreamSpillerFactory) GenericSpillerFactory(com.facebook.presto.spiller.GenericSpillerFactory) SpillerFactory(com.facebook.presto.spiller.SpillerFactory) SingleStreamSpillerFactory(com.facebook.presto.spiller.SingleStreamSpillerFactory) GenericPartitioningSpillerFactory(com.facebook.presto.spiller.GenericPartitioningSpillerFactory) PartitioningSpillerFactory(com.facebook.presto.spiller.PartitioningSpillerFactory) FileSingleStreamSpillerFactory(com.facebook.presto.spiller.FileSingleStreamSpillerFactory) TempStorageStandaloneSpillerFactory(com.facebook.presto.spiller.TempStorageStandaloneSpillerFactory) SplitManager(com.facebook.presto.split.SplitManager) TaskManager(com.facebook.presto.execution.TaskManager) SqlTaskManager(com.facebook.presto.execution.SqlTaskManager) MetadataManager(com.facebook.presto.metadata.MetadataManager) JmxGcMonitor(com.facebook.airlift.stats.JmxGcMonitor) ResourceManagerInconsistentException(com.facebook.presto.resourcemanager.ResourceManagerInconsistentException) ScheduledExecutorService(java.util.concurrent.ScheduledExecutorService) ExecutorService(java.util.concurrent.ExecutorService) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) ThreadPoolExecutor(java.util.concurrent.ThreadPoolExecutor) DiscoveryNodeManager(com.facebook.presto.metadata.DiscoveryNodeManager) SystemSessionProperties(com.facebook.presto.SystemSessionProperties)

Aggregations

NodeVersion (com.facebook.presto.client.NodeVersion)11 InternalNode (com.facebook.presto.metadata.InternalNode)5 ImmutableList (com.google.common.collect.ImmutableList)5 URI (java.net.URI)5 Optional (java.util.Optional)4 ExecutorService (java.util.concurrent.ExecutorService)4 Executors.newCachedThreadPool (java.util.concurrent.Executors.newCachedThreadPool)4 ScheduledExecutorService (java.util.concurrent.ScheduledExecutorService)4 Threads.daemonThreadsNamed (com.facebook.airlift.concurrent.Threads.daemonThreadsNamed)3 ServiceDescriptor (com.facebook.airlift.discovery.client.ServiceDescriptor)3 NodeInfo (com.facebook.airlift.node.NodeInfo)3 NodeTaskMap (com.facebook.presto.execution.NodeTaskMap)3 QueryManagerConfig (com.facebook.presto.execution.QueryManagerConfig)3 List (java.util.List)3 Objects.requireNonNull (java.util.Objects.requireNonNull)3 Executors.newScheduledThreadPool (java.util.concurrent.Executors.newScheduledThreadPool)3 AbstractConfigurationAwareModule (com.facebook.airlift.configuration.AbstractConfigurationAwareModule)2 ConfigBinder.configBinder (com.facebook.airlift.configuration.ConfigBinder.configBinder)2 ServiceSelector (com.facebook.airlift.discovery.client.ServiceSelector)2 HttpClient (com.facebook.airlift.http.client.HttpClient)2