List:Commits« Previous MessageNext Message »
From:ramil Date:March 21 2006 1:22pm
Subject:bk commit into 5.0 tree (ramil:1.2097) BUG#18306
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of ram. When ram does a push these changes will
be propagated to the main repository and, within 24 hours after the
push, to the public repository.
For information on how to access the public repository
see http://dev.mysql.com/doc/mysql/en/installing-source-tree.html

ChangeSet
  1.2097 06/03/21 16:22:34 ramil@stripped +1 -0
  Fix for bug #18306: MySQL crashes and restarts using subquery.
  

  sql/opt_range.cc
    1.206 06/03/21 16:22:25 ramil@stripped +11 -3
    Fix for bug #18306: MySQL crashes and restarts using subquery.
    - we have to restore the thread's mem_root here as we can come across 
      subselect items.

# This is a BitKeeper patch.  What follows are the unified diffs for the
# set of deltas contained in the patch.  The rest of the patch, the part
# that BitKeeper cares about, is below these diffs.
# User:	ramil
# Host:	myoffice.izhnet.ru
# Root:	/usr/home/ram/work/mysql-5.0

--- 1.205/sql/opt_range.cc	2006-02-25 19:46:26 +04:00
+++ 1.206/sql/opt_range.cc	2006-03-21 16:22:25 +04:00
@@ -3604,9 +3604,17 @@ static SEL_TREE *get_mm_tree(PARAM *para
   /* Here when simple cond */
   if (cond->const_item())
   {
-    if (cond->val_int())
-      DBUG_RETURN(new SEL_TREE(SEL_TREE::ALWAYS));
-    DBUG_RETURN(new SEL_TREE(SEL_TREE::IMPOSSIBLE));
+    /*
+      As we can come across a subselect item here (which assumes 
+      all the memory allocated has the same life span as the subselect 
+      item itself) we have to restore the thread's mem_root.
+    */
+    MEM_ROOT *tmp_root= param->mem_root;
+    param->thd->mem_root= param->old_root;
+    tree= cond->val_int() ? new(tmp_root) SEL_TREE(SEL_TREE::ALWAYS) :
+                            new(tmp_root) SEL_TREE(SEL_TREE::IMPOSSIBLE);
+    param->thd->mem_root= tmp_root;
+    DBUG_RETURN(tree);
   }
 
   table_map ref_tables= 0;
Thread
bk commit into 5.0 tree (ramil:1.2097) BUG#18306ramil21 Mar