List:Commits« Previous MessageNext Message »
From:holyfoot Date:January 4 2007 1:09pm
Subject:bk commit into 5.1 tree (holyfoot:1.2379)
View as plain text  
Below is the list of changes that have just been committed into a local
5.1 repository of hf. When hf 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@stripped, 2007-01-04 16:09:24+04:00, holyfoot@hfmain.(none) +13 -0
  Merge mysql.com:/d2/hf/opt/my50-opt
  into  mysql.com:/d2/hf/opt/my51-opt
  MERGE: 1.1810.2362.43

  mysql-test/r/gis-rtree.result@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0
-0
    Auto merged
    MERGE: 1.14.1.9

  mysql-test/r/ps.result@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.56.1.28

  mysql-test/r/subselect.result@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none)
+0 -0
    Auto merged
    MERGE: 1.134.1.33

  mysql-test/r/udf.result@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.3.1.7

  mysql-test/t/gis-rtree.test@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0
-0
    Auto merged
    MERGE: 1.18.1.2

  mysql-test/t/ps.test@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.56.1.25

  mysql-test/t/subselect.test@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0
-0
    Auto merged
    MERGE: 1.129.1.7

  mysql-test/t/udf.test@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.8.1.3

  sql/item_subselect.cc@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.113.1.32

  sql/item_subselect.h@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.77.1.8

  sql/sql_lex.cc@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.142.1.66

  sql/sql_udf.cc@stripped, 2007-01-04 16:09:18+04:00, holyfoot@hfmain.(none) +1 -1
    merging
    MERGE: 1.45.1.17

  storage/myisam/mi_check.c@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.129.24.2

  storage/myisam/mi_check.c@stripped, 2007-01-04 16:07:28+04:00, holyfoot@hfmain.(none)
+0 -0
    Merge rename: myisam/mi_check.c -> storage/myisam/mi_check.c

# 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:	holyfoot
# Host:	hfmain.(none)
# Root:	/d2/hf/opt/my51-opt/RESYNC

