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

@ -40,7 +40,7 @@ connection con1;
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT @@tx_isolation;
SELECT @@transaction_isolation;
# Record count should be 1
SELECT COUNT(*) FROM tab;
@ -54,7 +54,7 @@ connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT @@tx_isolation;
SELECT @@transaction_isolation;
START TRANSACTION;
@ -155,7 +155,7 @@ connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT @@tx_isolation;
SELECT @@transaction_isolation;
# Record count should be 1
SELECT COUNT(*) FROM tab;
@ -169,7 +169,7 @@ connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT @@tx_isolation;
SELECT @@transaction_isolation;
START TRANSACTION;

View File

@ -79,7 +79,7 @@ insert into t1 select * from t1;
# Connection 'a' will place predicate lock on almost all pages
connection a;
set session transaction isolation level serializable;
select @@tx_isolation;
select @@transaction_isolation;
start transaction;
set @g1 = ST_GeomFromText('Polygon((100 100, 100 110, 110 110, 110 100, 100 100))');
select count(*) from t1 where MBRwithin(t1.c2, @g1);
@ -89,7 +89,7 @@ connect (b,localhost,root,,);
set session transaction isolation level serializable;
set session innodb_lock_wait_timeout = 1;
select @@tx_isolation;
select @@transaction_isolation;
insert into t1 select * from t1;
insert into t1 select * from t1;
@ -115,7 +115,7 @@ select count(*) from t1 where MBRwithin(t1.c2, @g1);
connection b;
select @@innodb_lock_wait_timeout;
select @@tx_isolation;
select @@transaction_isolation;
--error ER_LOCK_WAIT_TIMEOUT
insert into t1 select * from t1;
@ -146,7 +146,7 @@ insert into t1 select * from t1;
# Connection 'a' will place predicate lock on almost all pages
connection a;
set session transaction isolation level serializable;
select @@tx_isolation;
select @@transaction_isolation;
start transaction;
set @g1 = ST_GeomFromText('Polygon((100 100, 100 110, 110 110, 110 100, 100 100))');
select count(*) from t1 where MBRwithin(t1.c2, @g1);
@ -156,7 +156,7 @@ connection b;
set session transaction isolation level serializable;
set session innodb_lock_wait_timeout = 1;
select @@tx_isolation;
select @@transaction_isolation;
insert into t1 select * from t1;
insert into t1 select * from t1;
@ -181,7 +181,7 @@ select count(*) from t1 where MBRIntersects(t1.c2, @g1);
connection b;
select @@innodb_lock_wait_timeout;
select @@tx_isolation;
select @@transaction_isolation;
# this should conflict with the "MBRIntersects" predicate lock in session "a"
--error ER_LOCK_WAIT_TIMEOUT
@ -264,7 +264,7 @@ CALL insert_t1(0, 1000);
# Connection 'a' will place predicate lock on root and last leaf page
connection a;
set session transaction isolation level serializable;
select @@tx_isolation;
select @@transaction_isolation;
start transaction;
set @g1 = ST_GeomFromText('Polygon((800 800, 800 1000, 1000 1000, 1000 800, 800 800))');
select count(*) from t1 where MBRwithin(t1.c2, @g1);