1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-29 05:21:33 +03:00

Bug #50907 Assertion `hash_tables->table->next == __null' on

HANDLER OPEN

The problem was a too restrictive assert in the code for 
HANDLER ... OPEN and HANDLER ... READ that checked table->next
to verify that we didn't open views or merge tables.

This pointer is also used to link temporary tables together
(see thd->temporary_tables). In this case TABLE::next can be
set even if we're trying to open a single table.

This patch adjust the two asserts to also check for the presence
of temporary tables.

Test case added to handler_myisam.test.
This commit is contained in:
Jon Olav Hauglid
2010-02-05 15:52:17 +01:00
parent a9e22b5896
commit 82f4494125
4 changed files with 56 additions and 3 deletions

View File

@ -322,8 +322,14 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
thd->mdl_context.set_needs_thr_lock_abort(TRUE);
}
/* Assert that the above check prevent opening of views and merge tables. */
DBUG_ASSERT(hash_tables->table->next == NULL);
/*
Assert that the above check prevents opening of views and merge tables.
For temporary tables, TABLE::next can be set even if only one table
was opened for HANDLER as it is used to link them together
(see thd->temporary_tables).
*/
DBUG_ASSERT(hash_tables->table->next == NULL ||
hash_tables->table->s->tmp_table);
/*
If it's a temp table, don't reset table->query_id as the table is
being used by this handler. Otherwise, no meaning at all.
@ -485,7 +491,8 @@ retry:
/* save open_tables state */
backup_open_tables= thd->open_tables;
/* Always a one-element list, see mysql_ha_open(). */
DBUG_ASSERT(hash_tables->table->next == NULL);
DBUG_ASSERT(hash_tables->table->next == NULL ||
hash_tables->table->s->tmp_table);
/*
mysql_lock_tables() needs thd->open_tables to be set correctly to
be able to handle aborts properly.