Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shutdown BigQuery, Kinesis, Redis and Memory connectors #17175

Merged
merged 7 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@
import io.trino.spi.connector.ConnectorSession;
import io.trino.spi.connector.ConnectorSplitManager;
import io.trino.spi.connector.ConnectorTransactionHandle;
import io.trino.spi.connector.SystemTable;
import io.trino.spi.transaction.IsolationLevel;
import io.trino.transaction.InternalConnector;
import io.trino.transaction.TransactionId;

import java.util.Set;
import java.util.function.Function;

import static java.util.Objects.requireNonNull;
Expand All @@ -37,14 +35,6 @@ public class SystemConnector
private final ConnectorPageSourceProvider pageSourceProvider;
private final Function<TransactionId, ConnectorTransactionHandle> transactionHandleFunction;

public SystemConnector(
InternalNodeManager nodeManager,
Set<SystemTable> tables,
Function<TransactionId, ConnectorTransactionHandle> transactionHandleFunction)
{
this(nodeManager, new StaticSystemTablesProvider(tables), transactionHandleFunction);
}

public SystemConnector(
InternalNodeManager nodeManager,
SystemTablesProvider tables,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package io.trino.plugin.bigquery;

import io.airlift.bootstrap.LifeCycleManager;
import io.trino.plugin.base.classloader.ClassLoaderSafeConnectorMetadata;
import io.trino.plugin.base.session.SessionPropertiesProvider;
import io.trino.spi.connector.Connector;
Expand All @@ -37,6 +38,7 @@
public class BigQueryConnector
implements Connector
{
private final LifeCycleManager lifeCycleManager;
private final BigQueryTransactionManager transactionManager;
private final BigQuerySplitManager splitManager;
private final BigQueryPageSourceProvider pageSourceProvider;
Expand All @@ -46,13 +48,15 @@ public class BigQueryConnector

@Inject
public BigQueryConnector(
LifeCycleManager lifeCycleManager,
BigQueryTransactionManager transactionManager,
BigQuerySplitManager splitManager,
BigQueryPageSourceProvider pageSourceProvider,
BigQueryPageSinkProvider pageSinkProvider,
Set<ConnectorTableFunction> connectorTableFunctions,
Set<SessionPropertiesProvider> sessionPropertiesProviders)
{
this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
this.transactionManager = requireNonNull(transactionManager, "transactionManager is null");
this.splitManager = requireNonNull(splitManager, "splitManager is null");
this.pageSourceProvider = requireNonNull(pageSourceProvider, "pageSourceProvider is null");
Expand Down Expand Up @@ -116,4 +120,10 @@ public List<PropertyMetadata<?>> getSessionProperties()
{
return sessionProperties;
}

@Override
public void shutdown()
{
lifeCycleManager.stop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.google.common.collect.ImmutableList;
import com.google.inject.Inject;
import io.airlift.bootstrap.LifeCycleManager;
import io.trino.spi.connector.Connector;
import io.trino.spi.connector.ConnectorMetadata;
import io.trino.spi.connector.ConnectorRecordSetProvider;
Expand All @@ -33,6 +34,7 @@
public class KinesisConnector
implements Connector
{
private final LifeCycleManager lifeCycleManager;
private final KinesisMetadata metadata;
private final KinesisSplitManager splitManager;
private final KinesisRecordSetProvider recordSetProvider;
Expand All @@ -41,11 +43,13 @@ public class KinesisConnector

@Inject
public KinesisConnector(
LifeCycleManager lifeCycleManager,
KinesisMetadata metadata,
KinesisSplitManager splitManager,
KinesisRecordSetProvider recordSetProvider,
KinesisSessionProperties properties)
{
this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
this.metadata = requireNonNull(metadata, "metadata is null");
this.splitManager = requireNonNull(splitManager, "splitManager is null");
this.recordSetProvider = requireNonNull(recordSetProvider, "recordSetProvider is null");
Expand Down Expand Up @@ -82,4 +86,10 @@ public List<PropertyMetadata<?>> getSessionProperties()
{
return propertyList;
}

@Override
public void shutdown()
{
lifeCycleManager.stop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package io.trino.plugin.memory;

import io.airlift.bootstrap.LifeCycleManager;
import io.trino.spi.connector.Connector;
import io.trino.spi.connector.ConnectorMetadata;
import io.trino.spi.connector.ConnectorPageSinkProvider;
Expand All @@ -24,21 +25,26 @@

import javax.inject.Inject;

import static java.util.Objects.requireNonNull;

public class MemoryConnector
implements Connector
{
private final LifeCycleManager lifeCycleManager;
private final MemoryMetadata metadata;
private final MemorySplitManager splitManager;
private final MemoryPageSourceProvider pageSourceProvider;
private final MemoryPageSinkProvider pageSinkProvider;

@Inject
public MemoryConnector(
LifeCycleManager lifeCycleManager,
MemoryMetadata metadata,
MemorySplitManager splitManager,
MemoryPageSourceProvider pageSourceProvider,
MemoryPageSinkProvider pageSinkProvider)
{
this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
this.metadata = metadata;
this.splitManager = splitManager;
this.pageSourceProvider = pageSourceProvider;
Expand Down Expand Up @@ -74,4 +80,10 @@ public ConnectorPageSinkProvider getPageSinkProvider()
{
return pageSinkProvider;
}

@Override
public void shutdown()
{
lifeCycleManager.stop();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
*/
package io.trino.plugin.redis;

import io.airlift.bootstrap.LifeCycleManager;
import io.trino.spi.connector.Connector;
import io.trino.spi.connector.ConnectorMetadata;
import io.trino.spi.connector.ConnectorRecordSetProvider;
Expand All @@ -33,17 +34,20 @@
public class RedisConnector
implements Connector
{
private final LifeCycleManager lifeCycleManager;
private final RedisMetadata metadata;

private final RedisSplitManager splitManager;
private final RedisRecordSetProvider recordSetProvider;

@Inject
public RedisConnector(
LifeCycleManager lifeCycleManager,
RedisMetadata metadata,
RedisSplitManager splitManager,
RedisRecordSetProvider recordSetProvider)
{
this.lifeCycleManager = requireNonNull(lifeCycleManager, "lifeCycleManager is null");
this.metadata = requireNonNull(metadata, "metadata is null");
this.splitManager = requireNonNull(splitManager, "splitManager is null");
this.recordSetProvider = requireNonNull(recordSetProvider, "recordSetProvider is null");
Expand Down Expand Up @@ -73,4 +77,10 @@ public ConnectorRecordSetProvider getRecordSetProvider()
{
return recordSetProvider;
}

@Override
public void shutdown()
{
lifeCycleManager.stop();
}
}