--- 1.129.24.1/myisam/mi_check.c	2007-01-04 16:09:29 +04:00
+++ 1.157/storage/myisam/mi_check.c	2007-01-04 16:09:29 +04:00
@@ -414,7 +414,7 @@ int chk_key(MI_CHECK *param, register MI
     puts("- check key delete-chain");
 
   param->key_file_blocks=info->s->base.keystart;
-  for (key=0 ; key < info->s->state.header.max_block_size ; key++)
+  for (key=0 ; key < info->s->state.header.max_block_size_index ; key++)
     if (check_k_link(param,info,key))
     {
       if (param->testflag & T_VERBOSE) puts("");
@@ -1493,7 +1493,7 @@ int mi_repair(MI_CHECK *param, register 
     share->state.key_root[i]= HA_OFFSET_ERROR;
 
   /* Drop the delete chain. */
-  for (i=0 ; i < share->state.header.max_block_size ; i++)
+  for (i=0 ; i < share->state.header.max_block_size_index ; i++)
     share->state.key_del[i]=  HA_OFFSET_ERROR;
 
   /*
@@ -1885,7 +1885,7 @@ int mi_sort_index(MI_CHECK *param, regis
   info->update= (short) (HA_STATE_CHANGED | HA_STATE_ROW_CHANGED);
   for (key=0 ; key < info->s->base.keys ; key++)
     info->s->state.key_root[key]=index_pos[key];
-  for (key=0 ; key < info->s->state.header.max_block_size ; key++)
+  for (key=0 ; key < info->s->state.header.max_block_size_index ; key++)
     info->s->state.key_del[key]=  HA_OFFSET_ERROR;
 
   info->s->state.changed&= ~STATE_NOT_SORTED_PAGES;
@@ -2188,7 +2188,7 @@ int mi_repair_by_sort(MI_CHECK *param, r
     /* Clear the pointers to the given rows */
     for (i=0 ; i < share->base.keys ; i++)
       share->state.key_root[i]= HA_OFFSET_ERROR;
-    for (i=0 ; i < share->state.header.max_block_size ; i++)
+    for (i=0 ; i < share->state.header.max_block_size_index ; i++)
       share->state.key_del[i]=  HA_OFFSET_ERROR;
     info->state->key_file_length=share->base.keystart;
   }
@@ -2210,6 +2210,7 @@ int mi_repair_by_sort(MI_CHECK *param, r
     my_seek(param->read_cache.file,0L,MY_SEEK_END,MYF(0));
 
   sort_param.wordlist=NULL;
+  init_alloc_root(&sort_param.wordroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0);
 
   if (share->data_file_type == DYNAMIC_RECORD)
     length=max(share->base.min_pack_length+1,share->base.min_block_length);
@@ -2272,12 +2273,36 @@ int mi_repair_by_sort(MI_CHECK *param, r
     {
       uint ft_max_word_len_for_sort=FT_MAX_WORD_LEN_FOR_SORT*
                                     sort_param.keyinfo->seg->charset->mbmaxlen;
-      sort_info.max_records=
-        (ha_rows) (sort_info.filelength/ft_min_word_len+1);
+      sort_param.key_length+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
+      /*
+        fulltext indexes may have much more entries than the
+        number of rows in the table. We estimate the number here.
+
+        Note, built-in parser is always nr. 0 - see ftparser_call_initializer()
+      */
+      if (sort_param.keyinfo->ftparser_nr == 0)
+      {
+        /*
+          for built-in parser the number of generated index entries
+          cannot be larger than the size of the data file divided
+          by the minimal word's length
+        */
+        sort_info.max_records=
+          (ha_rows) (sort_info.filelength/ft_min_word_len+1);
+      }
+      else
+      {
+        /*
+          for external plugin parser we cannot tell anything at all :(
+          so, we'll use all the sort memory and start from ~10 buffpeks.
+          (see _create_index_by_sort)
+        */
+        sort_info.max_records=
+          10*param->sort_buffer_length/sort_param.key_length;
+      }
 
       sort_param.key_read=sort_ft_key_read;
       sort_param.key_write=sort_ft_key_write;
-      sort_param.key_length+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
     }
     else
     {
@@ -2294,6 +2319,7 @@ int mi_repair_by_sort(MI_CHECK *param, r
     }
     /* No need to calculate checksum again. */
     sort_param.calc_checksum= 0;
+    free_root(&sort_param.wordroot, MYF(0));
 
     /* Set for next loop */
     sort_info.max_records= (ha_rows) info->state->records;
@@ -2617,7 +2643,7 @@ int mi_repair_parallel(MI_CHECK *param, 
     /* Clear the pointers to the given rows */
     for (i=0 ; i < share->base.keys ; i++)
       share->state.key_root[i]= HA_OFFSET_ERROR;
-    for (i=0 ; i < share->state.header.max_block_size ; i++)
+    for (i=0 ; i < share->state.header.max_block_size_index ; i++)
       share->state.key_del[i]=  HA_OFFSET_ERROR;
     info->state->key_file_length=share->base.keystart;
   }
@@ -2742,6 +2768,7 @@ int mi_repair_parallel(MI_CHECK *param, 
       uint ft_max_word_len_for_sort=FT_MAX_WORD_LEN_FOR_SORT*
                                    
sort_param[i].keyinfo->seg->charset->mbmaxlen;
       sort_param[i].key_length+=ft_max_word_len_for_sort-HA_FT_MAXBYTELEN;
+      init_alloc_root(&sort_param[i].wordroot, FTPARSER_MEMROOT_ALLOC_SIZE, 0);
     }
   }
   sort_info.total_keys=i;
@@ -3016,10 +3043,11 @@ static int sort_ft_key_read(MI_SORT_PARA
   {
     for (;;)
     {
-      my_free((char*) wptr, MYF(MY_ALLOW_ZERO_PTR));
+      free_root(&sort_param->wordroot, MYF(MY_MARK_BLOCKS_FREE));
       if ((error=sort_get_next_record(sort_param)))
         DBUG_RETURN(error);
-      if (!(wptr=_mi_ft_parserecord(info,sort_param->key,sort_param->record)))
+      if (!(wptr=_mi_ft_parserecord(info,sort_param->key,sort_param->record,
+                                    &sort_param->wordroot)))
         DBUG_RETURN(1);
       if (wptr->pos)
         break;
@@ -3043,7 +3071,7 @@ static int sort_ft_key_read(MI_SORT_PARA
 #endif
   if (!wptr->pos)
   {
-    my_free((char*) sort_param->wordlist, MYF(0));
+    free_root(&sort_param->wordroot, MYF(MY_MARK_BLOCKS_FREE));
     sort_param->wordlist=0;
     error=sort_write_record(sort_param);
   }
@@ -4175,9 +4203,6 @@ int recreate_table(MI_CHECK *param, MI_I
 
   create_info.data_file_length=file_length;
   create_info.auto_increment=share.state.auto_increment;
-  create_info.raid_type=   share.base.raid_type;
-  create_info.raid_chunks= share.base.raid_chunks;
-  create_info.raid_chunksize= share.base.raid_chunksize;
   create_info.language = (param->language ? param->language :
 			  share.state.header.language);
   create_info.key_file_length=  status_info.key_file_length;

--- 1.214/sql/sql_lex.cc	2007-01-04 16:09:29 +04:00
+++ 1.215/sql/sql_lex.cc	2007-01-04 16:09:29 +04:00
@@ -1934,7 +1934,6 @@ void st_select_lex_unit::set_limit(SELEC
 {
   ha_rows select_limit_val;
 
-  DBUG_ASSERT(! thd->stmt_arena->is_stmt_prepare());
   select_limit_val= (ha_rows)(sl->select_limit ? sl->select_limit->val_uint() :
                                                  HA_POS_ERROR);
   offset_limit_cnt= (ha_rows)(sl->offset_limit ? sl->offset_limit->val_uint() :

--- 1.69/sql/sql_udf.cc	2007-01-04 16:09:29 +04:00
+++ 1.70/sql/sql_udf.cc	2007-01-04 16:09:29 +04:00
@@ -481,6 +481,8 @@ int mysql_drop_function(THD *thd,const L
   TABLE *table;
   TABLE_LIST tables;
   udf_func *udf;
+  char *exact_name_str;
+  uint exact_name_len;
   DBUG_ENTER("mysql_drop_function");
   if (!initialized)
   {
@@ -494,6 +496,8 @@ int mysql_drop_function(THD *thd,const L
     my_error(ER_FUNCTION_NOT_DEFINED, MYF(0), udf_name->str);
     goto err;
   }
+  exact_name_str= udf->name.str;
+  exact_name_len= udf->name.length;
   del_udf(udf);
   /*
     Close the handle if this was function that was found during boot or
@@ -508,7 +512,7 @@ int mysql_drop_function(THD *thd,const L
   if (!(table = open_ltable(thd,&tables,TL_WRITE)))
     goto err;
   table->use_all_columns();
-  table->field[0]->store(udf_name->str, udf_name->length,
system_charset_info);
+  table->field[0]->store(udf_name->str, udf_name->length,
&my_charset_bin);
   if (!table->file->index_read_idx(table->record[0], 0,
 				   (byte*) table->field[0]->ptr,
 				   table->key_info[0].key_length,

--- 1.159/mysql-test/r/subselect.result	2007-01-04 16:09:29 +04:00
+++ 1.160/mysql-test/r/subselect.result	2007-01-04 16:09:29 +04:00
@@ -3033,6 +3033,19 @@ t3	CREATE TABLE `t3` (
   `a` datetime DEFAULT NULL
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 DROP TABLE t1,t2,t3;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1), (2);
+SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) > 0;
+a
+SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
+a
+1
+2
+EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	PRIMARY	t1	ALL	NULL	NULL	NULL	NULL	2	
+2	SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
+DROP TABLE t1;
 create table t1 (df decimal(5,1));
 insert into t1 values(1.1);
 insert into t1 values(2.2);

--- 1.139/mysql-test/t/subselect.test	2007-01-04 16:09:29 +04:00
+++ 1.140/mysql-test/t/subselect.test	2007-01-04 16:09:29 +04:00
@@ -1988,6 +1988,18 @@ SHOW CREATE TABLE t3;
 
 DROP TABLE t1,t2,t3;
 
+#
+# Bug 24670: subquery witout tables but with a WHERE clause
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1), (2);
+
+SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) > 0;
+SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
+EXPLAIN SELECT a FROM t1 WHERE (SELECT 1 FROM DUAL WHERE 1=0) IS NULL;
+
+DROP TABLE t1;
 # End of 4.1 tests
 
 #

--- 1.139/sql/item_subselect.cc	2007-01-04 16:09:29 +04:00
+++ 1.140/sql/item_subselect.cc	2007-01-04 16:09:29 +04:00
@@ -391,6 +391,7 @@ Item_singlerow_subselect::select_transfo
       */
       !(select_lex->item_list.head()->type() == FIELD_ITEM ||
 	select_lex->item_list.head()->type() == REF_ITEM) &&
+      !join->conds && !join->having &&
       /*
         switch off this optimization for prepare statement,
         because we do not rollback this changes
@@ -415,8 +416,6 @@ Item_singlerow_subselect::select_transfo
     */
     substitution->walk(&Item::remove_dependence_processor, 0,
 		       (byte *) select_lex->outer_select());
-    /* SELECT without FROM clause can't have WHERE or HAVING clause */
-    DBUG_ASSERT(join->conds == 0 && join->having == 0);
     return RES_REDUCE;
   }
   return RES_OK;
@@ -2316,6 +2315,22 @@ bool subselect_uniquesubquery_engine::ch
 bool subselect_single_select_engine::no_tables()
 {
   return(select_lex->table_list.elements == 0);
+}
+
+
+/*
+  Check statically whether the subquery can return NULL
+
+  SINOPSYS
+    subselect_single_select_engine::may_be_null()
+
+  RETURN
+    FALSE  can guarantee that the subquery never return NULL
+    TRUE   otherwise
+*/
+bool subselect_single_select_engine::may_be_null()
+{
+  return ((no_tables() && !join->conds && !join->having) ?
maybe_null : 1);
 }
 
 

--- 1.85/sql/item_subselect.h	2007-01-04 16:09:29 +04:00
+++ 1.86/sql/item_subselect.h	2007-01-04 16:09:29 +04:00
@@ -363,7 +363,7 @@ public:
   enum Item_result type() { return res_type; }
   enum_field_types field_type() { return res_field_type; }
   virtual void exclude()= 0;
-  bool may_be_null() { return maybe_null; };
+  virtual bool may_be_null() { return maybe_null; };
   virtual table_map upper_select_const_tables()= 0;
   static table_map calc_const_tables(TABLE_LIST *);
   virtual void print(String *str)= 0;
@@ -400,6 +400,7 @@ public:
   void print (String *str);
   bool change_result(Item_subselect *si, select_subselect *result);
   bool no_tables();
+  bool may_be_null();
   bool is_executed() const { return executed; }
   bool no_rows();
 };

--- 1.15/mysql-test/r/udf.result	2007-01-04 16:09:29 +04:00
+++ 1.16/mysql-test/r/udf.result	2007-01-04 16:09:29 +04:00
@@ -232,6 +232,17 @@ DROP FUNCTION sequence;
 DROP FUNCTION lookup;
 DROP FUNCTION reverse_lookup;
 DROP FUNCTION avgcost;
+select * from mysql.func;
+name	ret	dl	type
+CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
+select IS_const(3);
+IS_const(3)
+const
+drop function IS_const;
+select * from mysql.func;
+name	ret	dl	type
+select is_const(3);
+ERROR 42000: FUNCTION test.is_const does not exist
 CREATE FUNCTION is_const RETURNS STRING SONAME "UDF_EXAMPLE_LIB";
 select
 is_const(3) as const,

--- 1.15/mysql-test/t/udf.test	2007-01-04 16:09:29 +04:00
+++ 1.16/mysql-test/t/udf.test	2007-01-04 16:09:29 +04:00
@@ -240,6 +240,23 @@ DROP FUNCTION reverse_lookup;
 DROP FUNCTION avgcost;
 
 #
+# Bug #15439: UDF name case handling forces DELETE FROM mysql.func to remove 
+#             the UDF
+# 
+select * from mysql.func;
+--replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB
+eval CREATE FUNCTION is_const RETURNS STRING SONAME "$UDF_EXAMPLE_LIB";
+
+select IS_const(3);
+
+drop function IS_const;
+
+select * from mysql.func;
+
+--error 1305
+select is_const(3);
+
+#
 # Bug#18761: constant expression as UDF parameters not passed in as constant
 #
 --replace_result $UDF_EXAMPLE_LIB UDF_EXAMPLE_LIB

--- 1.26/mysql-test/r/gis-rtree.result	2007-01-04 16:09:29 +04:00
+++ 1.27/mysql-test/r/gis-rtree.result	2007-01-04 16:09:29 +04:00
@@ -881,3 +881,14 @@ ERROR 22003: Cannot get geometry object 
 INSERT INTO t1(foo) VALUES ('');
 ERROR 22003: Cannot get geometry object from data you send to the GEOMETRY field
 DROP TABLE t1;
+CREATE TABLE t1 (a INT AUTO_INCREMENT, b POINT NOT NULL, KEY (a), SPATIAL KEY (b));
+INSERT INTO t1 (b) VALUES (GeomFromText('POINT(1 2)'));
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+OPTIMIZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	status	OK
+DROP TABLE t1;

--- 1.20/mysql-test/t/gis-rtree.test	2007-01-04 16:09:29 +04:00
+++ 1.21/mysql-test/t/gis-rtree.test	2007-01-04 16:09:29 +04:00
@@ -254,3 +254,20 @@ INSERT INTO t1() VALUES ();
 --error 1416
 INSERT INTO t1(foo) VALUES ('');
 DROP TABLE t1;
+
+#
+# Bug #23578: Corruption prevents Optimize table from working properly with a 
+#             spatial index
+#
+
+CREATE TABLE t1 (a INT AUTO_INCREMENT, b POINT NOT NULL, KEY (a), SPATIAL KEY (b));
+
+INSERT INTO t1 (b) VALUES (GeomFromText('POINT(1 2)'));
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+INSERT INTO t1 (b) SELECT b FROM t1;
+
+OPTIMIZE TABLE t1;
+DROP TABLE t1;

--- 1.94/mysql-test/r/ps.result	2007-01-04 16:09:29 +04:00
+++ 1.95/mysql-test/r/ps.result	2007-01-04 16:09:29 +04:00
@@ -1522,6 +1522,21 @@ Variable_name	Value
 Slow_queries	1
 deallocate prepare no_index;
 deallocate prepare sq;
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1), (2);
+CREATE TABLE t2 (b int);
+INSERT INTO t2 VALUES (NULL);
+SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL;
+a
+1
+2
+PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL';
+EXECUTE stmt;
+a
+1
+2
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1,t2;
 End of 5.0 tests.
 create procedure proc_1() reset query cache;
 call proc_1();

--- 1.94/mysql-test/t/ps.test	2007-01-04 16:09:29 +04:00
+++ 1.95/mysql-test/t/ps.test	2007-01-04 16:09:29 +04:00
@@ -1576,6 +1576,24 @@ execute sq;
 deallocate prepare no_index;
 deallocate prepare sq;
 
+#
+# Bug 25027: query with a single-row non-correlated subquery
+#            and IS NULL predicate
+#
+
+CREATE TABLE t1 (a int);
+INSERT INTO t1 VALUES (1), (2);
+CREATE TABLE t2 (b int);
+INSERT INTO t2 VALUES (NULL);
+
+SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL;
+PREPARE stmt FROM 'SELECT a FROM t1 WHERE (SELECT b FROM t2) IS NULL';
+
+EXECUTE stmt;
+
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1,t2;
+
 --echo End of 5.0 tests.
 
 #
Thread
bk commit into 5.1 tree (holyfoot:1.2379)holyfoot4 Jan