MySQL Lists are EOL. Please join:

List:Commits« Previous MessageNext Message »
From:Alexey Kopytov Date:April 29 2010 8:34pm
Subject:bzr commit into mysql-trunk branch (Alexey.Kopytov:3011)
View as plain text  
#At file:///data/src/bzr/mysql-trunk-merge/ based on revid:alik@stripped

 3011 Alexey Kopytov	2010-04-30 [merge]
      Manual merge of mysql-5.1-bugteam to mysql-trunk-merge.
      
      Conflicts:
      
      Text conflict in configure.in
      Text conflict in dbug/dbug.c
      Text conflict in mysql-test/r/ps.result
      Text conflict in mysql-test/t/ps.test
      Text conflict in sql/CMakeLists.txt
      Text conflict in sql/ha_ndbcluster.cc
      Text conflict in sql/mysqld.cc
      Text conflict in sql/sql_plugin.cc
      Text conflict in sql/sql_table.cc

    added:
      mysql-test/r/bug46261.result
      mysql-test/suite/sys_vars/r/secure_file_priv.result
      mysql-test/suite/sys_vars/t/secure_file_priv-master.opt
      mysql-test/suite/sys_vars/t/secure_file_priv.test
      mysql-test/t/bug46261-master.opt
      mysql-test/t/bug46261.test
    modified:
      configure.in
      dbug/dbug.c
      include/mysql/plugin.h
      include/mysql/plugin.h.pp
      mysql-test/r/error_simulation.result
      mysql-test/r/innodb_mysql.result
      mysql-test/r/join.result
      mysql-test/r/loaddata.result*
      mysql-test/r/ps.result
      mysql-test/r/row.result
      mysql-test/r/variables_debug.result
      mysql-test/suite/rpl/r/rpl_do_grant.result
      mysql-test/suite/rpl/t/rpl_do_grant.test
      mysql-test/t/error_simulation.test
      mysql-test/t/innodb_mysql.test
      mysql-test/t/join.test
      mysql-test/t/ps.test
      mysql-test/t/row.test
      mysql-test/t/variables_debug.test
      scripts/mysqlhotcopy.sh
      sql/CMakeLists.txt
      sql/field.cc
      sql/handler.cc
      sql/handler.h
      sql/item_cmpfunc.h
      sql/mysqld.cc
      sql/sql_acl.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_load.cc
      sql/sql_parse.cc
      sql/sql_plugin.cc
      sql/sql_table.cc
      sql/sql_update.cc
=== modified file 'configure.in'
--- a/configure.in	2010-04-10 08:24:06 +0000
+++ b/configure.in	2010-04-29 20:33:06 +0000
@@ -19,15 +19,16 @@ dnl Process this file with autoconf to p
 # Minimum Autoconf version required.
 AC_PREREQ(2.59)
 
-# Various people throughout the community may parse configure.in to
-# get the MySQL version from the source branch.  If the formatting
-# of this line is going to be changed, please announce the change to
-# internals@stripped in advance of pushing the change.
-#
-# Remember to also update version.c in ndb.
-# When changing major version number please also check switch statement
-# in client/mysqlbinlog.cc:check_master_version().
+dnl Various people throughout the community may parse configure.in to
+dnl get the MySQL version from the source branch.  If the formatting
+dnl of this line is going to be changed, please announce the change to
+dnl internals@stripped in advance of pushing the change.
+dnl
+dnl When changing the major version number please also check the switch
+dnl statement in mysqlbinlog::check_master_version().  You may also need
+dnl to update version.c in ndb.
 AC_INIT([MySQL Server], [5.5.5-m3], [], [mysql])
+
 AC_CONFIG_SRCDIR([sql/mysqld.cc])
 AC_CANONICAL_SYSTEM
 # USTAR format gives us the possibility to store longer path names in

=== modified file 'dbug/dbug.c'
--- a/dbug/dbug.c	2010-04-18 13:32:05 +0000
+++ b/dbug/dbug.c	2010-04-29 20:33:06 +0000
@@ -507,7 +507,13 @@ int DbugParse(CODE_STATE *cs, const char
   rel= control[0] == '+' || control[0] == '-';
   if ((!rel || (!stack->out_file && !stack->next)))
   {
-    FreeState(cs, stack, 0);
+    /*
+      We need to free what's already in init_settings, because unlike
+      the thread related stack frames there's a chance that something
+      is in these variables already.
+    */
+    if (stack == &init_settings)
+      FreeState(cs, stack, 0);
     stack->flags= 0;
     stack->delay= 0;
     stack->maxdepth= 0;
@@ -1709,7 +1715,10 @@ void _db_end_()
   while ((discard= cs->stack))
   {
     if (discard == &init_settings)
+    {
+      FreeState (cs, discard, 0);
       break;
+    }
     cs->stack= discard->next;
     FreeState(cs, discard, 1);
   }

=== modified file 'include/mysql/plugin.h'
--- a/include/mysql/plugin.h	2010-03-24 15:03:44 +0000
+++ b/include/mysql/plugin.h	2010-04-29 20:33:06 +0000
@@ -593,30 +593,37 @@ void mysql_query_cache_invalidate4(MYSQL
                                    const char *key, unsigned int key_length,
                                    int using_trx);
 
-#ifdef __cplusplus
-}
-#endif
 
-#ifdef __cplusplus
 /**
   Provide a handler data getter to simplify coding
 */
-inline
-void *
-thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton)
-{
-  return *thd_ha_data(thd, hton);
-}
+void *thd_get_ha_data(const MYSQL_THD thd, const struct handlerton *hton);
+
 
 /**
   Provide a handler data setter to simplify coding
+
+  @details
+  Set ha_data pointer (storage engine per-connection information).
+
+  To avoid unclean deactivation (uninstall) of storage engine plugin
+  in the middle of transaction, additional storage engine plugin
+  lock is acquired.
+
+  If ha_data is not null and storage engine plugin was not locked
+  by thd_set_ha_data() in this connection before, storage engine
+  plugin gets locked.
+
+  If ha_data is null and storage engine plugin was locked by
+  thd_set_ha_data() in this connection before, storage engine
+  plugin lock gets released.
+
+  If handlerton::close_connection() didn't reset ha_data, server does
+  it immediately after calling handlerton::close_connection().
 */
