1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

MDEV-21921 Make transaction_isolation and transaction_read_only into system variables

In MariaDB, we have a confusing problem where:
* The transaction_isolation option can be set in a configuration file, but it cannot be set dynamically.
* The tx_isolation system variable can be set dynamically, but it cannot be set in a configuration file.

Therefore, we have two different names for the same thing in different contexts. This is needlessly confusing, and it complicates the documentation. The same thing applys for transaction_read_only.

MySQL 5.7 solved this problem by making them into system variables. https://dev.mysql.com/doc/relnotes/mysql/5.7/en/news-5-7-20.html

This commit takes a similar approach by adding new system variables and marking the original ones as deprecated. This commit also resolves some legacy problems related to SET STATEMENT and transaction_isolation.
This commit is contained in:
Junqi Xie
2023-03-12 13:55:30 +08:00
committed by Daniel Black
parent 4472a7b4ff
commit d20a96f9c1
100 changed files with 1232 additions and 962 deletions

View File

@ -19,21 +19,21 @@ SET @@autocommit=0;
COMMIT;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
START TRANSACTION;
SELECT @@tx_isolation;
@@tx_isolation
SELECT @@transaction_isolation;
@@transaction_isolation
REPEATABLE-READ
Should be REPEATABLE READ
SELECT * FROM t1;
s1
1
2
SELECT @@tx_isolation;
@@tx_isolation
SELECT @@transaction_isolation;
@@transaction_isolation
REPEATABLE-READ
Should be REPEATABLE READ
INSERT INTO t1 VALUES (-1);
SELECT @@tx_isolation;
@@tx_isolation
SELECT @@transaction_isolation;
@@transaction_isolation
REPEATABLE-READ
Should be REPEATABLE READ
COMMIT;
@ -310,20 +310,20 @@ COMMIT;
#
# Test 2: Check setting of variable.
SET SESSION TRANSACTION READ WRITE;
SELECT @@tx_read_only;
@@tx_read_only
SELECT @@transaction_read_only;
@@transaction_read_only
0
SET SESSION TRANSACTION READ ONLY;
SELECT @@tx_read_only;
@@tx_read_only
SELECT @@transaction_read_only;
@@transaction_read_only
1
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE;
SELECT @@tx_read_only;
@@tx_read_only
SELECT @@transaction_read_only;
@@transaction_read_only
0
SET SESSION TRANSACTION READ ONLY, ISOLATION LEVEL REPEATABLE READ;
SELECT @@tx_read_only;
@@tx_read_only
SELECT @@transaction_read_only;
@@transaction_read_only
1
START TRANSACTION;
# Not allowed inside a transaction
@ -528,16 +528,16 @@ DROP TABLE t1;
# Test 7: SET TRANSACTION inside stored routines
CREATE PROCEDURE p1() SET SESSION TRANSACTION READ ONLY;
CALL p1();
SELECT @@tx_read_only;
@@tx_read_only
SELECT @@transaction_read_only;
@@transaction_read_only
1
SET SESSION TRANSACTION READ WRITE;
DROP PROCEDURE p1;
CREATE PROCEDURE p1() SET SESSION TRANSACTION READ ONLY,
ISOLATION LEVEL SERIALIZABLE;
CALL p1();
SELECT @@tx_read_only;
@@tx_read_only
SELECT @@transaction_read_only;
@@transaction_read_only
1
SET SESSION TRANSACTION READ WRITE, ISOLATION LEVEL REPEATABLE READ;
DROP PROCEDURE p1;
@ -549,8 +549,8 @@ END|
SELECT f1();
f1()
1
SELECT @@tx_read_only;
@@tx_read_only
SELECT @@transaction_read_only;
@@transaction_read_only
1
SET SESSION TRANSACTION READ WRITE;
DROP FUNCTION f1;
@ -562,8 +562,8 @@ END|
SELECT f1();
f1()
1
SELECT @@tx_read_only;
@@tx_read_only
SELECT @@transaction_read_only;
@@transaction_read_only
1
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE;
DROP FUNCTION f1;