Search in sources :

Example 1 with ClusterTtlProviderFactory

use of com.facebook.presto.spi.ttl.ClusterTtlProviderFactory in project presto by prestodb.

the class TestConfidenceBasedClusterTtlProviderManager method setup.

@BeforeClass
public void setup() {
    InMemoryNodeManager nodeManager = new InMemoryNodeManager();
    nodeManager.addNode(new ConnectorId("prism"), ImmutableSet.of(node1, node2, node3));
    ConfidenceBasedNodeTtlFetcherManager nodeTtlFetcherManager = new ConfidenceBasedNodeTtlFetcherManager(nodeManager, new NodeSchedulerConfig(), new NodeTtlFetcherManagerConfig());
    NodeTtlFetcherFactory nodeTtlFetcherFactory = new TestingNodeTtlFetcherFactory(nodeToTtl);
    nodeTtlFetcherManager.addNodeTtlFetcherFactory(nodeTtlFetcherFactory);
    nodeTtlFetcherManager.load(nodeTtlFetcherFactory.getName(), ImmutableMap.of());
    nodeTtlFetcherManager.refreshTtlInfo();
    clusterTtlProviderManager = new ConfidenceBasedClusterTtlProviderManager(nodeTtlFetcherManager);
    ClusterTtlProviderFactory clusterTtlProviderFactory = new TestingClusterTtlProviderFactory();
    clusterTtlProviderManager.addClusterTtlProviderFactory(clusterTtlProviderFactory);
    clusterTtlProviderManager.load(clusterTtlProviderFactory.getName(), ImmutableMap.of());
}
Also used : ConfidenceBasedClusterTtlProviderManager(com.facebook.presto.ttl.clusterttlprovidermanagers.ConfidenceBasedClusterTtlProviderManager) NodeTtlFetcherFactory(com.facebook.presto.spi.ttl.NodeTtlFetcherFactory) TestingNodeTtlFetcherFactory(com.facebook.presto.spi.ttl.TestingNodeTtlFetcherFactory) ConfidenceBasedNodeTtlFetcherManager(com.facebook.presto.ttl.nodettlfetchermanagers.ConfidenceBasedNodeTtlFetcherManager) NodeTtlFetcherManagerConfig(com.facebook.presto.ttl.nodettlfetchermanagers.NodeTtlFetcherManagerConfig) TestingClusterTtlProviderFactory(com.facebook.presto.spi.ttl.TestingClusterTtlProviderFactory) TestingClusterTtlProviderFactory(com.facebook.presto.spi.ttl.TestingClusterTtlProviderFactory) ClusterTtlProviderFactory(com.facebook.presto.spi.ttl.ClusterTtlProviderFactory) NodeSchedulerConfig(com.facebook.presto.execution.scheduler.NodeSchedulerConfig) TestingNodeTtlFetcherFactory(com.facebook.presto.spi.ttl.TestingNodeTtlFetcherFactory) InMemoryNodeManager(com.facebook.presto.metadata.InMemoryNodeManager) ConnectorId(com.facebook.presto.spi.ConnectorId) BeforeClass(org.testng.annotations.BeforeClass)

Example 2 with ClusterTtlProviderFactory

use of com.facebook.presto.spi.ttl.ClusterTtlProviderFactory in project presto by prestodb.

the class PluginManager method installPlugin.

