List:Commits« Previous MessageNext Message »
From:Tor Didriksen Date:January 18 2012 2:42pm
Subject:bzr push into mysql-trunk branch (tor.didriksen:3459 to 3462)
View as plain text  
 3462 Tor Didriksen	2012-01-18 [merge]
      merge trunk => opt-team

    modified:
      mysql-test/extra/rpl_tests/rpl_start_stop_slave.test
      mysql-test/r/partition.result
      mysql-test/suite/rpl/r/rpl_log_pos.result
      mysql-test/suite/rpl/r/rpl_manual_change_index_file.result
      mysql-test/suite/rpl/r/rpl_packet.result
      mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result
      mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test
      mysql-test/t/partition.test
      sql/filesort.cc
      sql/filesort_utils.h
      sql/rpl_master.cc
      sql/share/errmsg-utf8.txt
      sql/sql_table.cc
      sql/table.h
      unittest/gunit/filesort_buffer-t.cc
 3461 Tor Didriksen	2012-01-18 [merge]
      empty merge trunk => opt-team

 3460 Tor Didriksen	2012-01-18 [merge]
      merge trunk => opt-team

    added:
      mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result
      mysql-test/suite/sys_vars/r/innodb_doublewrite_batch_size_basic.result
      mysql-test/suite/sys_vars/r/innodb_page_hash_locks_basic.result
      mysql-test/suite/sys_vars/r/innodb_trx_rseg_n_slots_debug_basic.result
      mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test
      mysql-test/suite/sys_vars/t/innodb_doublewrite_batch_size_basic.test
      mysql-test/suite/sys_vars/t/innodb_page_hash_locks_basic.test
      mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test
    modified:
      CMakeLists.txt
      include/my_global.h
      mysql-test/extra/rpl_tests/rpl_extra_col_master.test
      mysql-test/r/ctype_many.result
      mysql-test/r/func_time.result
      mysql-test/r/user_var.result
      mysql-test/suite/funcs_1/r/is_columns_mysql.result
      mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result
      mysql-test/suite/funcs_1/r/is_tables_mysql.result
      mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result
      mysql-test/suite/sys_vars/r/all_vars.result
      mysql-test/suite/sys_vars/r/character_sets_dir_basic.result
      mysql-test/suite/sys_vars/r/plugin_dir_basic.result
      mysql-test/suite/sys_vars/t/all_vars.test
      mysql-test/suite/sys_vars/t/character_sets_dir_basic.test
      mysql-test/t/ctype_many.test
      mysql-test/t/func_time.test
      mysql-test/t/user_var.test
      scripts/mysql_system_tables.sql
      scripts/mysqld_safe.sh
      scripts/mysqlhotcopy.sh
      sql/item.cc
      sql/item_cmpfunc.cc
      sql/item_cmpfunc.h
      sql/item_func.h
      sql/mysqld.cc
      sql/sql_executor.cc
      sql/sql_optimizer.cc
      sql/sql_plugin.cc
      sql/sql_udf.cc
      storage/innobase/buf/buf0buf.cc
      storage/innobase/dict/dict0stats.cc
      storage/innobase/ibuf/ibuf0ibuf.cc
 3459 Tor Didriksen	2012-01-17 [merge]
      merge opt-backporting => opt-team

    modified:
      mysql-test/r/group_by.result
      mysql-test/t/group_by.test
      sql/item_subselect.cc
=== modified file 'CMakeLists.txt'
--- a/CMakeLists.txt	2011-09-06 03:13:44 +0000
+++ b/CMakeLists.txt	2012-01-16 11:41:54 +0000
@@ -79,8 +79,19 @@ ELSEIF(NOT HAVE_CMAKE_BUILD_TYPE OR OLD_
   SET(OLD_WITH_DEBUG 0 CACHE INTERNAL "" FORCE)
 ENDIF()
 
+# Optionally set project name, e.g.
+# foo.xcodeproj (mac) or foo.sln (windows)
+SET(MYSQL_PROJECT_NAME_DOCSTRING "MySQL project name")
+IF(DEFINED MYSQL_PROJECT_NAME)
+  SET(MYSQL_PROJECT_NAME ${MYSQL_PROJECT_NAME} CACHE STRING
+      ${MYSQL_PROJECT_NAME_DOCSTRING} FORCE)
+ELSE()
+  SET(MYSQL_PROJECT_NAME "MySQL" CACHE STRING
+      ${MYSQL_PROJECT_NAME_DOCSTRING} FORCE)
+  MARK_AS_ADVANCED(MYSQL_PROJECT_NAME)
+ENDIF()
+PROJECT(${MYSQL_PROJECT_NAME})
 
-PROJECT(MySQL)
 IF(BUILD_CONFIG)
   INCLUDE(
   ${CMAKE_SOURCE_DIR}/cmake/build_configurations/${BUILD_CONFIG}.cmake)

=== modified file 'include/my_global.h'
--- a/include/my_global.h	2012-01-11 09:33:52 +0000
+++ b/include/my_global.h	2012-01-17 09:39:54 +0000
@@ -1058,11 +1058,31 @@ typedef char		my_bool; /* Small bool */
 
 #ifndef HAVE_DLERROR
 #ifdef _WIN32
+#define DLERROR_GENERATE(errmsg, error_number) \
+  char win_errormsg[2048]; \
+  if(FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, \
+                   0, error_number, 0, win_errormsg, 2048, NULL)) \
+  { \
+    char *ptr; \
+    for (ptr= &win_errormsg[0] + strlen(win_errormsg) - 1; \
+         ptr >= &win_errormsg[0] && strchr("\r\n\t\0x20", *ptr); \
+         ptr--) \
+      *ptr= 0; \
+    errmsg= win_errormsg; \
+  } \
+  else \
+    errmsg= ""
 #define dlerror() ""
-#else
+#define dlopen_errno GetLastError()
+#else /* _WIN32 */
 #define dlerror() "No support for dynamic loading (static build?)"
