| 1 |
# |
| 2 |
# WL#9636: Rename tx_{isolation,isolation} variables to transaction_* |
| 3 |
# |
| 4 |
######################################################################## |
| 5 |
# START OF transaction_isolation TESTS # |
| 6 |
######################################################################## |
| 7 |
######################################################################### |
| 8 |
# Saving initial value of transaction_isolation in a temporary variable # |
| 9 |
######################################################################### |
| 10 |
SET @global_start_value = @@global.transaction_isolation; |
| 11 |
SELECT @global_start_value; |
| 12 |
@global_start_value |
| 13 |
REPEATABLE-READ |
| 14 |
SET @session_start_value = @@session.transaction_isolation; |
| 15 |
SELECT @session_start_value; |
| 16 |
@session_start_value |
| 17 |
REPEATABLE-READ |
| 18 |
#################################################################### |
| 19 |
# Display the DEFAULT value of transaction_isolation # |
| 20 |
#################################################################### |
| 21 |
SET @@global.transaction_isolation = 'READ-UNCOMMITTED'; |
| 22 |
SET @@global.transaction_isolation = DEFAULT; |
| 23 |
SELECT @@global.transaction_isolation; |
| 24 |
@@global.transaction_isolation |
| 25 |
REPEATABLE-READ |
| 26 |
SET @@session.transaction_isolation = DEFAULT; |
| 27 |
SELECT @@session.transaction_isolation; |
| 28 |
@@session.transaction_isolation |
| 29 |
REPEATABLE-READ |
| 30 |
######################################################### |
| 31 |
# Check if NULL or empty value is accepeted # |
| 32 |
######################################################### |
| 33 |
SET @@global.transaction_isolation = NULL; |
| 34 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'NULL' |
| 35 |
SET @@global.transaction_isolation = ''; |
| 36 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of '' |
| 37 |
SET @@session.transaction_isolation = NULL; |
| 38 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'NULL' |
| 39 |
SET @@session.transaction_isolation = ''; |
| 40 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of '' |
| 41 |
##################################################################### |
| 42 |
# Change the value of transaction_isolation to a valid value # |
| 43 |
##################################################################### |
| 44 |
SET @@global.transaction_isolation = 'READ-UNCOMMITTED'; |
| 45 |
SELECT @@global.transaction_isolation; |
| 46 |
@@global.transaction_isolation |
| 47 |
READ-UNCOMMITTED |
| 48 |
SET @@global.transaction_isolation = 'read-COMMITTED'; |
| 49 |
SELECT @@global.transaction_isolation; |
| 50 |
@@global.transaction_isolation |
| 51 |
READ-COMMITTED |
| 52 |
SET @@global.transaction_isolation = 'REPEATABLE-READ'; |
| 53 |
SELECT @@global.transaction_isolation; |
| 54 |
@@global.transaction_isolation |
| 55 |
REPEATABLE-READ |
| 56 |
SET @@global.transaction_isolation = 'SERIALIZable'; |
| 57 |
SELECT @@global.transaction_isolation; |
| 58 |
@@global.transaction_isolation |
| 59 |
SERIALIZABLE |
| 60 |
SET @@session.transaction_isolation = 'READ-UNCOMMITTED'; |
| 61 |
SELECT @@session.transaction_isolation; |
| 62 |
@@session.transaction_isolation |
| 63 |
READ-UNCOMMITTED |
| 64 |
SET @@session.transaction_isolation = 'READ-COMMITTED'; |
| 65 |
SELECT @@session.transaction_isolation; |
| 66 |
@@session.transaction_isolation |
| 67 |
READ-COMMITTED |
| 68 |
SET @@session.transaction_isolation = 'REPEATABLE-READ'; |
| 69 |
SELECT @@session.transaction_isolation; |
| 70 |
@@session.transaction_isolation |
| 71 |
REPEATABLE-READ |
| 72 |
SET @@session.transaction_isolation = 'serializable'; |
| 73 |
SELECT @@session.transaction_isolation; |
| 74 |
@@session.transaction_isolation |
| 75 |
SERIALIZABLE |
| 76 |
####################################################################### |
| 77 |
# Change the value of transaction_isolation to invalid value # |
| 78 |
####################################################################### |
| 79 |
SET @@global.transaction_isolation = -1; |
| 80 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of '-1' |
| 81 |
SET @@global.transaction_isolation = READUNCOMMITTED; |
| 82 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'READUNCOMMITTED' |
| 83 |
SET @@global.transaction_isolation = 'REPEATABLE'; |
| 84 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'REPEATABLE' |
| 85 |
SET @@global.transaction_isolation = OFF; |
| 86 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'OFF' |
| 87 |
SET @@global.transaction_isolation = ON; |
| 88 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'ON' |
| 89 |
SET @@global.transaction_isolation = 'NON-SERIALIZABLE'; |
| 90 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'NON-SERIALIZABLE' |
| 91 |
# for session scope |
| 92 |
SET @@transaction_isolation = -1; |
| 93 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of '-1' |
| 94 |
SET @@transaction_isolation = READUNCOMMITTED; |
| 95 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'READUNCOMMITTED' |
| 96 |
SET @@transaction_isolation = 'REPEATABLE'; |
| 97 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'REPEATABLE' |
| 98 |
SET @@transaction_isolation = 'NONE'; |
| 99 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'NONE' |
| 100 |
SET @@transaction_isolation = 'ALL'; |
| 101 |
ERROR 42000: Variable 'transaction_isolation' can't be set to the value of 'ALL' |
| 102 |
######################################################################### |
| 103 |
# Check if the value in session Table matches value in variable # |
| 104 |
######################################################################### |
| 105 |
SELECT @@session.transaction_isolation = VARIABLE_VALUE |
| 106 |
FROM performance_schema.session_variables |
| 107 |
WHERE VARIABLE_NAME='transaction_isolation'; |
| 108 |
@@session.transaction_isolation = VARIABLE_VALUE |
| 109 |
1 |
| 110 |
######################################################################### |
| 111 |
# Check if the value in GLOBAL Table matches value in variable # |
| 112 |
######################################################################### |
| 113 |
SELECT @@global.transaction_isolation = VARIABLE_VALUE |
| 114 |
FROM performance_schema.global_variables |
| 115 |
WHERE VARIABLE_NAME='transaction_isolation'; |
| 116 |
@@global.transaction_isolation = VARIABLE_VALUE |
| 117 |
1 |
| 118 |
################################################################### |
| 119 |
# Check if numbers can be used on variable # |
| 120 |
################################################################### |
| 121 |
SET @@global.transaction_isolation = 0; |
| 122 |
SELECT @@global.transaction_isolation; |
| 123 |
@@global.transaction_isolation |
| 124 |
READ-UNCOMMITTED |
| 125 |
SET @@global.transaction_isolation = 1; |
| 126 |
SELECT @@global.transaction_isolation; |
| 127 |
@@global.transaction_isolation |
| 128 |
READ-COMMITTED |
| 129 |
SET @@global.transaction_isolation = 2; |
| 130 |
SELECT @@global.transaction_isolation; |
| 131 |
@@global.transaction_isolation |
| 132 |
REPEATABLE-READ |
| 133 |
SET @@global.transaction_isolation = 3; |
| 134 |
SELECT @@global.transaction_isolation; |
| 135 |
@@global.transaction_isolation |
| 136 |
SERIALIZABLE |
| 137 |
SET @@global.transaction_isolation = 0.4; |
| 138 |
ERROR 42000: Incorrect argument type to variable 'transaction_isolation' |
| 139 |
################################################################### |
| 140 |
# Check if TRUE and FALSE values can be used on variable # |
| 141 |
################################################################### |
| 142 |
SET @@global.transaction_isolation = TRUE; |
| 143 |
SELECT @@global.transaction_isolation; |
| 144 |
@@global.transaction_isolation |
| 145 |
READ-COMMITTED |
| 146 |
SET @@global.transaction_isolation = FALSE; |
| 147 |
SELECT @@global.transaction_isolation; |
| 148 |
@@global.transaction_isolation |
| 149 |
READ-UNCOMMITTED |
| 150 |
########################################################################### |
| 151 |
# Check if transaction_isolation can be accessed with and without @@ sign # |
| 152 |
########################################################################### |
| 153 |
SET transaction_isolation = 'REPEATABLE-READ'; |
| 154 |
SET session.transaction_isolation = 'REPEATABLE-READ'; |
| 155 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'session.transaction_isolation = 'REPEATABLE-READ'' at line 1 |
| 156 |
SET global.transaction_isolation = 'REPEATABLE-READ'; |
| 157 |
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'global.transaction_isolation = 'REPEATABLE-READ'' at line 1 |
| 158 |
SET session transaction_isolation = 'REPEATABLE-READ'; |
| 159 |
SELECT @@transaction_isolation; |
| 160 |
@@transaction_isolation |
| 161 |
REPEATABLE-READ |
| 162 |
SET global transaction_isolation = 'REPEATABLE-READ'; |
| 163 |
SELECT @@global.transaction_isolation; |
| 164 |
@@global.transaction_isolation |
| 165 |
REPEATABLE-READ |
| 166 |
############################## |
| 167 |
# Restore initial value # |
| 168 |
############################## |
| 169 |
SET @@global.transaction_isolation = @global_start_value; |
| 170 |
SELECT @@global.transaction_isolation; |
| 171 |
@@global.transaction_isolation |
| 172 |
REPEATABLE-READ |
| 173 |
SET @@session.transaction_isolation = @session_start_value; |
| 174 |
SELECT @@session.transaction_isolation; |
| 175 |
@@session.transaction_isolation |
| 176 |
REPEATABLE-READ |
| 177 |
#################################################################### |
| 178 |
# END OF transaction_isolation TESTS # |
| 179 |
#################################################################### |