List:Internals« Previous MessageNext Message »
From:konstantin Date:May 30 2005 6:56pm
Subject:bk commit into 5.0 tree (konstantin:1.1935)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 repository of kostja. When kostja 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.1935 05/05/30 20:56:11 konstantin@stripped +10 -0
  Merge bk-internal.mysql.com:/home/bk/mysql-5.0
  into mysql.com:/opt/local/work/mysql-5.0-7306-new

  sql/sql_select.cc
    1.329 05/05/30 20:56:08 konstantin@stripped +0 -0
    Auto merged

  sql/sql_parse.cc
    1.438 05/05/30 20:56:08 konstantin@stripped +0 -0
    Auto merged

  sql/sql_olap.cc
    1.17 05/05/30 20:56:07 konstantin@stripped +0 -0
    Auto merged

  sql/sql_lex.h
    1.180 05/05/30 20:56:07 konstantin@stripped +0 -0
    Auto merged

  sql/sql_lex.cc
    1.146 05/05/30 20:56:07 konstantin@stripped +0 -0
    Auto merged

  sql/sql_insert.cc
    1.154 05/05/30 20:56:07 konstantin@stripped +0 -0
    Auto merged

  sql/sql_base.cc
    1.247 05/05/30 20:56:07 konstantin@stripped +0 -0
    Auto merged

  sql/opt_range.cc
    1.164 05/05/30 20:56:07 konstantin@stripped +0 -0
    Auto merged

  sql/mysql_priv.h
    1.302 05/05/30 20:56:06 konstantin@stripped +0 -0
    Auto merged

  sql/item_subselect.cc
    1.101 05/05/30 20:56:06 konstantin@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:	konstantin
# Host:	dragonfly.local
# Root:	/opt/local/work/mysql-5.0-7306-new/RESYNC

--- 1.301/sql/mysql_priv.h	2005-05-27 19:22:15 +04:00
+++ 1.302/sql/mysql_priv.h	2005-05-30 20:56:06 +04:00
@@ -884,8 +884,7 @@
 		   List_iterator<Item> *it, bool any_privileges,
                    bool allocate_view_names);
 bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds,
-		  TABLE_LIST **leaves, bool refresh_only,
-                  bool select_insert);
+		  TABLE_LIST **leaves, bool select_insert);
 int setup_wild(THD *thd, TABLE_LIST *tables, List<Item> &fields,
 	       List<Item> *sum_func_list, uint wild_num);
 bool setup_fields(THD *thd, Item** ref_pointer_array, TABLE_LIST *tables,

--- 1.163/sql/opt_range.cc	2005-05-26 22:00:20 +04:00
+++ 1.164/sql/opt_range.cc	2005-05-30 20:56:07 +04:00
@@ -7980,8 +7980,17 @@
       }
     }
   }
-  else if (have_min && min_max_arg_part && min_max_arg_part->field->is_null())
+  else if (have_min && min_max_arg_part &&
+           min_max_arg_part->field->real_maybe_null())
   {
+    /*
+      If a MIN/MAX argument value is NULL, we can quickly determine
+      that we're in the beginning of the next group, because NULLs
+      are always < any other value. This allows us to quickly
+      determine the end of the current group and jump to the next
+      group (see next_min()) and thus effectively increases the
+      usable key length.
+    */
     max_used_key_length+= min_max_arg_len;
     ++used_key_parts;
   }

--- 1.246/sql/sql_base.cc	2005-05-25 19:38:28 +04:00
+++ 1.247/sql/sql_base.cc	2005-05-30 20:56:07 +04:00
@@ -3208,7 +3208,7 @@
 */
 
 bool setup_tables(THD *thd, TABLE_LIST *tables, Item **conds,
-                  TABLE_LIST **leaves, bool refresh, bool select_insert)
+                  TABLE_LIST **leaves, bool select_insert)
 {
   uint tablenr= 0;
   DBUG_ENTER("setup_tables");
@@ -3261,17 +3261,14 @@
     my_error(ER_TOO_MANY_TABLES,MYF(0),MAX_TABLES);
     DBUG_RETURN(1);
   }
-  if (!refresh)
+  for (TABLE_LIST *table_list= tables;
+       table_list;
+       table_list= table_list->next_local)
   {
-    for (TABLE_LIST *table_list= tables;
-	 table_list;
-	 table_list= table_list->next_local)
-    {
-      if (table_list->ancestor &&
-	table_list->setup_ancestor(thd, conds,
-				   table_list->effective_with_check))
-        DBUG_RETURN(1);
-    }
+    if (table_list->ancestor &&
+        table_list->setup_ancestor(thd, conds,
+                                   table_list->effective_with_check))
+      DBUG_RETURN(1);
   }
   DBUG_RETURN(0);
 }

