List:Commits« Previous MessageNext Message »
From:Dmitri Lenev Date:November 20 2007 5:09pm
Subject:Re: bk commit into 5.1 tree (davi:1.2615) BUG#31397
View as plain text  
Hello Davi!

Here are my comments about the latest version of your fix for Bug#31397:

* Davi Arnaut <davi@stripped> [07/11/20 17:20]:
> ChangeSet@stripped, 2007-11-20 12:09:04-02:00, davi@stripped +9 -0
>   Bug#31397 Inconsistent drop table behavior of handler tables.
>   
>   The problem is that DROP TABLE and other DDL statements failed to
>   automatically close handlers associated with tables that were marked
>   for reopen (FLUSH TABLES).

...

> -int mysql_ha_flush(THD *thd, TABLE_LIST *tables, uint mode_flags,
> -                   bool is_locked)
> +static TABLE_LIST *mysql_ha_find(THD *thd, TABLE_LIST *tables)
>  {
> -  TABLE_LIST    *tmp_tables;
> -  TABLE         **table_ptr;
> -  bool          did_lock= FALSE;
> -  DBUG_ENTER("mysql_ha_flush");
> -  DBUG_PRINT("enter", ("tables: 0x%lx  mode_flags: 0x%02x",
> -                       (long) tables, mode_flags));
> +  TABLE_LIST *hash_tables, *head= NULL, *first= tables;
> +  DBUG_ENTER("mysql_ha_scan");
                 ^^^^^^^^^^^^^
I think above should be "mysql_ha_find".

...

> -static int mysql_ha_flush_table(THD *thd, TABLE **table_ptr, uint mode_flags)
> +void mysql_ha_flush(THD *thd)
>  {
> -  TABLE_LIST    *hash_tables;
> -  TABLE         *table= *table_ptr;
> -  DBUG_ENTER("mysql_ha_flush_table");
> -  DBUG_PRINT("enter",("'%s'.'%s' as '%s'  flags: 0x%02x",
> -                      table->s->db.str, table->s->table_name.str,
> -                      table->alias, mode_flags));
> +  TABLE_LIST *hash_tables;
> +  DBUG_ENTER("mysql_ha_flush");
>  
> -  if ((hash_tables= (TABLE_LIST*) hash_search(&thd->handler_tables_hash,
> -                                              (uchar*) table->alias,
> -                                              strlen(table->alias) + 1)))
> +  safe_mutex_assert_owner(&LOCK_open);
> +
> +  if (! thd->handler_tables_hash.records)
> +    DBUG_VOID_RETURN;
> +
> +  for (uint i= 0; i < thd->handler_tables_hash.records; i++)
>    {

I think above "if" statement is unnecessary as "for" loop that follows
it won't be executed if thd->handler_tables_hash.records == 0. Therefore
in my opinion it makes sense to remove this "if" statement...

...

I think it is OK to push this patch after considering/fixing above points.

-- 
Dmitri Lenev, Software Developer
MySQL AB, www.mysql.com

Are you MySQL certified?  http://www.mysql.com/certification
Thread
bk commit into 5.1 tree (davi:1.2615) BUG#31397Davi Arnaut20 Nov
  • Re: bk commit into 5.1 tree (davi:1.2615) BUG#31397Dmitri Lenev20 Nov