diff options
author | Sergei Golubchik <sergii@pisem.net> | 2011-07-02 22:08:51 +0200 |
---|---|---|
committer | Sergei Golubchik <sergii@pisem.net> | 2011-07-02 22:08:51 +0200 |
commit | 9809f05199aeb0b67991fac41bd86f38730768dc (patch) | |
tree | fa2792ff86d0da014b535d743759810612338042 /mysql-test/include/check_ftwrl_incompatible.inc | |
parent | 0accbd0364e0333e0b119aa9ce93e34ded9df6cb (diff) | |
parent | 5a0e7394a5ae0c7b6a1ea35b7ea3a8985325987a (diff) | |
download | mariadb-git-9809f05199aeb0b67991fac41bd86f38730768dc.tar.gz |
5.5-merge
Diffstat (limited to 'mysql-test/include/check_ftwrl_incompatible.inc')
-rw-r--r-- | mysql-test/include/check_ftwrl_incompatible.inc | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/mysql-test/include/check_ftwrl_incompatible.inc b/mysql-test/include/check_ftwrl_incompatible.inc new file mode 100644 index 00000000000..4787a69ea9c --- /dev/null +++ b/mysql-test/include/check_ftwrl_incompatible.inc @@ -0,0 +1,155 @@ +# +# SUMMARY +# Check that a statement is incompatible with FLUSH TABLES WITH READ LOCK. +# +# PARAMETERS +# $con_aux1 Name of the 1st aux connection to be used by this script. +# $con_aux2 Name of the 2nd aux connection to be used by this script. +# $statement The statement to be checked. +# $cleanup_stmt1 The 1st statement to be run in order to revert effects +# of statement to be checked. +# $cleanup_stmt2 The 2nd statement to be run in order to revert effects +# of statement to be checked. +# $skip_3rd_chk Skip the 3rd stage of checking. The purpose of the third +# stage is to check that metadata locks taken by this +# statement are incompatible with metadata locks taken +# by FTWRL. +# +# EXAMPLE +# flush_read_lock.test +# +--disable_result_log +--disable_query_log + +# Reset DEBUG_SYNC facility for safety. +set debug_sync= "RESET"; + +# +# First, check that the statement cannot be run under FTWRL. +# +flush tables with read lock; +--disable_abort_on_error +--eval $statement +--enable_abort_on_error +let $err= $mysql_errno; +if ($err) +{ +--echo Success: Was not able to run '$statement' under FTWRL. +unlock tables; +} +if (!$err) +{ +--echo Error: Was able to run '$statement' under FTWRL! +unlock tables; +if ($cleanup_stmt1) +{ +--eval $cleanup_stmt1; +} +if ($cleanup_stmt2) +{ +--eval $cleanup_stmt2; +} +} + + +# +# Then check that this statement is blocked by FTWRL +# that is active in another connection. +# +connection $con_aux1; +flush tables with read lock; + +connection default; +--send_eval $statement; + +connection $con_aux1; + +--enable_result_log +--enable_query_log +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where (state = "Waiting for global read lock" or + state = "Waiting for commit lock") and + info = "$statement"; +--source include/wait_condition.inc +--disable_result_log +--disable_query_log + +if ($success) +{ +--echo Success: '$statement' is blocked by FTWRL active in another connection. +} +if (!$success) +{ +--echo Error: '$statement' wasn't blocked by FTWRL active in another connection! +} +unlock tables; + +connection default; +--reap + +if ($cleanup_stmt1) +{ +--eval $cleanup_stmt1; +} +if ($cleanup_stmt2) +{ +--eval $cleanup_stmt2; +} + +if (!$skip_3rd_check) +{ +# +# Finally, let us check that FTWRL will not succeed if this +# statement is active but has already closed its tables. +# +connection default; +--eval set debug_sync='execute_command_after_close_tables SIGNAL parked WAIT_FOR go'; +--send_eval $statement; + +connection $con_aux1; +set debug_sync="now WAIT_FOR parked"; +--send flush tables with read lock + +connection $con_aux2; +--enable_result_log +--enable_query_log +let $wait_condition= + select count(*) = 1 from information_schema.processlist + where (state = "Waiting for global read lock" or + state = "Waiting for commit lock") and + info = "flush tables with read lock"; +--source include/wait_condition.inc +--disable_result_log +--disable_query_log + +if ($success) +{ +--echo Success: FTWRL is blocked when '$statement' is active in another connection. +} +if (!$success) +{ +--echo Error: FTWRL isn't blocked when '$statement' is active in another connection! +} +set debug_sync="now SIGNAL go"; +connection default; +--reap +connection $con_aux1; +--reap +unlock tables; +connection default; + +set debug_sync= "RESET"; + +if ($cleanup_stmt1) +{ +--eval $cleanup_stmt1; +} +if ($cleanup_stmt2) +{ +--eval $cleanup_stmt2; +} +} + +--enable_result_log +--enable_query_log |