List:Commits« Previous MessageNext Message »
From:holyfoot Date:June 14 2007 11:41am
Subject:bk commit into 5.0 tree (holyfoot:1.2519)
View as plain text  
Below is the list of changes that have just been committed into a local
5.0 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-06-14 16:41:10+05:00, holyfoot@hfmain.(none) +14 -0
  Merge bk@stripped:mysql-5.0
  into  mysql.com:/d2/hf/mrg/mysql-5.0-opt
  MERGE: 1.2493.3.36

  client/mysqltest.c@stripped, 2007-06-14 16:37:34+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.292.1.1

  mysql-test/r/innodb_mysql.result@stripped, 2007-06-14 16:39:42+05:00, holyfoot@hfmain.(none) +8 -8
    merging
    MERGE: 1.21.1.1

  mysql-test/t/innodb_mysql.test@stripped, 2007-06-14 16:40:23+05:00, holyfoot@hfmain.(none) +8 -8
    merging
    MERGE: 1.21.1.1

  sql/field.cc@stripped, 2007-06-14 16:37:34+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.349.1.2

  sql/field.h@stripped, 2007-06-14 16:37:34+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.204.1.2

  sql/item.cc@stripped, 2007-06-14 16:37:34+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.269.1.1

  sql/item.h@stripped, 2007-06-14 16:37:34+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.230.1.1

  sql/item_cmpfunc.cc@stripped, 2007-06-14 16:37:35+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.253.1.2

  sql/mysqld.cc@stripped, 2007-06-14 16:37:35+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.609.2.3

  sql/sql_parse.cc@stripped, 2007-06-14 16:37:35+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.622.1.1

  sql/sql_prepare.cc@stripped, 2007-06-14 16:37:35+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.202.1.1

  sql/sql_select.cc@stripped, 2007-06-14 16:41:04+05:00, holyfoot@hfmain.(none) +0 -1
    merging
    MERGE: 1.529.1.1

  sql/sql_table.cc@stripped, 2007-06-14 16:37:36+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.347.1.1

  sql/sql_yacc.yy@stripped, 2007-06-14 16:37:36+05:00, holyfoot@hfmain.(none) +0 -0
    Auto merged
    MERGE: 1.521.1.1

# 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/mrg/mysql-5.0-opt/RESYNC

--- 1.352/sql/field.cc	2007-06-14 16:41:15 +05:00
+++ 1.353/sql/field.cc	2007-06-14 16:41:15 +05:00
@@ -6218,7 +6218,8 @@ uint Field_string::get_key_image(char *b
                           length / field_charset->mbmaxlen);
   memcpy(buff, ptr, bytes);
   if (bytes < length)
-    bzero(buff + bytes, length - bytes);
+    field_charset->cset->fill(field_charset, buff + bytes, length - bytes, 
+                              field_charset->pad_char);
   return bytes;
 }
 

--- 1.205/sql/field.h	2007-06-14 16:41:15 +05:00
+++ 1.206/sql/field.h	2007-06-14 16:41:15 +05:00
@@ -360,7 +360,12 @@ public:
   {
     return field_length / charset()->mbmaxlen;
   }
-
+  virtual geometry_type get_geometry_type()
+  {
+    /* shouldn't get here. */
+    DBUG_ASSERT(0);
+    return GEOM_GEOMETRY;
+  }
   friend bool reopen_table(THD *,struct st_table *,bool);
   friend int cre_myisam(my_string name, register TABLE *form, uint options,
 			ulonglong auto_increment_value);
@@ -1324,6 +1329,7 @@ public:
   uint get_key_image(char *buff,uint length,imagetype type);
   uint size_of() const { return sizeof(*this); }
   int  reset(void) { return !maybe_null() || Field_blob::reset(); }
+  geometry_type get_geometry_type() { return geom_type; };
 };
 #endif /*HAVE_SPATIAL*/
 