public void installPlugin(Plugin plugin) {
    for (BlockEncoding blockEncoding : plugin.getBlockEncodings()) {
        log.info("Registering block encoding %s", blockEncoding.getName());
        blockEncodingManager.addBlockEncoding(blockEncoding);
    }
    for (Type type : plugin.getTypes()) {
        log.info("Registering type %s", type.getTypeSignature());
        metadata.getFunctionAndTypeManager().addType(type);
    }
    for (ParametricType parametricType : plugin.getParametricTypes()) {
        log.info("Registering parametric type %s", parametricType.getName());
        metadata.getFunctionAndTypeManager().addParametricType(parametricType);
    }
    for (ConnectorFactory connectorFactory : plugin.getConnectorFactories()) {
        if (disabledConnectors.contains(connectorFactory.getName())) {
            log.info("Skipping disabled connector %s", connectorFactory.getName());
            continue;
        }
        log.info("Registering connector %s", connectorFactory.getName());
        connectorManager.addConnectorFactory(connectorFactory);
    }
    for (Class<?> functionClass : plugin.getFunctions()) {
        log.info("Registering functions from %s", functionClass.getName());
        metadata.registerBuiltInFunctions(extractFunctions(functionClass));
    }
    for (FunctionNamespaceManagerFactory functionNamespaceManagerFactory : plugin.getFunctionNamespaceManagerFactories()) {
        log.info("Registering function namespace manager %s", functionNamespaceManagerFactory.getName());
        metadata.getFunctionAndTypeManager().addFunctionNamespaceFactory(functionNamespaceManagerFactory);
    }
    for (SessionPropertyConfigurationManagerFactory sessionConfigFactory : plugin.getSessionPropertyConfigurationManagerFactories()) {
        log.info("Registering session property configuration manager %s", sessionConfigFactory.getName());
        sessionPropertyDefaults.addConfigurationManagerFactory(sessionConfigFactory);
    }
    for (ResourceGroupConfigurationManagerFactory configurationManagerFactory : plugin.getResourceGroupConfigurationManagerFactories()) {
        log.info("Registering resource group configuration manager %s", configurationManagerFactory.getName());
        resourceGroupManager.addConfigurationManagerFactory(configurationManagerFactory);
    }
    for (SystemAccessControlFactory accessControlFactory : plugin.getSystemAccessControlFactories()) {
        log.info("Registering system access control %s", accessControlFactory.getName());
        accessControlManager.addSystemAccessControlFactory(accessControlFactory);
    }
    for (PasswordAuthenticatorFactory authenticatorFactory : plugin.getPasswordAuthenticatorFactories()) {
        log.info("Registering password authenticator %s", authenticatorFactory.getName());
        passwordAuthenticatorManager.addPasswordAuthenticatorFactory(authenticatorFactory);
    }
    for (EventListenerFactory eventListenerFactory : plugin.getEventListenerFactories()) {
        log.info("Registering event listener %s", eventListenerFactory.getName());
        eventListenerManager.addEventListenerFactory(eventListenerFactory);
    }
    for (TempStorageFactory tempStorageFactory : plugin.getTempStorageFactories()) {
        log.info("Registering temp storage %s", tempStorageFactory.getName());
        tempStorageManager.addTempStorageFactory(tempStorageFactory);
    }
    for (QueryPrerequisitesFactory queryPrerequisitesFactory : plugin.getQueryPrerequisitesFactories()) {
        log.info("Registering query prerequisite factory %s", queryPrerequisitesFactory.getName());
        queryPrerequisitesManager.addQueryPrerequisitesFactory(queryPrerequisitesFactory);
    }
    for (NodeTtlFetcherFactory nodeTtlFetcherFactory : plugin.getNodeTtlFetcherFactories()) {
        log.info("Registering Ttl fetcher factory %s", nodeTtlFetcherFactory.getName());
        nodeTtlFetcherManager.addNodeTtlFetcherFactory(nodeTtlFetcherFactory);
    }
    for (ClusterTtlProviderFactory clusterTtlProviderFactory : plugin.getClusterTtlProviderFactories()) {
        log.info("Registering Cluster Ttl provider factory %s", clusterTtlProviderFactory.getName());
        clusterTtlProviderManager.addClusterTtlProviderFactory(clusterTtlProviderFactory);
    }
}
Also used : NodeTtlFetcherFactory(com.facebook.presto.spi.ttl.NodeTtlFetcherFactory) ResourceGroupConfigurationManagerFactory(com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManagerFactory) ClusterTtlProviderFactory(com.facebook.presto.spi.ttl.ClusterTtlProviderFactory) EventListenerFactory(com.facebook.presto.spi.eventlistener.EventListenerFactory) QueryPrerequisitesFactory(com.facebook.presto.spi.prerequisites.QueryPrerequisitesFactory) SystemAccessControlFactory(com.facebook.presto.spi.security.SystemAccessControlFactory) ParametricType(com.facebook.presto.common.type.ParametricType) Type(com.facebook.presto.common.type.Type) PasswordAuthenticatorFactory(com.facebook.presto.spi.security.PasswordAuthenticatorFactory) ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory) ParametricType(com.facebook.presto.common.type.ParametricType) FunctionNamespaceManagerFactory(com.facebook.presto.spi.function.FunctionNamespaceManagerFactory) TempStorageFactory(com.facebook.presto.spi.storage.TempStorageFactory) SessionPropertyConfigurationManagerFactory(com.facebook.presto.spi.session.SessionPropertyConfigurationManagerFactory) BlockEncoding(com.facebook.presto.common.block.BlockEncoding)

