From 552c4621f762d1227da35fe2ba33cb06a39de75d Mon Sep 17 00:00:00 2001 From: vedanshugarg04 Date: Mon, 29 Jun 2026 17:57:00 +0530 Subject: [PATCH 1/4] Add TRANSACTION_ISOLATION_LEVEL config in cloudsql-postgres and cloudsql-mysql plugins for develop --- .../docs/CloudSQLMySQL-batchsink.md | 8 +++++++- .../docs/CloudSQLMySQL-batchsource.md | 8 ++++++++ .../docs/CloudSQLMySQL-connector.md | 8 ++++++++ .../plugin/cloudsql/mysql/CloudSQLMySQLSource.java | 10 ++++++++++ .../widgets/CloudSQLMySQL-batchsink.json | 14 ++++++++++++++ .../widgets/CloudSQLMySQL-batchsource.json | 14 ++++++++++++++ .../widgets/CloudSQLMySQL-connector.json | 14 ++++++++++++++ .../docs/CloudSQLPostgreSQL-batchsink.md | 8 +++++++- .../docs/CloudSQLPostgreSQL-batchsource.md | 8 ++++++++ .../docs/CloudSQLPostgreSQL-connector.md | 8 ++++++++ .../postgres/CloudSQLPostgreSQLSource.java | 10 ++++++++++ .../widgets/CloudSQLPostgreSQL-batchsink.json | 13 +++++++++++++ .../widgets/CloudSQLPostgreSQL-batchsource.json | 13 +++++++++++++ .../widgets/CloudSQLPostgreSQL-connector.json | 13 +++++++++++++ .../db/config/AbstractDBSpecificSourceConfig.java | 1 + 15 files changed, 148 insertions(+), 2 deletions(-) diff --git a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsink.md b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsink.md index eaf9e5535..1e6ec3433 100644 --- a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsink.md +++ b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsink.md @@ -42,7 +42,13 @@ Can be found in the instance overview page. **Password:** Password to use to connect to the specified database. -**Transaction Isolation Level:** Transaction isolation level for queries run by this sink. +**Transaction Isolation Level** The transaction isolation level of the database connection +- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. +- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. +- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. +- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible. + +For more details on the Transaction Isolation Levels supported in CloudSQL MySQL, refer to the [CloudSQL MySQL documentation](https://dev.mysql.com/doc/refman/8.0/en/innodb-transaction-isolation-levels.html) **Connection Timeout:** The timeout value (in seconds) used for socket connect operations. If connecting to the server takes longer than this value, the connection is broken. A value of 0 means that it is disabled. diff --git a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsource.md b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsource.md index 52a5945e7..b59848552 100644 --- a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsource.md +++ b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsource.md @@ -52,6 +52,14 @@ For example, 'SELECT MIN(id),MAX(id) FROM table'. Not required if numSplits is s **Password:** Password to use to connect to the specified database. +**Transaction Isolation Level** The transaction isolation level of the database connection +- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. +- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. +- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. +- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible. + +For more details on the Transaction Isolation Levels supported in CloudSQL MySQL, refer to the [CloudSQL MySQL documentation](https://dev.mysql.com/doc/refman/8.0/en/innodb-transaction-isolation-levels.html) + **Connection Arguments:** A list of arbitrary string key/value pairs as connection arguments. These arguments will be passed to the JDBC driver as connection arguments for JDBC drivers that may need additional configurations. diff --git a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-connector.md b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-connector.md index 3197760e0..e39125178 100644 --- a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-connector.md +++ b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-connector.md @@ -27,6 +27,14 @@ authentication. Optional for databases that do not require authentication. **Password:** Password to use to connect to the specified database. +**Transaction Isolation Level** The transaction isolation level of the database connection +- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. +- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. +- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. +- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible. + +For more details on the Transaction Isolation Levels supported in CloudSQL MySQL, refer to the [CloudSQL MySQL documentation](https://dev.mysql.com/doc/refman/8.0/en/innodb-transaction-isolation-levels.html) + **Connection Arguments:** A list of arbitrary string tag/value pairs as connection arguments. These arguments will be passed to the JDBC driver, as connection arguments, for JDBC drivers that may need additional configurations. This is a semicolon-separated list of key-value pairs, where each pair is separated by a equals '=' and specifies diff --git a/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java b/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java index 80358ce4b..88951768f 100644 --- a/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java +++ b/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java @@ -156,6 +156,11 @@ public static class CloudSQLMySQLSourceConfig extends AbstractDBSpecificSourceCo @Description("The existing connection to use.") private CloudSQLMySQLConnectorConfig connection; + @Name(TRANSACTION_ISOLATION_LEVEL) + @Description("Transaction isolation level for queries run by this source.") + @Nullable + public String transactionIsolationLevel; + @Override protected Map getDBSpecificArguments() { if (getFetchSize() == null || getFetchSize() <= 0) { @@ -168,6 +173,11 @@ protected Map getDBSpecificArguments() { return arguments; } + @Override + public String getTransactionIsolationLevel() { + return transactionIsolationLevel; + } + @Override public void validate(FailureCollector collector) { ConfigUtil.validateConnection(this, useConnection, connection, collector); diff --git a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsink.json b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsink.json index 3a3277ed8..f0e05ef51 100644 --- a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsink.json +++ b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsink.json @@ -84,6 +84,20 @@ "label": "Password", "name": "password" }, + { + "widget-type": "select", + "label": "Transaction Isolation Level", + "name": "transactionIsolationLevel", + "widget-attributes": { + "values": [ + "TRANSACTION_READ_UNCOMMITTED", + "TRANSACTION_READ_COMMITTED", + "TRANSACTION_SERIALIZABLE", + "TRANSACTION_REPEATABLE_READ" + ], + "default": "TRANSACTION_REPEATABLE_READ" + } + }, { "widget-type": "keyvalue", "label": "Connection Arguments", diff --git a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsource.json b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsource.json index a90154670..05581fd35 100644 --- a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsource.json +++ b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsource.json @@ -84,6 +84,20 @@ "label": "Password", "name": "password" }, + { + "widget-type": "select", + "label": "Transaction Isolation Level", + "name": "transactionIsolationLevel", + "widget-attributes": { + "values": [ + "TRANSACTION_READ_UNCOMMITTED", + "TRANSACTION_READ_COMMITTED", + "TRANSACTION_SERIALIZABLE", + "TRANSACTION_REPEATABLE_READ" + ], + "default": "TRANSACTION_REPEATABLE_READ" + } + }, { "widget-type": "keyvalue", "label": "Connection Arguments", diff --git a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-connector.json b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-connector.json index 1cebc7850..62fc148db 100644 --- a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-connector.json +++ b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-connector.json @@ -54,6 +54,20 @@ "widget-attributes": { "default": "3306" } + }, + { + "widget-type": "select", + "label": "Transaction Isolation Level", + "name": "transactionIsolationLevel", + "widget-attributes": { + "values": [ + "TRANSACTION_READ_UNCOMMITTED", + "TRANSACTION_READ_COMMITTED", + "TRANSACTION_SERIALIZABLE", + "TRANSACTION_REPEATABLE_READ" + ], + "default": "TRANSACTION_REPEATABLE_READ" + } } ] }, diff --git a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsink.md b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsink.md index 338a67c9e..2543b8ab8 100644 --- a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsink.md +++ b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsink.md @@ -42,7 +42,13 @@ Can be found in the instance overview page. **Password:** Password to use to connect to the specified database. -**Transaction Isolation Level:** Transaction isolation level for queries run by this sink. +**Transaction Isolation Level** The transaction isolation level of the databse connection +- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. +- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. +- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. +- Note: PostgreSQL does not implement `TRANSACTION_READ_UNCOMMITTED` as a distinct isolation level. Instead, this mode behaves identically to`TRANSACTION_READ_COMMITTED`, which is why it is not exposed as a separate option. + +For more details on the Transaction Isolation Levels supported in CloudSQL PostgreSQL, refer to the [CloudSQL PostgreSQL documentation](https://www.postgresql.org/docs/current/transaction-iso.html) **Connection Arguments:** A list of arbitrary string key/value pairs as connection arguments. These arguments will be passed to the JDBC driver as connection arguments for JDBC drivers that may need additional configurations. diff --git a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsource.md b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsource.md index 8d9ad7171..255d7203c 100644 --- a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsource.md +++ b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsource.md @@ -52,6 +52,14 @@ For example, 'SELECT MIN(id),MAX(id) FROM table'. Not required if numSplits is s **Password:** Password to use to connect to the specified database. +**Transaction Isolation Level** The transaction isolation level of the databse connection +- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. +- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. +- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. +- Note: PostgreSQL does not implement `TRANSACTION_READ_UNCOMMITTED` as a distinct isolation level. Instead, this mode behaves identically to`TRANSACTION_READ_COMMITTED`, which is why it is not exposed as a separate option. + +For more details on the Transaction Isolation Levels supported in CloudSQL PostgreSQL, refer to the [CloudSQL PostgreSQL documentation](https://www.postgresql.org/docs/current/transaction-iso.html) + **Connection Arguments:** A list of arbitrary string key/value pairs as connection arguments. These arguments will be passed to the JDBC driver as connection arguments for JDBC drivers that may need additional configurations. diff --git a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-connector.md b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-connector.md index 0e502fefd..26eae94a2 100644 --- a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-connector.md +++ b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-connector.md @@ -27,6 +27,14 @@ authentication. Optional for databases that do not require authentication. **Password:** Password to use to connect to the specified database. +**Transaction Isolation Level** The transaction isolation level of the databse connection +- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. +- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. +- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. +- Note: PostgreSQL does not implement `TRANSACTION_READ_UNCOMMITTED` as a distinct isolation level. Instead, this mode behaves identically to`TRANSACTION_READ_COMMITTED`, which is why it is not exposed as a separate option. + +For more details on the Transaction Isolation Levels supported in CloudSQL PostgreSQL, refer to the [CloudSQL PostgreSQL documentation](https://www.postgresql.org/docs/current/transaction-iso.html) + **Connection Arguments:** A list of arbitrary string tag/value pairs as connection arguments. These arguments will be passed to the JDBC driver, as connection arguments, for JDBC drivers that may need additional configurations. This is a semicolon-separated list of key-value pairs, where each pair is separated by a equals '=' and specifies diff --git a/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java b/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java index 7ebc7d809..f63785653 100644 --- a/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java +++ b/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java @@ -157,6 +157,11 @@ public static class CloudSQLPostgreSQLSourceConfig extends AbstractDBSpecificSou @Description("The existing connection to use.") private CloudSQLPostgreSQLConnectorConfig connection; + @Name(TRANSACTION_ISOLATION_LEVEL) + @Description("Transaction isolation level for queries run by this source.") + @Nullable + private String transactionIsolationLevel; + @Override protected Map getDBSpecificArguments() { return Collections.emptyMap(); @@ -173,6 +178,11 @@ protected CloudSQLPostgreSQLConnectorConfig getConnection() { return connection; } + @Override + public String getTransactionIsolationLevel() { + return transactionIsolationLevel; + } + @Override public void validate(FailureCollector collector) { ConfigUtil.validateConnection(this, useConnection, connection, collector); diff --git a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json index 8d6578413..976cc1100 100644 --- a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json +++ b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json @@ -84,6 +84,19 @@ "label": "Password", "name": "password" }, + { + "widget-type": "select", + "label": "Transaction Isolation Level", + "name": "transactionIsolationLevel", + "widget-attributes": { + "values": [ + "TRANSACTION_REPEATABLE_READ", + "TRANSACTION_SERIALIZABLE", + "TRANSACTION_READ_COMMITTED" + ], + "default": "TRANSACTION_READ_COMMITTED" + } + }, { "widget-type": "keyvalue", "label": "Connection Arguments", diff --git a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsource.json b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsource.json index ea449120d..c0b6be109 100644 --- a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsource.json +++ b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsource.json @@ -84,6 +84,19 @@ "label": "Password", "name": "password" }, + { + "widget-type": "select", + "label": "Transaction Isolation Level", + "name": "transactionIsolationLevel", + "widget-attributes": { + "values": [ + "TRANSACTION_REPEATABLE_READ", + "TRANSACTION_SERIALIZABLE", + "TRANSACTION_READ_COMMITTED" + ], + "default": "TRANSACTION_READ_COMMITTED" + } + }, { "widget-type": "keyvalue", "label": "Connection Arguments", diff --git a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-connector.json b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-connector.json index 36013ac40..7dc9f32e2 100644 --- a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-connector.json +++ b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-connector.json @@ -54,6 +54,19 @@ "widget-attributes": { "default": "5432" } + }, + { + "widget-type": "select", + "label": "Transaction Isolation Level", + "name": "transactionIsolationLevel", + "widget-attributes": { + "values": [ + "TRANSACTION_REPEATABLE_READ", + "TRANSACTION_SERIALIZABLE", + "TRANSACTION_READ_COMMITTED" + ], + "default": "TRANSACTION_READ_COMMITTED" + } } ] }, diff --git a/database-commons/src/main/java/io/cdap/plugin/db/config/AbstractDBSpecificSourceConfig.java b/database-commons/src/main/java/io/cdap/plugin/db/config/AbstractDBSpecificSourceConfig.java index f15939ab7..73d57d356 100644 --- a/database-commons/src/main/java/io/cdap/plugin/db/config/AbstractDBSpecificSourceConfig.java +++ b/database-commons/src/main/java/io/cdap/plugin/db/config/AbstractDBSpecificSourceConfig.java @@ -49,6 +49,7 @@ public abstract class AbstractDBSpecificSourceConfig extends PluginConfig implem public static final String DATABASE = "database"; public static final String FETCH_SIZE = "fetchSize"; public static final String DEFAULT_FETCH_SIZE = "1000"; + public static final String TRANSACTION_ISOLATION_LEVEL = "transactionIsolationLevel"; @Name(Constants.Reference.REFERENCE_NAME) @Description(Constants.Reference.REFERENCE_NAME_DESCRIPTION) From da5dd2f4a309a9fca025fa41aaecff349ba10414 Mon Sep 17 00:00:00 2001 From: vedanshugarg04 Date: Tue, 30 Jun 2026 11:07:45 +0530 Subject: [PATCH 2/4] Added a constant for default isolation level --- .../cloudsql/mysql/CloudSQLMySQLSource.java | 4 +++- .../widgets/CloudSQLMySQL-batchsink.json | 14 ------------ .../postgres/CloudSQLPostgreSQLSource.java | 4 +++- .../widgets/CloudSQLPostgreSQL-batchsink.json | 22 ++++--------------- 4 files changed, 10 insertions(+), 34 deletions(-) diff --git a/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java b/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java index 88951768f..3f85b08d7 100644 --- a/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java +++ b/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java @@ -161,6 +161,8 @@ public static class CloudSQLMySQLSourceConfig extends AbstractDBSpecificSourceCo @Nullable public String transactionIsolationLevel; + public static final String DEFAULT_TRANSACTION_ISOLATION_LEVEL = "TRANSACTION_REPEATABLE_READ"; + @Override protected Map getDBSpecificArguments() { if (getFetchSize() == null || getFetchSize() <= 0) { @@ -175,7 +177,7 @@ protected Map getDBSpecificArguments() { @Override public String getTransactionIsolationLevel() { - return transactionIsolationLevel; + return transactionIsolationLevel != null ? transactionIsolationLevel : DEFAULT_TRANSACTION_ISOLATION_LEVEL; } @Override diff --git a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsink.json b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsink.json index f0e05ef51..3a3277ed8 100644 --- a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsink.json +++ b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsink.json @@ -84,20 +84,6 @@ "label": "Password", "name": "password" }, - { - "widget-type": "select", - "label": "Transaction Isolation Level", - "name": "transactionIsolationLevel", - "widget-attributes": { - "values": [ - "TRANSACTION_READ_UNCOMMITTED", - "TRANSACTION_READ_COMMITTED", - "TRANSACTION_SERIALIZABLE", - "TRANSACTION_REPEATABLE_READ" - ], - "default": "TRANSACTION_REPEATABLE_READ" - } - }, { "widget-type": "keyvalue", "label": "Connection Arguments", diff --git a/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java b/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java index f63785653..7abcdc0bc 100644 --- a/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java +++ b/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java @@ -162,6 +162,8 @@ public static class CloudSQLPostgreSQLSourceConfig extends AbstractDBSpecificSou @Nullable private String transactionIsolationLevel; + public static final String DEFAULT_TRANSACTION_ISOLATION_LEVEL = "TRANSACTION_READ_COMMITTED"; + @Override protected Map getDBSpecificArguments() { return Collections.emptyMap(); @@ -180,7 +182,7 @@ protected CloudSQLPostgreSQLConnectorConfig getConnection() { @Override public String getTransactionIsolationLevel() { - return transactionIsolationLevel; + return transactionIsolationLevel != null ? transactionIsolationLevel : DEFAULT_TRANSACTION_ISOLATION_LEVEL; } @Override diff --git a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json index 976cc1100..7bfb28fae 100644 --- a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json +++ b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json @@ -84,19 +84,6 @@ "label": "Password", "name": "password" }, - { - "widget-type": "select", - "label": "Transaction Isolation Level", - "name": "transactionIsolationLevel", - "widget-attributes": { - "values": [ - "TRANSACTION_REPEATABLE_READ", - "TRANSACTION_SERIALIZABLE", - "TRANSACTION_READ_COMMITTED" - ], - "default": "TRANSACTION_READ_COMMITTED" - } - }, { "widget-type": "keyvalue", "label": "Connection Arguments", @@ -187,13 +174,12 @@ "label": "Transaction Isolation Level", "name": "transactionIsolationLevel", "widget-attributes": { - "default": "TRANSACTION_READ_COMMITTED", "values": [ - "TRANSACTION_READ_COMMITTED", - "TRANSACTION_READ_UNCOMMITTED", "TRANSACTION_REPEATABLE_READ", - "TRANSACTION_SERIALIZABLE" - ] + "TRANSACTION_SERIALIZABLE", + "TRANSACTION_READ_COMMITTED" + ], + "default": "TRANSACTION_READ_COMMITTED" } }, { From d45b9701026d8bc8dd4633200012892f164f9b15 Mon Sep 17 00:00:00 2001 From: vedanshugarg04 Date: Wed, 1 Jul 2026 10:31:26 +0530 Subject: [PATCH 3/4] fix: typos --- cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsource.md | 2 +- cloudsql-mysql-plugin/docs/CloudSQLMySQL-connector.md | 2 +- .../java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java | 2 +- .../docs/CloudSQLPostgreSQL-batchsource.md | 2 +- cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-connector.md | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsource.md b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsource.md index b59848552..11a863f4f 100644 --- a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsource.md +++ b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsource.md @@ -52,7 +52,7 @@ For example, 'SELECT MIN(id),MAX(id) FROM table'. Not required if numSplits is s **Password:** Password to use to connect to the specified database. -**Transaction Isolation Level** The transaction isolation level of the database connection +**Transaction Isolation Level:** The transaction isolation level of the database connection. - TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. - TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. - TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. diff --git a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-connector.md b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-connector.md index e39125178..9cd5d582a 100644 --- a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-connector.md +++ b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-connector.md @@ -27,7 +27,7 @@ authentication. Optional for databases that do not require authentication. **Password:** Password to use to connect to the specified database. -**Transaction Isolation Level** The transaction isolation level of the database connection +**Transaction Isolation Level:** The transaction isolation level of the database connection. - TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. - TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. - TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. diff --git a/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java b/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java index 3f85b08d7..b627987fb 100644 --- a/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java +++ b/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java @@ -159,7 +159,7 @@ public static class CloudSQLMySQLSourceConfig extends AbstractDBSpecificSourceCo @Name(TRANSACTION_ISOLATION_LEVEL) @Description("Transaction isolation level for queries run by this source.") @Nullable - public String transactionIsolationLevel; + private String transactionIsolationLevel; public static final String DEFAULT_TRANSACTION_ISOLATION_LEVEL = "TRANSACTION_REPEATABLE_READ"; diff --git a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsource.md b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsource.md index 255d7203c..c477f4a23 100644 --- a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsource.md +++ b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsource.md @@ -52,7 +52,7 @@ For example, 'SELECT MIN(id),MAX(id) FROM table'. Not required if numSplits is s **Password:** Password to use to connect to the specified database. -**Transaction Isolation Level** The transaction isolation level of the databse connection +**Transaction Isolation Level:** The transaction isolation level of the database connection. - TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. - TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. - TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. diff --git a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-connector.md b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-connector.md index 26eae94a2..467469c30 100644 --- a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-connector.md +++ b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-connector.md @@ -27,7 +27,7 @@ authentication. Optional for databases that do not require authentication. **Password:** Password to use to connect to the specified database. -**Transaction Isolation Level** The transaction isolation level of the databse connection +**Transaction Isolation Level:** The transaction isolation level of the database connection. - TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. - TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. - TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. From f2b9fd451150b30cccb38e1d150cae7c20182753 Mon Sep 17 00:00:00 2001 From: vedanshugarg04 Date: Wed, 1 Jul 2026 13:44:04 +0530 Subject: [PATCH 4/4] fix: updated widget and docs --- cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsink.md | 8 +------- .../cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java | 2 +- .../widgets/CloudSQLMySQL-batchsource.json | 8 ++++---- .../widgets/CloudSQLMySQL-connector.json | 8 ++++---- .../docs/CloudSQLPostgreSQL-batchsink.md | 8 +------- .../cloudsql/postgres/CloudSQLPostgreSQLSource.java | 2 +- .../widgets/CloudSQLPostgreSQL-batchsink.json | 9 +++++---- .../widgets/CloudSQLPostgreSQL-batchsource.json | 8 ++++---- .../widgets/CloudSQLPostgreSQL-connector.json | 8 ++++---- 9 files changed, 25 insertions(+), 36 deletions(-) diff --git a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsink.md b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsink.md index 1e6ec3433..1eee31287 100644 --- a/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsink.md +++ b/cloudsql-mysql-plugin/docs/CloudSQLMySQL-batchsink.md @@ -42,13 +42,7 @@ Can be found in the instance overview page. **Password:** Password to use to connect to the specified database. -**Transaction Isolation Level** The transaction isolation level of the database connection -- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. -- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. -- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. -- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible. - -For more details on the Transaction Isolation Levels supported in CloudSQL MySQL, refer to the [CloudSQL MySQL documentation](https://dev.mysql.com/doc/refman/8.0/en/innodb-transaction-isolation-levels.html) +**Transaction Isolation Level:** Transaction isolation level for queries run by this sink. **Connection Timeout:** The timeout value (in seconds) used for socket connect operations. If connecting to the server takes longer than this value, the connection is broken. A value of 0 means that it is disabled. diff --git a/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java b/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java index b627987fb..43c63aa9e 100644 --- a/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java +++ b/cloudsql-mysql-plugin/src/main/java/io/cdap/plugin/cloudsql/mysql/CloudSQLMySQLSource.java @@ -161,7 +161,7 @@ public static class CloudSQLMySQLSourceConfig extends AbstractDBSpecificSourceCo @Nullable private String transactionIsolationLevel; - public static final String DEFAULT_TRANSACTION_ISOLATION_LEVEL = "TRANSACTION_REPEATABLE_READ"; + private static final String DEFAULT_TRANSACTION_ISOLATION_LEVEL = "TRANSACTION_REPEATABLE_READ"; @Override protected Map getDBSpecificArguments() { diff --git a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsource.json b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsource.json index 05581fd35..20c6d872f 100644 --- a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsource.json +++ b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-batchsource.json @@ -89,13 +89,13 @@ "label": "Transaction Isolation Level", "name": "transactionIsolationLevel", "widget-attributes": { + "default": "TRANSACTION_REPEATABLE_READ", "values": [ + "TRANSACTION_REPEATABLE_READ", "TRANSACTION_READ_UNCOMMITTED", "TRANSACTION_READ_COMMITTED", - "TRANSACTION_SERIALIZABLE", - "TRANSACTION_REPEATABLE_READ" - ], - "default": "TRANSACTION_REPEATABLE_READ" + "TRANSACTION_SERIALIZABLE" + ] } }, { diff --git a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-connector.json b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-connector.json index 62fc148db..e641add41 100644 --- a/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-connector.json +++ b/cloudsql-mysql-plugin/widgets/CloudSQLMySQL-connector.json @@ -60,13 +60,13 @@ "label": "Transaction Isolation Level", "name": "transactionIsolationLevel", "widget-attributes": { + "default": "TRANSACTION_REPEATABLE_READ", "values": [ + "TRANSACTION_REPEATABLE_READ", "TRANSACTION_READ_UNCOMMITTED", "TRANSACTION_READ_COMMITTED", - "TRANSACTION_SERIALIZABLE", - "TRANSACTION_REPEATABLE_READ" - ], - "default": "TRANSACTION_REPEATABLE_READ" + "TRANSACTION_SERIALIZABLE" + ] } } ] diff --git a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsink.md b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsink.md index 2543b8ab8..5a70a7f30 100644 --- a/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsink.md +++ b/cloudsql-postgresql-plugin/docs/CloudSQLPostgreSQL-batchsink.md @@ -42,13 +42,7 @@ Can be found in the instance overview page. **Password:** Password to use to connect to the specified database. -**Transaction Isolation Level** The transaction isolation level of the databse connection -- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible. -- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented. -- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible. -- Note: PostgreSQL does not implement `TRANSACTION_READ_UNCOMMITTED` as a distinct isolation level. Instead, this mode behaves identically to`TRANSACTION_READ_COMMITTED`, which is why it is not exposed as a separate option. - -For more details on the Transaction Isolation Levels supported in CloudSQL PostgreSQL, refer to the [CloudSQL PostgreSQL documentation](https://www.postgresql.org/docs/current/transaction-iso.html) +**Transaction Isolation Level:** Transaction isolation level for queries run by this sink. **Connection Arguments:** A list of arbitrary string key/value pairs as connection arguments. These arguments will be passed to the JDBC driver as connection arguments for JDBC drivers that may need additional configurations. diff --git a/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java b/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java index 7abcdc0bc..e07251a56 100644 --- a/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java +++ b/cloudsql-postgresql-plugin/src/main/java/io/cdap/plugin/cloudsql/postgres/CloudSQLPostgreSQLSource.java @@ -162,7 +162,7 @@ public static class CloudSQLPostgreSQLSourceConfig extends AbstractDBSpecificSou @Nullable private String transactionIsolationLevel; - public static final String DEFAULT_TRANSACTION_ISOLATION_LEVEL = "TRANSACTION_READ_COMMITTED"; + private static final String DEFAULT_TRANSACTION_ISOLATION_LEVEL = "TRANSACTION_READ_COMMITTED"; @Override protected Map getDBSpecificArguments() { diff --git a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json index 7bfb28fae..8d6578413 100644 --- a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json +++ b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsink.json @@ -174,12 +174,13 @@ "label": "Transaction Isolation Level", "name": "transactionIsolationLevel", "widget-attributes": { + "default": "TRANSACTION_READ_COMMITTED", "values": [ + "TRANSACTION_READ_COMMITTED", + "TRANSACTION_READ_UNCOMMITTED", "TRANSACTION_REPEATABLE_READ", - "TRANSACTION_SERIALIZABLE", - "TRANSACTION_READ_COMMITTED" - ], - "default": "TRANSACTION_READ_COMMITTED" + "TRANSACTION_SERIALIZABLE" + ] } }, { diff --git a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsource.json b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsource.json index c0b6be109..1308b83e0 100644 --- a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsource.json +++ b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-batchsource.json @@ -89,12 +89,12 @@ "label": "Transaction Isolation Level", "name": "transactionIsolationLevel", "widget-attributes": { + "default": "TRANSACTION_READ_COMMITTED", "values": [ + "TRANSACTION_READ_COMMITTED", "TRANSACTION_REPEATABLE_READ", - "TRANSACTION_SERIALIZABLE", - "TRANSACTION_READ_COMMITTED" - ], - "default": "TRANSACTION_READ_COMMITTED" + "TRANSACTION_SERIALIZABLE" + ] } }, { diff --git a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-connector.json b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-connector.json index 7dc9f32e2..6b89ae657 100644 --- a/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-connector.json +++ b/cloudsql-postgresql-plugin/widgets/CloudSQLPostgreSQL-connector.json @@ -60,12 +60,12 @@ "label": "Transaction Isolation Level", "name": "transactionIsolationLevel", "widget-attributes": { + "default": "TRANSACTION_READ_COMMITTED", "values": [ + "TRANSACTION_READ_COMMITTED", "TRANSACTION_REPEATABLE_READ", - "TRANSACTION_SERIALIZABLE", - "TRANSACTION_READ_COMMITTED" - ], - "default": "TRANSACTION_READ_COMMITTED" + "TRANSACTION_SERIALIZABLE" + ] } } ]