-inline
-void
-thd_set_ha_data(const MYSQL_THD thd, const struct handlerton *hton,
-                const void *ha_data)
-{
-  *thd_ha_data(thd, hton)= (void*) ha_data;
+void thd_set_ha_data(MYSQL_THD thd, const struct handlerton *hton,
+                     const void *ha_data);
+#ifdef __cplusplus
 }
 #endif
 

=== modified file 'include/mysql/plugin.h.pp'
--- a/include/mysql/plugin.h.pp	2010-01-19 13:30:55 +0000
+++ b/include/mysql/plugin.h.pp	2010-04-29 20:33:06 +0000
@@ -165,3 +165,6 @@ void thd_get_xid(const void* thd, MYSQL_
 void mysql_query_cache_invalidate4(void* thd,
                                    const char *key, unsigned int key_length,
                                    int using_trx);
+void *thd_get_ha_data(const void* thd, const struct handlerton *hton);
+void thd_set_ha_data(void* thd, const struct handlerton *hton,
+                     const void *ha_data);

=== added file 'mysql-test/r/bug46261.result'
--- a/mysql-test/r/bug46261.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/bug46261.result	2010-04-22 13:52:00 +0000
@@ -0,0 +1,8 @@
+#
+# Bug#46261 Plugins can be installed with --skip-grant-tables
+#
+INSTALL PLUGIN example SONAME 'ha_example.so';
+ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
+UNINSTALL PLUGIN example;
+ERROR HY000: The MySQL server is running with the --skip-grant-tables option so it cannot execute this statement
+End of 5.1 tests

=== modified file 'mysql-test/r/error_simulation.result'
--- a/mysql-test/r/error_simulation.result	2008-04-03 08:27:56 +0000
+++ b/mysql-test/r/error_simulation.result	2010-04-25 11:06:40 +0000
@@ -18,3 +18,26 @@ SELECT MAX(a) FROM t1 GROUP BY a,b;
 ERROR 23000: Can't write; duplicate key in table 'tmp_table'
 set tmp_table_size=default;
 DROP TABLE t1;
+#
+# Bug #50946: fast index creation still seems to copy the table
+#
+CREATE TABLE t1 (a INT(100) NOT NULL);
+INSERT INTO t1 VALUES (1), (0), (2);
+SET SESSION debug='+d,alter_table_only_index_change';
+ALTER TABLE t1 ADD INDEX a(a);
+SET SESSION debug=DEFAULT;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(100) NOT NULL,
+  KEY `a` (`a`)
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+SELECT * FROM t1;
+a
+0
+1
+2
+DROP TABLE t1;
+#
+# End of 5.1 tests
+#

=== modified file 'mysql-test/r/innodb_mysql.result'
--- a/mysql-test/r/innodb_mysql.result	2010-03-24 15:03:44 +0000
+++ b/mysql-test/r/innodb_mysql.result	2010-04-29 20:33:06 +0000
@@ -2355,6 +2355,34 @@ Index_type	BTREE
 Comment	
 Index_comment	
 DROP TABLE t1;
+#
+# Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when 
+#  JOINed during an UPDATE
+#
+CREATE TABLE t1 (d INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, b INT, 
+c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
+set up our data elements
+INSERT INTO t1 (d) VALUES (1);
+INSERT INTO t2 (a,b) VALUES (1,1);
+SELECT SECOND(c) INTO @bug47453 FROM t2;
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+SECOND(c)-@bug47453
+0
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+SECOND(c)-@bug47453
+0
+SELECT SLEEP(1);
+SLEEP(1)
+0
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+#should be 0
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+SECOND(c)-@bug47453
+0
+DROP TABLE t1, t2;
 End of 5.1 tests
 #
 # Test for bug #39932 "create table fails if column for FK is in different

=== modified file 'mysql-test/r/join.result'
--- a/mysql-test/r/join.result	2010-04-03 17:35:51 +0000
+++ b/mysql-test/r/join.result	2010-04-29 20:33:06 +0000
@@ -1146,6 +1146,16 @@ ROW(t1.b, 1111.11) <=> ROW('','');
 id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
 1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE noticed after reading const tables
 DROP TABLE t1;
+#
+# Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
+# 
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
+INSERT INTO t1 VALUES (0,0), (1,1);
+SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
+a	b	a	b
+0	0	0	0
+1	1	1	1
+DROP TABLE t1;
 End of 5.0 tests.
 CREATE TABLE t1 (f1 int);
 CREATE TABLE t2 (f1 int);
@@ -1174,14 +1184,4 @@ NULL
 NULL
 1
 DROP TABLE t1, t2, mm1;
-#
-# Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
-# 
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
-INSERT INTO t1 VALUES (0,0), (1,1);
-SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
-a	b	a	b
-0	0	0	0
-1	1	1	1
-DROP TABLE t1;
 End of 5.1 tests

=== modified file 'mysql-test/r/loaddata.result' (properties changed: +x to -x)
--- a/mysql-test/r/loaddata.result	2010-04-03 17:35:51 +0000
+++ b/mysql-test/r/loaddata.result	2010-04-29 20:33:06 +0000
@@ -204,10 +204,10 @@ a	b	c
 15	NULL	Fifteen
 show variables like "secure_file_pri%";
 Variable_name	Value
-secure_file_priv	MYSQLTEST_VARDIR/
+secure_file_priv	MYSQLTEST_VARDIR
 select @@secure_file_priv;
 @@secure_file_priv
-MYSQLTEST_VARDIR/
+MYSQLTEST_VARDIR
 set @@secure_file_priv= 0;
 ERROR HY000: Variable 'secure_file_priv' is a read only variable
 truncate table t1;

=== modified file 'mysql-test/r/ps.result'
--- a/mysql-test/r/ps.result	2010-03-24 15:03:44 +0000
+++ b/mysql-test/r/ps.result	2010-04-29 20:33:06 +0000
@@ -2992,6 +2992,19 @@ select @plaintext;
 bcd
 deallocate prepare encode;
 deallocate prepare decode;
+#
+# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+#
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (0, 0),(0, 0);
+PREPARE stmt FROM "SELECT 1 FROM t1 WHERE
+ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))";
+EXECUTE stmt;
+1
+EXECUTE stmt;
+1
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
 
 End of 5.1 tests.
 

