mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
ac5e6f60a8
tables' lock." Execution of ALTER TABLE ... ENABLE KEYS on a table (which can take rather long time) prevented concurrent execution of all statements using tables. The problem was caused by the fact that we were holding LOCK_open mutex during whole duration of this statement and particularly during call to handler::enable_indexes(). This behavior was introduced as part of the fix for bug 14262 "SP: DROP PROCEDURE|VIEW (maybe more) write to binlog too late (race cond)" The patch simply restores old behavior. Note that we can safely do this as this operation takes exclusive lock (similar to name-lock) which blocks both DML and DDL on the table being altered. It also introduces mysql-test/include/wait_show_pattern.inc helper script which is used to make test-case for this bug robust enough. mysql-test/include/wait_slave_status.inc: Now wait_slave_status.inc reuses more generic wait_output_matches.inc script. sql/sql_table.cc: mysql_alter_table(): Changed ALTER TABLE ... ENABLE/DISABLE KEYS not to hold LOCK_open mutex during call to handler::enable_indexes() as the latter can take rather long time and therefore such ALTER would block execution of all other statements that use tables. We can safely do this as this operation takes exclusive lock (similar to name-lock) on the table which is altered. mysql-test/include/wait_show_pattern.inc: New BitKeeper file ``mysql-test/include/wait_show_pattern.inc'' mysql-test/r/alter_table-big.result: New BitKeeper file ``mysql-test/r/alter_table-big.result'' mysql-test/t/alter_table-big.test: New BitKeeper file ``mysql-test/t/alter_table-big.test''
51 lines
1.1 KiB
PHP
51 lines
1.1 KiB
PHP
# include/wait_show_pattern.inc
|
|
#
|
|
# SUMMARY
|
|
#
|
|
# Waits until output produced by SHOW statement which particular type is
|
|
# specified as parameter matches certain pattern or maximum time reached.
|
|
#
|
|
# NOTES
|
|
#
|
|
# Only the first row produced by the parameter statement is checked.
|
|
#
|
|
# USAGE
|
|
#
|
|
# let $show_type= <Tail of SHOW statement>;
|
|
# let $show_pattern= 'Pattern to be used for LIKE matching';
|
|
# --source wait_show_pattern.inc
|
|
#
|
|
# EXAMPLES
|
|
#
|
|
# alter_table-big.test, wait_slave_status.inc
|
|
#
|
|
# SEE ALSO
|
|
#
|
|
# wait_slave_status.inc, wait_condition.inc (>=5.1)
|
|
#
|
|
###############################################################################
|
|
|
|
--disable_query_log
|
|
|
|
# We accept to wait maximum 30 seconds (0.2 sec/loop).
|
|
let $wait_counter= 150;
|
|
while ($wait_counter)
|
|
{
|
|
let $result= `SHOW $show_type`;
|
|
let $success= `SELECT '$result' LIKE $show_pattern`;
|
|
if ($success)
|
|
{
|
|
let $wait_counter= 0;
|
|
}
|
|
if (!$success)
|
|
{
|
|
real_sleep 0.2;
|
|
dec $wait_counter;
|
|
}
|
|
}
|
|
if (!$success)
|
|
{
|
|
echo Timeout in wait_show_pattern.inc \$show_type= $show_type \$show_pattern= $show_pattern (\$result= '$result');
|
|
}
|
|
|
|
--enable_query_log
|