mirror of
https://github.com/MariaDB/server.git
synced 2025-08-07 00:04:31 +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:
@@ -1,4 +1,4 @@
|
||||
SET GLOBAL tx_isolation='REPEATABLE-READ';
|
||||
SET GLOBAL transaction_isolation='REPEATABLE-READ';
|
||||
CREATE TABLE bug56680(
|
||||
a INT AUTO_INCREMENT PRIMARY KEY,
|
||||
b CHAR(1),
|
||||
@@ -28,7 +28,7 @@ connection default;
|
||||
SELECT b FROM bug56680;
|
||||
b
|
||||
x
|
||||
SET GLOBAL tx_isolation='READ-UNCOMMITTED';
|
||||
SET GLOBAL transaction_isolation='READ-UNCOMMITTED';
|
||||
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
|
||||
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
|
||||
INSERT INTO bug56680 SELECT 0,b,c FROM bug56680;
|
||||
|
@@ -10,8 +10,8 @@ show warnings;
|
||||
Level Code Message
|
||||
begin;
|
||||
update worklog5743 set a = (repeat("x", 17000));
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
connect con1,localhost,root,,;
|
||||
select a = repeat("x", 17000) from worklog5743;
|
||||
@@ -22,8 +22,8 @@ a = repeat("b", 16000)
|
||||
1
|
||||
connect con2,localhost,root,,;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a = repeat("x", 17000) from worklog5743;
|
||||
a = repeat("x", 17000)
|
||||
@@ -42,8 +42,8 @@ insert into worklog5743 values(9, repeat("a", 10000));
|
||||
begin;
|
||||
update worklog5743 set a1 = 1000;
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -53,8 +53,8 @@ a1 a2 = repeat("a", 10000)
|
||||
9 1
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
a1 a2 = repeat("a", 10000)
|
||||
@@ -68,8 +68,8 @@ insert into worklog5743 values(9, repeat("a", 10000));
|
||||
begin;
|
||||
update worklog5743 set a1 = 1000;
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -79,8 +79,8 @@ a1 a2 = repeat("a", 10000)
|
||||
9 1
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
a1 a2 = repeat("a", 10000)
|
||||
@@ -258,8 +258,8 @@ select a1, left(a2, 20) from worklog5743_16;
|
||||
a1 left(a2, 20)
|
||||
1000 aaaaaaaaaaaaaaaaaaaa
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -293,8 +293,8 @@ a1 left(a2, 20)
|
||||
9 aaaaaaaaaaaaaaaaaaaa
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
|
||||
a1 left(a2, 20)
|
||||
@@ -367,8 +367,8 @@ repeat("a", 3068));
|
||||
begin;
|
||||
update worklog5743 set a1 = 1000;
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1 from worklog5743 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -378,8 +378,8 @@ a1
|
||||
9
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1 from worklog5743 where a1 = 9;
|
||||
a1
|
||||
@@ -399,8 +399,8 @@ insert into worklog5743 values(repeat("a", 20000));
|
||||
begin;
|
||||
insert into worklog5743 values(repeat("b", 20000));
|
||||
update worklog5743 set a = (repeat("x", 25000));
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
connection con1;
|
||||
select a = repeat("a", 20000) from worklog5743;
|
||||
@@ -409,8 +409,8 @@ a = repeat("a", 20000)
|
||||
disconnect con1;
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a = repeat("x", 25000) from worklog5743;
|
||||
a = repeat("x", 25000)
|
||||
|
@@ -13,8 +13,8 @@ Level Code Message
|
||||
SET sql_mode= default;
|
||||
begin;
|
||||
update worklog5743 set a = (repeat("x", 17000));
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
connect con1,localhost,root,,;
|
||||
select a = repeat("x", 17000) from worklog5743;
|
||||
@@ -25,8 +25,8 @@ a = repeat("b", 16000)
|
||||
1
|
||||
connect con2,localhost,root,,;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a = repeat("x", 17000) from worklog5743;
|
||||
a = repeat("x", 17000)
|
||||
@@ -45,8 +45,8 @@ insert into worklog5743 values(9, repeat("a", 10000));
|
||||
begin;
|
||||
update worklog5743 set a1 = 1111;
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -56,8 +56,8 @@ a1 a2 = repeat("a", 10000)
|
||||
9 1
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
a1 a2 = repeat("a", 10000)
|
||||
@@ -71,8 +71,8 @@ insert into worklog5743 values(9, repeat("a", 10000));
|
||||
begin;
|
||||
update worklog5743 set a1 = 2222;
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -82,8 +82,8 @@ a1 a2 = repeat("a", 10000)
|
||||
9 1
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
a1 a2 = repeat("a", 10000)
|
||||
@@ -183,8 +183,8 @@ select a1, left(a2, 20) from worklog5743_4;
|
||||
a1 left(a2, 20)
|
||||
1000 aaaaaaaaaaaaaaaaaaaa
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -206,8 +206,8 @@ a1 left(a2, 20)
|
||||
9 aaaaaaaaaaaaaaaaaaaa
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
|
||||
a1 left(a2, 20)
|
||||
@@ -261,8 +261,8 @@ insert into worklog5743 values(9, repeat("a", 764));
|
||||
begin;
|
||||
update worklog5743 set a1 = 4444;
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1 from worklog5743 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -272,8 +272,8 @@ a1
|
||||
9
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1 from worklog5743 where a1 = 9;
|
||||
a1
|
||||
@@ -289,8 +289,8 @@ insert into worklog5743 values(repeat("a", 20000));
|
||||
begin;
|
||||
insert into worklog5743 values(repeat("b", 20000));
|
||||
update worklog5743 set a = (repeat("x", 25000));
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
connection con1;
|
||||
select a = repeat("a", 20000) from worklog5743;
|
||||
@@ -299,8 +299,8 @@ a = repeat("a", 20000)
|
||||
disconnect con1;
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a = repeat("x", 25000) from worklog5743;
|
||||
a = repeat("x", 25000)
|
||||
|
@@ -16,8 +16,8 @@ Note 1071 Specified key was too long; max key length is 1536 bytes
|
||||
SET sql_mode= default;
|
||||
begin;
|
||||
update worklog5743 set a = (repeat("x", 17000));
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
connect con1,localhost,root,,;
|
||||
select a = repeat("x", 17000) from worklog5743;
|
||||
@@ -28,8 +28,8 @@ a = repeat("b", 16000)
|
||||
1
|
||||
connect con2,localhost,root,,;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a = repeat("x", 17000) from worklog5743;
|
||||
a = repeat("x", 17000)
|
||||
@@ -48,8 +48,8 @@ insert into worklog5743 values(9, repeat("a", 10000));
|
||||
begin;
|
||||
update worklog5743 set a1 = 1000;
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -59,8 +59,8 @@ a1 a2 = repeat("a", 10000)
|
||||
9 1
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
a1 a2 = repeat("a", 10000)
|
||||
@@ -74,8 +74,8 @@ insert into worklog5743 values(9, repeat("a", 10000));
|
||||
begin;
|
||||
update worklog5743 set a1 = 1000;
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -85,8 +85,8 @@ a1 a2 = repeat("a", 10000)
|
||||
9 1
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1, a2 = repeat("a", 10000) from worklog5743 where a1 = 9;
|
||||
a1 a2 = repeat("a", 10000)
|
||||
@@ -217,8 +217,8 @@ select a1, left(a2, 20) from worklog5743_8;
|
||||
a1 left(a2, 20)
|
||||
1000 aaaaaaaaaaaaaaaaaaaa
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -246,8 +246,8 @@ a1 left(a2, 20)
|
||||
9 aaaaaaaaaaaaaaaaaaaa
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1, left(a2, 20) from worklog5743_1 where a1 = 9;
|
||||
a1 left(a2, 20)
|
||||
@@ -295,8 +295,8 @@ update worklog5743 set a1 = 1000;
|
||||
begin;
|
||||
update worklog5743 set a1 = 1000;
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
explain select a1 from worklog5743 where a1 = 9;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
@@ -305,8 +305,8 @@ select a1 from worklog5743 where a1 = 9;
|
||||
a1
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a1 from worklog5743 where a1 = 9;
|
||||
a1
|
||||
@@ -325,8 +325,8 @@ insert into worklog5743 values(repeat("a", 20000));
|
||||
begin;
|
||||
insert into worklog5743 values(repeat("b", 20000));
|
||||
update worklog5743 set a = (repeat("x", 25000));
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
connection con1;
|
||||
select a = repeat("a", 20000) from worklog5743;
|
||||
@@ -335,8 +335,8 @@ a = repeat("a", 20000)
|
||||
disconnect con1;
|
||||
connection con2;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
select a = repeat("x", 25000) from worklog5743;
|
||||
a = repeat("x", 25000)
|
||||
|
@@ -793,16 +793,16 @@ col_1_text = REPEAT("a", 200) col_2_text = REPEAT("o", 200)
|
||||
1 1
|
||||
0 1
|
||||
connection con1;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
REPEATABLE-READ
|
||||
SELECT col_1_text = REPEAT("b", 200) , col_2_text = REPEAT("o", 200) FROM
|
||||
worklog5743;
|
||||
col_1_text = REPEAT("b", 200) col_2_text = REPEAT("o", 200)
|
||||
0 1
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
SELECT col_1_text = REPEAT("b", 200) , col_2_text = REPEAT("o", 200) FROM
|
||||
worklog5743;
|
||||
@@ -864,8 +864,8 @@ col_1_text = REPEAT("a", 200) col_2_text = REPEAT("o", 200)
|
||||
COMMIT;
|
||||
connection con1;
|
||||
SET SESSION TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
|
||||
select @@session.tx_isolation;
|
||||
@@session.tx_isolation
|
||||
select @@session.transaction_isolation;
|
||||
@@session.transaction_isolation
|
||||
READ-UNCOMMITTED
|
||||
SELECT col_1_text = REPEAT("b", 200) , col_2_text = REPEAT("o", 200) FROM
|
||||
worklog5743;
|
||||
|
Reference in New Issue
Block a user