=== modified file 'mysql-test/r/row.result'
--- a/mysql-test/r/row.result	2009-02-19 13:59:00 +0000
+++ b/mysql-test/r/row.result	2010-04-16 11:42:34 +0000
@@ -457,3 +457,12 @@ abc	1	abc	1
 select host,user from mysql.user where (host,user) = ('localhost','test');
 host	user
 drop table t1,t2;
+#
+# Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+#
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (0, 0),(0, 0);
+SELECT 1 FROM t1 WHERE ROW(a, b) >=
+ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
+1
+DROP TABLE t1;

=== modified file 'mysql-test/r/variables_debug.result'
--- a/mysql-test/r/variables_debug.result	2008-02-26 15:03:59 +0000
+++ b/mysql-test/r/variables_debug.result	2010-04-16 07:30:53 +0000
@@ -10,3 +10,16 @@ set debug= '-P';
 select @@debug;
 @@debug
 T
+#
+# Bug #52629: memory leak from sys_var_thd_dbug in 
+#  binlog.binlog_write_error
+#
+SET GLOBAL debug='d,injecting_fault_writing';
+SELECT @@global.debug;
+@@global.debug
+d,injecting_fault_writing
+SET GLOBAL debug='';
+SELECT @@global.debug;
+@@global.debug
+
+End of 5.1 tests

=== modified file 'mysql-test/suite/rpl/r/rpl_do_grant.result'
--- a/mysql-test/suite/rpl/r/rpl_do_grant.result	2010-02-10 12:12:55 +0000
+++ b/mysql-test/suite/rpl/r/rpl_do_grant.result	2010-04-29 20:33:06 +0000
@@ -246,4 +246,18 @@ GRANT ALL PRIVILEGES ON *.* TO 'root'@'l
 DROP TABLE t1;
 DROP PROCEDURE p1;
 DROP USER 'user49119'@'localhost';
+stop slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+reset master;
+reset slave;
+drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
+start slave;
+grant all on *.* to foo@"1.2.3.4";
+revoke all privileges, grant option from "foo";
+ERROR HY000: Can't revoke all privileges for one or more of the requested users
+show binlog events from <binlog_start>;
+Log_name	Pos	Event_type	Server_id	End_log_pos	Info
+master-bin.000001	#	Query	#	#	use `test`; grant all on *.* to foo@"1.2.3.4"
+master-bin.000001	#	Query	#	#	use `test`; revoke all privileges, grant option from "foo"
+DROP USER foo@"1.2.3.4";
 "End of test"

=== modified file 'mysql-test/suite/rpl/t/rpl_do_grant.test'
--- a/mysql-test/suite/rpl/t/rpl_do_grant.test	2010-02-10 12:16:49 +0000
+++ b/mysql-test/suite/rpl/t/rpl_do_grant.test	2010-04-29 20:33:06 +0000
@@ -318,4 +318,33 @@ DROP USER 'user49119'@'localhost';
 
 -- sync_slave_with_master
 