Example 3 with ClusterTtlProviderFactory

use of com.facebook.presto.spi.ttl.ClusterTtlProviderFactory in project presto by prestodb.

the class ConfidenceBasedClusterTtlProviderManager method load.

@VisibleForTesting
public void load(String factoryName, Map<String, String> properties) {
    log.info("-- Loading Cluster Ttl Provider factory --");
    ClusterTtlProviderFactory clusterTtlProviderFactory = clusterTtlProviderFactories.get(factoryName);
    checkState(clusterTtlProviderFactory != null, "Cluster Ttl Provider factory %s is not registered", factoryName);
    ClusterTtlProvider clusterTtlProvider = clusterTtlProviderFactory.create(properties);
    checkState(this.clusterTtlProvider.compareAndSet(null, clusterTtlProvider), "Cluster Ttl Provider has already been set!");
    log.info("-- Loaded Cluster Ttl Provider %s --", factoryName);
}
Also used : ClusterTtlProviderFactory(com.facebook.presto.spi.ttl.ClusterTtlProviderFactory) ClusterTtlProvider(com.facebook.presto.spi.ttl.ClusterTtlProvider) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

ClusterTtlProviderFactory (com.facebook.presto.spi.ttl.ClusterTtlProviderFactory)3 NodeTtlFetcherFactory (com.facebook.presto.spi.ttl.NodeTtlFetcherFactory)2 BlockEncoding (com.facebook.presto.common.block.BlockEncoding)1 ParametricType (com.facebook.presto.common.type.ParametricType)1 Type (com.facebook.presto.common.type.Type)1 NodeSchedulerConfig (com.facebook.presto.execution.scheduler.NodeSchedulerConfig)1 InMemoryNodeManager (com.facebook.presto.metadata.InMemoryNodeManager)1 ConnectorId (com.facebook.presto.spi.ConnectorId)1 ConnectorFactory (com.facebook.presto.spi.connector.ConnectorFactory)1 EventListenerFactory (com.facebook.presto.spi.eventlistener.EventListenerFactory)1 FunctionNamespaceManagerFactory (com.facebook.presto.spi.function.FunctionNamespaceManagerFactory)1 QueryPrerequisitesFactory (com.facebook.presto.spi.prerequisites.QueryPrerequisitesFactory)1 ResourceGroupConfigurationManagerFactory (com.facebook.presto.spi.resourceGroups.ResourceGroupConfigurationManagerFactory)1 PasswordAuthenticatorFactory (com.facebook.presto.spi.security.PasswordAuthenticatorFactory)1 SystemAccessControlFactory (com.facebook.presto.spi.security.SystemAccessControlFactory)1 SessionPropertyConfigurationManagerFactory (com.facebook.presto.spi.session.SessionPropertyConfigurationManagerFactory)1 TempStorageFactory (com.facebook.presto.spi.storage.TempStorageFactory)1 ClusterTtlProvider (com.facebook.presto.spi.ttl.ClusterTtlProvider)1 TestingClusterTtlProviderFactory (com.facebook.presto.spi.ttl.TestingClusterTtlProviderFactory)1 TestingNodeTtlFetcherFactory (com.facebook.presto.spi.ttl.TestingNodeTtlFetcherFactory)1