summaryrefslogtreecommitdiff
path: root/sql/sp_head.cc
diff options
context:
space:
mode:
authorDyre Tjeldvoll <Dyre.Tjeldvoll@oracle.com>2015-04-30 12:56:33 +0200
committerSergey Vojtovich <svoj@mariadb.org>2018-10-17 19:59:44 +0400
commit2be83a28a2cdecad28d28f04a0dfeff2eb5ff957 (patch)
treee199d4405666b5d90d6ea505b1821f81dbb6c045 /sql/sp_head.cc
parente31e697f17f79ffa6913499e7e2d29866f24b475 (diff)
downloadmariadb-git-bb-5.5-svoj.tar.gz
BUG#19988193: ASSERTION `(*TABLES)->REGINFO.LOCK_TYPE >= TL_READ'bb-5.5-svoj
FAILED IN LOCK_EXTERNAL BUG#21198646: ASSERTION FAILED: (*TABLES)->REGINFO.LOCK_TYPE >= TL_READ FILE LOCK.CC, LINE 356 This patch addresses two related issues: Calling a procedure which creates a view from a trigger (BUG#19988193), and creating a function calling a procedure doing RENAME TABLE (BUG#21198646), could both, in certain circumstances, trigger an assert. Root cause was that prelocking of tables with lock_type==TL_IGNORE is not supported, and so triggers an assert. TL_IGNORE is only used for source tables in CREATE VIEW statements and the table of a RENAME TABLE statement. It is very unusual for these statements to be part of prelocking analysis, as both are implicit commit statements which are not permitted in triggers and stored functions/procedures. But as the test cases show; it is possible to have such statements contribute to the prelocking set, but in both cases the statement is "meaningless", in the sense that it will trigger an error during execution. Fix: In mysql_make_view(), avoid adding the backing tables to view_ref if view_ref->prelocking_placeholder==true and lock_type==TL_IGNORE. In sp_head::add_used_tables_to_table_list() skip SP_TABLES which have lock_type=TL_IGNORE. Test: New test cases added to tablelock.test
Diffstat (limited to 'sql/sp_head.cc')
-rw-r--r--sql/sp_head.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/sp_head.cc b/sql/sp_head.cc
index 14a57914560..eec59d8a3dd 100644
--- a/sql/sp_head.cc
+++ b/sql/sp_head.cc
@@ -4230,7 +4230,7 @@ sp_head::add_used_tables_to_table_list(THD *thd,
char *tab_buff, *key_buff;
TABLE_LIST *table;
SP_TABLE *stab= (SP_TABLE*) my_hash_element(&m_sptabs, i);
- if (stab->temp)
+ if (stab->temp || stab->lock_type == TL_IGNORE)
continue;
if (!(tab_buff= (char *)thd->calloc(ALIGN_SIZE(sizeof(TABLE_LIST)) *