List:Commits« Previous MessageNext Message »
From:Sergey Vojtovich Date:June 3 2009 10:17am
Subject:Re: bzr commit into mysql-5.1 branch (mattias.jonsson:2773) Bug#35111
View as plain text  
Hi Mattias,

ok to push, but please see one question inline.

On Wed, Mar 25, 2009 at 02:56:22PM +0000, Mattias Jonsson wrote:
> #At file:///Users/mattiasj/clones/bzrroot/b35111-51-main_storage/ based on
> revid:alik@stripped
> 
>  2773 Mattias Jonsson	2009-03-25
>       Bug#35111: Truncate a MyISAM partitioned table does not reset
>       the auto_increment value
>       
>       This is an alternative patch that instead of allowing RECREATE TABLE
>       on TRUNCATE TABLE it implements reset_auto_increment that is called
>       after delete_all_rows.
...skip...

> === modified file 'sql/ha_partition.cc'
> --- a/sql/ha_partition.cc	2009-02-20 15:56:32 +0000
> +++ b/sql/ha_partition.cc	2009-03-25 14:56:16 +0000
> @@ -3179,6 +3179,7 @@ int ha_partition::delete_row(const uchar
>  int ha_partition::delete_all_rows()
>  {
>    int error;
> +  bool truncate= FALSE;
>    handler **file;
>    THD *thd= ha_thd();
>    DBUG_ENTER("ha_partition::delete_all_rows");
> @@ -3190,12 +3191,16 @@ int ha_partition::delete_all_rows()
>      ha_data->next_auto_inc_val= 0;
>      ha_data->auto_inc_initialized= FALSE;
>      unlock_auto_increment();
> +    truncate= TRUE;
>    }
>    file= m_file;
>    do
>    {
>      if ((error= (*file)->ha_delete_all_rows()))
>        DBUG_RETURN(error);
> +    /* Ignore the error */
> +    if (truncate)
> +      (void) (*file)->ha_reset_auto_increment(0);
>    } while (*(++file));
>    DBUG_RETURN(0);
>  }
I wonder if we really need this. Partitioning handler seem to do the
same in ha_partition::reset_auto_increment(). And server calls it after
::delete_all_rows().

Regards,
Sergey
-- 
Sergey Vojtovich <svoj@stripped>
MySQL AB, Software Engineer
Izhevsk, Russia, www.mysql.com
Thread
bzr commit into mysql-5.1 branch (mattias.jonsson:2773) Bug#35111Mattias Jonsson25 Mar
  • Re: bzr commit into mysql-5.1 branch (mattias.jonsson:2773) Bug#35111Sergey Vojtovich3 Jun
    • Re: bzr commit into mysql-5.1 branch (mattias.jonsson:2773) Bug#35111satya5 Jun