| 1 |
## Test releasing of long lasting queries when their session has been stopped |
| 2 |
|
| 3 |
## Preamble |
| 4 |
--source include/no_ps_protocol.inc |
| 5 |
--source include/xplugin_preamble.inc |
| 6 |
--source include/xplugin_create_user.inc |
| 7 |
|
| 8 |
## Test data |
| 9 |
|
| 10 |
## Test starts here |
| 11 |
--write_file $MYSQL_TMP_DIR/connection_not_alive.xpl |
| 12 |
-->quiet |
| 13 |
|
| 14 |
-->macro Get_connection_id |
| 15 |
-->stmtsql SELECT connection_id(); |
| 16 |
-->recvtovar %ID% |
| 17 |
-->endmacro |
| 18 |
|
| 19 |
-->macro Assert_connection_not_alive %CONNECTION_ID% |
| 20 |
-->wait_for 0 SELECT count(*) FROM information_schema.processlist WHERE id = %CONNECTION_ID% |
| 21 |
-->endmacro |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
-->title =I. Aborting of sleeping session |
| 26 |
|
| 27 |
-->newsession sleep_session |
| 28 |
-->callmacro Get_connection_id |
| 29 |
-->stmtsql SELECT sleep(1000); |
| 30 |
-->closesession abort |
| 31 |
|
| 32 |
-->setsession |
| 33 |
-->callmacro Assert_connection_not_alive %ID% |
| 34 |
|
| 35 |
|
| 36 |
-->title =II. Aborting of updating locked table session |
| 37 |
|
| 38 |
-->newsession lock_table |
| 39 |
-->sql |
| 40 |
LOCK TABLES test.table WRITE; |
| 41 |
-->endsql |
| 42 |
|
| 43 |
-->newsession try_update_lock_table |
| 44 |
-->callmacro Get_connection_id |
| 45 |
-->stmtsql UPDATE test.table SET field = field + 1; |
| 46 |
-->closesession abort |
| 47 |
|
| 48 |
-->setsession |
| 49 |
-->callmacro Assert_connection_not_alive %ID% |
| 50 |
|
| 51 |
-->setsession lock_table |
| 52 |
-->sql |
| 53 |
UNLOCK TABLES; |
| 54 |
-->endsql |
| 55 |
-->closesession |
| 56 |
|
| 57 |
|
| 58 |
-->title =III. Aborting of updating table session used by transaction |
| 59 |
|
| 60 |
-->newsession transaction |
| 61 |
-->sql |
| 62 |
START TRANSACTION; |
| 63 |
UPDATE test.table SET field = 7; |
| 64 |
-->endsql |
| 65 |
|
| 66 |
-->newsession try_update_table_in_trans |
| 67 |
-->callmacro Get_connection_id |
| 68 |
-->stmtsql UPDATE test.table SET field = field * 10; |
| 69 |
-->closesession abort |
| 70 |
|
| 71 |
-->setsession |
| 72 |
-->callmacro Assert_connection_not_alive %ID% |
| 73 |
|
| 74 |
-->setsession transaction |
| 75 |
-->sql |
| 76 |
COMMIT; |
| 77 |
-->endsql |
| 78 |
-->closesession |
| 79 |
|
| 80 |
EOF |
| 81 |
|
| 82 |
|
| 83 |
CREATE TABLE test.table (field INT); |
| 84 |
INSERT INTO test.table VALUES (1),(2),(3); |
| 85 |
|
| 86 |
--exec $MYSQLXTEST -ux_root --password='' --file=$MYSQL_TMP_DIR/connection_not_alive.xpl 2>&1 |
| 87 |
|
| 88 |
## Cleanup |
| 89 |
--let $count_sessions= 1 |
| 90 |
--source include/wait_until_count_sessions.inc |
| 91 |
DROP TABLE test.table; |
| 92 |
--source ../include/xplugin_cleanup.inc |