From bfcb5e8b0b5adae54368380bc1aa8eb98cfe205d Mon Sep 17 00:00:00 2001 From: David Phillips Date: Wed, 3 Nov 2021 14:23:59 -0700 Subject: [PATCH] Migrate Connector.beginTransaction() implementations --- .../java/io/trino/testing/TestingSession.java | 2 +- .../trino/transaction/InternalConnector.java | 2 +- .../io/trino/connector/MockConnector.java | 2 +- .../io/trino/execution/TestSetRoleTask.java | 2 +- .../io/trino/sql/analyzer/TestAnalyzer.java | 2 +- .../sql/planner/TestMaterializedViews.java | 2 +- .../plugin/accumulo/AccumuloConnector.java | 2 +- .../io/trino/plugin/atop/AtopConnector.java | 2 +- .../io/trino/plugin/jdbc/JdbcConnector.java | 2 +- .../plugin/bigquery/BigQueryConnector.java | 2 +- .../plugin/blackhole/BlackHoleConnector.java | 2 +- .../plugin/cassandra/CassandraConnector.java | 2 +- .../elasticsearch/ElasticsearchConnector.java | 2 +- .../plugin/example/ExampleConnector.java | 2 +- .../plugin/google/sheets/SheetsConnector.java | 2 +- .../plugin/iceberg/IcebergConnector.java | 2 +- .../io/trino/plugin/jmx/JmxConnector.java | 2 +- .../io/trino/plugin/kafka/KafkaConnector.java | 2 +- .../plugin/kinesis/KinesisConnector.java | 2 +- .../plugin/kinesis/TestKinesisPlugin.java | 2 +- .../io/trino/plugin/kudu/KuduConnector.java | 2 +- .../plugin/localfile/LocalFileConnector.java | 2 +- .../trino/plugin/memory/MemoryConnector.java | 2 +- .../trino/plugin/mongodb/MongoConnector.java | 2 +- .../plugin/phoenix/PhoenixConnector.java | 2 +- .../plugin/phoenix5/PhoenixConnector.java | 2 +- .../io/trino/plugin/pinot/PinotConnector.java | 2 +- .../prometheus/PrometheusConnector.java | 2 +- .../plugin/raptor/legacy/RaptorConnector.java | 2 +- .../raptor/legacy/TestRaptorConnector.java | 19 ++++++++++++------- .../io/trino/plugin/redis/RedisConnector.java | 2 +- .../trino/plugin/thrift/ThriftConnector.java | 2 +- .../plugin/tpcds/TpcdsConnectorFactory.java | 2 +- .../plugin/tpch/TpchConnectorFactory.java | 2 +- .../tpch/IndexedTpchConnectorFactory.java | 2 +- .../io/trino/execution/TestBeginQuery.java | 2 +- .../TestCoordinatorDynamicFiltering.java | 2 +- 37 files changed, 48 insertions(+), 43 deletions(-) diff --git a/core/trino-main/src/main/java/io/trino/testing/TestingSession.java b/core/trino-main/src/main/java/io/trino/testing/TestingSession.java index add0fe23ab50..9b952e6ceda1 100644 --- a/core/trino-main/src/main/java/io/trino/testing/TestingSession.java +++ b/core/trino-main/src/main/java/io/trino/testing/TestingSession.java @@ -94,7 +94,7 @@ private static Connector createTestSessionConnector() return new Connector() { @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return new ConnectorTransactionHandle() {}; } diff --git a/core/trino-main/src/main/java/io/trino/transaction/InternalConnector.java b/core/trino-main/src/main/java/io/trino/transaction/InternalConnector.java index a46d27cee65e..7d274995d6a0 100644 --- a/core/trino-main/src/main/java/io/trino/transaction/InternalConnector.java +++ b/core/trino-main/src/main/java/io/trino/transaction/InternalConnector.java @@ -21,7 +21,7 @@ public interface InternalConnector extends Connector { @Override - default ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + default ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { throw new UnsupportedOperationException(); } diff --git a/core/trino-main/src/test/java/io/trino/connector/MockConnector.java b/core/trino-main/src/test/java/io/trino/connector/MockConnector.java index b92eb22e033e..79be5431a9af 100644 --- a/core/trino-main/src/test/java/io/trino/connector/MockConnector.java +++ b/core/trino-main/src/test/java/io/trino/connector/MockConnector.java @@ -177,7 +177,7 @@ public class MockConnector } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return MockConnectorTransactionHandle.INSTANCE; } diff --git a/core/trino-main/src/test/java/io/trino/execution/TestSetRoleTask.java b/core/trino-main/src/test/java/io/trino/execution/TestSetRoleTask.java index 420ade189ab6..6c8baf5baac0 100644 --- a/core/trino-main/src/test/java/io/trino/execution/TestSetRoleTask.java +++ b/core/trino-main/src/test/java/io/trino/execution/TestSetRoleTask.java @@ -107,7 +107,7 @@ public void setUp() Connector systemRoleConnector = new Connector() { @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return new ConnectorTransactionHandle() {}; } diff --git a/core/trino-main/src/test/java/io/trino/sql/analyzer/TestAnalyzer.java b/core/trino-main/src/test/java/io/trino/sql/analyzer/TestAnalyzer.java index d5824c1fd40a..b0339bc08f96 100644 --- a/core/trino-main/src/test/java/io/trino/sql/analyzer/TestAnalyzer.java +++ b/core/trino-main/src/test/java/io/trino/sql/analyzer/TestAnalyzer.java @@ -5328,7 +5328,7 @@ private static Connector createTestingConnector() private final ConnectorMetadata metadata = new TestingMetadata(); @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return new ConnectorTransactionHandle() {}; } diff --git a/core/trino-main/src/test/java/io/trino/sql/planner/TestMaterializedViews.java b/core/trino-main/src/test/java/io/trino/sql/planner/TestMaterializedViews.java index b66ab17a0de7..8f84b24670af 100644 --- a/core/trino-main/src/test/java/io/trino/sql/planner/TestMaterializedViews.java +++ b/core/trino-main/src/test/java/io/trino/sql/planner/TestMaterializedViews.java @@ -236,7 +236,7 @@ private static Connector createTestingConnector() private final ConnectorMetadata metadata = new TestingMetadata(); @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return new ConnectorTransactionHandle() {}; } diff --git a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloConnector.java b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloConnector.java index a30b5af16ba0..bb76c8dd2b17 100644 --- a/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloConnector.java +++ b/plugin/trino-accumulo/src/main/java/io/trino/plugin/accumulo/AccumuloConnector.java @@ -82,7 +82,7 @@ public ConnectorMetadata getMetadata(ConnectorTransactionHandle transactionHandl } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_UNCOMMITTED, isolationLevel); ConnectorTransactionHandle transaction = new AccumuloTransactionHandle(); diff --git a/plugin/trino-atop/src/main/java/io/trino/plugin/atop/AtopConnector.java b/plugin/trino-atop/src/main/java/io/trino/plugin/atop/AtopConnector.java index 2efec8f32eed..9ae775abd2d8 100644 --- a/plugin/trino-atop/src/main/java/io/trino/plugin/atop/AtopConnector.java +++ b/plugin/trino-atop/src/main/java/io/trino/plugin/atop/AtopConnector.java @@ -53,7 +53,7 @@ public AtopConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return AtopTransactionHandle.INSTANCE; } diff --git a/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/JdbcConnector.java b/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/JdbcConnector.java index 22181e5ad5b7..77b61e64d62d 100644 --- a/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/JdbcConnector.java +++ b/plugin/trino-base-jdbc/src/main/java/io/trino/plugin/jdbc/JdbcConnector.java @@ -88,7 +88,7 @@ public JdbcConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_COMMITTED, isolationLevel); JdbcTransactionHandle transaction = new JdbcTransactionHandle(); diff --git a/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryConnector.java b/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryConnector.java index fc8fc1f6b170..170ab1aa5443 100644 --- a/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryConnector.java +++ b/plugin/trino-bigquery/src/main/java/io/trino/plugin/bigquery/BigQueryConnector.java @@ -48,7 +48,7 @@ public BigQueryConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { log.debug("beginTransaction(isolationLevel=%s, readOnly=%s)", isolationLevel, readOnly); checkConnectorSupports(READ_COMMITTED, isolationLevel); diff --git a/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleConnector.java b/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleConnector.java index 795efe59fc16..e3e8325416a2 100644 --- a/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleConnector.java +++ b/plugin/trino-blackhole/src/main/java/io/trino/plugin/blackhole/BlackHoleConnector.java @@ -75,7 +75,7 @@ public BlackHoleConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return BlackHoleTransactionHandle.INSTANCE; } diff --git a/plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraConnector.java b/plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraConnector.java index e1cb6d9353bb..3cbb9b190fbc 100644 --- a/plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraConnector.java +++ b/plugin/trino-cassandra/src/main/java/io/trino/plugin/cassandra/CassandraConnector.java @@ -59,7 +59,7 @@ public CassandraConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_UNCOMMITTED, isolationLevel); return CassandraTransactionHandle.INSTANCE; diff --git a/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/ElasticsearchConnector.java b/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/ElasticsearchConnector.java index 3571244fe1a6..102c9f5a4694 100644 --- a/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/ElasticsearchConnector.java +++ b/plugin/trino-elasticsearch/src/main/java/io/trino/plugin/elasticsearch/ElasticsearchConnector.java @@ -56,7 +56,7 @@ public ElasticsearchConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_COMMITTED, isolationLevel); return ElasticsearchTransactionHandle.INSTANCE; diff --git a/plugin/trino-example-http/src/main/java/io/trino/plugin/example/ExampleConnector.java b/plugin/trino-example-http/src/main/java/io/trino/plugin/example/ExampleConnector.java index 5d0cb896fec0..112b99345af4 100644 --- a/plugin/trino-example-http/src/main/java/io/trino/plugin/example/ExampleConnector.java +++ b/plugin/trino-example-http/src/main/java/io/trino/plugin/example/ExampleConnector.java @@ -48,7 +48,7 @@ public ExampleConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return INSTANCE; } diff --git a/plugin/trino-google-sheets/src/main/java/io/trino/plugin/google/sheets/SheetsConnector.java b/plugin/trino-google-sheets/src/main/java/io/trino/plugin/google/sheets/SheetsConnector.java index 5c571229f438..9bf5356ce6dc 100644 --- a/plugin/trino-google-sheets/src/main/java/io/trino/plugin/google/sheets/SheetsConnector.java +++ b/plugin/trino-google-sheets/src/main/java/io/trino/plugin/google/sheets/SheetsConnector.java @@ -48,7 +48,7 @@ public SheetsConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return INSTANCE; } diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergConnector.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergConnector.java index f917685fee85..b797c098a59d 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergConnector.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergConnector.java @@ -181,7 +181,7 @@ public ConnectorAccessControl getAccessControl() } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(SERIALIZABLE, isolationLevel); ConnectorTransactionHandle transaction = new HiveTransactionHandle(); diff --git a/plugin/trino-jmx/src/main/java/io/trino/plugin/jmx/JmxConnector.java b/plugin/trino-jmx/src/main/java/io/trino/plugin/jmx/JmxConnector.java index 88b12926fdc1..17bf6d4f2cb1 100644 --- a/plugin/trino-jmx/src/main/java/io/trino/plugin/jmx/JmxConnector.java +++ b/plugin/trino-jmx/src/main/java/io/trino/plugin/jmx/JmxConnector.java @@ -66,7 +66,7 @@ public JmxRecordSetProvider getRecordSetProvider() } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_COMMITTED, isolationLevel); return JmxTransactionHandle.INSTANCE; diff --git a/plugin/trino-kafka/src/main/java/io/trino/plugin/kafka/KafkaConnector.java b/plugin/trino-kafka/src/main/java/io/trino/plugin/kafka/KafkaConnector.java index 22c0a8ab57ab..8e0292ee3cfd 100644 --- a/plugin/trino-kafka/src/main/java/io/trino/plugin/kafka/KafkaConnector.java +++ b/plugin/trino-kafka/src/main/java/io/trino/plugin/kafka/KafkaConnector.java @@ -64,7 +64,7 @@ public KafkaConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_COMMITTED, isolationLevel); return KafkaTransactionHandle.INSTANCE; diff --git a/plugin/trino-kinesis/src/main/java/io/trino/plugin/kinesis/KinesisConnector.java b/plugin/trino-kinesis/src/main/java/io/trino/plugin/kinesis/KinesisConnector.java index 00d700a3df7f..e3d10236a76e 100644 --- a/plugin/trino-kinesis/src/main/java/io/trino/plugin/kinesis/KinesisConnector.java +++ b/plugin/trino-kinesis/src/main/java/io/trino/plugin/kinesis/KinesisConnector.java @@ -58,7 +58,7 @@ public ConnectorMetadata getMetadata(ConnectorTransactionHandle transactionHandl } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean b) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_COMMITTED, isolationLevel); return KinesisTransactionHandle.INSTANCE; diff --git a/plugin/trino-kinesis/src/test/java/io/trino/plugin/kinesis/TestKinesisPlugin.java b/plugin/trino-kinesis/src/test/java/io/trino/plugin/kinesis/TestKinesisPlugin.java index fd8256927c3a..61bda4d328ac 100644 --- a/plugin/trino-kinesis/src/test/java/io/trino/plugin/kinesis/TestKinesisPlugin.java +++ b/plugin/trino-kinesis/src/test/java/io/trino/plugin/kinesis/TestKinesisPlugin.java @@ -59,7 +59,7 @@ public void testCreateConnector() ConnectorMetadata md = c.getMetadata(KinesisTransactionHandle.INSTANCE); assertNotNull(md); - ConnectorTransactionHandle handle = c.beginTransaction(READ_COMMITTED, true); + ConnectorTransactionHandle handle = c.beginTransaction(READ_COMMITTED, true, true); assertTrue(handle instanceof KinesisTransactionHandle); c.shutdown(); diff --git a/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduConnector.java b/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduConnector.java index c4b2852da442..bb2236a9bfc2 100755 --- a/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduConnector.java +++ b/plugin/trino-kudu/src/main/java/io/trino/plugin/kudu/KuduConnector.java @@ -73,7 +73,7 @@ public KuduConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_COMMITTED, isolationLevel); return KuduTransactionHandle.INSTANCE; diff --git a/plugin/trino-local-file/src/main/java/io/trino/plugin/localfile/LocalFileConnector.java b/plugin/trino-local-file/src/main/java/io/trino/plugin/localfile/LocalFileConnector.java index 62feb6a0306a..6ba792fe1162 100644 --- a/plugin/trino-local-file/src/main/java/io/trino/plugin/localfile/LocalFileConnector.java +++ b/plugin/trino-local-file/src/main/java/io/trino/plugin/localfile/LocalFileConnector.java @@ -49,7 +49,7 @@ public LocalFileConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_COMMITTED, isolationLevel); return LocalFileTransactionHandle.INSTANCE; diff --git a/plugin/trino-memory/src/main/java/io/trino/plugin/memory/MemoryConnector.java b/plugin/trino-memory/src/main/java/io/trino/plugin/memory/MemoryConnector.java index eb95fce1cfc5..0d1f0477eae3 100644 --- a/plugin/trino-memory/src/main/java/io/trino/plugin/memory/MemoryConnector.java +++ b/plugin/trino-memory/src/main/java/io/trino/plugin/memory/MemoryConnector.java @@ -45,7 +45,7 @@ public MemoryConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return MemoryTransactionHandle.INSTANCE; } diff --git a/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoConnector.java b/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoConnector.java index c44c542a7c29..3e0462a5bcd3 100644 --- a/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoConnector.java +++ b/plugin/trino-mongodb/src/main/java/io/trino/plugin/mongodb/MongoConnector.java @@ -55,7 +55,7 @@ public MongoConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_UNCOMMITTED, isolationLevel); MongoTransactionHandle transaction = new MongoTransactionHandle(); diff --git a/plugin/trino-phoenix/src/main/java/io/trino/plugin/phoenix/PhoenixConnector.java b/plugin/trino-phoenix/src/main/java/io/trino/plugin/phoenix/PhoenixConnector.java index 647470cc3b2b..b1181a80fcb1 100644 --- a/plugin/trino-phoenix/src/main/java/io/trino/plugin/phoenix/PhoenixConnector.java +++ b/plugin/trino-phoenix/src/main/java/io/trino/plugin/phoenix/PhoenixConnector.java @@ -71,7 +71,7 @@ public PhoenixConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return new JdbcTransactionHandle(); } diff --git a/plugin/trino-phoenix5/src/main/java/io/trino/plugin/phoenix5/PhoenixConnector.java b/plugin/trino-phoenix5/src/main/java/io/trino/plugin/phoenix5/PhoenixConnector.java index f5994c7ad8bf..e6858cabe684 100644 --- a/plugin/trino-phoenix5/src/main/java/io/trino/plugin/phoenix5/PhoenixConnector.java +++ b/plugin/trino-phoenix5/src/main/java/io/trino/plugin/phoenix5/PhoenixConnector.java @@ -71,7 +71,7 @@ public PhoenixConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return new JdbcTransactionHandle(); } diff --git a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/PinotConnector.java b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/PinotConnector.java index 483daaaee132..3908bb94392b 100755 --- a/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/PinotConnector.java +++ b/plugin/trino-pinot/src/main/java/io/trino/plugin/pinot/PinotConnector.java @@ -58,7 +58,7 @@ public PinotConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return PinotTransactionHandle.INSTANCE; } diff --git a/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusConnector.java b/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusConnector.java index af584db8a96f..180093a01737 100644 --- a/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusConnector.java +++ b/plugin/trino-prometheus/src/main/java/io/trino/plugin/prometheus/PrometheusConnector.java @@ -51,7 +51,7 @@ public PrometheusConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return INSTANCE; } diff --git a/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorConnector.java b/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorConnector.java index 226d0d264775..6e0a740395f6 100644 --- a/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorConnector.java +++ b/plugin/trino-raptor-legacy/src/main/java/io/trino/plugin/raptor/legacy/RaptorConnector.java @@ -118,7 +118,7 @@ public void start() } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_COMMITTED, isolationLevel); RaptorTransactionHandle transaction = new RaptorTransactionHandle(); diff --git a/plugin/trino-raptor-legacy/src/test/java/io/trino/plugin/raptor/legacy/TestRaptorConnector.java b/plugin/trino-raptor-legacy/src/test/java/io/trino/plugin/raptor/legacy/TestRaptorConnector.java index 8df535fd42b4..44efed764817 100644 --- a/plugin/trino-raptor-legacy/src/test/java/io/trino/plugin/raptor/legacy/TestRaptorConnector.java +++ b/plugin/trino-raptor-legacy/src/test/java/io/trino/plugin/raptor/legacy/TestRaptorConnector.java @@ -134,7 +134,7 @@ public void testMaintenanceBlocked() assertFalse(metadataDao.isMaintenanceBlockedLocked(tableId2)); // begin delete for table1 - ConnectorTransactionHandle txn1 = connector.beginTransaction(READ_COMMITTED, false); + ConnectorTransactionHandle txn1 = beginTransaction(); ConnectorTableHandle handle1 = getTableHandle(connector.getMetadata(txn1), "test1"); connector.getMetadata(txn1).beginDelete(SESSION, handle1); @@ -142,7 +142,7 @@ public void testMaintenanceBlocked() assertFalse(metadataDao.isMaintenanceBlockedLocked(tableId2)); // begin delete for table2 - ConnectorTransactionHandle txn2 = connector.beginTransaction(READ_COMMITTED, false); + ConnectorTransactionHandle txn2 = beginTransaction(); ConnectorTableHandle handle2 = getTableHandle(connector.getMetadata(txn2), "test2"); connector.getMetadata(txn2).beginDelete(SESSION, handle2); @@ -150,7 +150,7 @@ public void testMaintenanceBlocked() assertTrue(metadataDao.isMaintenanceBlockedLocked(tableId2)); // begin another delete for table1 - ConnectorTransactionHandle txn3 = connector.beginTransaction(READ_COMMITTED, false); + ConnectorTransactionHandle txn3 = beginTransaction(); ConnectorTableHandle handle3 = getTableHandle(connector.getMetadata(txn3), "test1"); connector.getMetadata(txn3).beginDelete(SESSION, handle3); @@ -214,7 +214,7 @@ private void assertSplitShard(Type temporalType, String min, String max, int exp .setPropertyMetadata(new RaptorSessionProperties(new StorageManagerConfig()).getSessionProperties()) .build(); - ConnectorTransactionHandle transaction = connector.beginTransaction(READ_COMMITTED, false); + ConnectorTransactionHandle transaction = beginTransaction(); connector.getMetadata(transaction).createTable( SESSION, new ConnectorTableMetadata( @@ -224,7 +224,7 @@ private void assertSplitShard(Type temporalType, String min, String max, int exp false); connector.commit(transaction); - ConnectorTransactionHandle txn1 = connector.beginTransaction(READ_COMMITTED, false); + ConnectorTransactionHandle txn1 = beginTransaction(); ConnectorTableHandle handle1 = getTableHandle(connector.getMetadata(txn1), "test"); ConnectorInsertTableHandle insertTableHandle = connector.getMetadata(txn1).beginInsert(session, handle1); ConnectorPageSink raptorPageSink = connector.getPageSinkProvider().createPageSink(txn1, session, insertTableHandle); @@ -256,7 +256,7 @@ else if (temporalType.equals(DATE)) { private long createTable(String name) { - ConnectorTransactionHandle transaction = connector.beginTransaction(READ_COMMITTED, false); + ConnectorTransactionHandle transaction = beginTransaction(); connector.getMetadata(transaction).createTable( SESSION, new ConnectorTableMetadata( @@ -265,12 +265,17 @@ private long createTable(String name) false); connector.commit(transaction); - transaction = connector.beginTransaction(READ_COMMITTED, false); + transaction = beginTransaction(); ConnectorTableHandle tableHandle = getTableHandle(connector.getMetadata(transaction), name); connector.commit(transaction); return ((RaptorTableHandle) tableHandle).getTableId(); } + private ConnectorTransactionHandle beginTransaction() + { + return connector.beginTransaction(READ_COMMITTED, false, true); + } + private static ConnectorTableHandle getTableHandle(ConnectorMetadata metadata, String name) { return metadata.getTableHandle(SESSION, new SchemaTableName("test", name)); diff --git a/plugin/trino-redis/src/main/java/io/trino/plugin/redis/RedisConnector.java b/plugin/trino-redis/src/main/java/io/trino/plugin/redis/RedisConnector.java index eeddc09a2cd4..dfd2d25a1e6a 100644 --- a/plugin/trino-redis/src/main/java/io/trino/plugin/redis/RedisConnector.java +++ b/plugin/trino-redis/src/main/java/io/trino/plugin/redis/RedisConnector.java @@ -49,7 +49,7 @@ public RedisConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { checkConnectorSupports(READ_COMMITTED, isolationLevel); return RedisTransactionHandle.INSTANCE; diff --git a/plugin/trino-thrift/src/main/java/io/trino/plugin/thrift/ThriftConnector.java b/plugin/trino-thrift/src/main/java/io/trino/plugin/thrift/ThriftConnector.java index 1e3a16696255..b46150ec3e3d 100644 --- a/plugin/trino-thrift/src/main/java/io/trino/plugin/thrift/ThriftConnector.java +++ b/plugin/trino-thrift/src/main/java/io/trino/plugin/thrift/ThriftConnector.java @@ -57,7 +57,7 @@ public ThriftConnector( } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return ThriftTransactionHandle.INSTANCE; } diff --git a/plugin/trino-tpcds/src/main/java/io/trino/plugin/tpcds/TpcdsConnectorFactory.java b/plugin/trino-tpcds/src/main/java/io/trino/plugin/tpcds/TpcdsConnectorFactory.java index 0edc3933740c..401ad7d5e32e 100644 --- a/plugin/trino-tpcds/src/main/java/io/trino/plugin/tpcds/TpcdsConnectorFactory.java +++ b/plugin/trino-tpcds/src/main/java/io/trino/plugin/tpcds/TpcdsConnectorFactory.java @@ -68,7 +68,7 @@ public Connector create(String catalogName, Map config, Connecto return new Connector() { @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return TpcdsTransactionHandle.INSTANCE; } diff --git a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnectorFactory.java b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnectorFactory.java index 5ca8236ba641..2ea233393511 100644 --- a/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnectorFactory.java +++ b/plugin/trino-tpch/src/main/java/io/trino/plugin/tpch/TpchConnectorFactory.java @@ -89,7 +89,7 @@ public Connector create(String catalogName, Map properties, Conn return new Connector() { @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return TpchTransactionHandle.INSTANCE; } diff --git a/testing/trino-testing/src/main/java/io/trino/testing/tpch/IndexedTpchConnectorFactory.java b/testing/trino-testing/src/main/java/io/trino/testing/tpch/IndexedTpchConnectorFactory.java index a6f87f0d3422..a82502ccad41 100644 --- a/testing/trino-testing/src/main/java/io/trino/testing/tpch/IndexedTpchConnectorFactory.java +++ b/testing/trino-testing/src/main/java/io/trino/testing/tpch/IndexedTpchConnectorFactory.java @@ -73,7 +73,7 @@ public Connector create(String catalogName, Map properties, Conn return new Connector() { @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return TpchTransactionHandle.INSTANCE; } diff --git a/testing/trino-tests/src/test/java/io/trino/execution/TestBeginQuery.java b/testing/trino-tests/src/test/java/io/trino/execution/TestBeginQuery.java index 8be061c92100..2d51122a6526 100644 --- a/testing/trino-tests/src/test/java/io/trino/execution/TestBeginQuery.java +++ b/testing/trino-tests/src/test/java/io/trino/execution/TestBeginQuery.java @@ -191,7 +191,7 @@ private TestConnector(ConnectorMetadata metadata) } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return TestingTransactionHandle.create(); } diff --git a/testing/trino-tests/src/test/java/io/trino/execution/TestCoordinatorDynamicFiltering.java b/testing/trino-tests/src/test/java/io/trino/execution/TestCoordinatorDynamicFiltering.java index e34631c1e52b..6fc3bd9f7e9f 100644 --- a/testing/trino-tests/src/test/java/io/trino/execution/TestCoordinatorDynamicFiltering.java +++ b/testing/trino-tests/src/test/java/io/trino/execution/TestCoordinatorDynamicFiltering.java @@ -448,7 +448,7 @@ private TestConnector(ConnectorMetadata metadata) } @Override - public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly) + public ConnectorTransactionHandle beginTransaction(IsolationLevel isolationLevel, boolean readOnly, boolean autoCommit) { return TestingTransactionHandle.create(); }