+#
+# Bug #51987  	revoke privileges logs wrong error code
+#
+
+-- connection master
+-- source include/master-slave-reset.inc
+-- connection master
+
+grant all on *.* to foo@"1.2.3.4";
+-- error ER_REVOKE_GRANTS
+revoke all privileges, grant option from "foo";
+
+## assertion: revoke is logged
+-- source include/show_binlog_events.inc
+
+-- sync_slave_with_master
+
+## assertion: slave replicates revoke and does not fail because master
+##            logged revoke with correct expected error code
+-- let $err= query_get_value(SHOW SLAVE STATUS, Last_SQL_Errno, 1)
+  if ($err)
+{
+    -- die UNEXPECTED ERROR AT SLAVE: $err
+}
+
+-- connection master
+DROP USER foo@"1.2.3.4";
+-- sync_slave_with_master
+
 --echo "End of test"

=== added file 'mysql-test/suite/sys_vars/r/secure_file_priv.result'
--- a/mysql-test/suite/sys_vars/r/secure_file_priv.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/secure_file_priv.result	2010-04-16 14:10:47 +0000
@@ -0,0 +1,22 @@
+#
+# Bug50373 --secure-file-priv=""
+#
+CREATE TABLE t1 (c1 VARCHAR(50));
+INSERT INTO t1 VALUES ("one"),("two"),("three"),("four"),("five");
+SHOW VARIABLES LIKE 'secure_file_priv';
+Variable_name	Value
+secure_file_priv	
+c1
+one
+two
+three
+four
+five
+loaded_file
+one
+two
+three
+four
+five
+
+DROP TABLE t1;

=== added file 'mysql-test/suite/sys_vars/t/secure_file_priv-master.opt'
--- a/mysql-test/suite/sys_vars/t/secure_file_priv-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/secure_file_priv-master.opt	2010-04-16 14:10:47 +0000
@@ -0,0 +1 @@
+--secure_file_priv=''

=== added file 'mysql-test/suite/sys_vars/t/secure_file_priv.test'
--- a/mysql-test/suite/sys_vars/t/secure_file_priv.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/secure_file_priv.test	2010-04-16 14:10:47 +0000
@@ -0,0 +1,21 @@
+--echo #
+--echo # Bug50373 --secure-file-priv=""
+--echo #
+CREATE TABLE t1 (c1 VARCHAR(50));
+INSERT INTO t1 VALUES ("one"),("two"),("three"),("four"),("five");
+SHOW VARIABLES LIKE 'secure_file_priv';
+--disable_query_log
+# Atempt to create a file where we normally aren't allowed to create one.
+# Doing this in a portable manner is difficult but we should be able to
+# count on the depth of the directory hierarchy used. Three steps up from
+# the datadir is the 'mysql_test' directory.
+--let $PROTECTED_FILE=`SELECT concat(@@datadir,'/../../../bug50373.txt')`;
+--eval SELECT * FROM t1 INTO OUTFILE '$PROTECTED_FILE';
+DELETE FROM t1;
+--eval LOAD DATA INFILE '$PROTECTED_FILE' INTO TABLE t1;
+SELECT * FROM t1;
+--eval SELECT load_file('$PROTECTED_FILE') AS loaded_file;
+--enable_query_log
+remove_file $PROTECTED_FILE;
+DROP TABLE t1;
+

=== added file 'mysql-test/t/bug46261-master.opt'
--- a/mysql-test/t/bug46261-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug46261-master.opt	2010-04-22 13:52:00 +0000
@@ -0,0 +1 @@
+--skip-grant-tables $EXAMPLE_PLUGIN_OPT

=== added file 'mysql-test/t/bug46261.test'
--- a/mysql-test/t/bug46261.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/bug46261.test	2010-04-22 13:52:00 +0000
@@ -0,0 +1,16 @@
+--source include/not_embedded.inc
+--source include/have_example_plugin.inc
+
+--echo #
+--echo # Bug#46261 Plugins can be installed with --skip-grant-tables
+--echo #
+
+--replace_regex /\.dll/.so/
+--error ER_OPTION_PREVENTS_STATEMENT
+eval INSTALL PLUGIN example SONAME $HA_EXAMPLE_SO;
+
+--replace_regex /\.dll/.so/
+--error ER_OPTION_PREVENTS_STATEMENT
+eval UNINSTALL PLUGIN example;
+
+--echo End of 5.1 tests

=== modified file 'mysql-test/t/error_simulation.test'
--- a/mysql-test/t/error_simulation.test	2008-04-03 08:27:56 +0000
+++ b/mysql-test/t/error_simulation.test	2010-04-25 11:06:40 +0000
@@ -33,3 +33,19 @@ set tmp_table_size=default;
 DROP TABLE t1;
 
 
+--echo #
+--echo # Bug #50946: fast index creation still seems to copy the table
+--echo #
+CREATE TABLE t1 (a INT(100) NOT NULL);
+INSERT INTO t1 VALUES (1), (0), (2);
+SET SESSION debug='+d,alter_table_only_index_change';
+ALTER TABLE t1 ADD INDEX a(a);
+SET SESSION debug=DEFAULT;
+SHOW CREATE TABLE t1;
+SELECT * FROM t1;
+DROP TABLE t1;
+
+
+--echo #
+--echo # End of 5.1 tests
+--echo #

