1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Merge mysql.com:/home/mydev/mysql-4.1-4100

into  mysql.com:/home/mydev/mysql-5.0-5000


mysql-test/r/flush.result:
  Auto merged
mysql-test/t/flush.test:
  Auto merged
sql/sql_parse.cc:
  Auto merged
This commit is contained in:
unknown
2005-08-08 00:10:07 +02:00
3 changed files with 69 additions and 0 deletions

View File

@ -6449,6 +6449,23 @@ bool reload_acl_and_cache(THD *thd, ulong options, TABLE_LIST *tables,
{
if ((options & REFRESH_READ_LOCK) && thd)
{
/*
We must not try to aspire a global read lock if we have a write
locked table. This would lead to a deadlock when trying to
reopen (and re-lock) the table after the flush.
*/
if (thd->locked_tables)
{
THR_LOCK_DATA **lock_p= thd->locked_tables->locks;
THR_LOCK_DATA **end_p= lock_p + thd->locked_tables->lock_count;
for (; lock_p < end_p; lock_p++)
if ((*lock_p)->type == TL_WRITE)
{
my_error(ER_LOCK_OR_ACTIVE_TRANSACTION, MYF(0));
return 1;
}
}
/*
Writing to the binlog could cause deadlocks, as we don't log
UNLOCK TABLES