List:Commits« Previous MessageNext Message »
From:Ramil Kalimullin Date:April 28 2009 6:06am
Subject:Re: bzr commit into mysql-5.0-bugteam branch (anurag.shekhar:2725)
Bug#39918
View as plain text  
Hi!

Please see my comments inline.

on 15.04.2009 16:00 Anurag Shekhar wrote:
> #At file:///home/anurag/mysqlsrc/mysql-5.0-bugteam-39918/ based on
> revid:sergey.glukhov@stripped
> 
>  2725 Anurag Shekhar	2009-04-15
>       Bug #39918 memory (heap) engine crashing with b-tree index and DELETE with seg
> fault
>       
>       While evaluating self join with delete server uses two instance of handler 
>       (with both holding reference to same file). During query evaluation last_pos 
>       is cached in handler to improve search performance. But in the mean while 
>       second handler is used to delete the node last_pos is holding. This makes 
>       the last_pos an invalid and when accessed results in segmentation fault.

Please explain the real problem in more general way (as Svoj suggested).

> === modified file 'mysql-test/t/heap_btree.test'
> --- a/mysql-test/t/heap_btree.test	2007-10-19 20:04:30 +0000
> +++ b/mysql-test/t/heap_btree.test	2009-04-15 11:00:45 +0000
> @@ -253,5 +253,13 @@ insert into t1 values (1, 1), (3, 3), (2
>  select * from t1 where a is null;
>  drop table t1;
>  
> +#
> +# bug#39918 - memory (heap) engine crashing while executing self join with delete
> +#

would be nice to
--echo #
--echo # Bug#39918 - memory (heap) engine crashing while executing self join with delete
--echo #
to have the header in the result file as well.

> === modified file 'sql/sql_delete.cc'
> --- a/sql/sql_delete.cc	2009-03-27 05:19:50 +0000
> +++ b/sql/sql_delete.cc	2009-04-15 11:00:45 +0000
> @@ -503,6 +503,11 @@ int mysql_multi_delete_prepare(THD *thd)
>        }
>      }
>    }
> +  /*
> +    Reset the exclude flag to false so it doesn't interfare
> +    with further calls to unique_table
> +  */
> +  lex->select_lex.exclude_from_table_unique_test= FALSE;
>    DBUG_RETURN(FALSE);
>  }
>  
> @@ -538,11 +543,23 @@ multi_delete::initialize_tables(JOIN *jo
>      DBUG_RETURN(1);
>  
>    table_map tables_to_delete_from=0;
> +  delete_while_scanning= 1;
>    for (walk= delete_tables; walk; walk= walk->next_local)
> +  {
>      tables_to_delete_from|= walk->table->map;
> +    if (unique_table (thd, walk, join->tables_list, false))

a needless space after "unique_table".

the above "if" should be changed to
if (delete_while_scanning &&
     unique_table(...))

> +    {
> +      /*
> +       If the table we are going to delete from appears
> +       in join, we need to defer delete. So the delete
> +       doesn't interfers with the scaning of results.
> +      */

the comment should be aligned properly.

Thanks,
Ramil.

Thread
bzr commit into mysql-5.0-bugteam branch (anurag.shekhar:2725)Bug#39918Anurag Shekhar15 Apr
  • Re: bzr commit into mysql-5.0-bugteam branch (anurag.shekhar:2725)Bug#39918Ramil Kalimullin <ramil@sun.com>28 Apr