summaryrefslogtreecommitdiff
path: root/sql/sql_yacc.yy
diff options
context:
space:
mode:
authorJon Olav Hauglid <jon.hauglid@sun.com>2010-06-07 17:27:40 +0200
committerJon Olav Hauglid <jon.hauglid@sun.com>2010-06-07 17:27:40 +0200
commitb5a038a590c2b9339704dcd8e21defc0c5cb8092 (patch)
treeadbedb50b401496019020cb5fde47d5f40369d25 /sql/sql_yacc.yy
parent5196821127d48dcf767c1751570b2a8a468bc5f3 (diff)
downloadmariadb-git-b5a038a590c2b9339704dcd8e21defc0c5cb8092.tar.gz
Bug #54282 Crash in MDL_context::upgrade_shared_lock_to_exclusive
This crash happened if a table was listed twice in a DROP TABLE statement, and the statement was executed while in LOCK TABLES mode. Since the two elements of table list were identical, they were assigned the same TABLE object. During processing of the first table element, the TABLE instance was destroyed and the second table list element was left with a dangling reference. When this reference was later accessed, the server crashed. Listing the same table twice in DROP TABLES should give an ER_NONUNIQ_TABLE error. However, this did not happen as the check for unique table names was skipped due to the lock type for table list elements being set to TL_IGNORE. Previously TL_UNLOCK was used and the unique check was performed. This bug was a regression introduced by a pre-requisite patch for Bug#51263 "Deadlock between transactional SELECT and ALTER TABLE ... REBUILD PARTITION". The regression only existed in an internal team tree and never in any released code. This patch reverts DROP TABLE (and DROP VIEW) to the old behavior of using TL_UNLOCK locks. Test case added to drop.test.
Diffstat (limited to 'sql/sql_yacc.yy')
-rw-r--r--sql/sql_yacc.yy4
1 files changed, 2 insertions, 2 deletions
diff --git a/sql/sql_yacc.yy b/sql/sql_yacc.yy
index 34e20374042..84412469252 100644
--- a/sql/sql_yacc.yy
+++ b/sql/sql_yacc.yy
@@ -10151,7 +10151,7 @@ drop:
lex->sql_command = SQLCOM_DROP_TABLE;
lex->drop_temporary= $2;
lex->drop_if_exists= $4;
- YYPS->m_lock_type= TL_IGNORE;
+ YYPS->m_lock_type= TL_UNLOCK;
YYPS->m_mdl_type= MDL_EXCLUSIVE;
}
table_list opt_restrict
@@ -10244,7 +10244,7 @@ drop:
LEX *lex= Lex;
lex->sql_command= SQLCOM_DROP_VIEW;
lex->drop_if_exists= $3;
- YYPS->m_lock_type= TL_IGNORE;
+ YYPS->m_lock_type= TL_UNLOCK;
YYPS->m_mdl_type= MDL_EXCLUSIVE;
}
table_list opt_restrict