List:Commits« Previous MessageNext Message »
From:sanja Date:April 26 2006 9:21am
Subject:bk commit into 5.1 tree (bell:1.2363)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of bell. When bell 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.2363 06/04/26 12:21:27 bell@stripped +7 -0
  Merge sanja.is.com.ua:/home/bell/mysql/bk/mysql-5.0
  into  sanja.is.com.ua:/home/bell/mysql/bk/work-err-5.1

  sql/share/errmsg.txt
    1.95 06/04/26 12:21:22 bell@stripped +1 -2
    merge

  configure.in
    1.342 06/04/26 12:21:22 bell@stripped +0 -2
    merge

  sql/sql_parse.cc
    1.541 06/04/26 12:19:02 bell@stripped +0 -0
    Auto merged

  sql/opt_range.cc
    1.214 06/04/26 12:19:02 bell@stripped +0 -0
    Auto merged

  sql/item.h
    1.197 06/04/26 12:19:02 bell@stripped +0 -0
    Auto merged

  sql/item.cc
    1.185 06/04/26 12:19:02 bell@stripped +0 -0
    Auto merged

  mysql-test/r/view.result
    1.158 06/04/26 12:19:01 bell@stripped +0 -0
    Auto merged

# 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:	bell
# Host:	sanja.is.com.ua
# Root:	/home/bell/mysql/bk/work-err-5.1/RESYNC

--- 1.184/sql/item.cc	2006-04-23 03:00:03 +03:00
+++ 1.185/sql/item.cc	2006-04-26 12:19:02 +03:00
@@ -1998,6 +1998,16 @@
 }
 
 
+void Item_decimal::set_decimal_value(my_decimal *value_par)
+{
+  my_decimal2decimal(value_par, &decimal_value);
+  decimals= (uint8) decimal_value.frac;
+  unsigned_flag= !decimal_value.sign();
+  max_length= my_decimal_precision_to_length(decimal_value.intg + decimals,
+                                             decimals, unsigned_flag);
+}
+
+
 String *Item_float::val_str(String *str)
 {
   // following assert is redundant, because fixed=1 assigned in constructor

--- 1.196/sql/item.h	2006-04-23 03:00:03 +03:00
+++ 1.197/sql/item.h	2006-04-26 12:19:02 +03:00
@@ -1486,6 +1486,7 @@
   }
   uint decimal_precision() const { return decimal_value.precision(); }
   bool eq(const Item *, bool binary_cmp) const;
+  void set_decimal_value(my_decimal *value_par);
 };
 
 

--- 1.213/sql/opt_range.cc	2006-04-21 03:00:22 +03:00
+++ 1.214/sql/opt_range.cc	2006-04-26 12:19:02 +03:00
@@ -4695,17 +4695,92 @@
 
     if (inv)
     {
-      tree= get_ne_mm_tree(param, cond_func, field,
-                           func->arguments()[1], func->arguments()[1],
-                           cmp_type);
-      if (tree)
+      /*
+        We get here for conditions like "t.keypart NOT IN (....)".
+        
+        If the IN-list contains only constants (and func->array is an ordered
+        array of them), we construct the appropriate SEL_ARG tree manually, 
+        because constructing it using the range analyzer (as 
+        AND_i( t.keypart != c_i)) will cause lots of memory to be consumed
+        (see BUG#15872). 
+      */
+      if (func->array && func->cmp_type != ROW_RESULT)
       {
-        Item **arg, **end;
-        for (arg= func->arguments()+2, end= arg+func->argument_count()-2;
-             arg < end ; arg++)
+        /* 
+          Create one Item_type constant object. We'll need it as
+          get_mm_parts only accepts constant values wrapped in Item_Type
+          objects.
+          We create the Item on param->mem_root which points to
+          per-statement mem_root (while thd->mem_root is currently pointing
+          to mem_root local to range optimizer).
+        */
+        MEM_ROOT *tmp_root= param->mem_root;
+        param->thd->mem_root= param->old_root;
+        Item *value_item= func->array->create_item();
+        param->thd->mem_root= tmp_root;
+
+        if (!value_item)
+          break;
+        
+        /* Get a SEL_TREE for "-inf < X < c_0" interval */
+        func->array->value_to_item(0, value_item);
+        tree= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
+                           value_item, cmp_type);
+        if (!tree)
+          break;
+#define NOT_IN_IGNORE_THRESHOLD 1000        
+        SEL_TREE *tree2;
+        if (func->array->count < NOT_IN_IGNORE_THRESHOLD)
         {
-          tree=  tree_and(param, tree, get_ne_mm_tree(param, cond_func, field, 
-                                                      *arg, *arg, cmp_type));
+          for (uint i=1; i < func->array->count; i++)
+          {
+            if (func->array->compare_elems(i, i-1))
+            {
+              /* Get a SEL_TREE for "-inf < X < c_i" interval */
+              func->array->value_to_item(i, value_item);
+              tree2= get_mm_parts(param, cond_func, field, Item_func::LT_FUNC,
+                                  value_item, cmp_type);
+              
+              /* Change all intervals to be "c_{i-1} < X < c_i" */
+              for (uint idx= 0; idx < param->keys; idx++)
+              {
+                SEL_ARG *new_interval;
+                if ((new_interval=  tree2->keys[idx]))
+                {
+                  SEL_ARG *last_val= tree->keys[idx]->last();
+                  new_interval->min_value= last_val->max_value;
+                  new_interval->min_flag= NEAR_MIN;
+                }
+              }
+              tree= tree_or(param, tree, tree2);
+            }
+          }
+        }
+        else
+          func->array->value_to_item(func->array->count - 1, value_item);
+
+        /* 
+          Get the SEL_TREE for the last "c_last < X < +inf" interval 
+          (value_item cotains c_last already)
+        */
+        tree2= get_mm_parts(param, cond_func, field, Item_func::GT_FUNC,
+                            value_item, cmp_type);
+        tree= tree_or(param, tree, tree2);
+      }
+      else
+      {
+        tree= get_ne_mm_tree(param, cond_func, field,
+                             func->arguments()[1], func->arguments()[1],
+                             cmp_type);
+        if (tree)
+        {
+          Item **arg, **end;
+          for (arg= func->arguments()+2, end= arg+func->argument_count()-2;
+               arg < end ; arg++)
+          {
+            tree=  tree_and(param, tree, get_ne_mm_tree(param, cond_func, field, 
+                                                        *arg, *arg, cmp_type));
+          }
         }
       }
     }