--- 1.153/sql/sql_insert.cc	2005-05-25 19:38:28 +04:00
+++ 1.154/sql/sql_insert.cc	2005-05-30 20:56:07 +04:00
@@ -699,7 +699,7 @@
   DBUG_ENTER("mysql_prepare_insert_check_table");
 
   if (setup_tables(thd, table_list, where, &thd->lex->select_lex.leaf_tables,
-		   FALSE, select_insert))
+		   select_insert))
     DBUG_RETURN(TRUE);
 
   if (insert_into_view && !fields.elements)

--- 1.145/sql/sql_lex.cc	2005-05-26 21:54:26 +04:00
+++ 1.146/sql/sql_lex.cc	2005-05-30 20:56:07 +04:00
@@ -1369,8 +1369,6 @@
              "LIMIT & IN/ALL/ANY/SOME subquery");
     return(1);
   }
-  // We need only 1 row to determinate existence
-  select_limit= 1;
   // no sense in ORDER BY without LIMIT
   order_list.empty();
   return(0);
@@ -1553,7 +1551,7 @@
        item->substype() == Item_subselect::IN_SUBS ||
        item->substype() == Item_subselect::ALL_SUBS))
   {
-    DBUG_ASSERT(select_limit == 1L && offset_limit == 0L);
+    DBUG_ASSERT(!item->fixed || select_limit == 1L && offset_limit == 0L);
     return;
   }
 
@@ -1756,11 +1754,9 @@
   SYNOPSIS
     st_select_lex_unit::set_limit()
     values	- SELECT_LEX with initial values for counters
-    sl		- SELECT_LEX for options set
 */
 
