1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-27 18:02:13 +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,8 +19,8 @@ COUNT(*)
connect con1,localhost,root,,;
connection con1;
SET GLOBAL TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT @@tx_isolation;
@@tx_isolation
SELECT @@transaction_isolation;
@@transaction_isolation
REPEATABLE-READ
SELECT COUNT(*) FROM tab;
COUNT(*)
@ -32,8 +32,8 @@ c1 ST_AsText(c2) ST_AsText(c3) ST_AsText(c4) ST_AsText(c5)
connect con2,localhost,root,,;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT @@tx_isolation;
@@tx_isolation
SELECT @@transaction_isolation;
@@transaction_isolation
READ-COMMITTED
START TRANSACTION;
INSERT INTO tab(c1,c2,c3,c4,c5)
@ -106,8 +106,8 @@ COUNT(*)
connect con1,localhost,root,,;
connection con1;
SET SESSION TRANSACTION ISOLATION LEVEL REPEATABLE READ;
SELECT @@tx_isolation;
@@tx_isolation
SELECT @@transaction_isolation;
@@transaction_isolation
REPEATABLE-READ
SELECT COUNT(*) FROM tab;
COUNT(*)
@ -119,8 +119,8 @@ c1 ST_AsText(c2) ST_AsText(c3) ST_AsText(c4) ST_AsText(c5)
connect con2,localhost,root,,;
connection con2;
SET SESSION TRANSACTION ISOLATION LEVEL READ COMMITTED;
SELECT @@tx_isolation;
@@tx_isolation
SELECT @@transaction_isolation;
@@transaction_isolation
READ-COMMITTED
START TRANSACTION;
INSERT INTO tab(c1,c2,c3,c4,c5)

View File

@ -58,8 +58,8 @@ insert into t1 select * from t1;
insert into t1 select * from t1;
connection a;
set session transaction isolation level serializable;
select @@tx_isolation;
@@tx_isolation
select @@transaction_isolation;
@@transaction_isolation
SERIALIZABLE
start transaction;
set @g1 = ST_GeomFromText('Polygon((100 100, 100 110, 110 110, 110 100, 100 100))');
@ -69,8 +69,8 @@ count(*)
connect b,localhost,root,,;
set session transaction isolation level serializable;
set session innodb_lock_wait_timeout = 1;
select @@tx_isolation;
@@tx_isolation
select @@transaction_isolation;
@@transaction_isolation
SERIALIZABLE
insert into t1 select * from t1;
insert into t1 select * from t1;
@ -92,8 +92,8 @@ connection b;
select @@innodb_lock_wait_timeout;
@@innodb_lock_wait_timeout
1
select @@tx_isolation;
@@tx_isolation
select @@transaction_isolation;
@@transaction_isolation
SERIALIZABLE
insert into t1 select * from t1;
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@ -120,8 +120,8 @@ insert into t1 select * from t1;
insert into t1 select * from t1;
connection a;
set session transaction isolation level serializable;
select @@tx_isolation;
@@tx_isolation
select @@transaction_isolation;
@@transaction_isolation
SERIALIZABLE
start transaction;
set @g1 = ST_GeomFromText('Polygon((100 100, 100 110, 110 110, 110 100, 100 100))');
@ -131,8 +131,8 @@ count(*)
connection b;
set session transaction isolation level serializable;
set session innodb_lock_wait_timeout = 1;
select @@tx_isolation;
@@tx_isolation
select @@transaction_isolation;
@@transaction_isolation
SERIALIZABLE
insert into t1 select * from t1;
insert into t1 select * from t1;
@ -158,8 +158,8 @@ connection b;
select @@innodb_lock_wait_timeout;
@@innodb_lock_wait_timeout
1
select @@tx_isolation;
@@tx_isolation
select @@transaction_isolation;
@@transaction_isolation
SERIALIZABLE
INSERT INTO t1 VALUES (1, ST_GeomFromText('LineString(8 105, 200 105)'));
ERROR HY000: Lock wait timeout exceeded; try restarting transaction
@ -227,8 +227,8 @@ end|
CALL insert_t1(0, 1000);
connection a;
set session transaction isolation level serializable;
select @@tx_isolation;
@@tx_isolation
select @@transaction_isolation;
@@transaction_isolation
SERIALIZABLE
start transaction;
set @g1 = ST_GeomFromText('Polygon((800 800, 800 1000, 1000 1000, 1000 800, 800 800))');