=== modified file 'mysql-test/t/innodb_mysql.test'
--- a/mysql-test/t/innodb_mysql.test	2010-03-24 15:03:44 +0000
+++ b/mysql-test/t/innodb_mysql.test	2010-04-29 20:33:06 +0000
@@ -589,6 +589,36 @@ ALTER TABLE t1 DROP INDEX k, ADD UNIQUE 
 
 DROP TABLE t1;
 
+
+--echo #
+--echo # Bug #47453: InnoDB incorrectly changes TIMESTAMP columns when 
+--echo #  JOINed during an UPDATE
+--echo #
+
+CREATE TABLE t1 (d INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT, b INT, 
+  c TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP
+  ON UPDATE CURRENT_TIMESTAMP) ENGINE=InnoDB;
+
+--echo set up our data elements
+INSERT INTO t1 (d) VALUES (1);
+INSERT INTO t2 (a,b) VALUES (1,1);
+SELECT SECOND(c) INTO @bug47453 FROM t2;
+
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+
+SELECT SLEEP(1);
+
+UPDATE t1 JOIN t2 ON d=a SET b=1 WHERE a=1;
+
+--echo #should be 0
+SELECT SECOND(c)-@bug47453 FROM t1 JOIN t2 ON d=a;
+
+DROP TABLE t1, t2;
+
+
 --echo End of 5.1 tests
 
 