-#endif
-#endif
+#define DLERROR_GENERATE(errmsg, error_number) errmsg= dlerror()
+#define dlopen_errno errno
+#endif /* _WIN32 */
+#else /* HAVE_DLERROR */
+#define DLERROR_GENERATE(errmsg, error_number) errmsg= dlerror()
+#define dlopen_errno errno
+#endif /* HAVE_DLERROR */
 
 
 /*

=== modified file 'mysql-test/extra/rpl_tests/rpl_extra_col_master.test'
--- a/mysql-test/extra/rpl_tests/rpl_extra_col_master.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_extra_col_master.test	2012-01-16 10:15:36 +0000
@@ -59,6 +59,8 @@
 #VARCHAR(M)    
 #
 
+--let $_saved_conn= $CURRENT_CONNECTION
+
 let $binformat = `SHOW VARIABLES LIKE '%binlog_format%'`;
 --echo
 --echo ***********************************************************
@@ -1056,3 +1058,5 @@ SELECT * FROM t1; 
 -- connection master
 DROP TABLE t1; 
 -- sync_slave_with_master
+
+--connection $_saved_conn

=== modified file 'mysql-test/extra/rpl_tests/rpl_start_stop_slave.test'
--- a/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/extra/rpl_tests/rpl_start_stop_slave.test	2012-01-17 22:32:29 +0000
@@ -177,3 +177,36 @@ UNLOCK TABLES;
 --connection master
 DROP TABLE t1;
 sync_slave_with_master;
+
+#
+# bug#3593869-64035 uninitialized event_coordinates instance crashes server
+# Testing how out of valid range position value is handled with an error.
+#
+
+--connection master
+RESET MASTER;
+let $master_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+let $master_pos= `SELECT $master_pos + 1`;
+
+--connection slave
+--source include/stop_slave.inc
+--replace_regex /[0-9]+/MASTER_POS/
+eval CHANGE MASTER TO master_log_pos=$master_pos;
+
+START SLAVE;
+# ER_MASTER_FATAL_ERROR_READING_BINLOG 1236
+--let $slave_param=Last_IO_Errno
+--let $slave_param_value=1236
+--source include/wait_for_slave_param.inc
+
+--let $slave_io_error_replace= / at [0-9]*/ at XXX/ /\.\/*master-bin/master-bin/
+--let $status_items= Last_IO_Errno, Last_IO_Error
+--source include/show_slave_status.inc
+
+--source include/stop_slave.inc
+RESET SLAVE;
+
+--connection master
+RESET MASTER;
+
+# Slave is stopped by bug#3593869-64035 tests.

=== modified file 'mysql-test/r/ctype_many.result'
--- a/mysql-test/r/ctype_many.result	2011-01-17 12:26:13 +0000
+++ b/mysql-test/r/ctype_many.result	2012-01-16 09:01:53 +0000
@@ -1776,3 +1776,14 @@ DROP TABLE t2;
 #
 # End of 5.5 tests
 #
+#
+# Bug#11766143 59185: ASSERTION FAILED: (FIXED == 1), FILE
+# ITEM_STRFUNC.CC, LINE 2760
+#
+CREATE TABLE t1 (a CHAR(1) CHARSET UTF8);
+INSERT INTO t1 VALUES ('a'), ('b');
+CREATE TABLE t2 (a BINARY(1));
+SELECT * FROM t2 WHERE a=(SELECT a FROM t1) AND a=_LATIN1'x';
+ERROR 21000: Subquery returns more than 1 row
+DROP TABLE t2;
+DROP TABLE t1;

=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result	2012-01-13 08:36:43 +0000
+++ b/mysql-test/r/func_time.result	2012-01-17 08:23:57 +0000
@@ -1512,6 +1512,40 @@ drop table t1;
 # Start of 5.6 tests
 #
 #
+# BUG#13545236 - ASSERT IN SEC_SINCE_EPOCH
+#
+CREATE TABLE t1 (a TIME NOT NULL);
+INSERT INTO t1 VALUES ('04:39:24');
+INSERT INTO t1 VALUES ('00:20:09');
+SELECT a FROM t1
+WHERE CONVERT_TZ(TIMESTAMPADD(YEAR , a, TIMESTAMP('0000-00-00')),
+'+00:00','+00:00');
+a
+SELECT a FROM t1
+WHERE CONVERT_TZ(TIMESTAMPADD(YEAR, a, DATE('0000-00-00')),
+'+00:00','+00:00');
+a
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00');
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, TIMESTAMP('0000-00-01')) IS NULL;
+a
+00:00:00
+Warnings:
+Warning	1292	Incorrect datetime value: '0000-00-01'
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, TIMESTAMP'0000-00-01 00:00:00') IS NULL;
+a
+00:00:00
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, DATE('0000-00-01')) IS NULL;
+a
+00:00:00
+Warnings:
+Warning	1292	Incorrect datetime value: '0000-00-01'
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, DATE'0000-00-01') IS NULL;
+a
+00:00:00
+DROP TABLE t1;
+#
 # BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIMESTAMP 
 # Part2 (5.6)
 CREATE TABLE t1 (a VARCHAR(32) NOT NULL);

=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result	2011-10-06 09:50:40 +0000
+++ b/mysql-test/r/partition.result	2012-01-18 13:03:10 +0000
@@ -2429,3 +2429,25 @@ SELECT * FROM vtmp;
 1
 DROP VIEW vtmp;
 DROP TABLE t1;
+#
+# Bug#13580775 ASSERTION FAILED: RECORD_LENGTH == M_RECORD_LENGTH,
+# FILE FILESORT_UTILS.CC
+#
+CREATE TABLE t1 (
+a INT PRIMARY KEY,
+b INT,
+c CHAR(1),
+d INT,
+KEY (c,d)
+) PARTITION BY KEY () PARTITIONS 1;
+INSERT INTO t1 VALUES (1,1,'a',1), (2,2,'a',1);
+SELECT 1 FROM t1 WHERE 1 IN
+(SELECT  group_concat(b)
+FROM t1
+WHERE c > geomfromtext('point(1 1)')
+GROUP BY b
+);
+1
+1
+1
+DROP TABLE t1;

=== modified file 'mysql-test/r/user_var.result'
--- a/mysql-test/r/user_var.result	2011-10-27 08:08:46 +0000
+++ b/mysql-test/r/user_var.result	2012-01-17 14:44:49 +0000
@@ -493,3 +493,26 @@ GROUP BY @b:=(SELECT COUNT(*) > t2.a);
 @a:=MIN(t1.a)
 1
 DROP TABLE t1;
+CREATE TABLE t1(a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0);
+SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a))
+AS b FROM t1 GROUP BY a;
+b
+1
+SELECT @a;
+@a
+1
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT, f2 INT);
+INSERT INTO t1 VALUES (1,2),(2,3),(3,1);
+CREATE TABLE t2(a INT);
+INSERT INTO t2 VALUES (1);
+SET @var=NULL;
+SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC
+LIMIT 1;
+@var:=(SELECT f2 FROM t2 WHERE @var)
+NULL
+SELECT @var;
+@var
+NULL
+DROP TABLE t1, t2;

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2011-12-06 09:18:55 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql.result	2012-01-17 13:18:08 +0000
@@ -97,20 +97,20 @@ def	mysql	host	Select_priv	3	N	NO	enum	1
 def	mysql	host	Show_view_priv	16	N	NO	enum	1	3	NULL	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	
 def	mysql	host	Trigger_priv	20	N	NO	enum	1	3	NULL	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	
 def	mysql	host	Update_priv	5	N	NO	enum	1	3	NULL	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')			select,insert,update,references	
-def	mysql	innodb_index_stats	database_name	1	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI		select,insert,update,references	
-def	mysql	innodb_index_stats	index_name	3	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI		select,insert,update,references	
+def	mysql	innodb_index_stats	database_name	1	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI		select,insert,update,references	
+def	mysql	innodb_index_stats	index_name	3	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI		select,insert,update,references	
 def	mysql	innodb_index_stats	last_update	4	CURRENT_TIMESTAMP	NO	timestamp	NULL	NULL	NULL	NULL	0	NULL	NULL	timestamp		on update CURRENT_TIMESTAMP	select,insert,update,references	
 def	mysql	innodb_index_stats	sample_size	7	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
-def	mysql	innodb_index_stats	stat_description	8	NULL	NO	varchar	1024	3072	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(1024)			select,insert,update,references	
-def	mysql	innodb_index_stats	stat_name	5	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI		select,insert,update,references	
+def	mysql	innodb_index_stats	stat_description	8	NULL	NO	varchar	1024	3072	NULL	NULL	NULL	utf8	utf8_bin	varchar(1024)			select,insert,update,references	
+def	mysql	innodb_index_stats	stat_name	5	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI		select,insert,update,references	
 def	mysql	innodb_index_stats	stat_value	6	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
-def	mysql	innodb_index_stats	table_name	2	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI		select,insert,update,references	
+def	mysql	innodb_index_stats	table_name	2	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI		select,insert,update,references	
 def	mysql	innodb_table_stats	clustered_index_size	5	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
-def	mysql	innodb_table_stats	database_name	1	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI		select,insert,update,references	
+def	mysql	innodb_table_stats	database_name	1	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI		select,insert,update,references	
 def	mysql	innodb_table_stats	last_update	3	CURRENT_TIMESTAMP	NO	timestamp	NULL	NULL	NULL	NULL	0	NULL	NULL	timestamp		on update CURRENT_TIMESTAMP	select,insert,update,references	
 def	mysql	innodb_table_stats	n_rows	4	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
 def	mysql	innodb_table_stats	sum_of_other_index_sizes	6	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
-def	mysql	innodb_table_stats	table_name	2	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI		select,insert,update,references	
+def	mysql	innodb_table_stats	table_name	2	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI		select,insert,update,references	
 def	mysql	ndb_binlog_index	deletes	6	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
 def	mysql	ndb_binlog_index	epoch	3	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned	PRI		select,insert,update,references	
 def	mysql	ndb_binlog_index	File	2	NULL	NO	varchar	255	255	NULL	NULL	NULL	latin1	latin1_swedish_ci	varchar(255)			select,insert,update,references	
@@ -317,6 +317,7 @@ ORDER BY CHARACTER_SET_NAME, COLLATION_N
 COL_CML	DATA_TYPE	CHARACTER_SET_NAME	COLLATION_NAME
 3.0000	char	utf8	utf8_bin
 3.0000	enum	utf8	utf8_bin
+3.0000	varchar	utf8	utf8_bin
 3.0000	char	utf8	utf8_general_ci
 3.0000	enum	utf8	utf8_general_ci
 3.0000	set	utf8	utf8_general_ci
@@ -450,16 +451,16 @@ NULL	mysql	help_topic	help_category_id	s
 3.0000	mysql	host	Alter_routine_priv	enum	1	3	utf8	utf8_general_ci	enum('N','Y')
 3.0000	mysql	host	Execute_priv	enum	1	3	utf8	utf8_general_ci	enum('N','Y')
 3.0000	mysql	host	Trigger_priv	enum	1	3	utf8	utf8_general_ci	enum('N','Y')
-3.0000	mysql	innodb_index_stats	database_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
-3.0000	mysql	innodb_index_stats	table_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
-3.0000	mysql	innodb_index_stats	index_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
+3.0000	mysql	innodb_index_stats	database_name	varchar	64	192	utf8	utf8_bin	varchar(64)
+3.0000	mysql	innodb_index_stats	table_name	varchar	64	192	utf8	utf8_bin	varchar(64)
+3.0000	mysql	innodb_index_stats	index_name	varchar	64	192	utf8	utf8_bin	varchar(64)
 NULL	mysql	innodb_index_stats	last_update	timestamp	NULL	NULL	NULL	NULL	timestamp
-3.0000	mysql	innodb_index_stats	stat_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
+3.0000	mysql	innodb_index_stats	stat_name	varchar	64	192	utf8	utf8_bin	varchar(64)
 NULL	mysql	innodb_index_stats	stat_value	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned
 NULL	mysql	innodb_index_stats	sample_size	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned
-3.0000	mysql	innodb_index_stats	stat_description	varchar	1024	3072	utf8	utf8_general_ci	varchar(1024)
-3.0000	mysql	innodb_table_stats	database_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
-3.0000	mysql	innodb_table_stats	table_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
+3.0000	mysql	innodb_index_stats	stat_description	varchar	1024	3072	utf8	utf8_bin	varchar(1024)
+3.0000	mysql	innodb_table_stats	database_name	varchar	64	192	utf8	utf8_bin	varchar(64)
+3.0000	mysql	innodb_table_stats	table_name	varchar	64	192	utf8	utf8_bin	varchar(64)
 NULL	mysql	innodb_table_stats	last_update	timestamp	NULL	NULL	NULL	NULL	timestamp
 NULL	mysql	innodb_table_stats	n_rows	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned
 NULL	mysql	innodb_table_stats	clustered_index_size	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned

=== modified file 'mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result	2011-12-06 09:18:55 +0000
+++ b/mysql-test/suite/funcs_1/r/is_columns_mysql_embedded.result	2012-01-17 13:18:08 +0000
@@ -97,20 +97,20 @@ def	mysql	host	Select_priv	3	N	NO	enum	1
 def	mysql	host	Show_view_priv	16	N	NO	enum	1	3	NULL	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
 def	mysql	host	Trigger_priv	20	N	NO	enum	1	3	NULL	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
 def	mysql	host	Update_priv	5	N	NO	enum	1	3	NULL	NULL	NULL	utf8	utf8_general_ci	enum('N','Y')				
-def	mysql	innodb_index_stats	database_name	1	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI			
-def	mysql	innodb_index_stats	index_name	3	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI			
+def	mysql	innodb_index_stats	database_name	1	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI			
+def	mysql	innodb_index_stats	index_name	3	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI			
 def	mysql	innodb_index_stats	last_update	4	CURRENT_TIMESTAMP	NO	timestamp	NULL	NULL	NULL	NULL	0	NULL	NULL	timestamp		on update CURRENT_TIMESTAMP		
 def	mysql	innodb_index_stats	sample_size	7	NULL	YES	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned				
-def	mysql	innodb_index_stats	stat_description	8	NULL	NO	varchar	1024	3072	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(1024)				
-def	mysql	innodb_index_stats	stat_name	5	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI			
+def	mysql	innodb_index_stats	stat_description	8	NULL	NO	varchar	1024	3072	NULL	NULL	NULL	utf8	utf8_bin	varchar(1024)				
+def	mysql	innodb_index_stats	stat_name	5	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI			
 def	mysql	innodb_index_stats	stat_value	6	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned				
-def	mysql	innodb_index_stats	table_name	2	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI			
+def	mysql	innodb_index_stats	table_name	2	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI			
 def	mysql	innodb_table_stats	clustered_index_size	5	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned				
-def	mysql	innodb_table_stats	database_name	1	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI			
+def	mysql	innodb_table_stats	database_name	1	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI			
 def	mysql	innodb_table_stats	last_update	3	CURRENT_TIMESTAMP	NO	timestamp	NULL	NULL	NULL	NULL	0	NULL	NULL	timestamp		on update CURRENT_TIMESTAMP		
 def	mysql	innodb_table_stats	n_rows	4	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned				
 def	mysql	innodb_table_stats	sum_of_other_index_sizes	6	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned				
-def	mysql	innodb_table_stats	table_name	2	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_general_ci	varchar(64)	PRI			
+def	mysql	innodb_table_stats	table_name	2	NULL	NO	varchar	64	192	NULL	NULL	NULL	utf8	utf8_bin	varchar(64)	PRI			
 def	mysql	ndb_binlog_index	deletes	6	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned				
 def	mysql	ndb_binlog_index	epoch	3	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	NULL	bigint(20) unsigned	PRI			
 def	mysql	ndb_binlog_index	File	2	NULL	NO	varchar	255	255	NULL	NULL	NULL	latin1	latin1_swedish_ci	varchar(255)				
@@ -317,6 +317,7 @@ ORDER BY CHARACTER_SET_NAME, COLLATION_N
 COL_CML	DATA_TYPE	CHARACTER_SET_NAME	COLLATION_NAME
 3.0000	char	utf8	utf8_bin
 3.0000	enum	utf8	utf8_bin
+3.0000	varchar	utf8	utf8_bin
 3.0000	char	utf8	utf8_general_ci
 3.0000	enum	utf8	utf8_general_ci
 3.0000	set	utf8	utf8_general_ci
@@ -450,16 +451,16 @@ NULL	mysql	help_topic	help_category_id	s
 3.0000	mysql	host	Alter_routine_priv	enum	1	3	utf8	utf8_general_ci	enum('N','Y')
 3.0000	mysql	host	Execute_priv	enum	1	3	utf8	utf8_general_ci	enum('N','Y')
 3.0000	mysql	host	Trigger_priv	enum	1	3	utf8	utf8_general_ci	enum('N','Y')
-3.0000	mysql	innodb_index_stats	database_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
-3.0000	mysql	innodb_index_stats	table_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
-3.0000	mysql	innodb_index_stats	index_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
+3.0000	mysql	innodb_index_stats	database_name	varchar	64	192	utf8	utf8_bin	varchar(64)
+3.0000	mysql	innodb_index_stats	table_name	varchar	64	192	utf8	utf8_bin	varchar(64)
+3.0000	mysql	innodb_index_stats	index_name	varchar	64	192	utf8	utf8_bin	varchar(64)
 NULL	mysql	innodb_index_stats	last_update	timestamp	NULL	NULL	NULL	NULL	timestamp
-3.0000	mysql	innodb_index_stats	stat_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
+3.0000	mysql	innodb_index_stats	stat_name	varchar	64	192	utf8	utf8_bin	varchar(64)
 NULL	mysql	innodb_index_stats	stat_value	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned
 NULL	mysql	innodb_index_stats	sample_size	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned
-3.0000	mysql	innodb_index_stats	stat_description	varchar	1024	3072	utf8	utf8_general_ci	varchar(1024)
-3.0000	mysql	innodb_table_stats	database_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
-3.0000	mysql	innodb_table_stats	table_name	varchar	64	192	utf8	utf8_general_ci	varchar(64)
+3.0000	mysql	innodb_index_stats	stat_description	varchar	1024	3072	utf8	utf8_bin	varchar(1024)
+3.0000	mysql	innodb_table_stats	database_name	varchar	64	192	utf8	utf8_bin	varchar(64)
+3.0000	mysql	innodb_table_stats	table_name	varchar	64	192	utf8	utf8_bin	varchar(64)
 NULL	mysql	innodb_table_stats	last_update	timestamp	NULL	NULL	NULL	NULL	timestamp
 NULL	mysql	innodb_table_stats	n_rows	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned
 NULL	mysql	innodb_table_stats	clustered_index_size	bigint	NULL	NULL	NULL	NULL	bigint(20) unsigned

=== modified file 'mysql-test/suite/funcs_1/r/is_tables_mysql.result'
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql.result	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql.result	2012-01-17 13:18:08 +0000
@@ -259,7 +259,7 @@ AUTO_INCREMENT	NULL
 CREATE_TIME	#CRT#
 UPDATE_TIME	#UT#
 CHECK_TIME	#CT#
-TABLE_COLLATION	utf8_general_ci
+TABLE_COLLATION	utf8_bin
 CHECKSUM	NULL
 CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#
@@ -282,7 +282,7 @@ AUTO_INCREMENT	NULL
 CREATE_TIME	#CRT#
 UPDATE_TIME	#UT#
 CHECK_TIME	#CT#
-TABLE_COLLATION	utf8_general_ci
+TABLE_COLLATION	utf8_bin
 CHECKSUM	NULL
 CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#

=== modified file 'mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result'
--- a/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/funcs_1/r/is_tables_mysql_embedded.result	2012-01-17 13:18:08 +0000
@@ -259,7 +259,7 @@ AUTO_INCREMENT	NULL
 CREATE_TIME	#CRT#
 UPDATE_TIME	#UT#
 CHECK_TIME	#CT#
-TABLE_COLLATION	utf8_general_ci
+TABLE_COLLATION	utf8_bin
 CHECKSUM	NULL
 CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#
@@ -282,7 +282,7 @@ AUTO_INCREMENT	NULL
 CREATE_TIME	#CRT#
 UPDATE_TIME	#UT#
 CHECK_TIME	#CT#
-TABLE_COLLATION	utf8_general_ci
+TABLE_COLLATION	utf8_bin
 CHECKSUM	NULL
 CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#
@@ -942,7 +942,7 @@ AUTO_INCREMENT	NULL
 CREATE_TIME	#CRT#
 UPDATE_TIME	#UT#
 CHECK_TIME	#CT#
-TABLE_COLLATION	utf8_general_ci
+TABLE_COLLATION	utf8_bin
 CHECKSUM	NULL
 CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#
@@ -965,7 +965,7 @@ AUTO_INCREMENT	NULL
 CREATE_TIME	#CRT#
 UPDATE_TIME	#UT#
 CHECK_TIME	#CT#
-TABLE_COLLATION	utf8_general_ci
+TABLE_COLLATION	utf8_bin
 CHECKSUM	NULL
 CREATE_OPTIONS	#CO#
 TABLE_COMMENT	#TC#

=== modified file 'mysql-test/suite/rpl/r/rpl_log_pos.result'
--- a/mysql-test/suite/rpl/r/rpl_log_pos.result	2012-01-04 15:48:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_log_pos.result	2012-01-17 22:32:29 +0000
@@ -12,7 +12,7 @@ change master to master_log_pos=MASTER_L
 Read_Master_Log_Pos = '75'
 start slave;
 include/wait_for_slave_io_error.inc [errno=1236]
-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
 include/stop_slave_sql.inc
 show master status;
 File	Position	Binlog_Do_DB	Binlog_Ignore_DB

=== modified file 'mysql-test/suite/rpl/r/rpl_manual_change_index_file.result'
--- a/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result	2012-01-04 15:48:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_manual_change_index_file.result	2012-01-17 22:32:29 +0000
@@ -8,7 +8,7 @@ CREATE TABLE t1(c1 INT);
 FLUSH LOGS;
 call mtr.add_suppression('Got fatal error 1236 from master when reading data from binary log: .*could not find next log');
 include/wait_for_slave_io_error.inc [errno=1236]
-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the last event was read from 'master-bin.000002' at XXX, the last byte read was read from 'master-bin.000002' at XXX.''
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'could not find next log; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000002' at XXX, the last byte read was read from 'master-bin.000002' at XXX.''
 CREATE TABLE t2(c1 INT);
 FLUSH LOGS;
 CREATE TABLE t3(c1 INT);

=== modified file 'mysql-test/suite/rpl/r/rpl_packet.result'
--- a/mysql-test/suite/rpl/r/rpl_packet.result	2012-01-04 15:48:00 +0000
+++ b/mysql-test/suite/rpl/r/rpl_packet.result	2012-01-17 22:32:29 +0000
@@ -40,7 +40,7 @@ DROP TABLE t1;
 CREATE TABLE t1 (f1 int PRIMARY KEY, f2 LONGTEXT, f3 LONGTEXT) ENGINE=MyISAM;
 INSERT INTO t1(f1, f2, f3) VALUES(1, REPEAT('a', @@global.max_allowed_packet), REPEAT('b', @@global.max_allowed_packet));
 include/wait_for_slave_io_error.inc [errno=1236]
-Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'log event entry exceeded max_allowed_packet; Increase max_allowed_packet on master; the start event position from '' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
 STOP SLAVE;
 RESET SLAVE;
 RESET MASTER;

=== modified file 'mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result'
--- a/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result	2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_stm_start_stop_slave.result	2012-01-17 22:32:29 +0000
@@ -72,6 +72,16 @@ include/wait_for_slave_to_stop.inc
 include/start_slave.inc
 # Clean up
 DROP TABLE t1;
+RESET MASTER;
+include/stop_slave.inc
+CHANGE MASTER TO master_log_pos=MASTER_POS;
+START SLAVE;
+include/wait_for_slave_param.inc [Last_IO_Errno]
+Last_IO_Errno = '1236'
+Last_IO_Error = 'Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position; the start event position from 'master-bin.000001' at XXX, the last event was read from 'master-bin.000001' at XXX, the last byte read was read from 'master-bin.000001' at XXX.''
+include/stop_slave.inc
+RESET SLAVE;
+RESET MASTER;
 SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
 call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;

=== modified file 'mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test'
--- a/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test	2011-03-17 13:20:36 +0000
+++ b/mysql-test/suite/rpl/t/rpl_stm_start_stop_slave.test	2012-01-17 22:32:29 +0000
@@ -22,5 +22,5 @@ SET @@global.innodb_flush_log_at_trx_com
 call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 --connection master
 SET @@global.innodb_flush_log_at_trx_commit= @old_innodb_flush_log_at_trx_commit;
-
+--let $rpl_only_running_threads= 1
 --source include/rpl_end.inc

=== modified file 'mysql-test/suite/sys_vars/r/all_vars.result'
--- a/mysql-test/suite/sys_vars/r/all_vars.result	2012-01-10 05:26:29 +0000
+++ b/mysql-test/suite/sys_vars/r/all_vars.result	2012-01-16 15:11:39 +0000
@@ -3,10 +3,6 @@ create table t2 (variable_name text);
 load data infile "MYSQLTEST_VARDIR/tmp/sys_vars.all_vars.txt" into table t1;
 insert into t2 select variable_name from information_schema.global_variables;
 insert into t2 select variable_name from information_schema.session_variables;
-delete from t2 where variable_name='innodb_change_buffering_debug';
-delete from t2 where variable_name='innodb_page_hash_locks';
-delete from t2 where variable_name='innodb_doublewrite_batch_size';
-delete from t2 where variable_name='innodb_trx_rseg_n_slots_debug';
 update t2 set variable_name= replace(variable_name, "PERFORMANCE_SCHEMA_", "PFS_");
 select variable_name as `There should be *no* long test name listed below:` from t2
 where length(variable_name) > 50;

=== modified file 'mysql-test/suite/sys_vars/r/character_sets_dir_basic.result'
--- a/mysql-test/suite/sys_vars/r/character_sets_dir_basic.result	2010-02-17 03:14:09 +0000
+++ b/mysql-test/suite/sys_vars/r/character_sets_dir_basic.result	2012-01-16 10:04:28 +0000
@@ -1,20 +1,20 @@
 select @@global.character_sets_dir;
 @@global.character_sets_dir
-MYSQL_CHARSETSDIR/
+MYSQL_CHARSETSDIR
 select @@session.character_sets_dir;
 ERROR HY000: Variable 'character_sets_dir' is a GLOBAL variable
 show global variables like 'character_sets_dir';
 Variable_name	Value
-character_sets_dir	MYSQL_CHARSETSDIR/
+character_sets_dir	MYSQL_CHARSETSDIR
 show session variables like 'character_sets_dir';
 Variable_name	Value
-character_sets_dir	MYSQL_CHARSETSDIR/
+character_sets_dir	MYSQL_CHARSETSDIR
 select * from information_schema.global_variables where variable_name='character_sets_dir';
 VARIABLE_NAME	VARIABLE_VALUE
-CHARACTER_SETS_DIR	MYSQL_CHARSETSDIR/
+CHARACTER_SETS_DIR	MYSQL_CHARSETSDIR
 select * from information_schema.session_variables where variable_name='character_sets_dir';
 VARIABLE_NAME	VARIABLE_VALUE
-CHARACTER_SETS_DIR	MYSQL_CHARSETSDIR/
+CHARACTER_SETS_DIR	MYSQL_CHARSETSDIR
 set global character_sets_dir="foo";
 ERROR HY000: Variable 'character_sets_dir' is a read only variable
 set session character_sets_dir="foo";

=== added file 'mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_change_buffering_debug_basic.result	2012-01-16 14:39:05 +0000
@@ -0,0 +1,64 @@
+SET @start_global_value = @@global.innodb_change_buffering_debug;
+SELECT @start_global_value;
+@start_global_value
+0
+select @@global.innodb_change_buffering_debug in (0, 1);
+@@global.innodb_change_buffering_debug in (0, 1)
+1
+select @@global.innodb_change_buffering_debug;
+@@global.innodb_change_buffering_debug
+0
+select @@session.innodb_change_buffering_debug;
+ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable
+show global variables like 'innodb_change_buffering_debug';
+Variable_name	Value
+innodb_change_buffering_debug	0
+show session variables like 'innodb_change_buffering_debug';
+Variable_name	Value
+innodb_change_buffering_debug	0
+select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_CHANGE_BUFFERING_DEBUG	0
+select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_CHANGE_BUFFERING_DEBUG	0
+set global innodb_change_buffering_debug=1;
+select @@global.innodb_change_buffering_debug;
+@@global.innodb_change_buffering_debug
+1
+select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_CHANGE_BUFFERING_DEBUG	1
+select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_CHANGE_BUFFERING_DEBUG	1
+set @@global.innodb_change_buffering_debug=0;
+select @@global.innodb_change_buffering_debug;
+@@global.innodb_change_buffering_debug
+0
+select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_CHANGE_BUFFERING_DEBUG	0
+select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_CHANGE_BUFFERING_DEBUG	0
+set session innodb_change_buffering_debug='some';
+ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable and should be set with SET GLOBAL
+set @@session.innodb_change_buffering_debug='some';
+ERROR HY000: Variable 'innodb_change_buffering_debug' is a GLOBAL variable and should be set with SET GLOBAL
+set global innodb_change_buffering_debug=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug'
+set global innodb_change_buffering_debug='foo';
+ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug'
+set global innodb_change_buffering_debug=-2;
+Warnings:
+Warning	1292	Truncated incorrect innodb_change_buffering_debug value: '-2'
+set global innodb_change_buffering_debug=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_change_buffering_debug'
+set global innodb_change_buffering_debug=2;
+Warnings:
+Warning	1292	Truncated incorrect innodb_change_buffering_debug value: '2'
+SET @@global.innodb_change_buffering_debug = @start_global_value;
+SELECT @@global.innodb_change_buffering_debug;
+@@global.innodb_change_buffering_debug
+0

=== added file 'mysql-test/suite/sys_vars/r/innodb_doublewrite_batch_size_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_doublewrite_batch_size_basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_doublewrite_batch_size_basic.result	2012-01-16 15:11:39 +0000
@@ -0,0 +1,24 @@
+select @@global.innodb_doublewrite_batch_size between 1 and 127;
+@@global.innodb_doublewrite_batch_size between 1 and 127
+1
+select @@global.innodb_doublewrite_batch_size;
+@@global.innodb_doublewrite_batch_size
+120
+select @@session.innodb_doublewrite_batch_size;
+ERROR HY000: Variable 'innodb_doublewrite_batch_size' is a GLOBAL variable
+show global variables like 'innodb_doublewrite_batch_size';
+Variable_name	Value
+innodb_doublewrite_batch_size	120
+show session variables like 'innodb_doublewrite_batch_size';
+Variable_name	Value
+innodb_doublewrite_batch_size	120
+select * from information_schema.global_variables where variable_name='innodb_doublewrite_batch_size';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_DOUBLEWRITE_BATCH_SIZE	120
+select * from information_schema.session_variables where variable_name='innodb_doublewrite_batch_size';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_DOUBLEWRITE_BATCH_SIZE	120
+set global innodb_doublewrite_batch_size=1;
+ERROR HY000: Variable 'innodb_doublewrite_batch_size' is a read only variable
+set @@session.innodb_doublewrite_batch_size='some';
+ERROR HY000: Variable 'innodb_doublewrite_batch_size' is a read only variable

=== added file 'mysql-test/suite/sys_vars/r/innodb_page_hash_locks_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_page_hash_locks_basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_page_hash_locks_basic.result	2012-01-16 15:11:39 +0000
@@ -0,0 +1,24 @@
+select @@global.innodb_page_hash_locks between 1 and 1024;
+@@global.innodb_page_hash_locks between 1 and 1024
+1
+select @@global.innodb_page_hash_locks;
+@@global.innodb_page_hash_locks
+16
+select @@session.innodb_page_hash_locks;
+ERROR HY000: Variable 'innodb_page_hash_locks' is a GLOBAL variable
+show global variables like 'innodb_page_hash_locks';
+Variable_name	Value
+innodb_page_hash_locks	16
+show session variables like 'innodb_page_hash_locks';
+Variable_name	Value
+innodb_page_hash_locks	16
+select * from information_schema.global_variables where variable_name='innodb_page_hash_locks';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_PAGE_HASH_LOCKS	16
+select * from information_schema.session_variables where variable_name='innodb_page_hash_locks';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_PAGE_HASH_LOCKS	16
+set global innodb_page_hash_locks=1;
+ERROR HY000: Variable 'innodb_page_hash_locks' is a read only variable
+set @@session.innodb_page_hash_locks='some';
+ERROR HY000: Variable 'innodb_page_hash_locks' is a read only variable

=== added file 'mysql-test/suite/sys_vars/r/innodb_trx_rseg_n_slots_debug_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_trx_rseg_n_slots_debug_basic.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_trx_rseg_n_slots_debug_basic.result	2012-01-16 14:39:05 +0000
@@ -0,0 +1,65 @@
+SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug;
+SELECT @start_global_value;
+@start_global_value
+0
+select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024;
+@@global.innodb_trx_rseg_n_slots_debug between 0 and 1024
+1
+select @@global.innodb_trx_rseg_n_slots_debug;
+@@global.innodb_trx_rseg_n_slots_debug
+0
+select @@session.innodb_trx_rseg_n_slots_debug;
+ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable
+show global variables like 'innodb_trx_rseg_n_slots_debug';
+Variable_name	Value
+innodb_trx_rseg_n_slots_debug	0
+show session variables like 'innodb_trx_rseg_n_slots_debug';
+Variable_name	Value
+innodb_trx_rseg_n_slots_debug	0
+select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_TRX_RSEG_N_SLOTS_DEBUG	0
+select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_TRX_RSEG_N_SLOTS_DEBUG	0
+set global innodb_trx_rseg_n_slots_debug=1;
+select @@global.innodb_trx_rseg_n_slots_debug;
+@@global.innodb_trx_rseg_n_slots_debug
+1
+select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_TRX_RSEG_N_SLOTS_DEBUG	1
+select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_TRX_RSEG_N_SLOTS_DEBUG	1
+set @@global.innodb_trx_rseg_n_slots_debug=0;
+select @@global.innodb_trx_rseg_n_slots_debug;
+@@global.innodb_trx_rseg_n_slots_debug
+0
+select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_TRX_RSEG_N_SLOTS_DEBUG	0
+select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+VARIABLE_NAME	VARIABLE_VALUE
+INNODB_TRX_RSEG_N_SLOTS_DEBUG	0
+set session innodb_trx_rseg_n_slots_debug='some';
+ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable and should be set with SET GLOBAL
+set @@session.innodb_trx_rseg_n_slots_debug='some';
+ERROR HY000: Variable 'innodb_trx_rseg_n_slots_debug' is a GLOBAL variable and should be set with SET GLOBAL
+set global innodb_trx_rseg_n_slots_debug=1.1;
+ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
+set global innodb_trx_rseg_n_slots_debug='foo';
+ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
+set global innodb_trx_rseg_n_slots_debug=-2;
+Warnings:
+Warning	1292	Truncated incorrect innodb_trx_rseg_n_slots_debug value: '-2'
+set global innodb_trx_rseg_n_slots_debug=1e1;
+ERROR 42000: Incorrect argument type to variable 'innodb_trx_rseg_n_slots_debug'
+set global innodb_trx_rseg_n_slots_debug=1024;
+set global innodb_trx_rseg_n_slots_debug=1025;
+Warnings:
+Warning	1292	Truncated incorrect innodb_trx_rseg_n_slots_debug value: '1025'
+SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value;
+SELECT @@global.innodb_trx_rseg_n_slots_debug;
+@@global.innodb_trx_rseg_n_slots_debug
+0

=== modified file 'mysql-test/suite/sys_vars/r/plugin_dir_basic.result'
--- a/mysql-test/suite/sys_vars/r/plugin_dir_basic.result	2011-08-16 09:08:10 +0000
+++ b/mysql-test/suite/sys_vars/r/plugin_dir_basic.result	2012-01-16 10:04:28 +0000
@@ -1,20 +1,20 @@
 select @@global.plugin_dir;
 @@global.plugin_dir
-MYSQL_TMP_DIR
+MYSQL_TMP_DIR/
 select @@session.plugin_dir;
 ERROR HY000: Variable 'plugin_dir' is a GLOBAL variable
 show global variables like 'plugin_dir';
 Variable_name	Value
-plugin_dir	MYSQL_TMP_DIR
+plugin_dir	MYSQL_TMP_DIR/
 show session variables like 'plugin_dir';
 Variable_name	Value
-plugin_dir	MYSQL_TMP_DIR
+plugin_dir	MYSQL_TMP_DIR/
 select * from information_schema.global_variables where variable_name='plugin_dir';
 VARIABLE_NAME	VARIABLE_VALUE
-PLUGIN_DIR	MYSQL_TMP_DIR
+PLUGIN_DIR	MYSQL_TMP_DIR/
 select * from information_schema.session_variables where variable_name='plugin_dir';
 VARIABLE_NAME	VARIABLE_VALUE
-PLUGIN_DIR	MYSQL_TMP_DIR
+PLUGIN_DIR	MYSQL_TMP_DIR/
 set global plugin_dir=1;
 ERROR HY000: Variable 'plugin_dir' is a read only variable
 set session plugin_dir=1;

=== modified file 'mysql-test/suite/sys_vars/t/all_vars.test'
--- a/mysql-test/suite/sys_vars/t/all_vars.test	2012-01-10 05:26:29 +0000
+++ b/mysql-test/suite/sys_vars/t/all_vars.test	2012-01-16 15:11:39 +0000
@@ -52,12 +52,6 @@ eval load data infile "$MYSQLTEST_VARDIR
 insert into t2 select variable_name from information_schema.global_variables;
 insert into t2 select variable_name from information_schema.session_variables;
 
-# These are only present in debug builds.
-delete from t2 where variable_name='innodb_change_buffering_debug';
-delete from t2 where variable_name='innodb_page_hash_locks';
-delete from t2 where variable_name='innodb_doublewrite_batch_size';
-delete from t2 where variable_name='innodb_trx_rseg_n_slots_debug';
-
 # Performance schema variables are too long for files named
 # 'mysql-test/suite/sys_vars/t/' ...
 # ... 'performance_schema_events_waits_history_long_size_basic-master.opt'

=== modified file 'mysql-test/suite/sys_vars/t/character_sets_dir_basic.test'
--- a/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test	2010-02-17 03:14:09 +0000
+++ b/mysql-test/suite/sys_vars/t/character_sets_dir_basic.test	2012-01-16 10:04:28 +0000
@@ -1,17 +1,26 @@
 #
 # show the global and session values;
 #
---replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
+
+# workaround to adjust for the directory separators being different in 
+# different OSes : slash on unixes and backslash or slash on windows.
+# TODO: fix with a proper comparison in mysqltest
+let $rcd= `SELECT REPLACE('$MYSQL_CHARSETSDIR', '\\\\\', '.')`;
+let $rcd= `SELECT REPLACE('$rcd', '/', '.')`;
+let $regex_charsetdir= `SELECT '/$rcd[\\\\\/\\\\\]/MYSQL_CHARSETSDIR/'`;
+
+--replace_regex $regex_charsetdir
 select @@global.character_sets_dir;
+
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 select @@session.character_sets_dir;
---replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
+--replace_regex $regex_charsetdir
 show global variables like 'character_sets_dir';
---replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
+--replace_regex $regex_charsetdir
 show session variables like 'character_sets_dir';
---replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
+--replace_regex $regex_charsetdir
 select * from information_schema.global_variables where variable_name='character_sets_dir';
---replace_result $MYSQL_CHARSETSDIR MYSQL_CHARSETSDIR
+--replace_regex $regex_charsetdir
 select * from information_schema.session_variables where variable_name='character_sets_dir';
 
 #

=== added file 'mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_change_buffering_debug_basic.test	2012-01-16 14:39:05 +0000
@@ -0,0 +1,52 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+SET @start_global_value = @@global.innodb_change_buffering_debug;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_change_buffering_debug in (0, 1);
+select @@global.innodb_change_buffering_debug;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_change_buffering_debug;
+show global variables like 'innodb_change_buffering_debug';
+show session variables like 'innodb_change_buffering_debug';
+select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
+select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
+
+#
+# show that it's writable
+#
+set global innodb_change_buffering_debug=1;
+select @@global.innodb_change_buffering_debug;
+select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
+select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
+set @@global.innodb_change_buffering_debug=0;
+select @@global.innodb_change_buffering_debug;
+select * from information_schema.global_variables where variable_name='innodb_change_buffering_debug';
+select * from information_schema.session_variables where variable_name='innodb_change_buffering_debug';
+--error ER_GLOBAL_VARIABLE
+set session innodb_change_buffering_debug='some';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_change_buffering_debug='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffering_debug=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffering_debug='foo';
+set global innodb_change_buffering_debug=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_change_buffering_debug=1e1;
+set global innodb_change_buffering_debug=2;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_change_buffering_debug = @start_global_value;
+SELECT @@global.innodb_change_buffering_debug;

=== added file 'mysql-test/suite/sys_vars/t/innodb_doublewrite_batch_size_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_doublewrite_batch_size_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_doublewrite_batch_size_basic.test	2012-01-16 15:11:39 +0000
@@ -0,0 +1,22 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+#
+# exists as global only
+#
+select @@global.innodb_doublewrite_batch_size between 1 and 127;
+select @@global.innodb_doublewrite_batch_size;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_doublewrite_batch_size;
+show global variables like 'innodb_doublewrite_batch_size';
+show session variables like 'innodb_doublewrite_batch_size';
+select * from information_schema.global_variables where variable_name='innodb_doublewrite_batch_size';
+select * from information_schema.session_variables where variable_name='innodb_doublewrite_batch_size';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_doublewrite_batch_size=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set @@session.innodb_doublewrite_batch_size='some';

=== added file 'mysql-test/suite/sys_vars/t/innodb_page_hash_locks_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_page_hash_locks_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_page_hash_locks_basic.test	2012-01-16 15:11:39 +0000
@@ -0,0 +1,22 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+#
+# exists as global only
+#
+select @@global.innodb_page_hash_locks between 1 and 1024;
+select @@global.innodb_page_hash_locks;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_page_hash_locks;
+show global variables like 'innodb_page_hash_locks';
+show session variables like 'innodb_page_hash_locks';
+select * from information_schema.global_variables where variable_name='innodb_page_hash_locks';
+select * from information_schema.session_variables where variable_name='innodb_page_hash_locks';
+
+#
+# show that it's read-only
+#
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set global innodb_page_hash_locks=1;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+set @@session.innodb_page_hash_locks='some';

=== added file 'mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_trx_rseg_n_slots_debug_basic.test	2012-01-16 14:39:05 +0000
@@ -0,0 +1,53 @@
+--source include/have_innodb.inc
+--source include/have_debug.inc
+
+SET @start_global_value = @@global.innodb_trx_rseg_n_slots_debug;
+SELECT @start_global_value;
+
+#
+# exists as global only
+#
+select @@global.innodb_trx_rseg_n_slots_debug between 0 and 1024;
+select @@global.innodb_trx_rseg_n_slots_debug;
+--error ER_INCORRECT_GLOBAL_LOCAL_VAR
+select @@session.innodb_trx_rseg_n_slots_debug;
+show global variables like 'innodb_trx_rseg_n_slots_debug';
+show session variables like 'innodb_trx_rseg_n_slots_debug';
+select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+
+#
+# show that it's writable
+#
+set global innodb_trx_rseg_n_slots_debug=1;
+select @@global.innodb_trx_rseg_n_slots_debug;
+select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+set @@global.innodb_trx_rseg_n_slots_debug=0;
+select @@global.innodb_trx_rseg_n_slots_debug;
+select * from information_schema.global_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+select * from information_schema.session_variables where variable_name='innodb_trx_rseg_n_slots_debug';
+--error ER_GLOBAL_VARIABLE
+set session innodb_trx_rseg_n_slots_debug='some';
+--error ER_GLOBAL_VARIABLE
+set @@session.innodb_trx_rseg_n_slots_debug='some';
+
+#
+# incorrect types
+#
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_trx_rseg_n_slots_debug=1.1;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_trx_rseg_n_slots_debug='foo';
+set global innodb_trx_rseg_n_slots_debug=-2;
+--error ER_WRONG_TYPE_FOR_VAR
+set global innodb_trx_rseg_n_slots_debug=1e1;
+set global innodb_trx_rseg_n_slots_debug=1024;
+set global innodb_trx_rseg_n_slots_debug=1025;
+
+#
+# Cleanup
+#
+
+SET @@global.innodb_trx_rseg_n_slots_debug = @start_global_value;
+SELECT @@global.innodb_trx_rseg_n_slots_debug;

=== modified file 'mysql-test/t/ctype_many.test'
--- a/mysql-test/t/ctype_many.test	2011-01-17 12:26:13 +0000
+++ b/mysql-test/t/ctype_many.test	2012-01-16 09:01:53 +0000
@@ -319,3 +319,15 @@ DROP TABLE t2;
 --echo #
 --echo # End of 5.5 tests
 --echo #
+
+--echo #
+--echo # Bug#11766143 59185: ASSERTION FAILED: (FIXED == 1), FILE
+--echo # ITEM_STRFUNC.CC, LINE 2760
+--echo #
+CREATE TABLE t1 (a CHAR(1) CHARSET UTF8);
+INSERT INTO t1 VALUES ('a'), ('b');
+CREATE TABLE t2 (a BINARY(1));
+--error ER_SUBQUERY_NO_1_ROW
+SELECT * FROM t2 WHERE a=(SELECT a FROM t1) AND a=_LATIN1'x';
+DROP TABLE t2;
+DROP TABLE t1;

=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test	2012-01-13 08:36:43 +0000
+++ b/mysql-test/t/func_time.test	2012-01-17 08:23:57 +0000
@@ -1005,6 +1005,27 @@ drop table t1;
 --echo #
 
 --echo #
+--echo # BUG#13545236 - ASSERT IN SEC_SINCE_EPOCH
+--echo #
+CREATE TABLE t1 (a TIME NOT NULL);
+INSERT INTO t1 VALUES ('04:39:24');
+INSERT INTO t1 VALUES ('00:20:09');
+SELECT a FROM t1
+WHERE CONVERT_TZ(TIMESTAMPADD(YEAR , a, TIMESTAMP('0000-00-00')),
+                 '+00:00','+00:00');
+SELECT a FROM t1
+WHERE CONVERT_TZ(TIMESTAMPADD(YEAR, a, DATE('0000-00-00')),
+                 '+00:00','+00:00');
+DROP TABLE t1;
+CREATE TABLE t1 (a TIME);
+INSERT INTO t1 VALUES ('00:00:00');
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, TIMESTAMP('0000-00-01')) IS NULL;
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, TIMESTAMP'0000-00-01 00:00:00') IS NULL;
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, DATE('0000-00-01')) IS NULL;
+SELECT * FROM t1 WHERE TIMESTAMPDIFF(MONTH, a, DATE'0000-00-01') IS NULL;
+DROP TABLE t1;
+
+--echo #
 --echo # BUG#13354387 - CRASH IN IN MY_DECIMAL::OPERATOR FOR VIEW AND FUNCTION UNIX_TIMESTAMP 
 --echo # Part2 (5.6)
 CREATE TABLE t1 (a VARCHAR(32) NOT NULL);

=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test	2011-10-06 09:50:40 +0000
+++ b/mysql-test/t/partition.test	2012-01-18 13:03:10 +0000
@@ -2433,3 +2433,27 @@ SELECT 1 FROM t1 AS t1_0 JOIN t1 ON t1_0
 SELECT * FROM vtmp;
 DROP VIEW vtmp;
 DROP TABLE t1;
+
+--echo #
+--echo # Bug#13580775 ASSERTION FAILED: RECORD_LENGTH == M_RECORD_LENGTH,
+--echo # FILE FILESORT_UTILS.CC
+--echo #
+
+CREATE TABLE t1 (
+  a INT PRIMARY KEY,
+  b INT,
+  c CHAR(1),
+  d INT,
+  KEY (c,d)
+) PARTITION BY KEY () PARTITIONS 1;
+
+INSERT INTO t1 VALUES (1,1,'a',1), (2,2,'a',1);
+
+SELECT 1 FROM t1 WHERE 1 IN
+(SELECT  group_concat(b)
+ FROM t1
+ WHERE c > geomfromtext('point(1 1)')
+ GROUP BY b
+);
+
+DROP TABLE t1;

=== modified file 'mysql-test/t/user_var.test'
--- a/mysql-test/t/user_var.test	2011-10-27 08:08:46 +0000
+++ b/mysql-test/t/user_var.test	2012-01-17 14:44:49 +0000
@@ -415,3 +415,24 @@ INSERT INTO t1 VALUES (1), (2);
 SELECT DISTINCT @a:=MIN(t1.a) FROM t1, t1 AS t2
 GROUP BY @b:=(SELECT COUNT(*) > t2.a);
 DROP TABLE t1;
+
+#
+# Bug #11764371 57196: MORE FUN WITH ASSERTION: !TABLE->FILE ||
+# TABLE->FILE->INITED == HANDLER::
+#
+
+CREATE TABLE t1(a INT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (0);
+SELECT DISTINCT POW(COUNT(*), @a:=(SELECT 1 FROM t1 LEFT JOIN t1 AS t2 ON @a))
+AS b FROM t1 GROUP BY a;
+SELECT @a;
+DROP TABLE t1;
+CREATE TABLE t1(f1 INT, f2 INT);
+INSERT INTO t1 VALUES (1,2),(2,3),(3,1);
+CREATE TABLE t2(a INT);
+INSERT INTO t2 VALUES (1);
+SET @var=NULL;
+SELECT @var:=(SELECT f2 FROM t2 WHERE @var) FROM t1 GROUP BY f1 ORDER BY f2 DESC
+LIMIT 1;
+SELECT @var;
+DROP TABLE t1, t2;

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2011-12-14 08:24:11 +0000
+++ b/scripts/mysql_system_tables.sql	2012-01-17 09:04:19 +0000
@@ -117,7 +117,7 @@ CREATE TABLE IF NOT EXISTS innodb_table_
 	clustered_index_size		BIGINT UNSIGNED NOT NULL,
 	sum_of_other_index_sizes	BIGINT UNSIGNED NOT NULL,
 	PRIMARY KEY (database_name, table_name)
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
+) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 CREATE TABLE IF NOT EXISTS innodb_index_stats (
 	database_name			VARCHAR(64) NOT NULL,
@@ -135,7 +135,7 @@ CREATE TABLE IF NOT EXISTS innodb_index_
 	PRIMARY KEY (database_name, table_name, index_name, stat_name),
 	FOREIGN KEY (database_name, table_name)
 	  REFERENCES innodb_table_stats (database_name, table_name)
-) ENGINE=INNODB DEFAULT CHARSET=utf8;
+) ENGINE=INNODB DEFAULT CHARSET=utf8 COLLATE=utf8_bin;
 
 SET SESSION sql_mode=@sql_mode_orig;
 

=== modified file 'scripts/mysqld_safe.sh'
--- a/scripts/mysqld_safe.sh	2011-11-18 12:48:52 +0000
+++ b/scripts/mysqld_safe.sh	2012-01-17 09:39:54 +0000
@@ -741,17 +741,55 @@ cmd="$cmd $args"
 test -n "$NOHUP_NICENESS" && cmd="$cmd < /dev/null"
 
 log_notice "Starting $MYSQLD daemon with databases from $DATADIR"
+
+# variable to track the current number of "fast" (a.k.a. subsecond) restarts
+fast_restart=0
+# maximum number of restarts before trottling kicks in
+max_fast_restarts=5
+# flag whether a usable sleep command exists
+have_sleep=1
+
 while true
 do
   rm -f $safe_mysql_unix_port "$pid_file"	# Some extra safety
 
+  start_time=`date +%M%S`
+
   eval_log_error "$cmd"
 
+  end_time=`date +%M%S`
+
   if test ! -f "$pid_file"		# This is removed if normal shutdown
   then
     break
   fi
 
+
+  # sanity check if time reading is sane and there's sleep
+  if test $end_time -gt 0 -a $have_sleep -gt 0
+  then
+    # throttle down the fast restarts
+    if test $end_time -eq $start_time
+    then
+      fast_restart=`expr $fast_restart + 1`
+      if test $fast_restart -ge $max_fast_restarts
+      then
+        log_notice "The server is respawning too fast. Sleeping for 1 second."
+        sleep 1
+        sleep_state=$?
+        if test $sleep_state -gt 0
+        then
+          log_notice "The server is respawning too fast and no working sleep command. Turning off trottling."
+          have_sleep=0
+        fi
+
+        fast_restart=0
+      fi
+    else
+      fast_restart=0
+    fi
+  fi
+
   if @TARGET_LINUX@ && test $KILL_MYSQLD -eq 1
   then
     # Test if one process was hanging.

=== modified file 'scripts/mysqlhotcopy.sh'
--- a/scripts/mysqlhotcopy.sh	2011-06-30 15:46:53 +0000
+++ b/scripts/mysqlhotcopy.sh	2012-01-17 03:25:57 +0000
@@ -272,23 +272,28 @@ if ( defined $opt{regexp} ) {
     }
 }
 
-# --- get list of tables to hotcopy ---
+# --- get list of tables and views to hotcopy ---
 
 my $hc_locks = "";
 my $hc_tables = "";
+my $hc_base_tables = "";
+my $hc_views = "";
+my $num_base_tables = 0;
+my $num_views = 0;
 my $num_tables = 0;
 my $num_files = 0;
 
 foreach my $rdb ( @db_desc ) {
     my $db = $rdb->{src};
-    my @dbh_tables = get_list_of_tables( $db );
+    my @dbh_base_tables = get_list_of_tables( $db );
+    my @dbh_views = get_list_of_views( $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
+      @dbh_base_tables = grep 
+        { !/^(apply_status|schema|general_log|slow_log)$/ } @dbh_base_tables
     }
 
     ## generate regex for tables/files
@@ -303,11 +308,20 @@ foreach my $rdb ( @db_desc ) {
 
         ## filter (out) tables specified in t_regex
         print "Filtering tables with '$t_regex'\n" if $opt{debug};
-        @dbh_tables = ( $negated 
-                        ? grep { $_ !~ $t_regex } @dbh_tables
-                        : grep { $_ =~ $t_regex } @dbh_tables );
+        @dbh_base_tables = ( $negated 
+                             ? grep { $_ !~ $t_regex } @dbh_base_tables
+                             : grep { $_ =~ $t_regex } @dbh_base_tables );
+
+        ## filter (out) views specified in t_regex
+        print "Filtering tables with '$t_regex'\n" if $opt{debug};
+        @dbh_views = ( $negated 
+                       ? grep { $_ !~ $t_regex } @dbh_views
+                       : grep { $_ =~ $t_regex } @dbh_views );
     }
 
+    ## Now concatenate the base table and view arrays.
+    my @dbh_tables = (@dbh_base_tables, @dbh_views);
+
     ## get list of files to copy
     my $db_dir = "$datadir/$db";
     opendir(DBDIR, $db_dir ) 
@@ -347,15 +361,25 @@ foreach my $rdb ( @db_desc ) {
 
     $rdb->{files}  = [ @db_files ];
     $rdb->{index}  = [ @index_files ];
-    my @hc_tables = map { quote_names("$db.$_") } @dbh_tables;
+    my @hc_base_tables = map { quote_names("$db.$_") } @dbh_base_tables;
+    my @hc_views = map { quote_names("$db.$_") } @dbh_views;
+    
+    my @hc_tables = (@hc_base_tables, @hc_views);
     $rdb->{tables} = [ @hc_tables ];
 
     $hc_locks .= ", "  if ( length $hc_locks && @hc_tables );
     $hc_locks .= join ", ", map { "$_ READ" } @hc_tables;
-    $hc_tables .= ", "  if ( length $hc_tables && @hc_tables );
-    $hc_tables .= join ", ", @hc_tables;
 
-    $num_tables += scalar @hc_tables;
+    $hc_base_tables .= ", "  if ( length $hc_base_tables && @hc_base_tables );
+    $hc_base_tables .= join ", ", @hc_base_tables;
+    $hc_views .= ", "  if ( length $hc_views && @hc_views );
+    $hc_views .= join ", ", @hc_views;
+
+    @hc_tables = (@hc_base_tables, @hc_views);
+
+    $num_base_tables += scalar @hc_base_tables;
+    $num_views += scalar @hc_views;
+    $num_tables += $num_base_tables + $num_views;
     $num_files  += scalar @{$rdb->{files}};
 }
 
@@ -467,7 +491,10 @@ if ( $opt{dryrun} ) {
         print "FLUSH TABLES /*!32323 $hc_tables */\n";
     }
     else {
-        print "FLUSH TABLES $hc_tables WITH READ LOCK\n";
+        # Lock base tables and views separately.
+        print "FLUSH TABLES $hc_base_tables WITH READ LOCK\n"
+          if ( $hc_base_tables );
+        print "LOCK TABLES $hc_views READ\n" if ( $hc_views );
     }
     
     print "FLUSH LOGS\n" if ( $opt{flushlog} );
