1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Backport of revno: 3702

Bug #48248 assert in MDL_ticket::upgrade_shared_lock_to_exclusive

The assert would happen if REPAIR TABLE was used on a table already
locked by LOCK TABLES READ. REPAIR mistakenly tried to upgrade the
read-lock to exclusive, thereby triggering the assert.

The cause of the problem was that REPAIR TABLE ignored errors 
from opening and locking tables. This is by design, as REPAIR
can be used to broken tables that cannot be opened. However,
repair also ignored logical errors such as the inability to
exclusivly lock a table due to conflicting LOCK TABLES.

This patch fixes the problem by not ignoring errors from
opening and locking tables if inside LOCK TABLES mode.
In LOCK TABLES we already know that the table can be opened,
so that the failure to open must be a logical error.

Test added to repair.test.
This commit is contained in:
Jon Olav Hauglid
2009-12-09 14:03:37 +01:00
parent 81813b1d72
commit cf1110cd4a
5 changed files with 44 additions and 6 deletions

View File

@@ -41,7 +41,7 @@ lock tables t1 write;
check table t2;
Table Op Msg_type Msg_text
test.t2 check Error Table 't2' was not locked with LOCK TABLES
test.t2 check error Corrupt
test.t2 check status Operation failed
insert into t1 select index1,nr from t1;
ERROR HY000: Table 't1' was not locked with LOCK TABLES
unlock tables;