=== modified file 'mysql-test/t/join.test'
--- a/mysql-test/t/join.test	2010-03-26 07:46:18 +0000
+++ b/mysql-test/t/join.test	2010-04-26 20:46:52 +0000
@@ -807,6 +807,17 @@ WHERE ROW(t1.a, 1111.11) = ROW(1111.11, 
 ROW(t1.b, 1111.11) <=> ROW('','');
 DROP TABLE t1;
 
+--echo #
+--echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
+--echo # 
+
+CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
+INSERT INTO t1 VALUES (0,0), (1,1);
+
+SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
+
+DROP TABLE t1;
+
 --echo End of 5.0 tests.
 
 
@@ -840,15 +851,4 @@ ENGINE=MERGE  UNION=(t1,t2);
 SELECT t1.a FROM mm1,t1;
 DROP TABLE t1, t2, mm1;
 
---echo #
---echo # Bug #50335: Assertion `!(order->used & map)' in eq_ref_table
---echo # 
-
-CREATE TABLE t1 (a INT NOT NULL, b INT NOT NULL, PRIMARY KEY (a,b));
-INSERT INTO t1 VALUES (0,0), (1,1);
-
-SELECT * FROM t1 STRAIGHT_JOIN t1 t2 ON t1.a=t2.a AND t1.a=t2.b ORDER BY t2.a, t1.a;
-
-DROP TABLE t1;
-
 --echo End of 5.1 tests

=== modified file 'mysql-test/t/ps.test'
--- a/mysql-test/t/ps.test	2010-03-01 09:45:36 +0000
+++ b/mysql-test/t/ps.test	2010-04-29 20:33:06 +0000
@@ -3065,6 +3065,20 @@ select @plaintext;
 deallocate prepare encode;
 deallocate prepare decode;
 
+--echo #
+--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+--echo #
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (0, 0),(0, 0);
+PREPARE stmt FROM "SELECT 1 FROM t1 WHERE
+ROW(a, b) >= ROW('1', (SELECT 1 FROM t1 WHERE a > 1234))";
+--disable_warnings
+EXECUTE stmt;
+EXECUTE stmt;
+--enable_warnings
+DEALLOCATE PREPARE stmt;
+DROP TABLE t1;
+
 ###########################################################################
 
 --echo 

=== modified file 'mysql-test/t/row.test'
--- a/mysql-test/t/row.test	2009-02-19 13:20:44 +0000
+++ b/mysql-test/t/row.test	2010-04-16 11:42:34 +0000
@@ -255,3 +255,14 @@ select * from t1,t2 where (a,b) = (c,d);
 
 select host,user from mysql.user where (host,user) = ('localhost','test');
 drop table t1,t2;
+
+--echo #
+--echo # Bug#52124 memory leaks like a sieve in datetime, timestamp, time, date fields + warnings
+--echo #
+CREATE TABLE t1 (a DATETIME NOT NULL, b TINYINT);
+INSERT INTO t1 VALUES (0, 0),(0, 0);
+--disable_warnings
+SELECT 1 FROM t1 WHERE ROW(a, b) >=
+ROW('1', (SELECT 1 FROM t1 WHERE a > 1234));
+--enable_warnings
+DROP TABLE t1;

=== modified file 'mysql-test/t/variables_debug.test'
--- a/mysql-test/t/variables_debug.test	2008-02-26 15:03:59 +0000
+++ b/mysql-test/t/variables_debug.test	2010-04-16 07:30:53 +0000
@@ -10,3 +10,16 @@ set debug= '+P';
 select @@debug;
 set debug= '-P';
 select @@debug;
+
+--echo #
+--echo # Bug #52629: memory leak from sys_var_thd_dbug in 
+--echo #  binlog.binlog_write_error
+--echo #
+
+SET GLOBAL debug='d,injecting_fault_writing';
+SELECT @@global.debug;
+SET GLOBAL debug='';
+SELECT @@global.debug;
+
+
+--echo End of 5.1 tests

=== modified file 'scripts/mysqlhotcopy.sh'
--- a/scripts/mysqlhotcopy.sh	2010-02-28 19:49:29 +0000
+++ b/scripts/mysqlhotcopy.sh	2010-04-29 20:33:06 +0000
@@ -270,6 +270,14 @@ foreach my $rdb ( @db_desc ) {
     my $db = $rdb->{src};
     my @dbh_tables = get_list_of_tables( $db );
 
+    ## filter out certain system non-lockable tables. 
+    ## keep in sync with mysqldump.
+    if ($db =~ m/^mysql$/i)
+    {
+      @dbh_tables = grep 
+        { !/^(apply_status|schema|general_log|slow_log)$/ } @dbh_tables
+    }
+
     ## generate regex for tables/files
     my $t_regex;
     my $negated;

=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt	2010-04-13 15:04:45 +0000
+++ b/sql/CMakeLists.txt	2010-04-29 20:33:06 +0000
@@ -47,7 +47,7 @@ SET (SQL_SOURCE
                hostname.cc init.cc item.cc item_buff.cc item_cmpfunc.cc 
                item_create.cc item_func.cc item_geofunc.cc item_row.cc 
                item_strfunc.cc item_subselect.cc item_sum.cc item_timefunc.cc 
-               key.cc log.cc lock.cc message.rc 
+               key.cc log.cc lock.cc  
                log_event.cc rpl_record.cc rpl_reporting.cc
                log_event_old.cc rpl_record_old.cc
                message.h mf_iocache.cc my_decimal.cc ../sql-common/my_time.c
@@ -92,7 +92,7 @@ TARGET_LINK_LIBRARIES(sql ${MYSQLD_STATI
  
 
 IF(WIN32)
-  SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h)
+  SET(MYSQLD_SOURCE main.cc nt_servc.cc nt_servc.h message.rc)
 ELSE()
   SET(MYSQLD_SOURCE main.cc ${DTRACE_PROBES_ALL})
 ENDIF()

=== modified file 'sql/field.cc'
--- a/sql/field.cc	2010-04-11 06:52:42 +0000
+++ b/sql/field.cc	2010-04-29 20:33:06 +0000
@@ -8464,14 +8464,20 @@ bool Field_num::eq_def(Field *field)
 }
 
 
+/**
+  Check whether two numeric fields can be considered 'equal' for table
+  alteration purposes. Fields are equal if they are of the same type
+  and retain the same pack length.
+*/
+
 uint Field_num::is_equal(Create_field *new_field)
 {
   return ((new_field->sql_type == real_type()) &&
-	  ((new_field->flags & UNSIGNED_FLAG) == (uint) (flags &
-							 UNSIGNED_FLAG)) &&
+          ((new_field->flags & UNSIGNED_FLAG) == 
+           (uint) (flags & UNSIGNED_FLAG)) &&
 	  ((new_field->flags & AUTO_INCREMENT_FLAG) ==
 	   (uint) (flags & AUTO_INCREMENT_FLAG)) &&
-	  (new_field->length <= max_display_length()));
+          (new_field->pack_length == pack_length()));
 }
 
 

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2010-04-20 08:51:50 +0000
+++ b/sql/handler.cc	2010-04-29 20:33:06 +0000
@@ -174,7 +174,7 @@ redo:
 }
 
 
-plugin_ref ha_lock_engine(THD *thd, handlerton *hton)
+plugin_ref ha_lock_engine(THD *thd, const handlerton *hton)
 {
   if (hton)
   {
@@ -642,9 +642,13 @@ static my_bool closecon_handlerton(THD *
     there's no need to rollback here as all transactions must
     be rolled back already
   */
-  if (hton->state == SHOW_OPTION_YES && hton->close_connection &&
-      thd_get_ha_data(thd, hton))
-    hton->close_connection(hton, thd);
+  if (hton->state == SHOW_OPTION_YES && thd_get_ha_data(thd, hton))
+  {
+    if (hton->close_connection)
+      hton->close_connection(hton, thd);
+    /* make sure ha_data is reset and ha_data_lock is released */
+    thd_set_ha_data(thd, hton, NULL);
+  }
   return FALSE;
 }
 

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2010-03-31 14:05:33 +0000
+++ b/sql/handler.h	2010-04-29 20:33:06 +0000
@@ -2066,7 +2066,7 @@ extern ulong total_ha, total_ha_2pc;
 /* lookups */
 handlerton *ha_default_handlerton(THD *thd);
 plugin_ref ha_resolve_by_name(THD *thd, const LEX_STRING *name);
-plugin_ref ha_lock_engine(THD *thd, handlerton *hton);
+plugin_ref ha_lock_engine(THD *thd, const handlerton *hton);
 handlerton *ha_resolve_by_legacy_type(THD *thd, enum legacy_db_type db_type);
 handler *get_new_handler(TABLE_SHARE *share, MEM_ROOT *alloc,
                          handlerton *db_type);

=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h	2010-03-31 14:05:33 +0000
+++ b/sql/item_cmpfunc.h	2010-04-29 20:33:06 +0000
@@ -60,9 +60,9 @@ public:
   /* Allow owner function to use string buffers. */
   String value1, value2;
 
-  Arg_comparator(): thd(0), a_cache(0), b_cache(0), set_null(TRUE),
+  Arg_comparator(): comparators(0), thd(0), a_cache(0), b_cache(0), set_null(TRUE),
     get_value_a_func(0), get_value_b_func(0) {};
-  Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), thd(0),
+  Arg_comparator(Item **a1, Item **a2): a(a1), b(a2), comparators(0), thd(0),
     a_cache(0), b_cache(0), set_null(TRUE),
     get_value_a_func(0), get_value_b_func(0) {};
 
@@ -118,6 +118,11 @@ public:
     return (owner->type() == Item::FUNC_ITEM &&
            ((Item_func*)owner)->functype() == Item_func::EQUAL_FUNC);
   }
+  void cleanup()
+  {
+    delete [] comparators;
+    comparators= 0;
+  }
 
   friend class Item_func;
 };