@@ -484,16 +511,24 @@ else {
         # flush tables to make on-disk copy up to date
         $start = time;
         $dbh->do("FLUSH TABLES /*!32323 $hc_tables */");
+        printf "Flushed tables ($hc_tables) in %d seconds.\n", time-$start unless $opt{quiet};
     }
     else {
-        $dbh->do("FLUSH TABLES $hc_tables WITH READ LOCK");
-        printf "Locked $num_tables tables in %d seconds.\n", time-$start unless $opt{quiet};
-        $hc_started = time;	# count from time lock is granted
+        # Lock base tables and views separately, as 'FLUSH TABLES <tbl_name>
+        # ... WITH READ LOCK' (introduced in 5.5) would fail for views.
+        # Also, flush tables to make on-disk copy up to date
+        $dbh->do("FLUSH TABLES $hc_base_tables WITH READ LOCK")
+          if ( $hc_base_tables );
+        printf "Flushed $num_base_tables tables with read lock ($hc_base_tables) in %d seconds.\n",
+               time-$start unless $opt{quiet};
 
-        # flush tables to make on-disk copy up to date
         $start = time;
+        $dbh->do("LOCK TABLES $hc_views READ") if ( $hc_views );
+        printf "Locked $num_views views ($hc_views) in %d seconds.\n",
+               time-$start unless $opt{quiet};
+
+        $hc_started = time;	# count from time lock is granted
     }