-void st_select_lex_unit::set_limit(SELECT_LEX *values,
-				   SELECT_LEX *sl)
+void st_select_lex_unit::set_limit(SELECT_LEX *values)
 {
   offset_limit_cnt= values->offset_limit;
   select_limit_cnt= values->select_limit+values->offset_limit;

--- 1.179/sql/sql_lex.h	2005-05-25 20:54:59 +04:00
+++ 1.180/sql/sql_lex.h	2005-05-30 20:56:07 +04:00
@@ -445,10 +445,10 @@
 
   void print(String *str);
 
-  ulong init_prepare_fake_select_lex(THD *thd);
+  void init_prepare_fake_select_lex(THD *thd);
   inline bool is_prepared() { return prepared; }
   bool change_result(select_subselect *result, select_subselect *old_result);
-  void set_limit(st_select_lex *values, st_select_lex *sl);
+  void set_limit(st_select_lex *values);
 
   friend void lex_start(THD *thd, uchar *buf, uint length);
   friend int subselect_union_engine::exec();

--- 1.437/sql/sql_parse.cc	2005-05-27 20:30:33 +04:00
+++ 1.438/sql/sql_parse.cc	2005-05-30 20:56:08 +04:00
@@ -2778,7 +2778,7 @@
       select_result *result;
 
       select_lex->options|= SELECT_NO_UNLOCK;
-      unit->set_limit(select_lex, select_lex);
+      unit->set_limit(select_lex);
 
       if (!(res= open_and_lock_tables(thd, select_tables)))
       {
@@ -3176,7 +3176,7 @@
     select_lex->options|= SELECT_NO_UNLOCK;
 
     select_result *result;
-    unit->set_limit(select_lex, select_lex);
+    unit->set_limit(select_lex);
 
     if (!(res= open_and_lock_tables(thd, all_tables)))
     {

--- 1.328/sql/sql_select.cc	2005-05-30 03:34:17 +04:00
+++ 1.329/sql/sql_select.cc	2005-05-30 20:56:08 +04:00
@@ -233,7 +233,7 @@
   else
   {
     SELECT_LEX_UNIT *unit= &lex->unit;
-    unit->set_limit(unit->global_parameters, select_lex);
+    unit->set_limit(unit->global_parameters);
     /*
       'options' of mysql_select will be set in JOIN, as far as JOIN for
       every PS/SP execution new, we will not need reset this flag if 
@@ -342,7 +342,7 @@
 
   if ((!(select_options & OPTION_SETUP_TABLES_DONE) &&
        setup_tables(thd, tables_list, &conds, &select_lex->leaf_tables,
-                    FALSE, FALSE)) ||
+                    FALSE)) ||
       setup_wild(thd, tables_list, fields_list, &all_fields, wild_num) ||
       select_lex->setup_ref_array(thd, og_num) ||
       setup_fields(thd, (*rref_pointer_array), tables_list, fields_list, 1,
@@ -465,13 +465,6 @@
   count_field_types(&tmp_table_param, all_fields, 0);
   ref_pointer_array_size= all_fields.elements*sizeof(Item*);
   this->group= group_list != 0;
-  row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
-	      unit_arg->select_limit_cnt);
-  /* select_limit is used to decide if we are likely to scan the whole table */
-  select_limit= unit_arg->select_limit_cnt;
-  if (having || (select_options & OPTION_FOUND_ROWS))
-    select_limit= HA_POS_ERROR;
-  do_send_rows = (unit_arg->select_limit_cnt) ? 1 : 0;
   unit= unit_arg;
 
 #ifdef RESTRICTED_GROUP
@@ -550,6 +543,13 @@
     DBUG_RETURN(0);
   optimized= 1;
 
+  row_limit= ((select_distinct || order || group_list) ? HA_POS_ERROR :
+	      unit->select_limit_cnt);
+  /* select_limit is used to decide if we are likely to scan the whole table */
+  select_limit= unit->select_limit_cnt;
+  if (having || (select_options & OPTION_FOUND_ROWS))
+    select_limit= HA_POS_ERROR;
+  do_send_rows = (unit->select_limit_cnt) ? 1 : 0;
   // Ignore errors of execution if option IGNORE present
   if (thd->lex->ignore)
     thd->lex->current_select->no_error= 1;
@@ -1110,18 +1110,7 @@
 JOIN::reinit()
 {
   DBUG_ENTER("JOIN::reinit");
-  /* TODO move to unit reinit */
-  unit->set_limit(select_lex, select_lex);
 
-  /* conds should not be used here, it is added just for safety */
-  if (tables_list)
-  {
-    if (setup_tables(thd, tables_list, &conds, &select_lex->leaf_tables,
-                     TRUE, FALSE))
-      DBUG_RETURN(1);
-  }
-
-  /* Reset of sum functions */
   first_record= 0;
 
   if (exec_tmp_table1)
@@ -1147,6 +1136,7 @@
   if (tmp_join)
     restore_tmp();
 
+  /* Reset of sum functions */
   if (sum_funcs)
   {
     Item_sum *func, **func_ptr= sum_funcs;
@@ -13486,7 +13476,7 @@
   else
   {
     thd->lex->current_select= first;
-    unit->set_limit(unit->global_parameters, first);
+    unit->set_limit(unit->global_parameters);
     res= mysql_select(thd, &first->ref_pointer_array,
 			(TABLE_LIST*) first->table_list.first,
 			first->with_wild, first->item_list,

--- 1.16/sql/sql_olap.cc	2005-05-26 21:54:26 +04:00
+++ 1.17/sql/sql_olap.cc	2005-05-30 20:56:07 +04:00
@@ -153,8 +153,7 @@
 
 
   if (setup_tables(lex->thd, (TABLE_LIST *)select_lex->table_list.first
-                   &select_lex->where, &select_lex->leaf_tables,
-                   FALSE, FALSE) ||
+                   &select_lex->where, &select_lex->leaf_tables, FALSE) ||
       setup_fields(lex->thd, 0, (TABLE_LIST *)select_lex->table_list.first,
 		   select_lex->item_list, 1, &all_fields,1) ||
       setup_fields(lex->thd, 0, (TABLE_LIST *)select_lex->table_list.first,

--- 1.100/sql/item_subselect.cc	2005-05-26 21:54:25 +04:00
+++ 1.101/sql/item_subselect.cc	2005-05-30 20:56:06 +04:00
@@ -537,8 +537,6 @@
   null_value= 0; //can't be NULL
   maybe_null= 0; //can't be NULL
   value= 0;
-  // We need only 1 row to determinate existence
-  select_lex->master_unit()->global_parameters->select_limit= 1;
   DBUG_VOID_RETURN;
 }
 
@@ -605,6 +603,8 @@
    decimals= 0;
    max_length= 1;
    max_columns= engine->cols();
+   /* We need only 1 row to determinate existence */
+  unit->global_parameters->select_limit= 1;
 }
 
 double Item_exists_subselect::val_real()
@@ -854,9 +854,6 @@
     else
     {
       Item_maxmin_subselect *item;
-      // remove LIMIT placed  by ALL/ANY subquery
-      select_lex->master_unit()->global_parameters->select_limit=
-	HA_POS_ERROR;
       subs= item= new Item_maxmin_subselect(thd, this, select_lex, func->l_op());
       if (upper_item)
         upper_item->set_sub_test(item);
@@ -1286,13 +1283,10 @@
 			       select_subselect *result,
 			       Item_subselect *item)
   :subselect_engine(item, result),
-   prepared(0), optimized(0), executed(0), join(0)
+   prepared(0), optimized(0), executed(0),
+   select_lex(select), join(0)
 {
-  select_lex= select;
-  SELECT_LEX_UNIT *unit= select_lex->master_unit();
-  unit->set_limit(unit->global_parameters, select_lex);
-  unit->item= item;
-  this->select_lex= select_lex;
+  select_lex->master_unit()->item= item;
 }
 
 
@@ -1440,7 +1434,10 @@
   thd->lex->current_select= select_lex;
   if (!optimized)
   {
-    optimized=1;
+    SELECT_LEX_UNIT *unit= select_lex->master_unit();
+
+    optimized= 1;
+    unit->set_limit(unit->global_parameters);
     if (join->optimize())
     {
       thd->where= save_where;
Thread
bk commit into 5.0 tree (konstantin:1.1935)konstantin31 May