--- 1.271/sql/item.cc	2007-06-14 16:41:15 +05:00
+++ 1.272/sql/item.cc	2007-06-14 16:41:15 +05:00
@@ -4318,7 +4318,9 @@ Field *Item::tmp_table_field_from_field_
   case MYSQL_TYPE_GEOMETRY:
     return new Field_geom(max_length, maybe_null, name, table,
                           (Field::geometry_type)
-                          ((Item_geometry_func *)this)->get_geometry_type());
+                          ((type() == Item::TYPE_HOLDER) ?
+                           ((Item_type_holder *)this)->get_geometry_type() :
+                           ((Item_geometry_func *)this)->get_geometry_type()));
   }
 }
 
@@ -6423,6 +6425,10 @@ Item_type_holder::Item_type_holder(THD *
   if (Field::result_merge_type(fld_type) == INT_RESULT)
     decimals= 0;
   prev_decimal_int_part= item->decimal_int_part();
+  if (item->field_type() == MYSQL_TYPE_GEOMETRY)
+    geometry_type= (item->type() == Item::FIELD_ITEM) ?
+      ((Item_field *)item)->get_geometry_type() :
+      (Field::geometry_type)((Item_geometry_func *)item)->get_geometry_type();
 }
 
 

--- 1.231/sql/item.h	2007-06-14 16:41:15 +05:00
+++ 1.232/sql/item.h	2007-06-14 16:41:15 +05:00
@@ -1304,6 +1304,11 @@ public:
   int fix_outer_field(THD *thd, Field **field, Item **reference);
   virtual Item *update_value_transformer(byte *select_arg);
   void print(String *str);
+  Field::geometry_type get_geometry_type()
+  {
+    DBUG_ASSERT(field_type() == MYSQL_TYPE_GEOMETRY);
+    return field->get_geometry_type();
+  }
   friend class Item_default_value;
   friend class Item_insert_value;
   friend class st_select_lex_unit;
@@ -2570,6 +2575,7 @@ class Item_type_holder: public Item
 protected:
   TYPELIB *enum_set_typelib;
   enum_field_types fld_type;
+  Field::geometry_type geometry_type;
 
   void get_full_info(Item *item);
 
@@ -2589,6 +2595,7 @@ public:
   Field *make_field_by_type(TABLE *table);
   static uint32 display_length(Item *item);
   static enum_field_types get_real_type(Item *);
+  Field::geometry_type get_geometry_type() { return geometry_type; };
 };
 
 

--- 1.256/sql/item_cmpfunc.cc	2007-06-14 16:41:15 +05:00
+++ 1.257/sql/item_cmpfunc.cc	2007-06-14 16:41:15 +05:00
@@ -1755,6 +1755,23 @@ void Item_func_between::fix_length_and_d
     ge_cmp.set_datetime_cmp_func(args, args + 1);
     le_cmp.set_datetime_cmp_func(args, args + 2);
   }
+  else if (args[0]->real_item()->type() == FIELD_ITEM &&
+           thd->lex->sql_command != SQLCOM_CREATE_VIEW &&
+           thd->lex->sql_command != SQLCOM_SHOW_CREATE)
+  {
+    Field *field=((Item_field*) (args[0]->real_item()))->field;
+    if (field->can_be_compared_as_longlong())
+    {
+      /*
+        The following can't be recoded with || as convert_constant_item
+        changes the argument
+      */
+      if (convert_constant_item(thd, field,&args[1]))
+        cmp_type=INT_RESULT;			// Works for all types.
+      if (convert_constant_item(thd, field,&args[2]))
+        cmp_type=INT_RESULT;			// Works for all types.
+    }
+  }
 }
 
 