@@ -371,6 +376,11 @@ public:
   CHARSET_INFO *compare_collation() { return cmp.cmp_collation.collation; }
   uint decimal_precision() const { return 1; }
   void top_level_item() { abort_on_null= TRUE; }
+  void cleanup()
+  {
+    Item_int_func::cleanup();
+    cmp.cleanup();
+  }
 
   friend class  Arg_comparator;
 };

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2010-04-27 09:58:21 +0000
+++ b/sql/mysqld.cc	2010-04-29 20:33:06 +0000
@@ -7771,10 +7771,25 @@ static int fix_paths(void)
    */
   if (opt_secure_file_priv)
   {
-    convert_dirname(buff, opt_secure_file_priv, NullS);
-    x_free(opt_secure_file_priv);
-    opt_secure_file_priv= my_strdup(buff, MYF(MY_FAE));
+    if (*opt_secure_file_priv == 0)
+    {
+      opt_secure_file_priv= 0;
+    }
+    else
+    {
+      convert_dirname(buff, opt_secure_file_priv, NullS);
+      char *secure_file_real_path= (char *)my_malloc(FN_REFLEN, MYF(MY_FAE));
+      if (secure_file_real_path == 0 ||
+          my_realpath(secure_file_real_path, buff, 0))
+      {
+        sql_print_warning("Failed to normalize the argument for --secure-file-priv.");
+        return 1;
+      }
+      my_free(opt_secure_file_priv, MYF(0));
+      opt_secure_file_priv= secure_file_real_path;
+    }
   }
+  
   return 0;
 }
 

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	2010-04-13 15:04:45 +0000
+++ b/sql/sql_acl.cc	2010-04-29 20:33:06 +0000
@@ -6255,21 +6255,21 @@ bool mysql_revoke_all(THD *thd,  List <L
 
   mysql_mutex_unlock(&acl_cache->lock);
 
-  int binlog_error=
+  if (result)
+    my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
+
+  result= result |
     write_bin_log(thd, FALSE, thd->query(), thd->query_length());
 
   mysql_rwlock_unlock(&LOCK_grant);
   close_thread_tables(thd);
 
-  /* error for writing binary log has already been reported */
-  if (result && !binlog_error)
-    my_message(ER_REVOKE_GRANTS, ER(ER_REVOKE_GRANTS), MYF(0));
   /* Restore the state of binlog format */
   DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
   if (save_binlog_row_based)
     thd->set_current_stmt_binlog_format_row();
 
-  DBUG_RETURN(result || binlog_error);
+  DBUG_RETURN(result);
 }
 
 

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2010-04-27 09:58:21 +0000
+++ b/sql/sql_class.cc	2010-04-29 20:33:06 +0000
@@ -305,6 +305,37 @@ void **thd_ha_data(const THD *thd, const
   return (void **) &thd->ha_data[hton->slot].ha_ptr;
 }
 
+
+/**
+  Provide a handler data getter to simplify coding
+*/
+extern "C"
+void *thd_get_ha_data(const THD *thd, const struct handlerton *hton)
+{
+  return *thd_ha_data(thd, hton);
+}
+
+
+/**
+  Provide a handler data setter to simplify coding
+  @see thd_set_ha_data() definition in plugin.h
+*/
+extern "C"
+void thd_set_ha_data(THD *thd, const struct handlerton *hton,
+                     const void *ha_data)
+{
+  plugin_ref *lock= &thd->ha_data[hton->slot].lock;
+  if (ha_data && !*lock)
+    *lock= ha_lock_engine(NULL, (handlerton*) hton);
+  else if (!ha_data && *lock)
+  {
+    plugin_unlock(NULL, *lock);
+    *lock= NULL;
+  }
+  *thd_ha_data(thd, hton)= (void*) ha_data;
+}
+
+
 extern "C"
 long long thd_test_options(const THD *thd, long long test_options)
 {

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2010-04-27 09:58:21 +0000
+++ b/sql/sql_class.h	2010-04-29 20:33:06 +0000
@@ -1470,7 +1470,11 @@ struct Ha_data
     @sa trans_register_ha()
   */
   Ha_trx_info ha_info[2];
-
+  /**
+    NULL: engine is not bound to this thread
+    non-NULL: engine is bound to this thread, engine shutdown forbidden
+  */
+  plugin_ref lock;
   Ha_data() :ha_ptr(NULL) {}
 };
 