--- 1.540/sql/sql_parse.cc	2006-04-25 11:57:27 +03:00
+++ 1.541/sql/sql_parse.cc	2006-04-26 12:19:02 +03:00
@@ -1022,13 +1022,20 @@
     *passwd++ : strlen(passwd);
   db= thd->client_capabilities & CLIENT_CONNECT_WITH_DB ?
     db + passwd_len + 1 : 0;
+  uint db_len= db ? strlen(db) : 0;
+
+  if (passwd + passwd_len + db_len > (char *)net->read_pos + pkt_len)
+  {
+    inc_host_errors(&thd->remote.sin_addr);
+    return ER_HANDSHAKE_ERROR;
+  }
 
   /* Since 4.1 all database names are stored in utf8 */
   if (db)
   {
     db_buff[copy_and_convert(db_buff, sizeof(db_buff)-1,
                              system_charset_info,
-                             db, strlen(db),
+                             db, db_len,
                              thd->charset(), &dummy_errors)]= 0;
     db= db_buff;
   }
@@ -1606,7 +1613,17 @@
   {
     char *db, *tbl_name;
     uint db_len= *(uchar*) packet;
+    if (db_len >= packet_length || db_len > NAME_LEN)
+    {
+      my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+      break;
+    }
     uint tbl_len= *(uchar*) (packet + db_len + 1);
+    if (db_len+tbl_len+2 > packet_length || tbl_len > NAME_LEN)
+    {
+      my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+      break;
+    }
 
     statistic_increment(thd->status_var.com_other, &LOCK_status);
     thd->enable_slow_log= opt_log_slow_admin_statements;

--- 1.94/sql/share/errmsg.txt	2006-04-24 13:32:03 +03:00
+++ 1.95/sql/share/errmsg.txt	2006-04-26 12:21:22 +03:00
@@ -5837,4 +5837,4 @@
 ER_MAX_PREPARED_STMT_COUNT_REACHED 42000
         eng "Can't create more than max_prepared_stmt_count statements (current value: %lu)"
 ER_VIEW_RECURSIVE
-        eng "`%-.64s`.`%-.64s` contain view recursion"
+        eng "`%-.64s`.`%-.64s` contains view recursion"

--- 1.157/mysql-test/r/view.result	2006-04-25 17:09:26 +03:00
+++ 1.158/mysql-test/r/view.result	2006-04-26 12:19:01 +03:00
@@ -2606,7 +2606,7 @@
 drop table t1;
 rename table v2 to t1;
 select * from v1;
-ERROR HY000: `test`.`v1` contain view recursion
+ERROR HY000: `test`.`v1` contains view recursion
 drop view t1, v1;
 create table t1 (a int);
 create function f1() returns int
Thread
bk commit into 5.1 tree (bell:1.2363)sanja26 Apr