List:Internals« Previous MessageNext Message »
From:Michael Widenius Date:October 11 2005 10:38pm
Subject:bk commit into 5.0 tree (konstantin:1.2032) BUG#12736
View as plain text  
Hi!

>>>>> "k" == konstantin  <konstantin@stripped> writes:

k> Below is the list of changes that have just been committed into a local
k> 5.0 repository of kostja. When kostja does a push these changes will
k> be propagated to the main repository and, within 24 hours after the
k> push, to the public repository.
k> For information on how to access the public repository
k> see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

k> ChangeSet
k>   1.2032 05/10/11 20:43:13 konstantin@stripped +8 -0
k>   A fix and a test case for Bug#12736 "Server crash during a select".
k>   The bug was in JOIN::join_free which was wrongly determining that
k>   all joins have been already executed and therefore all used tables
k>   can be closed.

<cut>

k> +++ 1.377/sql/sql_select.cc	2005-10-11 20:43:06 +04:00

<cut>

k> +void JOIN::join_free()
k>  {
k>    SELECT_LEX_UNIT *unit;
k>    SELECT_LEX *sl;
k>    /*
k>      Optimization: if not EXPLAIN and we are done with the JOIN,
k>      free all tables.
k>    */
k> +  bool full= (!select_lex->uncacheable && !thd->lex->describe);
k> +  bool can_unlock= full;
k> +  DBUG_ENTER("JOIN::join_free");
 
k>    cleanup(full);
 
k>    for (unit= select_lex->first_inner_unit(); unit; unit= unit->next_unit())
k>      for (sl= unit->first_select(); sl; sl= sl->next_select())
k>      {
k> +      Item_subselect *subselect= sl->master_unit()->item;
k> +      bool full_local= full && (!subselect ||
> subselect->is_evaluated());
k> +      /*
k> +        If this join is evaluated, we can fully clean it up and clean up all
k> +        its underlying joins even if they are correlated -- they will not be
k> +        used any more anyway.
k> +        If this join is not yet evaluated, we still must clean it up to
k> +        close its table cursors -- it may never get evaluated, as in case of
k> +        ... HAVING FALSE OR a IN (SELECT ...))
k> +        but all table cursors must be closed before the unlock.
k> +      */
k> +      sl->cleanup_all_joins(full);
k> +      /* Can't unlock if at least one JOIN is still needed */
k> +      can_unlock= can_unlock && full_local;
k>      }
 
Why have the varible full_lock?

Instead simple replace setting of it to:

can_unlock= can_unlock && (!subselect || subselect->is_evaluated());

ok to push after the above change.

Regards,
Monty
Thread
bk commit into 5.0 tree (konstantin:1.2032) BUG#12736konstantin11 Oct
  • bk commit into 5.0 tree (konstantin:1.2032) BUG#12736Michael Widenius13 Oct