List:Commits« Previous MessageNext Message »
From:Sergei Golubchik Date:November 5 2007 3:34pm
Subject:Re: bk commit into 5.0 tree (evgen:1.2549) BUG#30384
View as plain text  
Hi!

On Nov 02, eugene@stripped wrote:
> ChangeSet@stripped, 2007-11-02 17:48:14+00:00, evgen@stripped +2 -0
>   Bug#30384: Having SQL_BUFFER_RESULT option in the CREATE .. KEY(..) .. SELECT
>   led to creating corrupted index.
>   
>   Corrected fix. The new method called prepare2 is added to the select_create
>   class. As all preparetions are done by the select_create::prepare function
>   it doesn't do anything.
>   The is_bulk_insert_mode flag is removed as it is not needed anymore.

looks like this doesn't fix the case of

 INSERT t1 SELECT sql_buffer_result * from t1

it'll still start bulk insert twice.

I think the problem is in select_insert::prepare()

   if (!(lex->current_select->options & OPTION_BUFFER_RESULT) &&
       unique_table(thd, table_list, table_list->next_global, 0))
   {
     ... lex->current_select->options|= OPTION_BUFFER_RESULT;
   }
   ...
   else
   {
     ... start_bulk_insert()
   }

see, it calls start_bulk_insert() if sql_buffer_result was specified by
the user, but if we enable it implicitly, start_bulk_insert() will be
called in ::prepare2().

I think there should be no difference in behaviour, no matter who and
how enabled sql_buffer_result. That is the code should be

   if (unique_table(thd, table_list, table_list->next_global, 0))
   {
     ... lex->current_select->options|= OPTION_BUFFER_RESULT;
   }
   ...
   else if (!(lex->current_select->options & OPTION_BUFFER_RESULT))
   {
     ... start_bulk_insert()
   }

Regards / Mit vielen Grüssen,
Sergei

-- 
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /   Sergei Golubchik <serg@stripped>
 / /|_/ / // /\ \/ /_/ / /__  Principal Software Developer
/_/  /_/\_, /___/\___\_\___/  MySQL GmbH, Dachauer Str. 37, D-80335 München
       <___/                  Geschäftsführer: Kaj Arnö - HRB
München 162140
Thread
bk commit into 5.0 tree (evgen:1.2549) BUG#30384eugene2 Nov
  • Re: bk commit into 5.0 tree (evgen:1.2549) BUG#30384Sergei Golubchik5 Nov