Skip to content

Commit e3b56c3

Browse files
committed
Set TRANSACTION_ISOLATION_LEVEL config in MySQL, PostgreSQL & SQL Server plugins
1 parent 4752157 commit e3b56c3

File tree

18 files changed

+55
-25
lines changed

18 files changed

+55
-25
lines changed

mssql-plugin/docs/SQL Server-connector.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,14 @@ authentication. Optional for databases that do not require authentication.
2222

2323
**Password:** Password to use to connect to the specified database.
2424

25-
**Transaction Isolation Level** The transaction isolation level of the databse connection
26-
- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible.
25+
**Transaction Isolation Level** The transaction isolation level of the database connection
26+
- TRANSACTION_READ_COMMITTED (default): No dirty reads. Non-repeatable reads and phantom reads are possible.
2727
- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented.
2828
- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
2929
- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible.
3030

31+
For more details on the Transaction Isolation Levels supported in SQL Server, refer to the [SQL Server documentation](https://learn.microsoft.com/en-us/sql/t-sql/statements/set-transaction-isolation-level-transact-sql?view=sql-server-ver16)
32+
3133
**Authentication Type:** Indicates which authentication method will be used for the connection. Use 'SQL Login'. to
3234
connect to a SQL Server using username and password properties. Use 'Active Directory Password' to connect to an Azure
3335
SQL Database/Data Warehouse using an Azure AD principal name and password.

mssql-plugin/docs/SqlServer-batchsink.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,14 @@ an Azure SQL Database/Data Warehouse using an Azure AD principal name and passwo
4646

4747
**Password:** Password to use to connect to the specified database.
4848

49-
**Transaction Isolation Level** The transaction isolation level of the databse connection
50-
- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible.
49+
**Transaction Isolation Level** The transaction isolation level of the database connection
50+
- TRANSACTION_READ_COMMITTED (default): No dirty reads. Non-repeatable reads and phantom reads are possible.
5151
- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented.
5252
- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
5353
- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible.
5454

55+
For more details on the Transaction Isolation Levels supported in SQL Server, refer to the [SQL Server documentation](https://learn.microsoft.com/en-us/sql/t-sql/statements/set-transaction-isolation-level-transact-sql?view=sql-server-ver16)
56+
5557
**Instance Name:** SQL Server instance name to connect to. When it is not specified, a
5658
connection is made to the default instance. For the case where both the instanceName and port are specified,
5759
see the notes for port. If you specify a Virtual Network Name in the Server connection property, you cannot

mssql-plugin/docs/SqlServer-batchsource.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,14 @@ an Azure SQL Database/Data Warehouse using an Azure AD principal name and passwo
5656

5757
**Password:** Password to use to connect to the specified database.
5858

59-
**Transaction Isolation Level** The transaction isolation level of the databse connection
60-
- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible.
59+
**Transaction Isolation Level** The transaction isolation level of the database connection
60+
- TRANSACTION_READ_COMMITTED (default): No dirty reads. Non-repeatable reads and phantom reads are possible.
6161
- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented.
6262
- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
6363
- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible.
6464

65+
For more details on the Transaction Isolation Levels supported in SQL Server, refer to the [SQL Server documentation](https://learn.microsoft.com/en-us/sql/t-sql/statements/set-transaction-isolation-level-transact-sql?view=sql-server-ver16)
66+
6567
**Instance Name:** SQL Server instance name to connect to. When it is not specified, a
6668
connection is made to the default instance. For the case where both the instanceName and port are specified,
6769
see the notes for port. If you specify a Virtual Network Name in the Server connection property, you cannot

mssql-plugin/src/main/java/io/cdap/plugin/mssql/SqlServerSink.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ public Map<String, String> getDBSpecificArguments() {
177177
packetSize, queryTimeout);
178178
}
179179

180+
@Override
181+
public String getTransactionIsolationLevel() {
182+
return connection.getTransactionIsolationLevel();
183+
}
184+
180185
@Override
181186
public String getConnectionString() {
182187
return String.format(SqlServerConstants.SQL_SERVER_CONNECTION_STRING_FORMAT,

mysql-plugin/docs/MySQL-connector.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,11 @@ authentication. Optional for databases that do not require authentication.
2525
**Transaction Isolation Level** The transaction isolation level of the databse connection
2626
- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible.
2727
- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented.
28-
- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
28+
- TRANSACTION_REPEATABLE_READ (default): No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
2929
- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible.
3030

31+
For more details on the Transaction Isolation Levels supported in MySQL, refer to the [MySQL documentation](https://dev.mysql.com/doc/refman/8.4/en/innodb-transaction-isolation-levels.html)
32+
3133
**Connection Arguments:** A list of arbitrary string tag/value pairs as connection arguments. These arguments
3234
will be passed to the JDBC driver, as connection arguments, for JDBC drivers that may need additional configurations.
3335
This is a semicolon-separated list of key-value pairs, where each pair is separated by a equals '=' and specifies

mysql-plugin/docs/Mysql-batchsink.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,11 @@ You also can use the macro function ${conn(connection-name)}.
4242
**Transaction Isolation Level** The transaction isolation level of the databse connection
4343
- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible.
4444
- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented.
45-
- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
45+
- TRANSACTION_REPEATABLE_READ (default): No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
4646
- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible.
4747

48+
For more details on the Transaction Isolation Levels supported in MySQL, refer to the [MySQL documentation](https://dev.mysql.com/doc/refman/8.4/en/innodb-transaction-isolation-levels.html)
49+
4850
**Connection Arguments:** A list of arbitrary string key/value pairs as connection arguments. These arguments
4951
will be passed to the JDBC driver as connection arguments for JDBC drivers that may need additional configurations.
5052

mysql-plugin/docs/Mysql-batchsource.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,14 @@ For example, 'SELECT MIN(id),MAX(id) FROM table'. Not required if numSplits is s
4949

5050
**Password:** Password to use to connect to the specified database.
5151

52-
**Transaction Isolation Level** The transaction isolation level of the databse connection
52+
**Transaction Isolation Level** The transaction isolation level of the database connection
5353
- TRANSACTION_READ_COMMITTED: No dirty reads. Non-repeatable reads and phantom reads are possible.
5454
- TRANSACTION_SERIALIZABLE: No dirty reads. Non-repeatable and phantom reads are prevented.
55-
- TRANSACTION_REPEATABLE_READ: No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
55+
- TRANSACTION_REPEATABLE_READ (default): No dirty reads. Prevents non-repeatable reads, but phantom reads are still possible.
5656
- TRANSACTION_READ_UNCOMMITTED: Allows dirty reads (reading uncommitted changes from other transactions). Non-repeatable reads and phantom reads are possible.
5757

58+
For more details on the Transaction Isolation Levels supported in MySQL, refer to the [MySQL documentation](https://dev.mysql.com/doc/refman/8.4/en/innodb-transaction-isolation-levels.html)
59+
5860
**Connection Arguments:** A list of arbitrary string key/value pairs as connection arguments. These arguments
5961
will be passed to the JDBC driver as connection arguments for JDBC drivers that may need additional configurations.
6062

mysql-plugin/src/main/java/io/cdap/plugin/mysql/MysqlSink.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,11 @@ public Map<String, String> getDBSpecificArguments() {
194194
trustCertificateKeyStorePassword, false);
195195
}
196196

197+
@Override
198+
public String getTransactionIsolationLevel() {
199+
return connection.getTransactionIsolationLevel();
200+
}
201+
197202
@Override
198203
public MysqlConnectorConfig getConnection() {
199204
return connection;

mysql-plugin/widgets/MySQL-connector.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"TRANSACTION_REPEATABLE_READ",
4343
"TRANSACTION_SERIALIZABLE"
4444
],
45-
"default": "TRANSACTION_SERIALIZABLE"
45+
"default": "TRANSACTION_REPEATABLE_READ"
4646
}
4747
}
4848
]

mysql-plugin/widgets/Mysql-batchsink.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"TRANSACTION_REPEATABLE_READ",
7777
"TRANSACTION_SERIALIZABLE"
7878
],
79-
"default": "TRANSACTION_SERIALIZABLE"
79+
"default": "TRANSACTION_REPEATABLE_READ"
8080
}
8181
},
8282
{

0 commit comments

Comments
 (0)