mariadb/mysql-test/suite/sys_vars/r/tx_compatibility.result
Junqi Xie d20a96f9c1 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.
2023-04-12 11:04:29 +10:00

139 lines
5.9 KiB
Text

#
# MDEV-21921 Make transaction_isolation and transaction_read_only into
# system variables
#
SET @saved_global_isolation= @@global.transaction_isolation;
SET @saved_global_read_only= @@global.transaction_read_only;
# Case 1: Check the influence of --transaction_* on
# @@session.transaction_* and @@global.transaction_*,
# @@session.tx_*, @@global.tx_*.
SELECT @@session.transaction_isolation, @@global.transaction_isolation,
@@session.tx_isolation, @@global.tx_isolation;
@@session.transaction_isolation @@global.transaction_isolation @@session.tx_isolation @@global.tx_isolation
SERIALIZABLE SERIALIZABLE SERIALIZABLE SERIALIZABLE
SHOW GLOBAL VARIABLES LIKE '%_isolation';
Variable_name Value
transaction_isolation SERIALIZABLE
tx_isolation SERIALIZABLE
SHOW SESSION VARIABLES LIKE '%_isolation';
Variable_name Value
transaction_isolation SERIALIZABLE
tx_isolation SERIALIZABLE
SELECT @@session.transaction_read_only, @@global.transaction_read_only,
@@session.tx_read_only, @@global.tx_read_only;
@@session.transaction_read_only @@global.transaction_read_only @@session.tx_read_only @@global.tx_read_only
1 1 1 1
SHOW GLOBAL VARIABLES LIKE '%_read_only';
Variable_name Value
transaction_read_only ON
tx_read_only ON
SHOW SESSION VARIABLES LIKE '%_read_only';
Variable_name Value
transaction_read_only ON
tx_read_only ON
# Case 2: Check that the change to tx_* is reflected to transaction_*.
SET tx_isolation= 'REPEATABLE-READ';
Warnings:
Warning 1287 '@@tx_isolation' is deprecated and will be removed in a future release. Please use '@@transaction_isolation' instead
SET @@global.tx_isolation= 'SERIALIZABLE';
Warnings:
Warning 1287 '@@tx_isolation' is deprecated and will be removed in a future release. Please use '@@transaction_isolation' instead
SELECT @@session.tx_isolation, @@global.tx_isolation,
@@session.transaction_isolation, @@global.transaction_isolation;
@@session.tx_isolation @@global.tx_isolation @@session.transaction_isolation @@global.transaction_isolation
REPEATABLE-READ SERIALIZABLE REPEATABLE-READ SERIALIZABLE
SHOW GLOBAL VARIABLES LIKE '%_isolation';
Variable_name Value
transaction_isolation SERIALIZABLE
tx_isolation SERIALIZABLE
SHOW SESSION VARIABLES LIKE '%_isolation';
Variable_name Value
transaction_isolation REPEATABLE-READ
tx_isolation REPEATABLE-READ
SET STATEMENT tx_isolation= 'SERIALIZABLE' FOR SHOW SESSION VARIABLES LIKE '%_isolation';
Variable_name Value
transaction_isolation SERIALIZABLE
tx_isolation SERIALIZABLE
Warnings:
Warning 1287 '@@tx_isolation' is deprecated and will be removed in a future release. Please use '@@transaction_isolation' instead
Warning 1287 '@@tx_isolation' is deprecated and will be removed in a future release. Please use '@@transaction_isolation' instead
SHOW SESSION VARIABLES LIKE '%_isolation';
Variable_name Value
transaction_isolation REPEATABLE-READ
tx_isolation REPEATABLE-READ
SET tx_read_only= OFF;
Warnings:
Warning 1287 '@@tx_read_only' is deprecated and will be removed in a future release. Please use '@@transaction_read_only' instead
SET @@global.tx_read_only= ON;
Warnings:
Warning 1287 '@@tx_read_only' is deprecated and will be removed in a future release. Please use '@@transaction_read_only' instead
SELECT @@session.tx_read_only, @@global.tx_read_only,
@@session.transaction_read_only, @@global.transaction_read_only;
@@session.tx_read_only @@global.tx_read_only @@session.transaction_read_only @@global.transaction_read_only
0 1 0 1
SHOW GLOBAL VARIABLES LIKE '%_read_only';
Variable_name Value
transaction_read_only ON
tx_read_only ON
SHOW SESSION VARIABLES LIKE '%_read_only';
Variable_name Value
transaction_read_only OFF
tx_read_only OFF
SET STATEMENT tx_read_only= ON FOR SHOW SESSION VARIABLES LIKE '%_read_only';
Variable_name Value
transaction_read_only ON
tx_read_only ON
Warnings:
Warning 1287 '@@tx_read_only' is deprecated and will be removed in a future release. Please use '@@transaction_read_only' instead
Warning 1287 '@@tx_read_only' is deprecated and will be removed in a future release. Please use '@@transaction_read_only' instead
SHOW SESSION VARIABLES LIKE '%_read_only';
Variable_name Value
transaction_read_only OFF
tx_read_only OFF
# Case 3: Check that the change to transaction_* is reflected to tx_*.
SET transaction_isolation= 'SERIALIZABLE';
SET @@global.transaction_isolation= 'REPEATABLE-READ';
SELECT @@session.tx_isolation, @@global.tx_isolation,
@@session.transaction_isolation, @@global.transaction_isolation;
@@session.tx_isolation @@global.tx_isolation @@session.transaction_isolation @@global.transaction_isolation
SERIALIZABLE REPEATABLE-READ SERIALIZABLE REPEATABLE-READ
SHOW GLOBAL VARIABLES LIKE '%_isolation';
Variable_name Value
transaction_isolation REPEATABLE-READ
tx_isolation REPEATABLE-READ
SHOW SESSION VARIABLES LIKE '%_isolation';
Variable_name Value
transaction_isolation SERIALIZABLE
tx_isolation SERIALIZABLE
SET STATEMENT transaction_isolation= 'REPEATABLE-READ' FOR SHOW SESSION VARIABLES LIKE '%_isolation';
Variable_name Value
transaction_isolation REPEATABLE-READ
tx_isolation REPEATABLE-READ
SHOW SESSION VARIABLES LIKE '%_isolation';
Variable_name Value
transaction_isolation SERIALIZABLE
tx_isolation SERIALIZABLE
SET transaction_read_only= ON;
SET @@global.transaction_read_only= OFF;
SELECT @@session.tx_read_only, @@global.tx_read_only,
@@session.transaction_read_only, @@global.transaction_read_only;
@@session.tx_read_only @@global.tx_read_only @@session.transaction_read_only @@global.transaction_read_only
1 0 1 0
SHOW GLOBAL VARIABLES LIKE '%_read_only';
Variable_name Value
transaction_read_only OFF
tx_read_only OFF
SHOW SESSION VARIABLES LIKE '%_read_only';
Variable_name Value
transaction_read_only ON
tx_read_only ON
SET STATEMENT transaction_read_only= OFF FOR SHOW SESSION VARIABLES LIKE '%_read_only';
Variable_name Value
transaction_read_only OFF
tx_read_only OFF
SHOW SESSION VARIABLES LIKE '%_read_only';
Variable_name Value
transaction_read_only ON
tx_read_only ON
SET @@global.transaction_isolation= @saved_global_isolation;
SET @@global.transaction_read_only= @saved_global_read_only;