| 1 |
CREATE TABLE t1(id INT NOT NULL); |
| 2 |
########################################## |
| 3 |
# Shutdown |
| 4 |
########################################## |
| 5 |
########################################## |
| 6 |
# Restart |
| 7 |
########################################## |
| 8 |
########################################## |
| 9 |
# Run plugin |
| 10 |
########################################## |
| 11 |
INSTALL PLUGIN test_session_info SONAME 'TEST_SESSION_INFO'; |
| 12 |
########################################## |
| 13 |
# Stop plugin |
| 14 |
########################################## |
| 15 |
UNINSTALL PLUGIN test_session_info; |
| 16 |
########################################## |
| 17 |
# Plugin log |
| 18 |
########################################## |
| 19 |
============================================================================================ |
| 20 |
Test in a server thread |
| 21 |
Opening Session 1 |
| 22 |
Opening Session 2 |
| 23 |
============================================================================================ |
| 24 |
Session 1 : srv_session_info_get_thd and srv_session_info_get_session_id |
| 25 |
============================================================================================ |
| 26 |
Thread handler id IS equal to session id returned by srv_session_info_get_session_id(Session_1) |
| 27 |
|
| 28 |
============================================================================================ |
| 29 |
Session 2 : srv_session_info_get_thd and srv_session_info_get_session_id |
| 30 |
============================================================================================ |
| 31 |
Thread handler id IS equal to session id returned by srv_session_info_get_session_id(Session_2) |
| 32 |
|
| 33 |
SELECT name,type,processlist_id,processlist_user,processlist_host,processlist_db,processlist_command,processlist_state,processlist_info,`role`,instrumented,history,connection_type FROM performance_schema.threads WHERE processlist_id = 9 |
| 34 |
name type processlist_id processlist_user processlist_host processlist_db processlist_command processlist_state processlist_info role instrumented history connection_type |
| 35 |
thread/sql/one_connection FOREGROUND 9 root localhost test Query executing SELECT name,type,processlist_id,processlist_user,processlist_host,processlist_db,processlist_command,processlist_state,processlist_info,`role`,instrumented,history,connection_type FROM performance_schema.threads WHERE processlist_id = 9 [NULL] YES YES Plugin |
| 36 |
|
| 37 |
num_cols : 13 |
| 38 |
nb rows : 1 |
| 39 |
affected rows : 0 |
| 40 |
server status : 2 |
| 41 |
warn count : 0 |
| 42 |
|
| 43 |
SELECT name,type,processlist_id,processlist_user,processlist_host,processlist_db,processlist_command,processlist_state,processlist_info,`role`,instrumented,history,connection_type FROM performance_schema.threads WHERE processlist_id = 10 |
| 44 |
name type processlist_id processlist_user processlist_host processlist_db processlist_command processlist_state processlist_info role instrumented history connection_type |
| 45 |
thread/sql/one_connection FOREGROUND 10 root localhost test Query executing SELECT name,type,processlist_id,processlist_user,processlist_host,processlist_db,processlist_command,processlist_state,processlist_info,`role`,instrumented,history,connection_type FROM performance_schema.threads WHERE processlist_id = 10 [NULL] YES YES Plugin |
| 46 |
|
| 47 |
num_cols : 13 |
| 48 |
nb rows : 1 |
| 49 |
affected rows : 0 |
| 50 |
server status : 2 |
| 51 |
warn count : 0 |
| 52 |
|
| 53 |
============================================================================================ |
| 54 |
Session 1 : srv_session_info_get_current_db |
| 55 |
============================================================================================ |
| 56 |
/*Session_1*/ SHOW TABLES LIKE '%slave%' |
| 57 |
error : 1046 |
| 58 |
error msg : No database selected |
| 59 |
|
| 60 |
current_db before init_db : (null) |
| 61 |
current_db after init_db : mysql |
| 62 |
|
| 63 |
/*Session_1*/ SHOW TABLES LIKE '%slave%' |
| 64 |
Tables_in_mysql (%slave%) |
| 65 |
slave_master_info |
| 66 |
slave_relay_log_info |
| 67 |
slave_worker_info |
| 68 |
|
| 69 |
num_cols : 1 |
| 70 |
nb rows : 3 |
| 71 |
affected rows : 0 |
| 72 |
server status : 2 |
| 73 |
warn count : 0 |
| 74 |
|
| 75 |
/*Session_1*/ USE information_schema |
| 76 |
affected rows : 0 |
| 77 |
server status : 2 |
| 78 |
warn count : 0 |
| 79 |
|
| 80 |
current_db after 'USE db_name' command : information_schema |
| 81 |
|
| 82 |
current_db before init_db : information_schema |
| 83 |
current_db after init_db : test |
| 84 |
|
| 85 |
/*Session_1*/ SHOW TABLES |
| 86 |
Tables_in_test |
| 87 |
t1 |
| 88 |
|
| 89 |
num_cols : 1 |
| 90 |
nb rows : 1 |
| 91 |
affected rows : 0 |
| 92 |
server status : 2 |
| 93 |
warn count : 0 |
| 94 |
|
| 95 |
============================================================================================ |
| 96 |
Session 2 : srv_session_info_get_current_db |
| 97 |
============================================================================================ |
| 98 |
/*Session_2*/ SHOW TABLES LIKE '%slave%' |
| 99 |
error : 1046 |
| 100 |
error msg : No database selected |
| 101 |
|
| 102 |
current_db before init_db : (null) |
| 103 |
current_db after init_db : mysql |
| 104 |
|
| 105 |
Session 2's view |
| 106 |
/*Session_2*/ SHOW TABLES LIKE '%slave%' |
| 107 |
Tables_in_mysql (%slave%) |
| 108 |
slave_master_info |
| 109 |
slave_relay_log_info |
| 110 |
slave_worker_info |
| 111 |
|
| 112 |
num_cols : 1 |
| 113 |
nb rows : 3 |
| 114 |
affected rows : 0 |
| 115 |
server status : 2 |
| 116 |
warn count : 0 |
| 117 |
|
| 118 |
Session 2's view |
| 119 |
/*Session_2*/ USE information_schema |
| 120 |
affected rows : 0 |
| 121 |
server status : 2 |
| 122 |
warn count : 0 |
| 123 |
|
| 124 |
current_db after 'USE db_name' command : information_schema |
| 125 |
|
| 126 |
current_db before init_db : information_schema |
| 127 |
current_db after init_db : test |
| 128 |
|
| 129 |
Session 2's view |
| 130 |
/*Session_2*/ SHOW TABLES |
| 131 |
Tables_in_test |
| 132 |
t1 |
| 133 |
|
| 134 |
num_cols : 1 |
| 135 |
nb rows : 1 |
| 136 |
affected rows : 0 |
| 137 |
server status : 2 |
| 138 |
warn count : 0 |
| 139 |
|
| 140 |
============================================================================================ |
| 141 |
Session 1 : srv_session_info_set/get_client_port |
| 142 |
============================================================================================ |
| 143 |
Port before srv_session_info_set_client_port : 0 |
| 144 |
Port after srv_session_info_set_client_port : 100 |
| 145 |
|
| 146 |
Session 1's view |
| 147 |
/*Session_1*/ SELECT host FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 148 |
host |
| 149 |
localhost:100 |
| 150 |
localhost |
| 151 |
|
| 152 |
num_cols : 1 |
| 153 |
nb rows : 2 |
| 154 |
affected rows : 0 |
| 155 |
server status : 34 |
| 156 |
warn count : 1 |
| 157 |
|
| 158 |
Session 2's view |
| 159 |
/*Session_2*/ SELECT host FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 160 |
host |
| 161 |
localhost:100 |
| 162 |
localhost |
| 163 |
|
| 164 |
num_cols : 1 |
| 165 |
nb rows : 2 |
| 166 |
affected rows : 0 |
| 167 |
server status : 34 |
| 168 |
warn count : 1 |
| 169 |
|
| 170 |
============================================================================================ |
| 171 |
Session 2 : srv_session_info_set/get_client_port |
| 172 |
============================================================================================ |
| 173 |
Port before srv_session_info_set_client_port : 0 |
| 174 |
Port after srv_session_info_set_client_port : 200 |
| 175 |
|
| 176 |
Session 1's view |
| 177 |
/*Session_1*/ SELECT host FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 178 |
host |
| 179 |
localhost:100 |
| 180 |
localhost:200 |
| 181 |
|
| 182 |
num_cols : 1 |
| 183 |
nb rows : 2 |
| 184 |
affected rows : 0 |
| 185 |
server status : 34 |
| 186 |
warn count : 1 |
| 187 |
|
| 188 |
Session 2's view |
| 189 |
/*Session_2*/ SELECT host FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 190 |
host |
| 191 |
localhost:100 |
| 192 |
localhost:200 |
| 193 |
|
| 194 |
num_cols : 1 |
| 195 |
nb rows : 2 |
| 196 |
affected rows : 0 |
| 197 |
server status : 34 |
| 198 |
warn count : 1 |
| 199 |
|
| 200 |
============================================================================================ |
| 201 |
Session 1 : srv_session_info_set_connection_type |
| 202 |
============================================================================================ |
| 203 |
Session 1's view |
| 204 |
SELECT CONNECTION_TYPE, CONNECTION_TYPE IS NULL FROM performance_schema.threads WHERE PROCESSLIST_ID = 9 /*session_1_id*/ |
| 205 |
CONNECTION_TYPE CONNECTION_TYPE IS NULL |
| 206 |
Plugin 0 |
| 207 |
|
| 208 |
num_cols : 2 |
| 209 |
nb rows : 1 |
| 210 |
affected rows : 0 |
| 211 |
server status : 2 |
| 212 |
warn count : 0 |
| 213 |
|
| 214 |
Setting NO_VIO_TYPE on session_1 |
| 215 |
Session 1's view |
| 216 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 9 /*session_1_id*/ |
| 217 |
CONNECTION_TYPE |
| 218 |
Plugin |
| 219 |
|
| 220 |
num_cols : 1 |
| 221 |
nb rows : 1 |
| 222 |
affected rows : 0 |
| 223 |
server status : 2 |
| 224 |
warn count : 0 |
| 225 |
|
| 226 |
Setting VIO_TYPE_TCPIP on session_1 |
| 227 |
Session 1's view |
| 228 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 9 /*session_1_id*/ |
| 229 |
CONNECTION_TYPE |
| 230 |
TCP/IP |
| 231 |
|
| 232 |
num_cols : 1 |
| 233 |
nb rows : 1 |
| 234 |
affected rows : 0 |
| 235 |
server status : 2 |
| 236 |
warn count : 0 |
| 237 |
|
| 238 |
Setting VIO_TYPE_NAMEDPIPE on session_1 |
| 239 |
Session 1's view |
| 240 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 9 /*session_1_id*/ |
| 241 |
CONNECTION_TYPE |
| 242 |
Named Pipe |
| 243 |
|
| 244 |
num_cols : 1 |
| 245 |
nb rows : 1 |
| 246 |
affected rows : 0 |
| 247 |
server status : 2 |
| 248 |
warn count : 0 |
| 249 |
|
| 250 |
============================================================================================ |
| 251 |
Session 2 : srv_session_info_set_connection_type |
| 252 |
============================================================================================ |
| 253 |
Session 2's view |
| 254 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 10 /*session_2_id*/ |
| 255 |
CONNECTION_TYPE |
| 256 |
Plugin |
| 257 |
|
| 258 |
num_cols : 1 |
| 259 |
nb rows : 1 |
| 260 |
affected rows : 0 |
| 261 |
server status : 2 |
| 262 |
warn count : 0 |
| 263 |
|
| 264 |
Setting VIO_TYPE_SSL on session_2 |
| 265 |
Setting VIO_TYPE_TCPIP on session_1 |
| 266 |
Session 2's view |
| 267 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 10 /*session_2_id*/ |
| 268 |
CONNECTION_TYPE |
| 269 |
SSL/TLS |
| 270 |
|
| 271 |
num_cols : 1 |
| 272 |
nb rows : 1 |
| 273 |
affected rows : 0 |
| 274 |
server status : 2 |
| 275 |
warn count : 0 |
| 276 |
|
| 277 |
Session 2's view |
| 278 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 10 /*session_2_id*/ |
| 279 |
CONNECTION_TYPE |
| 280 |
Shared Memory |
| 281 |
|
| 282 |
num_cols : 1 |
| 283 |
nb rows : 1 |
| 284 |
affected rows : 0 |
| 285 |
server status : 2 |
| 286 |
warn count : 0 |
| 287 |
|
| 288 |
============================================================================================ |
| 289 |
BEFORE kill of Session 1 |
| 290 |
============================================================================================ |
| 291 |
SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 292 |
ID USER HOST DB COMMAND INFO |
| 293 |
9 root localhost:100 test Query PLUGIN: SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 294 |
10 root localhost:200 test Sleep PLUGIN |
| 295 |
|
| 296 |
num_cols : 6 |
| 297 |
nb rows : 2 |
| 298 |
affected rows : 0 |
| 299 |
server status : 34 |
| 300 |
warn count : 1 |
| 301 |
|
| 302 |
============================================================================================ |
| 303 |
srv_session_info_killed(Session_1) : 0 |
| 304 |
srv_session_info_killed(Session_2) : 0 |
| 305 |
============================================================================================ |
| 306 |
Killing Session 1 |
| 307 |
KILL CONNECTION 9 /*session_1_id*/ |
| 308 |
affected rows : 0 |
| 309 |
server status : 2 |
| 310 |
warn count : 0 |
| 311 |
|
| 312 |
============================================================================================ |
| 313 |
AFTER kill of Session 1 |
| 314 |
============================================================================================ |
| 315 |
SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 316 |
|
| 317 |
============================================================================================ |
| 318 |
srv_session_info_killed(Session 1) : 1 |
| 319 |
srv_session_info_killed(Session 2) : 0 |
| 320 |
============================================================================================ |
| 321 |
Closing Session 1 |
| 322 |
Closing Session 1 failed as expected. It was already closed by EXEC_TEST_CMD |
| 323 |
============================================================================================ |
| 324 |
Get/Set session info with closed session(Session 1) |
| 325 |
============================================================================================ |
| 326 |
srv_session_info_get_thd : 0 |
| 327 |
srv_session_info_get_session_id : 0 |
| 328 |
srv_session_info_set_client_port : 1 |
| 329 |
srv_session_info_get_client_port : 0 |
| 330 |
srv_session_info_get_current_db : (null) |
| 331 |
srv_session_info_set_connection_type : 1 |
| 332 |
|
| 333 |
============================================================================================ |
| 334 |
SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 335 |
|
| 336 |
============================================================================================ |
| 337 |
Perform KILL QUERY and suicide (KILL CONNECTION) on Session 2 |
| 338 |
============================================================================================ |
| 339 |
KILL QUERY 10 /*session_2_id*/ |
| 340 |
srv_session_info_killed(Session 2) : 0 |
| 341 |
KILL CONNECTION 10 /*session_2_id*/ |
| 342 |
srv_session_info_killed(Session 2) : 1 |
| 343 |
============================================================================================ |
| 344 |
Get/Set session info with killed session(Session 2) |
| 345 |
============================================================================================ |
| 346 |
srv_session_info_get_thd : 1 |
| 347 |
srv_session_info_get_session_id : 10 |
| 348 |
srv_session_info_set_client_port : 0 |
| 349 |
srv_session_info_get_client_port : 11111 |
| 350 |
srv_session_info_get_current_db : test |
| 351 |
srv_session_info_set_connection_type : 0 |
| 352 |
|
| 353 |
============================================================================================ |
| 354 |
Session 2 got killed but not closed, thus it will appear in the processlist as Killed |
| 355 |
============================================================================================ |
| 356 |
/*Session 3*/SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 357 |
ID USER HOST DB COMMAND INFO |
| 358 |
10 root localhost:11111 test Killed PLUGIN |
| 359 |
11 root localhost [NULL] Query PLUGIN: /*Session 3*/SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 360 |
|
| 361 |
num_cols : 6 |
| 362 |
nb rows : 2 |
| 363 |
affected rows : 0 |
| 364 |
server status : 34 |
| 365 |
warn count : 1 |
| 366 |
|
| 367 |
Closing Session 2 |
| 368 |
Closing Session 3 |
| 369 |
Follows threaded run |
| 370 |
============================================================================================ |
| 371 |
init thread |
| 372 |
Opening Session 1 |
| 373 |
Opening Session 2 |
| 374 |
============================================================================================ |
| 375 |
Session 1 : srv_session_info_get_thd and srv_session_info_get_session_id |
| 376 |
============================================================================================ |
| 377 |
Thread handler id IS equal to session id returned by srv_session_info_get_session_id(Session_1) |
| 378 |
|
| 379 |
============================================================================================ |
| 380 |
Session 2 : srv_session_info_get_thd and srv_session_info_get_session_id |
| 381 |
============================================================================================ |
| 382 |
Thread handler id IS equal to session id returned by srv_session_info_get_session_id(Session_2) |
| 383 |
|
| 384 |
SELECT name,type,processlist_id,processlist_user,processlist_host,processlist_db,processlist_command,processlist_state,processlist_info,`role`,instrumented,history,connection_type FROM performance_schema.threads WHERE processlist_id = 12 |
| 385 |
name type processlist_id processlist_user processlist_host processlist_db processlist_command processlist_state processlist_info role instrumented history connection_type |
| 386 |
thread/test_service_sql/session_info FOREGROUND 12 root localhost [NULL] Query executing SELECT name,type,processlist_id,processlist_user,processlist_host,processlist_db,processlist_command,processlist_state,processlist_info,`role`,instrumented,history,connection_type FROM performance_schema.threads WHERE processlist_id = 12 [NULL] YES YES Plugin |
| 387 |
|
| 388 |
num_cols : 13 |
| 389 |
nb rows : 1 |
| 390 |
affected rows : 0 |
| 391 |
server status : 2 |
| 392 |
warn count : 0 |
| 393 |
|
| 394 |
SELECT name,type,processlist_id,processlist_user,processlist_host,processlist_db,processlist_command,processlist_state,processlist_info,`role`,instrumented,history,connection_type FROM performance_schema.threads WHERE processlist_id = 13 |
| 395 |
name type processlist_id processlist_user processlist_host processlist_db processlist_command processlist_state processlist_info role instrumented history connection_type |
| 396 |
thread/test_service_sql/session_info FOREGROUND 13 root localhost [NULL] Query executing SELECT name,type,processlist_id,processlist_user,processlist_host,processlist_db,processlist_command,processlist_state,processlist_info,`role`,instrumented,history,connection_type FROM performance_schema.threads WHERE processlist_id = 13 [NULL] YES YES Plugin |
| 397 |
|
| 398 |
num_cols : 13 |
| 399 |
nb rows : 1 |
| 400 |
affected rows : 0 |
| 401 |
server status : 2 |
| 402 |
warn count : 0 |
| 403 |
|
| 404 |
============================================================================================ |
| 405 |
Session 1 : srv_session_info_get_current_db |
| 406 |
============================================================================================ |
| 407 |
/*Session_1*/ SHOW TABLES LIKE '%slave%' |
| 408 |
error : 1046 |
| 409 |
error msg : No database selected |
| 410 |
|
| 411 |
current_db before init_db : (null) |
| 412 |
current_db after init_db : mysql |
| 413 |
|
| 414 |
/*Session_1*/ SHOW TABLES LIKE '%slave%' |
| 415 |
Tables_in_mysql (%slave%) |
| 416 |
slave_master_info |
| 417 |
slave_relay_log_info |
| 418 |
slave_worker_info |
| 419 |
|
| 420 |
num_cols : 1 |
| 421 |
nb rows : 3 |
| 422 |
affected rows : 0 |
| 423 |
server status : 2 |
| 424 |
warn count : 0 |
| 425 |
|
| 426 |
/*Session_1*/ USE information_schema |
| 427 |
affected rows : 0 |
| 428 |
server status : 2 |
| 429 |
warn count : 0 |
| 430 |
|
| 431 |
current_db after 'USE db_name' command : information_schema |
| 432 |
|
| 433 |
current_db before init_db : information_schema |
| 434 |
current_db after init_db : test |
| 435 |
|
| 436 |
/*Session_1*/ SHOW TABLES |
| 437 |
Tables_in_test |
| 438 |
t1 |
| 439 |
|
| 440 |
num_cols : 1 |
| 441 |
nb rows : 1 |
| 442 |
affected rows : 0 |
| 443 |
server status : 2 |
| 444 |
warn count : 0 |
| 445 |
|
| 446 |
============================================================================================ |
| 447 |
Session 2 : srv_session_info_get_current_db |
| 448 |
============================================================================================ |
| 449 |
/*Session_2*/ SHOW TABLES LIKE '%slave%' |
| 450 |
error : 1046 |
| 451 |
error msg : No database selected |
| 452 |
|
| 453 |
current_db before init_db : (null) |
| 454 |
current_db after init_db : mysql |
| 455 |
|
| 456 |
Session 2's view |
| 457 |
/*Session_2*/ SHOW TABLES LIKE '%slave%' |
| 458 |
Tables_in_mysql (%slave%) |
| 459 |
slave_master_info |
| 460 |
slave_relay_log_info |
| 461 |
slave_worker_info |
| 462 |
|
| 463 |
num_cols : 1 |
| 464 |
nb rows : 3 |
| 465 |
affected rows : 0 |
| 466 |
server status : 2 |
| 467 |
warn count : 0 |
| 468 |
|
| 469 |
Session 2's view |
| 470 |
/*Session_2*/ USE information_schema |
| 471 |
affected rows : 0 |
| 472 |
server status : 2 |
| 473 |
warn count : 0 |
| 474 |
|
| 475 |
current_db after 'USE db_name' command : information_schema |
| 476 |
|
| 477 |
current_db before init_db : information_schema |
| 478 |
current_db after init_db : test |
| 479 |
|
| 480 |
Session 2's view |
| 481 |
/*Session_2*/ SHOW TABLES |
| 482 |
Tables_in_test |
| 483 |
t1 |
| 484 |
|
| 485 |
num_cols : 1 |
| 486 |
nb rows : 1 |
| 487 |
affected rows : 0 |
| 488 |
server status : 2 |
| 489 |
warn count : 0 |
| 490 |
|
| 491 |
============================================================================================ |
| 492 |
Session 1 : srv_session_info_set/get_client_port |
| 493 |
============================================================================================ |
| 494 |
Port before srv_session_info_set_client_port : 0 |
| 495 |
Port after srv_session_info_set_client_port : 100 |
| 496 |
|
| 497 |
Session 1's view |
| 498 |
/*Session_1*/ SELECT host FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 499 |
host |
| 500 |
localhost:100 |
| 501 |
localhost |
| 502 |
|
| 503 |
num_cols : 1 |
| 504 |
nb rows : 2 |
| 505 |
affected rows : 0 |
| 506 |
server status : 34 |
| 507 |
warn count : 1 |
| 508 |
|
| 509 |
Session 2's view |
| 510 |
/*Session_2*/ SELECT host FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 511 |
host |
| 512 |
localhost:100 |
| 513 |
localhost |
| 514 |
|
| 515 |
num_cols : 1 |
| 516 |
nb rows : 2 |
| 517 |
affected rows : 0 |
| 518 |
server status : 34 |
| 519 |
warn count : 1 |
| 520 |
|
| 521 |
============================================================================================ |
| 522 |
Session 2 : srv_session_info_set/get_client_port |
| 523 |
============================================================================================ |
| 524 |
Port before srv_session_info_set_client_port : 0 |
| 525 |
Port after srv_session_info_set_client_port : 200 |
| 526 |
|
| 527 |
Session 1's view |
| 528 |
/*Session_1*/ SELECT host FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 529 |
host |
| 530 |
localhost:100 |
| 531 |
localhost:200 |
| 532 |
|
| 533 |
num_cols : 1 |
| 534 |
nb rows : 2 |
| 535 |
affected rows : 0 |
| 536 |
server status : 34 |
| 537 |
warn count : 1 |
| 538 |
|
| 539 |
Session 2's view |
| 540 |
/*Session_2*/ SELECT host FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 541 |
host |
| 542 |
localhost:100 |
| 543 |
localhost:200 |
| 544 |
|
| 545 |
num_cols : 1 |
| 546 |
nb rows : 2 |
| 547 |
affected rows : 0 |
| 548 |
server status : 34 |
| 549 |
warn count : 1 |
| 550 |
|
| 551 |
============================================================================================ |
| 552 |
Session 1 : srv_session_info_set_connection_type |
| 553 |
============================================================================================ |
| 554 |
Session 1's view |
| 555 |
SELECT CONNECTION_TYPE, CONNECTION_TYPE IS NULL FROM performance_schema.threads WHERE PROCESSLIST_ID = 12 /*session_1_id*/ |
| 556 |
CONNECTION_TYPE CONNECTION_TYPE IS NULL |
| 557 |
Plugin 0 |
| 558 |
|
| 559 |
num_cols : 2 |
| 560 |
nb rows : 1 |
| 561 |
affected rows : 0 |
| 562 |
server status : 2 |
| 563 |
warn count : 0 |
| 564 |
|
| 565 |
Setting NO_VIO_TYPE on session_1 |
| 566 |
Session 1's view |
| 567 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 12 /*session_1_id*/ |
| 568 |
CONNECTION_TYPE |
| 569 |
Plugin |
| 570 |
|
| 571 |
num_cols : 1 |
| 572 |
nb rows : 1 |
| 573 |
affected rows : 0 |
| 574 |
server status : 2 |
| 575 |
warn count : 0 |
| 576 |
|
| 577 |
Setting VIO_TYPE_TCPIP on session_1 |
| 578 |
Session 1's view |
| 579 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 12 /*session_1_id*/ |
| 580 |
CONNECTION_TYPE |
| 581 |
TCP/IP |
| 582 |
|
| 583 |
num_cols : 1 |
| 584 |
nb rows : 1 |
| 585 |
affected rows : 0 |
| 586 |
server status : 2 |
| 587 |
warn count : 0 |
| 588 |
|
| 589 |
Setting VIO_TYPE_NAMEDPIPE on session_1 |
| 590 |
Session 1's view |
| 591 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 12 /*session_1_id*/ |
| 592 |
CONNECTION_TYPE |
| 593 |
Named Pipe |
| 594 |
|
| 595 |
num_cols : 1 |
| 596 |
nb rows : 1 |
| 597 |
affected rows : 0 |
| 598 |
server status : 2 |
| 599 |
warn count : 0 |
| 600 |
|
| 601 |
============================================================================================ |
| 602 |
Session 2 : srv_session_info_set_connection_type |
| 603 |
============================================================================================ |
| 604 |
Session 2's view |
| 605 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 13 /*session_2_id*/ |
| 606 |
CONNECTION_TYPE |
| 607 |
Plugin |
| 608 |
|
| 609 |
num_cols : 1 |
| 610 |
nb rows : 1 |
| 611 |
affected rows : 0 |
| 612 |
server status : 2 |
| 613 |
warn count : 0 |
| 614 |
|
| 615 |
Setting VIO_TYPE_SSL on session_2 |
| 616 |
Setting VIO_TYPE_TCPIP on session_1 |
| 617 |
Session 2's view |
| 618 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 13 /*session_2_id*/ |
| 619 |
CONNECTION_TYPE |
| 620 |
SSL/TLS |
| 621 |
|
| 622 |
num_cols : 1 |
| 623 |
nb rows : 1 |
| 624 |
affected rows : 0 |
| 625 |
server status : 2 |
| 626 |
warn count : 0 |
| 627 |
|
| 628 |
Session 2's view |
| 629 |
SELECT CONNECTION_TYPE FROM performance_schema.threads WHERE PROCESSLIST_ID = 13 /*session_2_id*/ |
| 630 |
CONNECTION_TYPE |
| 631 |
Shared Memory |
| 632 |
|
| 633 |
num_cols : 1 |
| 634 |
nb rows : 1 |
| 635 |
affected rows : 0 |
| 636 |
server status : 2 |
| 637 |
warn count : 0 |
| 638 |
|
| 639 |
============================================================================================ |
| 640 |
BEFORE kill of Session 1 |
| 641 |
============================================================================================ |
| 642 |
SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 643 |
ID USER HOST DB COMMAND INFO |
| 644 |
12 root localhost:100 test Query PLUGIN: SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 645 |
13 root localhost:200 test Sleep PLUGIN |
| 646 |
|
| 647 |
num_cols : 6 |
| 648 |
nb rows : 2 |
| 649 |
affected rows : 0 |
| 650 |
server status : 34 |
| 651 |
warn count : 1 |
| 652 |
|
| 653 |
============================================================================================ |
| 654 |
srv_session_info_killed(Session_1) : 0 |
| 655 |
srv_session_info_killed(Session_2) : 0 |
| 656 |
============================================================================================ |
| 657 |
Killing Session 1 |
| 658 |
KILL CONNECTION 12 /*session_1_id*/ |
| 659 |
affected rows : 0 |
| 660 |
server status : 2 |
| 661 |
warn count : 0 |
| 662 |
|
| 663 |
============================================================================================ |
| 664 |
AFTER kill of Session 1 |
| 665 |
============================================================================================ |
| 666 |
SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 667 |
|
| 668 |
============================================================================================ |
| 669 |
srv_session_info_killed(Session 1) : 1 |
| 670 |
srv_session_info_killed(Session 2) : 0 |
| 671 |
============================================================================================ |
| 672 |
Closing Session 1 |
| 673 |
Closing Session 1 failed as expected. It was already closed by EXEC_TEST_CMD |
| 674 |
============================================================================================ |
| 675 |
Get/Set session info with closed session(Session 1) |
| 676 |
============================================================================================ |
| 677 |
srv_session_info_get_thd : 0 |
| 678 |
srv_session_info_get_session_id : 0 |
| 679 |
srv_session_info_set_client_port : 1 |
| 680 |
srv_session_info_get_client_port : 0 |
| 681 |
srv_session_info_get_current_db : (null) |
| 682 |
srv_session_info_set_connection_type : 1 |
| 683 |
|
| 684 |
============================================================================================ |
| 685 |
SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 686 |
|
| 687 |
============================================================================================ |
| 688 |
Perform KILL QUERY and suicide (KILL CONNECTION) on Session 2 |
| 689 |
============================================================================================ |
| 690 |
KILL QUERY 13 /*session_2_id*/ |
| 691 |
srv_session_info_killed(Session 2) : 0 |
| 692 |
KILL CONNECTION 13 /*session_2_id*/ |
| 693 |
srv_session_info_killed(Session 2) : 1 |
| 694 |
============================================================================================ |
| 695 |
Get/Set session info with killed session(Session 2) |
| 696 |
============================================================================================ |
| 697 |
srv_session_info_get_thd : 1 |
| 698 |
srv_session_info_get_session_id : 13 |
| 699 |
srv_session_info_set_client_port : 0 |
| 700 |
srv_session_info_get_client_port : 11111 |
| 701 |
srv_session_info_get_current_db : test |
| 702 |
srv_session_info_set_connection_type : 0 |
| 703 |
|
| 704 |
============================================================================================ |
| 705 |
Session 2 got killed but not closed, thus it will appear in the processlist as Killed |
| 706 |
============================================================================================ |
| 707 |
/*Session 3*/SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 708 |
ID USER HOST DB COMMAND INFO |
| 709 |
13 root localhost:11111 test Killed PLUGIN |
| 710 |
14 root localhost [NULL] Query PLUGIN: /*Session 3*/SELECT ID, USER, HOST, DB, COMMAND, INFO FROM INFORMATION_SCHEMA.PROCESSLIST WHERE info LIKE 'PLUGIN%' ORDER BY id |
| 711 |
|
| 712 |
num_cols : 6 |
| 713 |
nb rows : 2 |
| 714 |
affected rows : 0 |
| 715 |
server status : 34 |
| 716 |
warn count : 1 |
| 717 |
|
| 718 |
Closing Session 2 |
| 719 |
Closing Session 3 |
| 720 |
deinit thread |
| 721 |
########################################## |
| 722 |
# Cleanup |
| 723 |
########################################## |
| 724 |
DROP TABLE t1; |