--- 1.613/sql/mysqld.cc	2007-06-14 16:41:15 +05:00
+++ 1.614/sql/mysqld.cc	2007-06-14 16:41:15 +05:00
@@ -6198,8 +6198,8 @@ struct show_var_st status_vars[]= {
   {"Aborted_connects",         (char*) &aborted_connects,       SHOW_LONG},
   {"Binlog_cache_disk_use",    (char*) &binlog_cache_disk_use,  SHOW_LONG},
   {"Binlog_cache_use",         (char*) &binlog_cache_use,       SHOW_LONG},
-  {"Bytes_received",           (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONG_STATUS},
-  {"Bytes_sent",               (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONG_STATUS},
+  {"Bytes_received",           (char*) offsetof(STATUS_VAR, bytes_received), SHOW_LONGLONG_STATUS},
+  {"Bytes_sent",               (char*) offsetof(STATUS_VAR, bytes_sent), SHOW_LONGLONG_STATUS},
   {"Com_admin_commands",       (char*) offsetof(STATUS_VAR, com_other), SHOW_LONG_STATUS},
   {"Com_alter_db",	       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_DB]), SHOW_LONG_STATUS},
   {"Com_alter_table",	       (char*) offsetof(STATUS_VAR, com_stat[(uint) SQLCOM_ALTER_TABLE]), SHOW_LONG_STATUS},

--- 1.623/sql/sql_parse.cc	2007-06-14 16:41:15 +05:00
+++ 1.624/sql/sql_parse.cc	2007-06-14 16:41:15 +05:00
@@ -5252,7 +5252,17 @@ check_access(THD *thd, ulong want_access
   Security_context *sctx= thd->security_ctx;
 #ifndef NO_EMBEDDED_ACCESS_CHECKS
   ulong db_access;
-  bool  db_is_pattern= test(want_access & GRANT_ACL);
+  /*
+    GRANT command:
+    In case of database level grant the database name may be a pattern,
+    in case of table|column level grant the database name can not be a pattern.
+    We use 'dont_check_global_grants' as a flag to determine
+    if it's database level grant command 
+    (see SQLCOM_GRANT case, mysql_execute_command() function) and
+    set db_is_pattern according to 'dont_check_global_grants' value.
+  */
+  bool  db_is_pattern= (test(want_access & GRANT_ACL) &&
+                        dont_check_global_grants);
 #endif
   ulong dummy;
   DBUG_ENTER("check_access");

--- 1.530/sql/sql_select.cc	2007-06-14 16:41:15 +05:00
+++ 1.531/sql/sql_select.cc	2007-06-14 16:41:15 +05:00
@@ -10147,7 +10147,9 @@ bool create_myisam_from_heap(THD *thd, T
   /* copy all old rows */
   while (!table->file->rnd_next(new_table.record[1]))
   {
-    if ((write_err=new_table.file->write_row(new_table.record[1])))
+    write_err=new_table.file->write_row(new_table.record[1]);
+    DBUG_EXECUTE_IF("raise_error", write_err= HA_ERR_FOUND_DUPP_KEY ;);
+    if (write_err)
       goto err;
   }
   /* copy row that filled HEAP table */
@@ -10182,6 +10184,7 @@ bool create_myisam_from_heap(THD *thd, T
   delete new_table.file;
  err2:
   thd->proc_info=save_proc_info;
+  table->mem_root= new_table.mem_root;
   DBUG_RETURN(1);
 }
 

--- 1.348/sql/sql_table.cc	2007-06-14 16:41:15 +05:00
+++ 1.349/sql/sql_table.cc	2007-06-14 16:41:15 +05:00
@@ -3101,8 +3101,6 @@ bool mysql_alter_table(THD *thd,char *ne
 						   alter_info->tablespace_op));
   sprintf(new_name_buff,"%s/%s/%s%s",mysql_data_home, db, table_name, reg_ext);
   unpack_filename(new_name_buff, new_name_buff);
-  if (lower_case_table_names != 2)
-    my_casedn_str(files_charset_info, new_name_buff);
   frm_type= mysql_frm_type(thd, new_name_buff, &table_type);
   /* Rename a view */
   if (frm_type == FRMTYPE_VIEW && !(alter_info->flags & ~ALTER_RENAME))

--- 1.522/sql/sql_yacc.yy	2007-06-14 16:41:15 +05:00
+++ 1.523/sql/sql_yacc.yy	2007-06-14 16:41:15 +05:00
@@ -5820,7 +5820,8 @@ select_derived2:
 	  LEX *lex= Lex;
 	  lex->derived_tables|= DERIVED_SUBQUERY;
           if (lex->sql_command == (int)SQLCOM_HA_READ ||
-              lex->sql_command == (int)SQLCOM_KILL)
+              lex->sql_command == (int)SQLCOM_KILL ||
+              lex->sql_command == (int)SQLCOM_PURGE)
 	  {
             my_parse_error(ER(ER_SYNTAX_ERROR));
 	    MYSQL_YYABORT;
@@ -7275,6 +7276,7 @@ purge:
 	{
 	  LEX *lex=Lex;
 	  lex->type=0;
+          lex->sql_command = SQLCOM_PURGE;
 	} purge_options
 	{}
 	;
@@ -7286,7 +7288,6 @@ purge_options:
 purge_option:
         TO_SYM TEXT_STRING_sys
         {
-	   Lex->sql_command = SQLCOM_PURGE;
 	   Lex->to_log = $2.str;
         }
 	| BEFORE_SYM expr
@@ -9405,7 +9406,8 @@ subselect_start:
 	{
 	  LEX *lex=Lex;
           if (lex->sql_command == (int)SQLCOM_HA_READ ||
-              lex->sql_command == (int)SQLCOM_KILL)
+              lex->sql_command == (int)SQLCOM_KILL ||
+              lex->sql_command == (int)SQLCOM_PURGE)
 	  {
             my_parse_error(ER(ER_SYNTAX_ERROR));
 	    MYSQL_YYABORT;

--- 1.22/mysql-test/r/innodb_mysql.result	2007-06-14 16:41:15 +05:00
+++ 1.23/mysql-test/r/innodb_mysql.result	2007-06-14 16:41:15 +05:00
@@ -625,4 +625,40 @@ t1	CREATE TABLE `t1` (
   `a` int(11) default NULL
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1 COMMENT='123'
 drop table t1;
+CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
+INSERT INTO t1 VALUES ('uk'),('bg');
+SELECT * FROM t1 WHERE a = 'uk';
+a
+uk
+DELETE FROM t1 WHERE a = 'uk';
+SELECT * FROM t1 WHERE a = 'uk';
+a
+UPDATE t1 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t1 WHERE a = 'uk';
+a
+CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
+INSERT INTO t2 VALUES ('uk'),('bg');
+SELECT * FROM t2 WHERE a = 'uk';
+a
+uk
+DELETE FROM t2 WHERE a = 'uk';
+SELECT * FROM t2 WHERE a = 'uk';
+a
+INSERT INTO t2 VALUES ('uk');
+UPDATE t2 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t2 WHERE a = 'uk';
+a
+CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
+INSERT INTO t3 VALUES ('uk'),('bg');
+SELECT * FROM t3 WHERE a = 'uk';
+a
+uk
+DELETE FROM t3 WHERE a = 'uk';
+SELECT * FROM t3 WHERE a = 'uk';
+a
+INSERT INTO t3 VALUES ('uk');
+UPDATE t3 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t3 WHERE a = 'uk';
+a
+DROP TABLE t1,t2,t3;
 End of 5.0 tests

--- 1.22/mysql-test/t/innodb_mysql.test	2007-06-14 16:41:15 +05:00
+++ 1.23/mysql-test/t/innodb_mysql.test	2007-06-14 16:41:15 +05:00
@@ -605,4 +605,35 @@ alter table t1 comment '123';
 show create table t1;
 drop table t1;
 
+#
+# Bug #25866: Getting "#HY000 Can't find record in..." on and INSERT
+#
+CREATE TABLE t1 (a CHAR(2), KEY (a)) ENGINE = InnoDB DEFAULT CHARSET=UTF8;
+INSERT INTO t1 VALUES ('uk'),('bg');
+SELECT * FROM t1 WHERE a = 'uk';
+DELETE FROM t1 WHERE a = 'uk';
+SELECT * FROM t1 WHERE a = 'uk';
+UPDATE t1 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t1 WHERE a = 'uk';
+
+CREATE TABLE t2 (a CHAR(2), KEY (a)) ENGINE = InnoDB;
+INSERT INTO t2 VALUES ('uk'),('bg');
+SELECT * FROM t2 WHERE a = 'uk';
+DELETE FROM t2 WHERE a = 'uk';
+SELECT * FROM t2 WHERE a = 'uk';
+INSERT INTO t2 VALUES ('uk');
+UPDATE t2 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t2 WHERE a = 'uk';
+
+CREATE TABLE t3 (a CHAR(2), KEY (a)) ENGINE = MyISAM;
+INSERT INTO t3 VALUES ('uk'),('bg');
+SELECT * FROM t3 WHERE a = 'uk';
+DELETE FROM t3 WHERE a = 'uk';
+SELECT * FROM t3 WHERE a = 'uk';
+INSERT INTO t3 VALUES ('uk');
+UPDATE t3 SET a = 'us' WHERE a = 'uk';
+SELECT * FROM t3 WHERE a = 'uk';
+
+DROP TABLE t1,t2,t3;
+
 --echo End of 5.0 tests

--- 1.294/client/mysqltest.c	2007-06-14 16:41:15 +05:00
+++ 1.295/client/mysqltest.c	2007-06-14 16:41:15 +05:00
@@ -496,6 +496,10 @@ void handle_error(struct st_command*,
 void handle_no_error(struct st_command*);
 
 #ifdef EMBEDDED_LIBRARY
+
+/* attributes of the query thread */
+pthread_attr_t cn_thd_attrib;
+
 /*
   send_one_query executes query in separate thread what is
   necessary in embedded library to run 'send' in proper way.
@@ -534,7 +538,7 @@ static int do_send_query(struct st_conne
   cn->cur_query= q;
   cn->cur_query_len= q_len;
   cn->query_done= 0;
-  if (pthread_create(&tid, NULL, send_one_query, (void*)cn))
+  if (pthread_create(&tid, &cn_thd_attrib, send_one_query, (void*)cn))
     die("Cannot start new thread for query");
 
   return 0;
@@ -6169,6 +6173,12 @@ int main(int argc, char **argv)
     (sizeof(connections)/sizeof(struct st_connection)) - 1;
   next_con= connections + 1;
   cur_con= connections;
+
+#ifdef EMBEDDED_LIBRARY
+  /* set appropriate stack for the 'query' threads */
+  (void) pthread_attr_init(&cn_thd_attrib);
+  pthread_attr_setstacksize(&cn_thd_attrib, DEFAULT_THREAD_STACK);
+#endif /*EMBEDDED_LIBRARY*/
 
   /* Init file stack */
   memset(file_stack, 0, sizeof(file_stack));

--- 1.203/sql/sql_prepare.cc	2007-06-14 16:41:15 +05:00
+++ 1.204/sql/sql_prepare.cc	2007-06-14 16:41:15 +05:00
@@ -562,6 +562,8 @@ void set_param_date(Item_param *param, u
 static void set_param_str(Item_param *param, uchar **pos, ulong len)
 {
   ulong length= get_param_length(pos, len);
+  if (length > len)
+    length= len;
   param->set_str((const char *)*pos, length);
   *pos+= length;
 }
@@ -731,6 +733,8 @@ static bool insert_params_withlog(Prepar
         if (read_pos >= data_end)
           DBUG_RETURN(1);
         param->set_param_func(param, &read_pos, data_end - read_pos);
+        if (param->state == Item_param::NO_VALUE)
+          DBUG_RETURN(1);
       }
     }
     res= param->query_val_str(&str);
@@ -767,6 +771,8 @@ static bool insert_params(Prepared_state
         if (read_pos >= data_end)
           DBUG_RETURN(1);
         param->set_param_func(param, &read_pos, data_end - read_pos);
+        if (param->state == Item_param::NO_VALUE)
+          DBUG_RETURN(1);
       }
     }
     if (param->convert_str_value(stmt->thd))
@@ -849,6 +855,8 @@ static bool emb_insert_params(Prepared_s
                               client_param->length ?
                               *client_param->length :
                               client_param->buffer_length);
+        if (param->state == Item_param::NO_VALUE)
+          DBUG_RETURN(1);
       }
     }
     if (param->convert_str_value(thd))
@@ -890,6 +898,8 @@ static bool emb_insert_params_withlog(Pr
                               client_param->length ?
                               *client_param->length :
                               client_param->buffer_length);
+        if (param->state == Item_param::NO_VALUE)
+          DBUG_RETURN(1);
       }
     }
     res= param->query_val_str(&str);
Thread
bk commit into 5.0 tree (holyfoot:1.2519)holyfoot14 Jun