Bug#20691429 ASSERTION `CHILD_L' FAILED IN STORAGE/MYISAMMRG/

HA_MYISAMMRG.CC:631

Analysis
========
Any attempt to open a temporary MyISAM merge table consisting
of a view in its list of tables (not the last table in the list)
under LOCK TABLES causes the server to exit.

Current implementation doesn't perform sanity checks during
merge table creation. This allows merge table to be created
with incompatible tables (table with non-myisam engine),
views or even with table doesn't exist in the system.

During view open, check to verify whether requested view
is part of a merge table is missing under LOCK TABLES path
in open_table(). This leads to opening of underlying table
with parent_l having NULL value. Later when attaching child
tables to parent, this hits an ASSERT as all child tables
should have parent_l pointing to merge parent. If the operation
does not happen under LOCK TABLES mode, open_table() checks
for view's parent_l and returns error.

Fix:
======
Check added before opening view Under LOCK TABLES in open_table()
to verify whether it is part of merge table. Error is returned
if the view is part of a merge table.
This commit is contained in:
Ajo Robert 2015-11-13 18:04:31 +05:30
parent 15de3c6275
commit 6d1e2fbca8

View File

@ -2828,6 +2828,16 @@ bool open_table(THD *thd, TABLE_LIST *table_list, MEM_ROOT *mem_root,
*/ */
if (dd_frm_type(thd, path, &not_used) == FRMTYPE_VIEW) if (dd_frm_type(thd, path, &not_used) == FRMTYPE_VIEW)
{ {
/*
If parent_l of the table_list is non null then a merge table
has this view as child table, which is not supported.
*/
if (table_list->parent_l)
{
my_error(ER_WRONG_MRG_TABLE, MYF(0));
DBUG_RETURN(true);
}
if (!tdc_open_view(thd, table_list, alias, key, key_length, if (!tdc_open_view(thd, table_list, alias, key, key_length,
mem_root, 0)) mem_root, 0))
{ {