mirror of
https://github.com/MariaDB/server.git
synced 2025-07-24 19:42:23 +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:
@ -34,23 +34,23 @@ COMMIT;
|
||||
|
||||
#
|
||||
# Verify consistent output from
|
||||
# SELECT @@tx_isolation (Bug#20837)
|
||||
# SELECT @@transaction_isolation (Bug#20837)
|
||||
#
|
||||
# The transaction will be in READ UNCOMMITTED mode,
|
||||
# but SELECT @@tx_isolation should report the session
|
||||
# but SELECT @@transaction_isolation should report the session
|
||||
# value, which is REPEATABLE READ
|
||||
#
|
||||
SET @@autocommit=0;
|
||||
COMMIT;
|
||||
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
START TRANSACTION;
|
||||
SELECT @@tx_isolation;
|
||||
SELECT @@transaction_isolation;
|
||||
--echo Should be REPEATABLE READ
|
||||
SELECT * FROM t1;
|
||||
SELECT @@tx_isolation;
|
||||
SELECT @@transaction_isolation;
|
||||
--echo Should be REPEATABLE READ
|
||||
INSERT INTO t1 VALUES (-1);
|
||||
SELECT @@tx_isolation;
|
||||
SELECT @@transaction_isolation;
|
||||
--echo Should be REPEATABLE READ
|
||||
COMMIT;
|
||||
|
||||
@ -370,16 +370,16 @@ COMMIT;
|
||||
--echo # Test 2: Check setting of variable.
|
||||
|
||||
SET SESSION TRANSACTION READ WRITE;
|
||||
SELECT @@tx_read_only;
|
||||
SELECT @@transaction_read_only;
|
||||
|
||||
SET SESSION TRANSACTION READ ONLY;
|
||||
SELECT @@tx_read_only;
|
||||
SELECT @@transaction_read_only;
|
||||
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE;
|
||||
SELECT @@tx_read_only;
|
||||
SELECT @@transaction_read_only;
|
||||
|
||||
SET SESSION TRANSACTION READ ONLY, ISOLATION LEVEL REPEATABLE READ;
|
||||
SELECT @@tx_read_only;
|
||||
SELECT @@transaction_read_only;
|
||||
|
||||
START TRANSACTION;
|
||||
--echo # Not allowed inside a transaction
|
||||
@ -628,14 +628,14 @@ DROP TABLE t1;
|
||||
|
||||
CREATE PROCEDURE p1() SET SESSION TRANSACTION READ ONLY;
|
||||
CALL p1();
|
||||
SELECT @@tx_read_only;
|
||||
SELECT @@transaction_read_only;
|
||||
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;
|
||||
SELECT @@transaction_read_only;
|
||||
SET SESSION TRANSACTION READ WRITE, ISOLATION LEVEL REPEATABLE READ;
|
||||
DROP PROCEDURE p1;
|
||||
|
||||
@ -648,7 +648,7 @@ END|
|
||||
delimiter ;|
|
||||
|
||||
SELECT f1();
|
||||
SELECT @@tx_read_only;
|
||||
SELECT @@transaction_read_only;
|
||||
SET SESSION TRANSACTION READ WRITE;
|
||||
DROP FUNCTION f1;
|
||||
|
||||
@ -661,7 +661,7 @@ END|
|
||||
delimiter ;|
|
||||
|
||||
SELECT f1();
|
||||
SELECT @@tx_read_only;
|
||||
SELECT @@transaction_read_only;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ, READ WRITE;
|
||||
DROP FUNCTION f1;
|
||||
|
||||
|
Reference in New Issue
Block a user