| 1 |
--source include/not_embedded.inc |
| 2 |
|
| 3 |
--echo # |
| 4 |
--echo # Variable name : session_track_system_variables |
| 5 |
--echo # Scope : Global & Session |
| 6 |
--echo # |
| 7 |
|
| 8 |
--echo # Global - default |
| 9 |
SELECT @@global.session_track_system_variables; |
| 10 |
--echo # Session - default |
| 11 |
SELECT @@session.session_track_system_variables; |
| 12 |
--echo |
| 13 |
|
| 14 |
--echo # via INFORMATION_SCHEMA.GLOBAL_VARIABLES |
| 15 |
SELECT * FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track_system_variables' ORDER BY VARIABLE_NAME; |
| 16 |
|
| 17 |
--echo # via INFORMATION_SCHEMA.SESSION_VARIABLES |
| 18 |
SELECT * FROM INFORMATION_SCHEMA.SESSION_VARIABLES WHERE VARIABLE_NAME LIKE 'session_track_system_variables' ORDER BY VARIABLE_NAME; |
| 19 |
|
| 20 |
# Save the global value to be used to restore the original value. |
| 21 |
SET @global_saved_tmp = @@global.session_track_system_variables; |
| 22 |
--echo |
| 23 |
|
| 24 |
--echo # Altering global variable's value |
| 25 |
SET @@global.session_track_system_variables='autocommit'; |
| 26 |
SELECT @@global.session_track_system_variables; |
| 27 |
SELECT @@session.session_track_system_variables; |
| 28 |
--echo |
| 29 |
|
| 30 |
--echo # Altering session variable's value |
| 31 |
SET @@session.session_track_system_variables='autocommit'; |
| 32 |
SELECT @@global.session_track_system_variables; |
| 33 |
SELECT @@session.session_track_system_variables; |
| 34 |
--echo |
| 35 |
|
| 36 |
--echo # Variables' values in a new session. |
| 37 |
connect (con1,"127.0.0.1",root,,test,$MASTER_MYPORT,); |
| 38 |
|
| 39 |
--echo # Global - expect "autocommit" |
| 40 |
SELECT @@global.session_track_system_variables; |
| 41 |
--echo |
| 42 |
--echo # Session - expect "autocommit" |
| 43 |
SELECT @@session.session_track_system_variables; |
| 44 |
--echo |
| 45 |
|
| 46 |
--echo # Switching to the default connection. |
| 47 |
connection default; |
| 48 |
|
| 49 |
SELECT @@global.session_track_system_variables; |
| 50 |
SELECT @@session.session_track_system_variables; |
| 51 |
--echo |
| 52 |
|
| 53 |
--echo # Test if DEFAULT is working as expected. |
| 54 |
SET @@global.session_track_system_variables = DEFAULT; |
| 55 |
SET @@session.session_track_system_variables = DEFAULT; |
| 56 |
--echo |
| 57 |
|
| 58 |
SELECT @@global.session_track_system_variables; |
| 59 |
SELECT @@session.session_track_system_variables; |
| 60 |
--echo |
| 61 |
|
| 62 |
--echo # Variables' values in a new session (con2). |
| 63 |
connect (con2,"127.0.0.1",root,,test,$MASTER_MYPORT,); |
| 64 |
|
| 65 |
SELECT @@global.session_track_system_variables; |
| 66 |
SELECT @@session.session_track_system_variables; |
| 67 |
--echo |
| 68 |
|
| 69 |
--echo # Altering session should not affect global. |
| 70 |
SET @@session.session_track_system_variables = 'sql_mode'; |
| 71 |
SELECT @@global.session_track_system_variables; |
| 72 |
SELECT @@session.session_track_system_variables; |
| 73 |
--echo |
| 74 |
|
| 75 |
--echo # Variables' values in a new session (con3). |
| 76 |
connect (con3,"127.0.0.1",root,,test,$MASTER_MYPORT,); |
| 77 |
|
| 78 |
--echo # Altering global should not affect session. |
| 79 |
SET @@global.session_track_system_variables = 'sql_mode'; |
| 80 |
SELECT @@global.session_track_system_variables; |
| 81 |
SELECT @@session.session_track_system_variables; |
| 82 |
--echo |
| 83 |
|
| 84 |
--echo # Switching to the default connection. |
| 85 |
connection default; |
| 86 |
|
| 87 |
--echo # Testing NULL |
| 88 |
--error ER_WRONG_VALUE_FOR_VAR |
| 89 |
SET @@global.session_track_system_variables = NULL; |
| 90 |
--error ER_WRONG_VALUE_FOR_VAR |
| 91 |
SET @@session.session_track_system_variables = NULL; |
| 92 |
|
| 93 |
--echo # testing with duplicate entries. |
| 94 |
# Lets first set it to some valid value. |
| 95 |
SET @@global.session_track_system_variables= "time_zone"; |
| 96 |
SET @@session.session_track_system_variables= "time_zone"; |
| 97 |
# Now set with duplicate entries (must pass) |
| 98 |
SET @@global.session_track_system_variables= "sql_mode,sql_mode"; |
| 99 |
SET @@session.session_track_system_variables= "sql_mode,sql_mode"; |
| 100 |
SELECT @@global.session_track_system_variables; |
| 101 |
SELECT @@session.session_track_system_variables; |
| 102 |
--echo |
| 103 |
|
| 104 |
--echo # testing ordering |
| 105 |
SET @@global.session_track_system_variables= "time_zone,sql_mode"; |
| 106 |
SET @@session.session_track_system_variables= "time_zone,sql_mode"; |
| 107 |
SELECT @@global.session_track_system_variables; |
| 108 |
SELECT @@session.session_track_system_variables; |
| 109 |
--echo |
| 110 |
|
| 111 |
--echo # special values |
| 112 |
SET @@global.session_track_system_variables= "*"; |
| 113 |
SET @@session.session_track_system_variables= "*"; |
| 114 |
SELECT @@global.session_track_system_variables; |
| 115 |
SELECT @@session.session_track_system_variables; |
| 116 |
SET @@global.session_track_system_variables= ""; |
| 117 |
SET @@session.session_track_system_variables= ""; |
| 118 |
SELECT @@global.session_track_system_variables; |
| 119 |
SELECT @@session.session_track_system_variables; |
| 120 |
--echo |
| 121 |
|
| 122 |
--echo # MDEV-22524 SIGABRT in safe_mutex_unlock with session_track_system_variables and max_relay_log_size. |
| 123 |
SET SESSION session_track_system_variables="sql_slave_skip_counter", sql_slave_skip_counter= 0; |
| 124 |
|
| 125 |
--echo # Restoring the original values. |
| 126 |
SET @@global.session_track_system_variables = @global_saved_tmp; |
| 127 |
|
| 128 |
--echo # End of 10.2 tests. |
| 129 |
|
| 130 |
--echo # |
| 131 |
--echo # MDEV-39207 plugin variables disappear from session_track_system_variables list |
| 132 |
--echo # |
| 133 |
|
| 134 |
install soname 'ha_example.so'; |
| 135 |
|
| 136 |
--echo # Plugin global vars are not included |
| 137 |
set global session_track_system_variables='myisam_block_size'; |
| 138 |
select @@global.session_track_system_variables; |
| 139 |
set global session_track_system_variables='example_int_var'; |
| 140 |
select @@global.session_track_system_variables; |
| 141 |
set global session_track_system_variables='myisam_sort_buffer_size,example_int_var'; |
| 142 |
select @@global.session_track_system_variables; |
| 143 |
set global session_track_system_variables='myisam_block_size,myisam_sort_buffer_size,character_set_client,example_int_var'; |
| 144 |
select @@global.session_track_system_variables; |
| 145 |
|
| 146 |
--echo # Session tracking works as expected for plugin session var |
| 147 |
connect foo,localhost,root; |
| 148 |
enable_session_track_info; |
| 149 |
select @@session.session_track_system_variables; |
| 150 |
set session example_int_var = -1; |
| 151 |
disable_session_track_info; |
| 152 |
|
| 153 |
connection default; |
| 154 |
--disable_ps_protocol |
| 155 |
--disable_cursor_protocol |
| 156 |
disconnect foo; |
| 157 |
uninstall soname 'ha_example.so'; |
| 158 |
--enable_cursor_protocol |
| 159 |
--enable_ps_protocol |
| 160 |
SET @@global.session_track_system_variables = @global_saved_tmp; |
| 161 |
|
| 162 |
--echo # End of 10.11 tests |
| 163 |
--echo # |
| 164 |
--echo # MDEV-31609 Send initial values of system variables in first OK packet |
| 165 |
--echo # |
| 166 |
|
| 167 |
enable_session_track_info; |
| 168 |
|
| 169 |
connect foo,localhost,root; |
| 170 |
|
| 171 |
disable_session_track_info; |
| 172 |
connection default; |
| 173 |
disconnect foo; |
| 174 |
|
| 175 |
--echo # End of tests 11.5 |
| 176 |
|
| 177 |
--echo # |
| 178 |
--echo # MDEV-38179 regression in t_connect |
| 179 |
--echo # |
| 180 |
|
| 181 |
--echo # myisam_block_size is a global only plugin var and is not |
| 182 |
--echo # added to the session_track_system_variables. |
| 183 |
--echo # example_int_var is a session plugin var and is included. |
| 184 |
install soname 'ha_example.so'; |
| 185 |
set global session_track_system_variables='sql_slave_skip_counter,character_set_client,example_int_var'; |
| 186 |
select @@global.session_track_system_variables; |
| 187 |
enable_session_track_info; |
| 188 |
|
| 189 |
connect foo,localhost,root; |
| 190 |
select @@session.session_track_system_variables; |
| 191 |
|
| 192 |
connection default; |
| 193 |
disconnect foo; |
| 194 |
|
| 195 |
set global session_track_system_variables='sql_slave_skip_counter,myisam_block_size,character_set_client,example_int_var'; |
| 196 |
select @@global.session_track_system_variables; |
| 197 |
enable_session_track_info; |
| 198 |
|
| 199 |
connect foo,localhost,root; |
| 200 |
select @@session.session_track_system_variables; |
| 201 |
|
| 202 |
connection default; |
| 203 |
disconnect foo; |
| 204 |
|
| 205 |
set global session_track_system_variables='sql_slave_skip_counter,myisam_block_size,max_connections,character_set_client,example_int_var'; |
| 206 |
select @@global.session_track_system_variables; |
| 207 |
enable_session_track_info; |
| 208 |
|
| 209 |
connect foo,localhost,root; |
| 210 |
select @@session.session_track_system_variables; |
| 211 |
|
| 212 |
connection default; |
| 213 |
disconnect foo; |
| 214 |
|
| 215 |
set global session_track_system_variables='sql_slave_skip_counter,*'; |
| 216 |
select @@global.session_track_system_variables; |
| 217 |
enable_session_track_info; |
| 218 |
|
| 219 |
connect foo,localhost,root; |
| 220 |
select @@session.session_track_system_variables; |
| 221 |
|
| 222 |
connection default; |
| 223 |
|
| 224 |
SET global session_track_system_variables = @global_saved_tmp; |
| 225 |
disconnect foo; |
| 226 |
uninstall soname 'ha_example.so'; |
| 227 |
--echo # End of tests 11.8 |