mirror of
https://github.com/MariaDB/server.git
synced 2025-07-27 18:02:13 +03:00
Review fixes of new pushed code
- Fixed tests - Optimized new code - Fixed some unlikely core dumps - Better bug fixes for: - #14397 - OPTIMIZE TABLE with an open HANDLER causes a crash - #14850 (ERROR 1062 when a quering a view using a Group By on a column that can be null
This commit is contained in:
@ -227,6 +227,7 @@ bool mysql_ha_open(THD *thd, TABLE_LIST *tables, bool reopen)
|
||||
/* add to hash */
|
||||
if (my_hash_insert(&thd->handler_tables_hash, (byte*) hash_tables))
|
||||
{
|
||||
my_free((char*) hash_tables, MYF(0));
|
||||
mysql_ha_close(thd, tables);
|
||||
goto err;
|
||||
}
|
||||
@ -369,28 +370,6 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
||||
DBUG_PRINT("info-in-hash",("'%s'.'%s' as '%s' tab %p",
|
||||
hash_tables->db, hash_tables->table_name,
|
||||
hash_tables->alias, table));
|
||||
/* Table might have been flushed. */
|
||||
if (table && (table->s->version != refresh_version))
|
||||
{
|
||||
/*
|
||||
We must follow the thd->handler_tables chain, as we need the
|
||||
address of the 'next' pointer referencing this table
|
||||
for close_thread_table().
|
||||
*/
|
||||
for (table_ptr= &(thd->handler_tables);
|
||||
*table_ptr && (*table_ptr != table);
|
||||
table_ptr= &(*table_ptr)->next)
|
||||
{}
|
||||
(*table_ptr)->file->ha_index_or_rnd_end();
|
||||
VOID(pthread_mutex_lock(&LOCK_open));
|
||||
if (close_thread_table(thd, table_ptr))
|
||||
{
|
||||
/* Tell threads waiting for refresh that something has happened */
|
||||
VOID(pthread_cond_broadcast(&COND_refresh));
|
||||
}
|
||||
VOID(pthread_mutex_unlock(&LOCK_open));
|
||||
table= hash_tables->table= NULL;
|
||||
}
|
||||
if (!table)
|
||||
{
|
||||
/*
|
||||
@ -448,12 +427,6 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
||||
}
|
||||
}
|
||||
|
||||
if (insert_fields(thd, &thd->lex->select_lex.context,
|
||||
tables->db, tables->alias, &it, 0))
|
||||
goto err0;
|
||||
|
||||
protocol->send_fields(&list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
|
||||
|
||||
HANDLER_TABLES_HACK(thd);
|
||||
lock= mysql_lock_tables(thd, &tables->table, 1, 0, ¬_used);
|
||||
HANDLER_TABLES_HACK(thd);
|
||||
@ -461,6 +434,12 @@ bool mysql_ha_read(THD *thd, TABLE_LIST *tables,
|
||||
if (!lock)
|
||||
goto err0; // mysql_lock_tables() printed error message already
|
||||
|
||||
if (insert_fields(thd, &thd->lex->select_lex.context,
|
||||
tables->db, tables->alias, &it, 0))
|
||||
goto err0;
|
||||
|
||||
protocol->send_fields(&list, Protocol::SEND_NUM_ROWS | Protocol::SEND_EOF);
|
||||
|
||||
/*
|
||||
In ::external_lock InnoDB resets the fields which tell it that
|
||||
the handle is used in the HANDLER interface. Tell it again that
|
||||
|
Reference in New Issue
Block a user