-    printf "Flushed tables ($hc_tables) in %d seconds.\n", time-$start unless $opt{quiet};
     $dbh->do( "FLUSH LOGS" ) if ( $opt{flushlog} );
     $dbh->do( "RESET MASTER" ) if ( $opt{resetmaster} );
     $dbh->do( "RESET SLAVE" ) if ( $opt{resetslave} );
@@ -802,14 +837,29 @@ sub get_list_of_tables {
 
     my $tables =
         eval {
-            $dbh->selectall_arrayref('SHOW TABLES FROM ' .
-                                     $dbh->quote_identifier($db))
+            $dbh->selectall_arrayref('SHOW FULL TABLES FROM ' .
+                                     $dbh->quote_identifier($db) .
+                                     ' WHERE Table_type = \'BASE TABLE\'')
         } || [];
     warn "Unable to retrieve list of tables in $db: $@" if $@;
 
     return (map { $_->[0] } @$tables);
 }
 
+sub get_list_of_views {
+    my ( $db ) = @_;
+
+    my $views =
+        eval {
+            $dbh->selectall_arrayref('SHOW FULL TABLES FROM ' .
+                                     $dbh->quote_identifier($db) .
+                                     ' WHERE Table_type = \'VIEW\'')
+        } || [];
+    warn "Unable to retrieve list of views in $db: $@" if $@;
+
+    return (map { $_->[0] } @$views);
+}
+
 sub quote_names {
   my ( $name ) = @_;
   # given a db.table name, add quotes

=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc	2012-01-12 14:53:51 +0000
+++ b/sql/filesort.cc	2012-01-18 13:03:10 +0000
@@ -38,6 +38,7 @@
 #include "opt_trace.h"
 
 #include <algorithm>
+#include <utility>
 using std::max;
 using std::min;
 
@@ -284,6 +285,19 @@ ha_rows filesort(THD *thd, TABLE *table,
     {
       ha_rows keys= memory_available / (param.rec_length + sizeof(char*));
       param.max_keys_per_buffer= (uint) min(num_rows, keys);
+      if (table_sort.get_sort_keys())
+      {
+        // If we have already allocated a buffer, it better have same size!
+        if (std::make_pair(param.max_keys_per_buffer, param.rec_length) !=
+            table_sort.sort_buffer_properties())
+        {
+          /*
+           table->sort will still have a pointer to the same buffer,
+           but that will be overwritten by the assignment below.
+          */
+          table_sort.free_sort_buffer();
+        }
+      }
       table_sort.alloc_sort_buffer(param.max_keys_per_buffer, param.rec_length);
       if (table_sort.get_sort_keys())
         break;
@@ -444,7 +458,10 @@ ha_rows filesort(THD *thd, TABLE *table,
 #ifdef SKIP_DBUG_IN_FILESORT
   DBUG_POP();			/* Ok to DBUG */
 #endif
+
+  // Assign the copy back!
   table->sort= table_sort;
+
   DBUG_PRINT("exit",
              ("num_rows: %ld examined_rows: %ld found_rows: %ld",
               (long) num_rows, (long) *examined_rows, (long) *found_rows));

=== modified file 'sql/filesort_utils.h'
--- a/sql/filesort_utils.h	2011-11-07 15:32:36 +0000
+++ b/sql/filesort_utils.h	2012-01-18 13:03:10 +0000
@@ -20,6 +20,8 @@
 #include "my_base.h"
 #include "sql_array.h"
 
+#include <utility>
+
 /*
   Calculate cost of merge sort
 
@@ -86,6 +88,10 @@ public:
   /// Allocates the buffer, but does *not* initialize pointers.
   uchar **alloc_sort_buffer(uint num_records, uint record_length);
 
+  /// What is the <num_records, record_length> for the buffer?
+  std::pair<uint, uint> sort_buffer_properties()
+  { return std::make_pair(m_idx_array.size(), m_record_length); }
+
   /// Frees the buffer.
   void free_sort_buffer();
 

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2012-01-17 09:27:34 +0000
+++ b/sql/item.cc	2012-01-18 13:53:47 +0000
@@ -8507,12 +8507,18 @@ bool Item_cache_datetime::get_date(MYSQL
       return false;
     }
   case MYSQL_TYPE_DATE:
-    TIME_from_longlong_date_packed(ltime, int_value);
-    return false;
+    {
+      int warnings= 0;
+      TIME_from_longlong_date_packed(ltime, int_value);
+      return check_date(ltime, non_zero_date(ltime), fuzzydate, &warnings);
+    }
   case MYSQL_TYPE_DATETIME:
   case MYSQL_TYPE_TIMESTAMP:
-    TIME_from_longlong_datetime_packed(ltime, int_value);
-    return false;
+    {
+      int warnings= 0;
+      TIME_from_longlong_datetime_packed(ltime, int_value);
+      return check_date(ltime, non_zero_date(ltime), fuzzydate, &warnings);
+    }
   default:
     DBUG_ASSERT(0);
   }

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2012-01-12 13:22:52 +0000
+++ b/sql/item_cmpfunc.cc	2012-01-16 09:01:53 +0000
@@ -5987,7 +5987,8 @@ void Item_equal::compare_const(Item *c)
   else
   {
     Item_func_eq *func= new Item_func_eq(c, const_item);
-    func->set_cmp_func();
+    if(func->set_cmp_func())
+      return;
     func->quick_fix_field();
     cond_false= !func->val_int();
   }

=== modified file 'sql/item_cmpfunc.h'
--- a/sql/item_cmpfunc.h	2011-11-28 09:36:45 +0000
+++ b/sql/item_cmpfunc.h	2012-01-16 09:01:53 +0000
@@ -370,9 +370,9 @@ public:
   Item_bool_func2(Item *a,Item *b)
     :Item_int_func(a,b), cmp(tmp_arg, tmp_arg+1), abort_on_null(FALSE) {}
   void fix_length_and_dec();
-  void set_cmp_func()
+  int set_cmp_func()
   {
-    cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, TRUE);
+    return cmp.set_cmp_func(this, tmp_arg, tmp_arg+1, TRUE);
   }
   optimize_type select_optimize() const { return OPTIMIZE_OP; }
   virtual enum Functype rev_functype() const { return UNKNOWN_FUNC; }

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	2011-11-17 13:41:28 +0000
+++ b/sql/item_func.h	2012-01-17 14:44:49 +0000
@@ -1555,6 +1555,7 @@ class Item_var_func :public Item_func
 {
 public:
   Item_var_func() :Item_func() { }
+  Item_var_func(THD *thd, Item_var_func *item) :Item_func(thd, item) { }
   Item_var_func(Item *a) :Item_func(a) { }
   bool get_date(MYSQL_TIME *ltime, uint fuzzydate)
   {
@@ -1604,6 +1605,12 @@ public:
     :Item_var_func(b), cached_result_type(INT_RESULT),
      entry(NULL), entry_thread_id(0), name(a)
   {}
+  Item_func_set_user_var(THD *thd, Item_func_set_user_var *item)
+    :Item_var_func(thd, item), cached_result_type(item->cached_result_type),
+     entry(item->entry), entry_thread_id(item->entry_thread_id),
+     value(item->value), decimal_buff(item->decimal_buff),
+     null_item(item->null_item), save_result(item->save_result), name(item->name)
+  {}
   enum Functype functype() const { return SUSERVAR_FUNC; }
   double val_real();
   longlong val_int();

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-12-16 15:53:16 +0000
+++ b/sql/mysqld.cc	2012-01-17 09:39:54 +0000
@@ -8153,8 +8153,10 @@ static int fix_paths(void)
   (void) my_load_path(mysql_home,mysql_home,""); // Resolve current dir
   (void) my_load_path(mysql_real_data_home,mysql_real_data_home,mysql_home);
   (void) my_load_path(pidfile_name, pidfile_name_ptr, mysql_real_data_home);
-  (void) my_load_path(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr :
-                                      get_relative_path(PLUGINDIR), mysql_home);
+
+  convert_dirname(opt_plugin_dir, opt_plugin_dir_ptr ? opt_plugin_dir_ptr : 
+                                  get_relative_path(PLUGINDIR), NullS);
+  (void) my_load_path(opt_plugin_dir, opt_plugin_dir, mysql_home);
   opt_plugin_dir_ptr= opt_plugin_dir;
 
   my_realpath(mysql_unpacked_real_data_home, mysql_real_data_home, MYF(0));

=== modified file 'sql/rpl_master.cc'
--- a/sql/rpl_master.cc	2011-11-18 12:48:52 +0000
+++ b/sql/rpl_master.cc	2012-01-17 22:32:29 +0000
@@ -629,8 +629,7 @@ void mysql_binlog_send(THD* thd, char* l
   String* packet = &thd->packet;
   int error;
   const char *errmsg = "Unknown error";
-  const char *fmt= "%s; the last event was read from '%s' at %s, the last byte read was read from '%s' at %s.";
-  char llbuff1[22], llbuff2[22];
+  char llbuff0[22], llbuff1[22], llbuff2[22];
   char error_text[MAX_SLAVE_ERRMSG]; // to be send to slave via my_message()
   NET* net = &thd->net;
   mysql_mutex_t *log_lock;
@@ -664,16 +663,15 @@ void mysql_binlog_send(THD* thd, char* l
   */
   ulonglong heartbeat_period= get_heartbeat_period(thd);
   struct timespec heartbeat_buf;
-  struct event_coordinates coord_buf;
   struct timespec *heartbeat_ts= NULL;
-  struct event_coordinates *coord= NULL;
+  const LOG_POS_COORD start_coord= { log_ident, pos },
+    *p_start_coord= &start_coord;
+  LOG_POS_COORD coord_buf= { log_file_name, BIN_LOG_HEADER_SIZE },
+    *p_coord= &coord_buf;
   if (heartbeat_period != LL(0))
   {
     heartbeat_ts= &heartbeat_buf;
     set_timespec_nsec(*heartbeat_ts, 0);
-    coord= &coord_buf;
-    coord->file_name= log_file_name; // initialization basing on what slave remembers
-    coord->pos= pos;
   }
   sql_print_information("Start binlog_dump to slave_server(%d), pos(%s, %lu)",
                         thd->server_id, log_ident, (ulong)pos);
@@ -794,6 +792,7 @@ impossible position";
     mysql_bin_log, and it's already inited, and it will be destroyed
     only at shutdown).
   */
+  p_coord->pos= pos; // the first hb matches the slave's last seen value
   log_lock= mysql_bin_log.get_log_lock();
   log_cond= mysql_bin_log.get_log_cond();
   if (pos > BIN_LOG_HEADER_SIZE)
@@ -915,8 +914,7 @@ impossible position";
       /*
         log's filename does not change while it's active
       */
-      if (coord)
-        coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
+      p_coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
 
       event_type= (Log_event_type)((*packet)[LOG_EVENT_OFFSET+ev_offset]);
       DBUG_EXECUTE_IF("dump_thread_wait_before_send_xid",
@@ -1090,8 +1088,7 @@ impossible position";
 	  /* we read successfully, so we'll need to send it to the slave */
           mysql_mutex_unlock(log_lock);
 	  read_packet = 1;
-          if (coord)
-            coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
+          p_coord->pos= uint4korr(packet->ptr() + ev_offset + LOG_POS_OFFSET);
           event_type= (Log_event_type)((*packet)[LOG_EVENT_OFFSET+ev_offset]);
           DBUG_ASSERT(event_type != FORMAT_DESCRIPTION_EVENT);
 	  break;
@@ -1114,16 +1111,16 @@ impossible position";
           signal_cnt= mysql_bin_log.signal_cnt;
           do 
           {
-            if (coord)
+            if (heartbeat_period != 0)
             {
-              DBUG_ASSERT(heartbeat_ts && heartbeat_period != 0);
+              DBUG_ASSERT(heartbeat_ts);
               set_timespec_nsec(*heartbeat_ts, heartbeat_period);
             }
             thd->ENTER_COND(log_cond, log_lock,
                             &stage_master_has_sent_all_binlog_to_slave,
                             &old_stage);
             ret= mysql_bin_log.wait_for_update_bin_log(thd, heartbeat_ts);
-            DBUG_ASSERT(ret == 0 || (heartbeat_period != 0 && coord != NULL));
+            DBUG_ASSERT(ret == 0 || (heartbeat_period != 0));
             if (ret == ETIMEDOUT || ret == ETIME)
             {
 #ifndef DBUG_OFF
@@ -1141,7 +1138,7 @@ impossible position";
                 thd->EXIT_COND(&old_stage);
                 goto err;
               }
-              if (send_heartbeat_event(net, packet, coord, current_checksum_alg))
+              if (send_heartbeat_event(net, packet, p_coord, current_checksum_alg))
               {
                 errmsg = "Failed on my_net_write()";
                 my_errno= ER_UNKNOWN_ERROR;
@@ -1252,8 +1249,7 @@ impossible position";
 	goto err;
       }
 
-      if (coord)
-        coord->file_name= log_file_name; // reset to the next
+      p_coord->file_name= log_file_name; // reset to the next
     }
   }
 
@@ -1279,9 +1275,12 @@ err:
        detailing the fatal error message with coordinates 
        of the last position read.
     */
+    const char *fmt= "%s; the start event position from '%s' at %s, the last event was read from '%s' at %s, the last byte read was read from '%s' at %s.";
     my_snprintf(error_text, sizeof(error_text), fmt, errmsg,
-                coord->file_name, (llstr(coord->pos, llbuff1), llbuff1),
-                log_file_name, (llstr(my_b_tell(&log), llbuff2), llbuff2));
+                p_start_coord->file_name,
+                (llstr(p_start_coord->pos, llbuff0), llbuff0),
+                p_coord->file_name, (llstr(p_coord->pos, llbuff1), llbuff1),
+                log_file_name,    (llstr(my_b_tell(&log), llbuff2), llbuff2));
   }
   else
     strcpy(error_text, errmsg);

=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt	2011-11-28 07:42:18 +0000
+++ b/sql/share/errmsg-utf8.txt	2012-01-17 22:32:29 +0000
@@ -4701,14 +4701,14 @@ ER_NOT_SUPPORTED_YET 42000 
         spa "Esta versión de MySQL no soporta todavia '%s'"
         swe "Denna version av MySQL kan ännu inte utföra '%s'"
 ER_MASTER_FATAL_ERROR_READING_BINLOG  
-        nla "Kreeg fatale fout %d: '%-.256s' van master tijdens lezen van data uit binaire log"
-        eng "Got fatal error %d from master when reading data from binary log: '%-.256s'"
-        ger "Schwerer Fehler %d: '%-.256s vom Master beim Lesen des binären Logs"
-        ita "Errore fatale %d: '%-.256s' dal master leggendo i dati dal log binario"
-        por "Obteve fatal erro %d: '%-.256s' do master quando lendo dados do binary log"
-        rus "Получена неисправимая ошдвоичного журнала"
-        spa "Recibió fatal error %d: '%-.256s' del master cuando leyendo datos del binary log"
-        swe "Fick fatalt fel %d: '%-.256s' från master vid läsning av binärloggen"
+        nla "Kreeg fatale fout %d: '%-.512s' van master tijdens lezen van data uit binaire log"
+        eng "Got fatal error %d from master when reading data from binary log: '%-.512s'"
+        ger "Schwerer Fehler %d: '%-.512s vom Master beim Lesen des binären Logs"
+        ita "Errore fatale %d: '%-.512s' dal master leggendo i dati dal log binario"
+        por "Obteve fatal erro %d: '%-.512s' do master quando lendo dados do binary log"
+        rus "П%-.512s' от головного сервера в процессе выборки данных из двоичн%d: '%-.512s' del master cuando leyendo datos del binary log"
+        swe "Fick fatalt fel %d: '%-.512s' från master vid läsning av binärloggen"
 ER_SLAVE_IGNORED_TABLE  
         eng "Slave SQL thread ignored the query because of replicate-*-table rules"
         ger "Slave-SQL-Thread hat die Abfrage aufgrund von replicate-*-table-Regeln ignoriert"

=== modified file 'sql/sql_executor.cc'
--- a/sql/sql_executor.cc	2012-01-17 09:27:34 +0000
+++ b/sql/sql_executor.cc	2012-01-18 13:53:47 +0000
@@ -4680,64 +4680,88 @@ change_to_use_tmp_fields(THD *thd, Ref_p
   res_selected_fields.empty();
   res_all_fields.empty();
 
-  uint i, border= all_fields.elements - elements;
-  for (i= 0; (item= it++); i++)
+  uint border= all_fields.elements - elements;
+  for (uint i= 0; (item= it++); i++)
   {
     Field *field;
-
-    if ((item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) ||
-        (item->type() == Item::FUNC_ITEM &&
-         ((Item_func*)item)->functype() == Item_func::SUSERVAR_FUNC))
+    if (item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM)
       item_field= item;
-    else
+    else if (item->type() == Item::FIELD_ITEM)
+      item_field= item->get_tmp_table_item(thd);
+    else if (item->type() == Item::FUNC_ITEM &&
+             ((Item_func*)item)->functype() == Item_func::SUSERVAR_FUNC)
     {
-      if (item->type() == Item::FIELD_ITEM)
+      field= item->get_tmp_table_field();
+      if (field != NULL)
       {
-	item_field= item->get_tmp_table_item(thd);
+        /*
+          Replace "@:=<expression>" with "@:=<tmp table column>". Otherwise, we
+          would re-evaluate <expression>, and if expression were a subquery, this
+          would access already-unlocked tables.
+        */
+        Item_func_set_user_var* suv=
+          new Item_func_set_user_var(thd, (Item_func_set_user_var*) item);
+        Item_field *new_field= new Item_field(field);
+        if (!suv || !new_field)
+          DBUG_RETURN(true);                  // Fatal error
+        /*
+          We are replacing the argument of Item_func_set_user_var after its value
+          has been read. The argument's null_value should be set by now, so we
+          must set it explicitly for the replacement argument since the
+          null_value may be read without any preceeding call to val_*().
+        */
+        new_field->update_null_value();
+        List<Item> list;
+        list.push_back(new_field);
+        suv->set_arguments(list);
+        item_field= suv;
       }
-      else if ((field= item->get_tmp_table_field()))
+      else
+        item_field= item;
+    }
+    else if ((field= item->get_tmp_table_field()))
+    {
+      if (item->type() == Item::SUM_FUNC_ITEM && field->table->group)
+        item_field= ((Item_sum*) item)->result_item(field);
+      else
+        item_field= (Item*) new Item_field(field);
+      if (!item_field)
+        DBUG_RETURN(true);                    // Fatal error
+
+      if (item->real_item()->type() != Item::FIELD_ITEM)
+        field->orig_table= 0;
+      item_field->name= item->name;
+      if (item->type() == Item::REF_ITEM)
       {
-	if (item->type() == Item::SUM_FUNC_ITEM && field->table->group)
-	  item_field= ((Item_sum*) item)->result_item(field);
-	else
-	  item_field= (Item*) new Item_field(field);
-	if (!item_field)
-	  DBUG_RETURN(TRUE);                    // Fatal error
-
-        if (item->real_item()->type() != Item::FIELD_ITEM)
-          field->orig_table= 0;
-	item_field->name= item->name;
-        if (item->type() == Item::REF_ITEM)
-        {
-          Item_field *ifield= (Item_field *) item_field;
-          Item_ref *iref= (Item_ref *) item;
-          ifield->table_name= iref->table_name;
-          ifield->db_name= iref->db_name;
-        }
+        Item_field *ifield= (Item_field *) item_field;
+        Item_ref *iref= (Item_ref *) item;
+        ifield->table_name= iref->table_name;
+        ifield->db_name= iref->db_name;
+      }
 #ifndef DBUG_OFF
-	if (!item_field->name)
-	{
-	  char buff[256];
-	  String str(buff,sizeof(buff),&my_charset_bin);
-	  str.length(0);
-	  item->print(&str, QT_ORDINARY);
-	  item_field->name= sql_strmake(str.ptr(),str.length());
-	}
-#endif
+      if (!item_field->name)
+      {
+        char buff[256];
+        String str(buff,sizeof(buff),&my_charset_bin);
+        str.length(0);
+        item->print(&str, QT_ORDINARY);
+        item_field->name= sql_strmake(str.ptr(),str.length());
       }
-      else
-	item_field= item;
+#endif
     }
+    else
+      item_field= item;
+
     res_all_fields.push_back(item_field);
     ref_pointer_array[((i < border)? all_fields.elements-i-1 : i-border)]=
       item_field;
   }
 
   List_iterator_fast<Item> itr(res_all_fields);
-  for (i= 0; i < border; i++)
+  for (uint i= 0; i < border; i++)
     itr++;
   itr.sublist(res_selected_fields, elements);
-  DBUG_RETURN(FALSE);
+  DBUG_RETURN(false);
 }
 
 

=== modified file 'sql/sql_optimizer.cc'
--- a/sql/sql_optimizer.cc	2012-01-16 14:00:28 +0000
+++ b/sql/sql_optimizer.cc	2012-01-18 13:53:47 +0000
@@ -424,6 +424,12 @@ JOIN::optimize()
   if (conds)
   {
     conds= substitute_for_best_equal_field(conds, cond_equal, map2table);
+    if (thd->is_error())
+    {
+      error= 1;
+      DBUG_PRINT("error",("Error from substitute_for_best_equal"));
+      DBUG_RETURN(1);
+    }
     conds->update_used_tables();
     DBUG_EXECUTE("where",
                  print_where(conds,
@@ -442,6 +448,12 @@ JOIN::optimize()
       *tab->on_expr_ref= substitute_for_best_equal_field(*tab->on_expr_ref,
                                                          tab->cond_equal,
                                                          map2table);
+      if (thd->is_error())
+      {
+        error= 1;
+        DBUG_PRINT("error",("Error from substitute_for_best_equal"));
+        DBUG_RETURN(1);
+      }
       (*tab->on_expr_ref)->update_used_tables();
     }
   }
@@ -1183,9 +1195,9 @@ static bool check_simple_equality(Item *
         if (!item)
         {
           Item_func_eq *eq_item;
-          if ((eq_item= new Item_func_eq(left_item, right_item)))
+          if (!(eq_item= new Item_func_eq(left_item, right_item)) ||
+              eq_item->set_cmp_func())
             return FALSE;
-          eq_item->set_cmp_func();
           eq_item->quick_fix_field();
           item= eq_item;
         }  
@@ -1276,9 +1288,9 @@ static bool check_row_equality(THD *thd,
     if (!is_converted)
     {
       Item_func_eq *eq_item;
-      if (!(eq_item= new Item_func_eq(left_item, right_item)))
+      if (!(eq_item= new Item_func_eq(left_item, right_item)) ||
+          eq_item->set_cmp_func())
         return FALSE;
-      eq_item->set_cmp_func();
       eq_item->quick_fix_field();
       eq_list->push_back(eq_item);
     }
@@ -1852,10 +1864,8 @@ static Item *eliminate_item_equal(Item *
         head= item_equal->get_first();
 
       eq_item= new Item_func_eq(item_field, head);
-      if (!eq_item)
+      if (!eq_item || eq_item->set_cmp_func())
         return NULL;
-
-      eq_item->set_cmp_func();
       eq_item->quick_fix_field();
     }
   }
@@ -1911,7 +1921,7 @@ static Item *eliminate_item_equal(Item *
     the order in them to comply with the order of upper levels.
 
   @return
-    The transformed condition
+    The transformed condition, or NULL in case of error
 */
 
 static Item* substitute_for_best_equal_field(Item *cond,
@@ -1958,6 +1968,8 @@ static Item* substitute_for_best_equal_f
       while ((item_equal= it++))
       {
         cond= eliminate_item_equal(cond, cond_equal->upper_levels, item_equal);
+        if (cond == NULL)
+          return NULL;
         // This occurs when eliminate_item_equal() founds that cond is
         // always false and substitutes it with Item_int 0.
         // Due to this, value of item_equal will be 0, so just return it.

=== modified file 'sql/sql_plugin.cc'
--- a/sql/sql_plugin.cc	2011-11-10 09:55:20 +0000
+++ b/sql/sql_plugin.cc	2012-01-17 09:39:54 +0000
@@ -469,18 +469,22 @@ static st_plugin_dl *plugin_dl_add(const
   dlpathlen=
     strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", dl->str, NullS) -
     dlpath;
+  (void) unpack_filename(dlpath, dlpath);
   plugin_dl.ref_count= 1;
   /* Open new dll handle */
   if (!(plugin_dl.handle= dlopen(dlpath, RTLD_NOW)))
   {
-    const char *errmsg=dlerror();
+    const char *errmsg;
+    int error_number= dlopen_errno;
+    DLERROR_GENERATE(errmsg, error_number);
+
     if (!strncmp(dlpath, errmsg, dlpathlen))
     { // if errmsg starts from dlpath, trim this prefix.
       errmsg+=dlpathlen;
       if (*errmsg == ':') errmsg++;
       if (*errmsg == ' ') errmsg++;
     }
-    report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, errno, errmsg);
+    report_error(report, ER_CANT_OPEN_LIBRARY, dlpath, error_number, errmsg);
     DBUG_RETURN(0);
   }
   /* Determine interface version */

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2012-01-17 09:27:34 +0000
+++ b/sql/sql_table.cc	2012-01-18 04:33:08 +0000
@@ -2451,6 +2451,14 @@ int mysql_rm_table_no_locks(THD *thd, TA
     }
     if (error)
     {
+      if (error == HA_ERR_TOO_MANY_CONCURRENT_TRXS)
+      {
+        my_error(HA_ERR_TOO_MANY_CONCURRENT_TRXS, MYF(0));
+        wrong_tables.free();
+        error= 1;
+        goto err;
+      }
+
       if (wrong_tables.length())
         wrong_tables.append(',');
 

=== modified file 'sql/sql_udf.cc'
--- a/sql/sql_udf.cc	2011-11-28 07:42:18 +0000
+++ b/sql/sql_udf.cc	2012-01-17 09:39:54 +0000
@@ -214,10 +214,15 @@ void udf_init()
       char dlpath[FN_REFLEN];
       strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", tmp->dl,
                NullS);
+      (void) unpack_filename(dlpath, dlpath);
       if (!(dl= dlopen(dlpath, RTLD_NOW)))
       {
+	const char *errmsg;
+	int error_number= dlopen_errno;
+	DLERROR_GENERATE(errmsg, error_number);
+
 	/* Print warning to log */
-        sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl, errno, dlerror());
+        sql_print_error(ER(ER_CANT_OPEN_LIBRARY), tmp->dl, error_number, errmsg);
 	/* Keep the udf in the hash so that we can remove it later */
 	continue;
       }
@@ -466,12 +471,18 @@ int mysql_create_function(THD *thd,udf_f
   {
     char dlpath[FN_REFLEN];
     strxnmov(dlpath, sizeof(dlpath) - 1, opt_plugin_dir, "/", udf->dl, NullS);
+    (void) unpack_filename(dlpath, dlpath);
+
     if (!(dl = dlopen(dlpath, RTLD_NOW)))
     {
+      const char *errmsg;
+      int error_number= dlopen_errno;
+      DLERROR_GENERATE(errmsg, error_number);
+
       DBUG_PRINT("error",("dlopen of %s failed, error: %d (%s)",
-                          udf->dl, errno, dlerror()));
+                          udf->dl, error_number, errmsg));
       my_error(ER_CANT_OPEN_LIBRARY, MYF(0),
-               udf->dl, errno, dlerror());
+               udf->dl, error_number, errmsg);
       goto err;
     }
     new_dl=1;

=== modified file 'sql/table.h'
--- a/sql/table.h	2012-01-13 09:33:13 +0000
+++ b/sql/table.h	2012-01-18 13:03:10 +0000
@@ -337,6 +337,9 @@ public:
   uchar **alloc_sort_buffer(uint num_records, uint record_length)
   { return filesort_buffer.alloc_sort_buffer(num_records, record_length); }
 
+  std::pair<uint, uint> sort_buffer_properties()
+  { return filesort_buffer.sort_buffer_properties(); }
+
   void free_sort_buffer()
   { filesort_buffer.free_sort_buffer(); }
 

=== modified file 'storage/innobase/buf/buf0buf.cc'
--- a/storage/innobase/buf/buf0buf.cc	2011-12-28 10:40:55 +0000
+++ b/storage/innobase/buf/buf0buf.cc	2012-01-16 08:15:20 +0000
@@ -3075,9 +3075,18 @@ buf_page_get_known_nowait(
 	ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
 #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
 #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
-	mutex_enter(&block->mutex);
-	ut_a(!block->page.file_page_was_freed);
-	mutex_exit(&block->mutex);
+	if (mode != BUF_KEEP_OLD) {
+		/* If mode == BUF_KEEP_OLD, we are executing an I/O
+		completion routine.  Avoid a bogus assertion failure
+		when ibuf_merge_or_delete_for_page() is processing a
+		page that was just freed due to DROP INDEX, or
+		deleting a record from SYS_INDEXES. This check will be
+		skipped in recv_recover_page() as well. */
+
+		mutex_enter(&block->mutex);
+		ut_a(!block->page.file_page_was_freed);
+		mutex_exit(&block->mutex);
+	}
 #endif
 
 #ifdef UNIV_IBUF_COUNT_DEBUG

=== modified file 'storage/innobase/dict/dict0stats.cc'
--- a/storage/innobase/dict/dict0stats.cc	2011-12-16 14:34:14 +0000
+++ b/storage/innobase/dict/dict0stats.cc	2012-01-17 09:04:19 +0000
@@ -1910,10 +1910,8 @@ dict_stats_fetch_index_stats_step(
 			     index != NULL;
 			     index = dict_table_get_next_index(index)) {
 
-				// FIXME: Can we use a better cast operator
-				if (strncasecmp(index->name,
-						(const char*) data,
-						len) == 0) {
+				if (strlen(index->name) == len
+				    && memcmp(index->name, data, len) == 0) {
 					/* the corresponding index was found */
 					break;
 				}
@@ -1999,26 +1997,29 @@ dict_stats_fetch_index_stats_step(
 	/* sample_size could be UINT64_UNDEFINED here, if it is NULL */
 
 #define PFX	"n_diff_pfx"
+#define PFX_LEN	10
 
-	if (strncasecmp("size", stat_name, stat_name_len) == 0) {
+	if (stat_name_len == 4 /* strlen("size") */
+	    && strncasecmp("size", stat_name, stat_name_len) == 0) {
 		index->stat_index_size = (ulint) stat_value;
 		arg->stats_were_modified = TRUE;
-	} else if (strncasecmp("n_leaf_pages", stat_name, stat_name_len)
+	} else if (stat_name_len == 12 /* strlen("n_leaf_pages") */
+		   && strncasecmp("n_leaf_pages", stat_name, stat_name_len)
 		   == 0) {
 		index->stat_n_leaf_pages = (ulint) stat_value;
 		arg->stats_were_modified = TRUE;
-	} else if (strncasecmp(PFX, stat_name,
-			       ut_min(strlen(PFX), stat_name_len)) == 0) {
+	} else if (stat_name_len > PFX_LEN /* e.g. stat_name=="n_diff_pfx01" */
+		   && strncasecmp(PFX, stat_name, PFX_LEN) == 0) {
 
 		const char*	num_ptr;
 		unsigned long	n_pfx;
 
 		/* point num_ptr into "1" from "n_diff_pfx12..." */
-		num_ptr = stat_name + strlen(PFX);
+		num_ptr = stat_name + PFX_LEN;
 
 		/* stat_name should have exactly 2 chars appended to PFX
 		and they should be digits */
-		if (stat_name_len != strlen(PFX) + 2
+		if (stat_name_len != PFX_LEN + 2
 		    || num_ptr[0] < '0' || num_ptr[0] > '9'
 		    || num_ptr[1] < '0' || num_ptr[1] > '9') {
 

=== modified file 'storage/innobase/ibuf/ibuf0ibuf.cc'
--- a/storage/innobase/ibuf/ibuf0ibuf.cc	2011-12-23 13:17:36 +0000
+++ b/storage/innobase/ibuf/ibuf0ibuf.cc	2012-01-16 12:30:58 +0000
@@ -1,6 +1,6 @@
 /*****************************************************************************
 
-Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved.
+Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved.
 
 This program is free software; you can redistribute it and/or modify it under
 the terms of the GNU General Public License as published by the Free Software
@@ -2415,7 +2415,15 @@ ibuf_get_merge_page_nos_func(
 		} else {
 			rec_page_no = ibuf_rec_get_page_no(mtr, rec);
 			rec_space_id = ibuf_rec_get_space(mtr, rec);
-			ut_ad(rec_page_no > IBUF_TREE_ROOT_PAGE_NO);
+			/* In the system tablespace, the smallest
+			possible secondary index leaf page number is
+			bigger than IBUF_TREE_ROOT_PAGE_NO (4). In
+			other tablespaces, the clustered index tree is
+			created at page 3, which makes page 4 the
+			smallest possible secondary index leaf page
+			(and that only after DROP INDEX). */
+			ut_ad(rec_page_no
+			      > IBUF_TREE_ROOT_PAGE_NO - (rec_space_id != 0));
 		}
 
 #ifdef UNIV_IBUF_DEBUG

=== modified file 'unittest/gunit/filesort_buffer-t.cc'
--- a/unittest/gunit/filesort_buffer-t.cc	2011-12-20 09:51:05 +0000
+++ b/unittest/gunit/filesort_buffer-t.cc	2012-01-18 13:03:10 +0000
@@ -16,11 +16,11 @@
 // First include (the generated) my_config.h, to get correct platform defines.
 #include "my_config.h"
 #include <gtest/gtest.h>
+#include <utility>
 
 #include "filesort_utils.h"
 #include "table.h"
 
-
 namespace {
 
 class FileSortBufferTest : public ::testing::Test
@@ -38,7 +38,15 @@ protected:
 TEST_F(FileSortBufferTest, FileSortBuffer)
 {
   const char letters[10]= "abcdefghi";
+  std::pair<uint, uint> buffer_properties= fs_info.sort_buffer_properties();
+  EXPECT_EQ(0U, buffer_properties.first);
+  EXPECT_EQ(0U, buffer_properties.second);
+
   uchar **sort_keys= fs_info.alloc_sort_buffer(10, sizeof(char));
+  buffer_properties= fs_info.sort_buffer_properties();
+  EXPECT_EQ(10U, buffer_properties.first);
+  EXPECT_EQ(sizeof(char), buffer_properties.second);
+
   uchar **null_sort_keys= NULL;
   EXPECT_NE(null_sort_keys, sort_keys);
   for (uint ix= 0; ix < 10; ++ix)

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk branch (tor.didriksen:3459 to 3462) Tor Didriksen20 Jan