=== modified file 'sql/sql_load.cc'
--- a/sql/sql_load.cc	2010-04-19 12:09:44 +0000
+++ b/sql/sql_load.cc	2010-04-29 20:33:06 +0000
@@ -396,9 +396,7 @@ int mysql_load(THD *thd,sql_exchange *ex
       }
       else if (opt_secure_file_priv)
       {
-        char secure_file_real_path[FN_REFLEN];
-        (void) my_realpath(secure_file_real_path, opt_secure_file_priv, 0);
-        if (strncmp(secure_file_real_path, name, strlen(secure_file_real_path)))
+        if (strncmp(opt_secure_file_priv, name, strlen(opt_secure_file_priv)))
         {
           /* Read only allowed from within dir specified by secure_file_priv */
           my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--secure-file-priv");

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2010-04-27 09:58:21 +0000
+++ b/sql/sql_parse.cc	2010-04-29 20:33:06 +0000
@@ -1160,8 +1160,16 @@ bool dispatch_command(enum enum_server_c
       We have name + wildcard in packet, separated by endzero
     */
     arg_end= strend(packet);
+    uint arg_length= arg_end - packet;
+    
+    /* Check given table name length. */
+    if (arg_length >= packet_length || arg_length > NAME_LEN)
+    {
+      my_message(ER_UNKNOWN_COM_ERROR, ER(ER_UNKNOWN_COM_ERROR), MYF(0));
+      break;
+    }
     thd->convert_string(&conv_name, system_charset_info,
-			packet, (uint) (arg_end - packet), thd->charset());
+			packet, arg_length, thd->charset());
     table_list.alias= table_list.table_name= conv_name.str;
     packet= arg_end + 1;
 

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2010-03-31 14:05:33 +0000
+++ b/sql/sql_plugin.cc	2010-04-29 20:33:06 +0000
@@ -1755,6 +1755,12 @@ bool mysql_install_plugin(THD *thd, cons
   struct st_plugin_int *tmp;
   DBUG_ENTER("mysql_install_plugin");
 
+  if (opt_noacl)
+  {
+    my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
+    DBUG_RETURN(TRUE);
+  }
+
   tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
   if (check_table_access(thd, INSERT_ACL, &tables, FALSE, 1, FALSE))
     DBUG_RETURN(TRUE);
@@ -1829,6 +1835,12 @@ bool mysql_uninstall_plugin(THD *thd, co
   struct st_plugin_int *plugin;
   DBUG_ENTER("mysql_uninstall_plugin");
 
+  if (opt_noacl)
+  {
+    my_error(ER_OPTION_PREVENTS_STATEMENT, MYF(0), "--skip-grant-tables");
+    DBUG_RETURN(TRUE);
+  }
+
   tables.init_one_table("mysql", 5, "plugin", 6, "plugin", TL_WRITE);
 
   if (check_table_access(thd, DELETE_ACL, &tables, FALSE, 1, FALSE))

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-04-21 06:50:58 +0000
+++ b/sql/sql_table.cc	2010-04-29 20:33:06 +0000
@@ -6935,7 +6935,14 @@ view_err:
                        &index_add_buffer, &index_add_count,
                        &candidate_key_count))
       goto err;
-
+   
+    DBUG_EXECUTE_IF("alter_table_only_metadata_change", {
+      if (need_copy_table_res != ALTER_TABLE_METADATA_ONLY)
+        goto err; });
+    DBUG_EXECUTE_IF("alter_table_only_index_change", {
+      if (need_copy_table_res != ALTER_TABLE_INDEX_CHANGED)
+        goto err; });
+   
     if (need_copy_table == ALTER_TABLE_METADATA_ONLY)
       need_copy_table= need_copy_table_res;
   }

=== modified file 'sql/sql_update.cc'
--- a/sql/sql_update.cc	2010-04-20 08:51:50 +0000
+++ b/sql/sql_update.cc	2010-04-29 20:33:06 +0000
@@ -1337,6 +1337,16 @@ int multi_update::prepare(List<Item> &no
     {
       table->read_set= &table->def_read_set;
       bitmap_union(table->read_set, &table->tmp_set);
+      /*
+        If a timestamp field settable on UPDATE is present then to avoid wrong
+        update force the table handler to retrieve write-only fields to be able
+        to compare records and detect data change.
+        */
+      if (table->file->ha_table_flags() & HA_PARTIAL_COLUMN_READ &&
+          table->timestamp_field &&
+          (table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_UPDATE ||
+           table->timestamp_field_type == TIMESTAMP_AUTO_SET_ON_BOTH))
+        bitmap_union(table->read_set, table->write_set);
     }
   }
   


Attachment: [text/bzr-bundle] bzr/alexey.kopytov@sun.com-20100429203306-tg0wz4y2xyx8edrl.bundle
Thread
bzr commit into mysql-trunk branch (Alexey.Kopytov:3011)Alexey Kopytov29 Apr