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