List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:March 8 2011 7:16pm
Subject:bzr push into mysql-trunk-mtr branch (bjorn.munch:3042 to 3044)
View as plain text  
 3044 Bjorn Munch	2011-03-08 [merge]
      Add extra line after unit test report in MTR

    modified:
      mysql-test/mysql-test-run.pl
 3043 Bjorn Munch	2011-03-08 [merge]
      merge from trunk main

    removed:
      mysql-test/include/have_case_insensitive_fs.inc
      mysql-test/r/case_insensitive_fs.require
    added:
      mysql-test/collections/disabled-weekly.list
      mysql-test/r/func_encrypt_ucs2.result
      mysql-test/std_data/bug47205.frm
      mysql-test/t/func_encrypt_ucs2.test
    modified:
      VERSION
      client/mysqlcheck.c
      cmake/make_dist.cmake.in
      include/my_pthread.h
      include/my_sys.h
      mysql-test/collections/default.experimental
      mysql-test/include/wait_for_status_var.inc
      mysql-test/r/ctype_latin1.result
      mysql-test/r/ctype_sjis.result
      mysql-test/r/ctype_ucs.result
      mysql-test/r/ctype_utf16.result
      mysql-test/r/ctype_utf32.result
      mysql-test/r/ctype_utf8.result
      mysql-test/r/flush.result
      mysql-test/r/func_set.result
      mysql-test/r/innodb_mysql_sync.result
      mysql-test/r/mysqlcheck.result
      mysql-test/r/partition.result
      mysql-test/r/xml.result
      mysql-test/suite/engines/iuds/r/insert_year.result
      mysql-test/suite/engines/iuds/t/disabled.def
      mysql-test/suite/large_tests/t/lock_tables_big.test
      mysql-test/suite/rpl/r/rpl_checksum.result
      mysql-test/suite/rpl/t/rpl_checksum.test
      mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test
      mysql-test/t/ctype_latin1.test
      mysql-test/t/ctype_sjis.test
      mysql-test/t/ctype_ucs.test
      mysql-test/t/ctype_utf16.test
      mysql-test/t/ctype_utf32.test
      mysql-test/t/ctype_utf8.test
      mysql-test/t/flush.test
      mysql-test/t/func_set.test
      mysql-test/t/grant_lowercase_fs.test
      mysql-test/t/innodb_mysql_sync.test
      mysql-test/t/mysqlcheck.test
      mysql-test/t/partition.test
      mysql-test/t/xml.test
      mysys/default.c
      mysys/my_init.c
      mysys/my_thr_init.c
      mysys/stacktrace.c
      sql/handler.cc
      sql/handler.h
      sql/item.cc
      sql/item_cmpfunc.cc
      sql/item_func.cc
      sql/item_strfunc.cc
      sql/item_strfunc.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/opt_range.cc
      sql/share/errmsg-utf8.txt
      sql/sql_admin.cc
      sql/sql_base.cc
      sql/sql_base.h
      sql/sql_lex.h
      sql/sql_parse.cc
      sql/sql_reload.cc
      sql/sql_table.cc
      sql/sql_trigger.cc
      sql/sql_truncate.cc
      sql/sql_view.cc
      sql/sql_yacc.yy
      storage/archive/ha_archive.h
      storage/csv/ha_tina.h
      storage/federated/ha_federated.h
      storage/innobase/handler/ha_innodb.cc
      storage/myisam/ha_myisam.cc
      storage/perfschema/unittest/pfs-t.cc
      storage/perfschema/unittest/pfs_instr-oom-t.cc
      storage/perfschema/unittest/pfs_instr-t.cc
      storage/perfschema/unittest/pfs_instr_class-oom-t.cc
      storage/perfschema/unittest/pfs_instr_class-t.cc
      storage/perfschema/unittest/pfs_timer-t.cc
      strings/xml.c
 3042 Bjorn Munch	2011-03-08
      Undo debug change to run_ctest in MTR

    modified:
      mysql-test/mysql-test-run.pl
=== modified file 'VERSION'
--- a/VERSION	2011-02-13 18:33:12 +0000
+++ b/VERSION	2011-03-06 16:45:02 +0000
@@ -1,4 +1,4 @@
 MYSQL_VERSION_MAJOR=5
 MYSQL_VERSION_MINOR=6
-MYSQL_VERSION_PATCH=2
+MYSQL_VERSION_PATCH=3
 MYSQL_VERSION_EXTRA=-m5

=== modified file 'client/mysqlcheck.c'
--- a/client/mysqlcheck.c	2011-01-16 04:02:29 +0000
+++ b/client/mysqlcheck.c	2011-03-08 09:21:39 +0000
@@ -42,7 +42,7 @@ static char *opt_password = 0, *current_
 	    *default_charset= 0, *current_host= 0;
 static char *opt_plugin_dir= 0, *opt_default_auth= 0;
 static int first_error = 0;
-DYNAMIC_ARRAY tables4repair;
+DYNAMIC_ARRAY tables4repair, tables4rebuild;
 #ifdef HAVE_SMEM
 static char *shared_memory_base_name=0;
 #endif
@@ -630,6 +630,27 @@ static int fix_database_storage_name(con
   return rc;
 }
 
+static int rebuild_table(char *name)
+{
+  char *query, *ptr;
+  int rc= 0;
+  query= (char*)my_malloc(sizeof(char) * (12 + fixed_name_length(name) + 6 + 1),
+                          MYF(MY_WME));
+  if (!query)
+    return 1;
+  ptr= strmov(query, "ALTER TABLE ");
+  ptr= fix_table_name(ptr, name);
+  ptr= strxmov(ptr, " FORCE", NullS);
+  if (mysql_real_query(sock, query, (uint)(ptr - query)))
+  {
+    fprintf(stderr, "Failed to %s\n", query);
+    fprintf(stderr, "Error: %s\n", mysql_error(sock));
+    rc= 1;
+  }
+  my_free(query);
+  return rc;
+}
+
 static int process_one_db(char *database)
 {
   if (what_to_do == DO_UPGRADE)
@@ -743,7 +764,7 @@ static void print_result()
   MYSQL_ROW row;
   char prev[NAME_LEN*2+2];
   uint i;
-  my_bool found_error=0;
+  my_bool found_error=0, table_rebuild=0;
 
   res = mysql_use_result(sock);
 
@@ -762,8 +783,14 @@ static void print_result()
       */
       if (found_error && opt_auto_repair && what_to_do != DO_REPAIR &&
 	  strcmp(row[3],"OK"))
-	insert_dynamic(&tables4repair, prev);
+      {
+        if (table_rebuild)
+          insert_dynamic(&tables4rebuild, prev);
+        else
+          insert_dynamic(&tables4repair, prev);
+      }
       found_error=0;
+      table_rebuild=0;
       if (opt_silent)
 	continue;
     }
@@ -773,7 +800,11 @@ static void print_result()
     {
       printf("%s\n%-9s: %s", row[0], row[2], row[3]);
       if (strcmp(row[2],"note"))
+      {
 	found_error=1;
+        if (opt_auto_repair && strstr(row[3], "ALTER TABLE") != NULL)
+          table_rebuild=1;
+      }
     }
     else
       printf("%-9s: %s", row[2], row[3]);
@@ -782,7 +813,12 @@ static void print_result()
   }
   /* add the last table to be repaired to the list */
   if (found_error && opt_auto_repair && what_to_do != DO_REPAIR)
-    insert_dynamic(&tables4repair, prev);
+  {
+    if (table_rebuild)
+      insert_dynamic(&tables4rebuild, prev);
+    else
+      insert_dynamic(&tables4repair, prev);
+  }
   mysql_free_result(res);
 }
 
@@ -882,7 +918,8 @@ int main(int argc, char **argv)
   }
 
   if (opt_auto_repair &&
-      my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64))
+      (my_init_dynamic_array(&tables4repair, sizeof(char)*(NAME_LEN*2+2),16,64) ||
+       my_init_dynamic_array(&tables4rebuild, sizeof(char)*(NAME_LEN*2+2),16,64)))
   {
     first_error = 1;
     goto end;
@@ -900,7 +937,7 @@ int main(int argc, char **argv)
   {
     uint i;
 
-    if (!opt_silent && tables4repair.elements)
+    if (!opt_silent && (tables4repair.elements || tables4rebuild.elements))
       puts("\nRepairing tables");
     what_to_do = DO_REPAIR;
     for (i = 0; i < tables4repair.elements ; i++)
@@ -908,11 +945,16 @@ int main(int argc, char **argv)
       char *name= (char*) dynamic_array_ptr(&tables4repair, i);
       handle_request_for_tables(name, fixed_name_length(name));
     }
+    for (i = 0; i < tables4rebuild.elements ; i++)
+      rebuild_table((char*) dynamic_array_ptr(&tables4rebuild, i));
   }
  end:
   dbDisconnect(current_host);
   if (opt_auto_repair)
+  {
     delete_dynamic(&tables4repair);
+    delete_dynamic(&tables4rebuild);
+  }
   my_free(opt_password);
 #ifdef HAVE_SMEM
   my_free(shared_memory_base_name);

=== modified file 'cmake/make_dist.cmake.in'
--- a/cmake/make_dist.cmake.in	2011-02-14 12:28:39 +0000
+++ b/cmake/make_dist.cmake.in	2011-03-04 15:12:05 +0000
@@ -29,6 +29,8 @@ SET(CMAKE_GENERATOR "@CMAKE_GENERATOR@")
 SET(CMAKE_MAKE_PROGRAM "@CMAKE_MAKE_PROGRAM@")
 SET(CMAKE_SYSTEM_NAME "@CMAKE_SYSTEM_NAME@")
 
+SET(VERSION "@VERSION@")
+
 SET(MYSQL_DOCS_LOCATION "@MYSQL_DOCS_LOCATION@")
 
 
@@ -100,6 +102,10 @@ CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/s
 CONFIGURE_FILE(${CMAKE_BINARY_DIR}/sql/sql_yacc.cc
    ${PACKAGE_DIR}/sql/sql_yacc.cc COPYONLY)
 
+# Copy spec files
+CONFIGURE_FILE(${CMAKE_BINARY_DIR}/support-files/mysql.${VERSION}.spec
+   ${PACKAGE_DIR}/support-files/mysql.${VERSION}.spec COPYONLY)
+
 # Add documentation, if user has specified where to find them
 IF(MYSQL_DOCS_LOCATION)
   MESSAGE("Copying documentation files from " ${MYSQL_DOCS_LOCATION})

=== modified file 'include/my_pthread.h'
--- a/include/my_pthread.h	2011-02-24 15:48:27 +0000
+++ b/include/my_pthread.h	2011-03-08 19:14:42 +0000
@@ -795,8 +795,7 @@ extern pthread_mutexattr_t my_errorcheck
 typedef ulong my_thread_id;
 
 extern my_bool my_thread_global_init(void);
-extern my_bool my_thread_basic_global_init(void);
-extern void my_thread_basic_global_reinit(void);
+extern void my_thread_global_reinit(void);
 extern void my_thread_global_end(void);
 extern my_bool my_thread_init(void);
 extern void my_thread_end(void);

=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2011-02-24 15:48:27 +0000
+++ b/include/my_sys.h	2011-03-08 19:14:42 +0000
@@ -639,7 +639,6 @@ extern int my_error_register(const char*
 extern const char **my_error_unregister(int first, int last);
 extern void my_message(uint my_err, const char *str,myf MyFlags);
 extern void my_message_stderr(uint my_err, const char *str, myf MyFlags);
-extern my_bool my_basic_init(void);
 extern my_bool my_init(void);
 extern void my_end(int infoflag);
 extern int my_redel(const char *from, const char *to, int MyFlags);

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2011-02-18 13:02:21 +0000
+++ b/mysql-test/collections/default.experimental	2011-02-28 18:50:04 +0000
@@ -16,7 +16,6 @@ main.subquery_sj_none @solaris
 main.type_float @freebsd                 # Bug#38965 2010-05-04 alik test cases gis-rtree, type_float, type_newdecimal fail in embedded server
 main.wait_timeout @solaris               # Bug#51244 2010-04-26 alik wait_timeout fails on OpenSolaris
 
-rpl.rpl_heartbeat_basic                  # BUG#54820 2010-06-26 alik rpl.rpl_heartbeat_basic fails sporadically again
 rpl.rpl_innodb_bug28430                  # Bug#46029
 rpl.rpl_row_sp011  @solaris              # Bug#47791 2010-01-20 alik Several test cases fail on Solaris with error Thread stack overrun
 rpl.rpl_delayed_slave                    # BUG#57514 rpl_delayed_slave fails sporadically in pb

=== added file 'mysql-test/collections/disabled-weekly.list'
--- a/mysql-test/collections/disabled-weekly.list	1970-01-01 00:00:00 +0000
+++ b/mysql-test/collections/disabled-weekly.list	2011-03-03 06:48:04 +0000
@@ -0,0 +1,9 @@
+rpl.rpl_semi_sync_event : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+rpl.rpl_semi_sync : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_master_enabled_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_master_timeout_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_master_trace_level_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_master_wait_no_slave_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_slave_enabled_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.rpl_semi_sync_slave_trace_level_basic : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.
+sys_vars.all_vars : lsoares 2011-02-11 BUG#11769332 Anitha asked me to disable this until plugin issues on windows are fixed.

=== removed file 'mysql-test/include/have_case_insensitive_fs.inc'
--- a/mysql-test/include/have_case_insensitive_fs.inc	2009-10-27 08:09:19 +0000
+++ b/mysql-test/include/have_case_insensitive_fs.inc	1970-01-01 00:00:00 +0000
@@ -1,4 +0,0 @@
---require r/case_insensitive_fs.require
---disable_query_log
-show variables like 'lower_case_file_system';
---enable_query_log

=== modified file 'mysql-test/include/wait_for_status_var.inc'
--- a/mysql-test/include/wait_for_status_var.inc	2011-01-13 21:18:17 +0000
+++ b/mysql-test/include/wait_for_status_var.inc	2011-02-27 20:23:44 +0000
@@ -61,7 +61,7 @@ let $_show_status_value= query_get_value
 
 # Set way of comparing
 let $_query= SELECT NOT('$_show_status_value' $_status_var_comparsion '$status_var_value');
-if ($is_number)
+if ($_is_number)
 {
   let $_query= SELECT NOT($_show_status_value $_status_var_comparsion $status_var_value);
 }
@@ -70,7 +70,7 @@ while (`$_query`)
 {
   if (!$_status_timeout_counter)
   {
-    --echo **** ERROR: failed while waiting for $status_type $status_var $_status_var_comparison $status_var_value ****
+    --echo **** ERROR: failed while waiting for $status_type $status_var $_status_var_comparsion $status_var_value ****
     --echo Note: the following output may have changed since the failure was detected
     --echo **** Showing STATUS, PROCESSLIST ****
     eval SHOW $status_type STATUS LIKE '$status_var';

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-03-08 09:48:07 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-03-08 19:14:42 +0000
@@ -509,7 +509,10 @@ sub main {
 		 $opt_gcov_msg, $opt_gcov_err);
   }
 
-  print "$ctest_report\n" if $ctest_report;
+  if ($ctest_report) {
+    print "$ctest_report\n";
+    mtr_print_line();
+  }
 
   print_total_times($opt_parallel) if $opt_report_times;
 
@@ -5760,7 +5763,7 @@ sub run_ctest() {
   $tinfo->{comment}.= "\nctest did not pruduce report summary" if ! $ctres;
   $tinfo->{result}= ($ctres && !$ctfail)
     ? 'MTR_RES_PASSED' : 'MTR_RES_FAILED';
-  $ctest_report .= "Report from unit tests in $ctfile\n";
+  $ctest_report .= "Report from unit tests in $ctfile";
   $tinfo->{failures}= ($tinfo->{result} eq 'MTR_RES_FAILED');
 
   mark_time_used('test');

=== removed file 'mysql-test/r/case_insensitive_fs.require'
--- a/mysql-test/r/case_insensitive_fs.require	2009-10-27 08:09:19 +0000
+++ b/mysql-test/r/case_insensitive_fs.require	1970-01-01 00:00:00 +0000
@@ -1,2 +0,0 @@
-Variable_name	Value
-lower_case_file_system	ON

=== modified file 'mysql-test/r/ctype_latin1.result'
--- a/mysql-test/r/ctype_latin1.result	2011-02-10 08:47:05 +0000
+++ b/mysql-test/r/ctype_latin1.result	2011-03-04 15:55:18 +0000
@@ -3269,6 +3269,21 @@ maketime(`a`,`a`,`a`)
 DROP TABLE t1;
 SET sql_mode=default;
 #
+# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters
+#
+SET NAMES utf8;
+EXPLAIN EXTENDED SELECT 'abcd��', _latin1'abcd��', _utf8'abcd��';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+Warnings:
+Note	1003	select 'abcd��' AS `abcd��`,_latin1'abcd\xC3\xB3' AS `abcd����`,_utf8'abcd\xC3\xB3' AS `abcd��`
+SET NAMES latin1;
+EXPLAIN EXTENDED SELECT 'abcd��', _latin1'abcd��', _utf8'abcd��';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+Warnings:
+Note	1003	select 'abcd��' AS `abcd��`,_latin1'abcd\xC3\xB3' AS `abcd��`,_utf8'abcd\xC3\xB3' AS `abcd�`
+#
 # End of 5.5 tests
 #
 #

=== modified file 'mysql-test/r/ctype_sjis.result'
--- a/mysql-test/r/ctype_sjis.result	2010-03-22 09:13:41 +0000
+++ b/mysql-test/r/ctype_sjis.result	2011-03-04 14:59:32 +0000
@@ -218,6 +218,12 @@ hex(a)	hex(lower(a))	hex(upper(a))
 8352835E	8352835E	8352835E
 8372835E	8372835E	8372835E
 DROP TABLE t1;
+#
+# Bug#11766519 - Bug#59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED.
+#
+SELECT QUOTE('�\');
+QUOTE('�\')
+'�\'
 # End of 5.1 tests
 #
 # Start of 5.5 tests

=== modified file 'mysql-test/r/ctype_ucs.result'
--- a/mysql-test/r/ctype_ucs.result	2011-02-10 08:47:05 +0000
+++ b/mysql-test/r/ctype_ucs.result	2011-03-04 14:59:32 +0000
@@ -1056,8 +1056,8 @@ old_password(name)
 14e500b131773991
 select quote(name) from bug20536;
 quote(name)
-????????
-????????????????
+'test1'
+'\'test\\_2\''
 drop table bug20536;
 set names ucs2;
 ERROR 42000: Variable 'character_set_client' can't be set to the value of 'ucs2'
@@ -1304,6 +1304,17 @@ CREATE VIEW v1 AS SELECT 1 from t1
 WHERE t1.b <=> (SELECT a FROM t1 WHERE a < SOME(SELECT '1'));
 DROP VIEW v1;
 DROP TABLE t1;
+#
+# Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed.
+#
+SELECT HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850));
+HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850))
+00
+SELECT CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED);
+CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED)
+0
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: ''��''
 End of 5.0 tests
 #
 # Start of 5.5 tests

=== modified file 'mysql-test/r/ctype_utf16.result'
--- a/mysql-test/r/ctype_utf16.result	2010-12-16 18:50:46 +0000
+++ b/mysql-test/r/ctype_utf16.result	2011-03-01 12:20:38 +0000
@@ -1109,6 +1109,21 @@ t2	CREATE TABLE `t2` (
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1
 DROP TABLE t1, t2;
 #
+# Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure
+#
+SELECT CASE _latin1'a' WHEN _utf16'a' THEN 'A' END;
+CASE _latin1'a' WHEN _utf16'a' THEN 'A' END
+A
+SELECT CASE _utf16'a' WHEN _latin1'a' THEN 'A' END;
+CASE _utf16'a' WHEN _latin1'a' THEN 'A' END
+A
+CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf16);
+INSERT INTO t1 VALUES ('a');
+SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1;
+CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END
+b
+DROP TABLE t1;
+#
 # End of 5.5 tests
 #
 #

=== modified file 'mysql-test/r/ctype_utf32.result'
--- a/mysql-test/r/ctype_utf32.result	2010-12-14 13:26:35 +0000
+++ b/mysql-test/r/ctype_utf32.result	2011-03-01 12:20:38 +0000
@@ -1173,6 +1173,21 @@ d
 f
 DROP TABLE t1;
 #
+# Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure
+#
+SELECT CASE _latin1'a' WHEN _utf32'a' THEN 'A' END;
+CASE _latin1'a' WHEN _utf32'a' THEN 'A' END
+A
+SELECT CASE _utf32'a' WHEN _latin1'a' THEN 'A' END;
+CASE _utf32'a' WHEN _latin1'a' THEN 'A' END
+A
+CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf32);
+INSERT INTO t1 VALUES ('a');
+SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1;
+CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END
+b
+DROP TABLE t1;
+#
 # End of 5.5 tests
 #
 #

=== modified file 'mysql-test/r/ctype_utf8.result'
--- a/mysql-test/r/ctype_utf8.result	2011-02-10 08:47:05 +0000
+++ b/mysql-test/r/ctype_utf8.result	2011-03-04 15:55:18 +0000
@@ -5083,6 +5083,21 @@ GROUP BY INSERT('', t2.a, t1.a, (@@globa
 ERROR 23000: Duplicate entry '107374182410737418241' for key 'group_key'
 DROP TABLE t1;
 #
+# Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters
+#
+SET NAMES latin1;
+EXPLAIN EXTENDED SELECT 'abcd����������', _latin1'abcd����������', _utf8'abcde	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+Warnings:
+Note	1003	select 'abcd����������' AS `abcd����������`,_latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcd����������`,_utf8'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `u`
+SET NAMES utf8;
+EXPLAIN EXTENDED SELECT 'abcd���������bcd����������';
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	NULL	NULL	NULL	NULL	NULL	NULL	NULL	NULL	No tables used
+Warnings:
+Note	1003	select 'abcd�����latin1'abcd\xC3\x81\xC3\x82\xC3\x83\xC3\x84\xC3\x85' AS `abcd�����������������x84\xC3\x85' AS `abcd����������`
+#
 # End of 5.5 tests
 #
 #

=== modified file 'mysql-test/r/flush.result'
--- a/mysql-test/r/flush.result	2010-11-11 17:11:05 +0000
+++ b/mysql-test/r/flush.result	2011-03-07 09:08:10 +0000
@@ -451,3 +451,18 @@ unlock tables;
 handler t1 close;
 # Cleanup.
 drop tables t1, t2;
+#
+# Bug#57649 FLUSH TABLES under FLUSH TABLES <list> WITH READ LOCK leads
+#           to assert failure.
+#
+DROP TABLE IF EXISTS t1;
+CREATE TABLE t1 (a INT);
+FLUSH TABLES t1 WITH READ LOCK;
+FLUSH TABLES;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1;
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+ALTER TABLE t1 COMMENT 'test';
+ERROR HY000: Table 't1' was locked with a READ lock and can't be updated
+UNLOCK TABLES;
+DROP TABLE t1;

=== added file 'mysql-test/r/func_encrypt_ucs2.result'
--- a/mysql-test/r/func_encrypt_ucs2.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/func_encrypt_ucs2.result	2011-03-04 14:59:32 +0000
@@ -0,0 +1,19 @@
+#
+# Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed.
+#
+SELECT CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2)));
+CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2)))
+9
+SELECT CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED);
+CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED)
+0
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: '\xFFT\xDCiK\x92j\xE6\xFC'
+SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)));
+CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)))
+4
+SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED);
+CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED)
+0
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: 'test'

=== modified file 'mysql-test/r/func_set.result'
--- a/mysql-test/r/func_set.result	2009-06-16 14:36:15 +0000
+++ b/mysql-test/r/func_set.result	2011-03-04 14:46:17 +0000
@@ -159,3 +159,45 @@ SELECT CONVERT( a USING latin1 ) FROM t2
 CONVERT( a USING latin1 )
 
 DROP TABLE t1, t2;
+#
+# BUG#59405: FIND_IN_SET won't work normaly after upgrade from 5.1 to 5.5
+#
+CREATE TABLE t1(days set('1','2','3','4','5','6','7'));
+INSERT INTO t1 VALUES('1,2,3,4,5,6,7'), (NULL), ('1,2,3,4,5,6,7');
+
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days);
+days
+1,2,3,4,5,6,7
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days) IS UNKNOWN;
+days
+NULL
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL) IS UNKNOWN;
+days
+1,2,3,4,5,6,7
+NULL
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(7, days);
+days
+1,2,3,4,5,6,7
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(8, days);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days) IS UNKNOWN;
+days
+1,2,3,4,5,6,7
+NULL
+1,2,3,4,5,6,7
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL);
+days
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN;
+days
+1,2,3,4,5,6,7
+NULL
+1,2,3,4,5,6,7
+
+DROP TABLE t1;

=== modified file 'mysql-test/r/innodb_mysql_sync.result'
--- a/mysql-test/r/innodb_mysql_sync.result	2011-01-26 13:23:29 +0000
+++ b/mysql-test/r/innodb_mysql_sync.result	2011-03-07 13:30:49 +0000
@@ -153,5 +153,15 @@ SET DEBUG_SYNC= "now SIGNAL query";
 a	b
 # Test 4: Secondary unique index, should not block reads.
 # Connection default
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+# Sending:
+ALTER TABLE t1 ADD UNIQUE (b);
+# Connection con1
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+SELECT * FROM t1;
+a	b
+SET DEBUG_SYNC= "now SIGNAL query";
+# Connection default
+# Reaping: ALTER TABLE t1 ADD UNIQUE (b)
 SET DEBUG_SYNC= "RESET";
 DROP TABLE t1;

=== modified file 'mysql-test/r/mysqlcheck.result'
--- a/mysql-test/r/mysqlcheck.result	2010-12-17 11:28:59 +0000
+++ b/mysql-test/r/mysqlcheck.result	2011-03-08 09:21:39 +0000
@@ -117,7 +117,7 @@ mysql.time_zone_name
 mysql.time_zone_transition                         Table is already up to date
 mysql.time_zone_transition_type                    Table is already up to date
 mysql.user                                         Table is already up to date
-create table t1 (a int);
+create table t1 (a int) engine=myisam;
 create view v1 as select * from t1;
 test.t1                                            OK
 test.t1                                            Table is already up to date
@@ -125,14 +125,14 @@ test.t1
 test.t1                                            Table is already up to date
 drop view v1;
 drop table t1;
-create table `t``1`(a int);
-create table `t 1`(a int);
+create table `t``1`(a int) engine=myisam;
+create table `t 1`(a int) engine=myisam;
 test.t 1                                           OK
 test.t`1                                           OK
 drop table `t``1`, `t 1`;
 create database d_bug25347;
 use d_bug25347;
-create table t_bug25347 (a int);
+create table t_bug25347 (a int) engine=myisam;
 create view v_bug25347 as select * from t_bug25347;
 insert into t_bug25347 values (1),(2),(3);
 flush tables;
@@ -172,15 +172,15 @@ Table	Op	Msg_type	Msg_text
 test.v1	check	status	OK
 information_schema.routines	check	note	The storage engine for the table doesn't support check
 drop view v1;
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(a INT);
+CREATE TABLE t1(a INT) engine=myisam;
+CREATE TABLE t2(a INT) engine=myisam;
 test.t1
 Error    : Incorrect information in file: './test/t1.frm'
 error    : Corrupt
 test.t2                                            OK
 DROP TABLE t1, t2;
 End of 5.0 tests
-create table t1(a int);
+create table t1(a int) engine=myisam;
 create view v1 as select * from t1;
 show tables;
 Tables_in_test
@@ -200,7 +200,7 @@ v-1
 drop view v1, `v-1`;
 drop table t1;
 SET NAMES utf8;
-CREATE TABLE `#mysql50#@` (a INT);
+CREATE TABLE `#mysql50#@` (a INT) engine=myisam;
 SHOW TABLES;
 Tables_in_test
 #mysql50#@
@@ -211,7 +211,7 @@ SHOW TABLES;
 Tables_in_test
 @
 DROP TABLE `@`;
-CREATE TABLE `��` (a INT);
+CREATE TABLE `��` (a INT) engine=myisam;
 SET NAMES DEFAULT;
 mysqlcheck --default-character-set="latin1" --databases test
 test.?
@@ -224,8 +224,8 @@ DROP TABLE `��`;
 SET NAMES DEFAULT;
 CREATE DATABASE `#mysql50#a@b`;
 USE `#mysql50#a@b`;
-CREATE TABLE `#mysql50#c@d` (a INT);
-CREATE TABLE t1 (a INT);
+CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam;
+CREATE TABLE t1 (a INT) engine=myisam;
 SELECT * FROM INFORMATION_SCHEMA.TRIGGERS
 WHERE TRIGGER_SCHEMA="#mysql50#a@b" ORDER BY trigger_name;
 TRIGGER_CATALOG	TRIGGER_SCHEMA	TRIGGER_NAME	EVENT_MANIPULATION	EVENT_OBJECT_CATALOG	EVENT_OBJECT_SCHEMA	EVENT_OBJECT_TABLE	ACTION_ORDER	ACTION_CONDITION	ACTION_STATEMENT	ACTION_ORIENTATION	ACTION_TIMING	ACTION_REFERENCE_OLD_TABLE	ACTION_REFERENCE_NEW_TABLE	ACTION_REFERENCE_OLD_ROW	ACTION_REFERENCE_NEW_ROW	CREATED	SQL_MODE	DEFINER	CHARACTER_SET_CLIENT	COLLATION_CONNECTION	DATABASE_COLLATION
@@ -254,12 +254,12 @@ USE test;
 # Bug #31821: --all-in-1 and --fix-table-names don't work together
 #
 drop table if exists `#mysql50#t1-1`;
-create table `#mysql50#t1-1` (a int);
+create table `#mysql50#t1-1` (a int) engine=myisam;
 show tables like 't1-1';
 Tables_in_test (t1-1)
 t1-1
 drop table `t1-1`;
-create table `#mysql50#t1-1` (a int);
+create table `#mysql50#t1-1` (a int) engine=myisam;
 show tables like 't1-1';
 Tables_in_test (t1-1)
 t1-1
@@ -268,3 +268,67 @@ End of 5.1 tests
 #
 # Bug #35269: mysqlcheck behaves different depending on order of parameters
 #
+#
+# Bug#11755431 47205: MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR
+#              ENGINES NOT SUPPORTING NATIVE
+#
+DROP TABLE IF EXISTS bug47205;
+#
+# Test 1: Check that ALTER TABLE ... rebuilds the table
+CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY)
+DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb;
+INSERT INTO bug47205 VALUES ("foobar");
+FLUSH TABLE bug47205;
+# Replace the FRM with a 5.0 FRM that will require upgrade
+# Should indicate that ALTER TABLE ... FORCE is needed
+CHECK TABLE bug47205 FOR UPGRADE;
+Table	Op	Msg_type	Msg_text
+test.bug47205	check	error	Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it!
+# ALTER TABLE ... FORCE should rebuild the table
+# and therefore output "affected rows: 1"
+ALTER TABLE bug47205 FORCE;
+affected rows: 1
+info: Records: 1  Duplicates: 0  Warnings: 0
+# Table should now be ok
+CHECK TABLE bug47205 FOR UPGRADE;
+Table	Op	Msg_type	Msg_text
+test.bug47205	check	status	OK
+DROP TABLE bug47205;
+#
+# Test 2: InnoDB - REPAIR not supported
+CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY)
+DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb;
+FLUSH TABLE bug47205;
+# Replace the FRM with a 5.0 FRM that will require upgrade
+# Should indicate that ALTER TABLE .. FORCE is needed
+CHECK TABLE bug47205 FOR UPGRADE;
+Table	Op	Msg_type	Msg_text
+test.bug47205	check	error	Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it!
+# Running mysqlcheck to check and upgrade
+test.bug47205
+error    : Table rebuild required. Please do "ALTER TABLE `bug47205` FORCE" or dump/reload to fix it!
+
+Repairing tables
+# Table should now be ok
+CHECK TABLE bug47205 FOR UPGRADE;
+Table	Op	Msg_type	Msg_text
+test.bug47205	check	status	OK
+DROP TABLE bug47205;
+#
+# Test 3: MyISAM - REPAIR supported
+# Use an old FRM that will require upgrade
+# Should indicate that REPAIR TABLE is needed
+CHECK TABLE bug47205 FOR UPGRADE;
+Table	Op	Msg_type	Msg_text
+test.bug47205	check	error	Table upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it!
+# Running mysqlcheck to check and upgrade
+test.bug47205
+error    : Table upgrade required. Please do "REPAIR TABLE `bug47205`" or dump/reload to fix it!
+
+Repairing tables
+test.bug47205                                      OK
+# Table should now be ok
+CHECK TABLE bug47205 FOR UPGRADE;
+Table	Op	Msg_type	Msg_text
+test.bug47205	check	status	OK
+DROP TABLE bug47205;

=== modified file 'mysql-test/r/partition.result'
--- a/mysql-test/r/partition.result	2011-02-24 15:48:27 +0000
+++ b/mysql-test/r/partition.result	2011-03-08 19:14:42 +0000
@@ -1,5 +1,18 @@
 drop table if exists t1, t2;
 #
+# Bug#59503: explain extended crash in get_mm_leaf
+#
+CREATE TABLE t1 (a VARCHAR(51) CHARACTER SET latin1)
+ENGINE=MyISAM
+PARTITION BY KEY (a) PARTITIONS 1;
+INSERT INTO t1 VALUES ('a'),('b'),('c');
+EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a > 1;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	filtered	Extra
+1	SIMPLE	t1	ALL	NULL	NULL	NULL	NULL	3	100.00	Using where
+Warnings:
+Note	1003	select 1 AS `1` from `test`.`t1` where (`test`.`t1`.`a` > 1)
+DROP TABLE t1;
+#
 # Bug#57778: failed primary key add to partitioned innodb table
 #            inconsistent and crashes
 #

=== modified file 'mysql-test/r/xml.result'
--- a/mysql-test/r/xml.result	2011-01-18 06:53:45 +0000
+++ b/mysql-test/r/xml.result	2011-03-01 14:47:01 +0000
@@ -1124,6 +1124,14 @@ Warning	1525	Incorrect XML value: 'parse
 SELECT UPDATEXML(CONVERT(_latin1'<!--' USING utf8),'1','1');
 UPDATEXML(CONVERT(_latin1'<!--' USING utf8),'1','1')
 NULL
+#
+# Bug#11766725 (bug#59901): EXTRACTVALUE STILL BROKEN AFTER FIX FOR BUG #44332
+#
+SELECT ExtractValue(CONVERT('<\"', BINARY(10)), 1);
+ExtractValue(CONVERT('<\"', BINARY(10)), 1)
+NULL
+Warnings:
+Warning	1525	Incorrect XML value: 'parse error at line 1 pos 11: STRING unexpected (ident or '/' wanted)'
 End of 5.1 tests
 #
 # Start of 5.5 tests

=== added file 'mysql-test/std_data/bug47205.frm'
Files a/mysql-test/std_data/bug47205.frm	1970-01-01 00:00:00 +0000 and b/mysql-test/std_data/bug47205.frm	2011-03-08 08:41:57 +0000 differ

=== modified file 'mysql-test/suite/engines/iuds/r/insert_year.result'
--- a/mysql-test/suite/engines/iuds/r/insert_year.result	2010-06-22 09:52:50 +0000
+++ b/mysql-test/suite/engines/iuds/r/insert_year.result	2011-03-01 16:06:04 +0000
@@ -2431,7 +2431,7 @@ c1	c2	c3	c4
 2155	2155	1998-12-26	1998-12-26 11:30:45
 SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t3;
 total_rows	min_value	max(c2)
-21	1901	2155
+21	0	2155
 SELECT * FROM t3 WHERE c3 = '1998-12-11';
 c1	c2	c3	c4
 1990	1990	1998-12-11	1998-12-11 11:30:45
@@ -2838,7 +2838,7 @@ c1	c2	c3	c4
 2155	2155	1998-12-26	1998-12-26 11:30:45
 SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t3;
 total_rows	min_value	max(c2)
-21	1901	2155
+21	0	2155
 SELECT * FROM t3 WHERE c3 = '1998-12-11';
 c1	c2	c3	c4
 1990	1990	1998-12-11	1998-12-11 11:30:45

=== modified file 'mysql-test/suite/engines/iuds/t/disabled.def'
--- a/mysql-test/suite/engines/iuds/t/disabled.def	2011-01-05 07:57:45 +0000
+++ b/mysql-test/suite/engines/iuds/t/disabled.def	2011-03-03 07:12:41 +0000
@@ -1,3 +1,4 @@
 insert_calendar : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
 update_delete_calendar : Bug#52824 + Bug#52283(in case of Innodb)
+type_bit_iuds : Anitha: Bug#11766521 SELECT DOES NOT RETURN RESULT FOR "EQUAL / NULL SAFE EQUAL" OPERATOR ON B 
 

=== modified file 'mysql-test/suite/large_tests/t/lock_tables_big.test'
--- a/mysql-test/suite/large_tests/t/lock_tables_big.test	2009-09-11 20:26:35 +0000
+++ b/mysql-test/suite/large_tests/t/lock_tables_big.test	2011-03-01 11:47:04 +0000
@@ -1,6 +1,16 @@
 #
 # Bug#24509 cannot use more than 2048 file descriptors on windows
 #
+
+#
+# This test requires approximately 6000 of files to be open simultaneously.
+# Let us skip it on platforms where open files limit is too low.
+let $max_open_files_limit= `SELECT @@open_files_limit < 6100`;
+if ($max_open_files_limit)
+{
+  skip Need open_files_limit to be greater than 6100;
+}
+
 --disable_query_log
 create database many_tables;
 use many_tables;
@@ -19,14 +29,14 @@ while ($i)
 }
 
 #lock all tables we just created (resembles mysqldump startup is doing with --all-databases operation)
-#There will be 3 descriptors for each table (table.FRM, table.MYI and table.MYD files) means 9000 files
+#There will be 2 descriptors for each table (table.MYI and table.MYD files) means 6000 files
 #descriptors altogether. For Microsoft C runtime, this is way too many.
 
 eval LOCK TABLES $table_list;
 unlock tables;
 
 drop database many_tables;
---disable_query_log
+--enable_query_log
 --echo all done
 
 

=== modified file 'mysql-test/suite/rpl/r/rpl_checksum.result'
--- a/mysql-test/suite/rpl/r/rpl_checksum.result	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result	2011-03-08 19:12:46 +0000
@@ -5,7 +5,7 @@ call mtr.add_suppression('Replication ev
 call mtr.add_suppression('Relay log write failure: could not queue event from master');
 call mtr.add_suppression('Event crc check failed! Most likely there is event corruption');
 call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, Error_code: 1593');
-call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them');
+call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process');
 set @master_save_binlog_checksum= @@global.binlog_checksum;
 set @save_master_verify_checksum =  @@global.master_verify_checksum;
 select @@global.binlog_checksum as 'must be CRC32 because of the command line option';

=== modified file 'mysql-test/suite/rpl/t/rpl_checksum.test'
--- a/mysql-test/suite/rpl/t/rpl_checksum.test	2011-02-23 20:01:27 +0000
+++ b/mysql-test/suite/rpl/t/rpl_checksum.test	2011-03-08 19:12:46 +0000
@@ -11,14 +11,13 @@ call mtr.add_suppression('Replication ev
 call mtr.add_suppression('Relay log write failure: could not queue event from master');
 call mtr.add_suppression('Event crc check failed! Most likely there is event corruption');
 call mtr.add_suppression('Slave SQL: Error initializing relay log position: I/O error reading event at position .*, Error_code: 1593');
+call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process');
 
 # A. read/write access to the global vars:
 # binlog_checksum master_verify_checksum slave_sql_verify_checksum
 
 connection master;
 
-call mtr.add_suppression('Master is configured to log replication events with checksum, but will not send such events to slaves that cannot process them');
-
 set @master_save_binlog_checksum= @@global.binlog_checksum;
 set @save_master_verify_checksum =  @@global.master_verify_checksum;
 

=== modified file 'mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test'
--- a/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test	2010-12-19 17:22:30 +0000
+++ b/mysql-test/suite/rpl/t/rpl_row_mysqlbinlog.test	2011-03-03 07:03:14 +0000
@@ -293,8 +293,11 @@ connection master;
 
 create table t4 (f text character set utf8);
 create table t5 (f text character set cp932); 
---exec $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'���')"
---exec $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'�\');"
+--character_set utf8
+--execw $MYSQL --default-character-set=utf8 test -e "insert into t4 values(_utf8'���')"
+--character_set cp932
+--execw $MYSQL --default-character-set=cp932 test -e "insert into t5 values(_cp932'�\');"
+--character_set latin1
 let $MYSQLD_DATADIR= `select @@datadir;`;
 flush logs;
 rename table t4 to t04, t5 to t05;

=== modified file 'mysql-test/t/ctype_latin1.test'
--- a/mysql-test/t/ctype_latin1.test	2010-11-18 09:26:45 +0000
+++ b/mysql-test/t/ctype_latin1.test	2011-03-04 15:55:18 +0000
@@ -143,6 +143,21 @@ SELECT '' LIKE '' ESCAPE EXPORT_SET(1, 1
 --source include/ctype_numconv.inc
 
 --echo #
+--echo # Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters
+--echo #
+# Test latin1 client erroneously started with --default-character-set=utf8
+# EXPLAIN output should still be pretty readable.
+# We're using 'APITAL LETTER A WITH TILDE ABOVE + SUPERSCRIPT 3" in latin1
+# - it's "LATIN SMALL LETTER O WITH ACUTE ABOVE" in utf8.
+SET NAMES utf8;
+EXPLAIN EXTENDED SELECT 'abcd�l latin1
+SET NAMES latin1;
+EXPLAIN EXTENDED SELECT 'abcd��', _latin1'abcd��', _utf8'abcd��';
+
+
+--echo #
 --echo # End of 5.5 tests
 --echo #
 

=== modified file 'mysql-test/t/ctype_sjis.test'
--- a/mysql-test/t/ctype_sjis.test	2010-03-22 09:13:41 +0000
+++ b/mysql-test/t/ctype_sjis.test	2011-03-04 14:59:32 +0000
@@ -92,6 +92,14 @@ INSERT INTO t1 VALUES (0x8372835E),(0x83
 SELECT hex(a), hex(lower(a)), hex(upper(a)) FROM t1 ORDER BY binary(a);
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#11766519 - Bug#59648: MY_STRTOLL10_MB2: ASSERTION `(*ENDPTR - S) % 2 == 0' FAILED.
+--echo #
+# In the below string backslash (0x5C) is a part of a multi-byte
+# character, so it should not be quoted.
+SELECT QUOTE('�\');
+
+
 --echo # End of 5.1 tests
 
 

=== modified file 'mysql-test/t/ctype_ucs.test'
--- a/mysql-test/t/ctype_ucs.test	2011-01-18 07:16:49 +0000
+++ b/mysql-test/t/ctype_ucs.test	2011-03-04 14:59:32 +0000
@@ -699,6 +699,12 @@ WHERE t1.b <=> (SELECT a FROM t1 WHERE a
 DROP VIEW v1;
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed.
+--echo #
+SELECT HEX(CHAR(COALESCE(NULL, CHAR(COUNT('%s') USING ucs2), 1, @@global.license, NULL) USING cp850));
+SELECT CONVERT(QUOTE(CHAR(0xf5 using ucs2)), SIGNED);
+
 --echo End of 5.0 tests
 
 

=== modified file 'mysql-test/t/ctype_utf16.test'
--- a/mysql-test/t/ctype_utf16.test	2010-09-28 15:29:26 +0000
+++ b/mysql-test/t/ctype_utf16.test	2011-03-01 12:20:38 +0000
@@ -746,6 +746,15 @@ CREATE TABLE t2 AS SELECT CONCAT(s1) FRO
 SHOW CREATE TABLE t2;
 DROP TABLE t1, t2;
 
+--echo #
+--echo # Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure
+--echo #
+SELECT CASE _latin1'a' WHEN _utf16'a' THEN 'A' END;
+SELECT CASE _utf16'a' WHEN _latin1'a' THEN 'A' END;
+CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf16);
+INSERT INTO t1 VALUES ('a');
+SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1;
+DROP TABLE t1;
 
 #
 ## TODO: add tests for all engines

=== modified file 'mysql-test/t/ctype_utf32.test'
--- a/mysql-test/t/ctype_utf32.test	2010-09-28 15:30:47 +0000
+++ b/mysql-test/t/ctype_utf32.test	2011-03-01 12:20:38 +0000
@@ -842,6 +842,16 @@ SELECT * FROM t1 WHERE b BETWEEN 'a' AND
 DROP TABLE t1;
 
 --echo #
+--echo # Bug#11753363 (Bug#44793) Character sets: case clause, ucs2 or utf32, failure
+--echo #
+SELECT CASE _latin1'a' WHEN _utf32'a' THEN 'A' END;
+SELECT CASE _utf32'a' WHEN _latin1'a' THEN 'A' END;
+CREATE TABLE t1 (s1 CHAR(5) CHARACTER SET utf32);
+INSERT INTO t1 VALUES ('a');
+SELECT CASE s1 WHEN 'a' THEN 'b' ELSE 'c' END FROM t1;
+DROP TABLE t1;
+
+--echo #
 --echo # End of 5.5 tests
 --echo #
 

=== modified file 'mysql-test/t/ctype_utf8.test'
--- a/mysql-test/t/ctype_utf8.test	2010-12-17 11:28:59 +0000
+++ b/mysql-test/t/ctype_utf8.test	2011-03-04 15:55:18 +0000
@@ -1570,6 +1570,16 @@ SELECT COUNT(*) FROM t1, t1 t2
 GROUP BY INSERT('', t2.a, t1.a, (@@global.max_binlog_size));
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#11764503 (Bug#57341) Query in EXPLAIN EXTENDED shows wrong characters
+--echo #
+# Emulate utf8 client erroneously started with --default-character-set=latin1,
+# as in the bug report. EXPLAIN output should still be pretty readable
+SET NAMES latin1;
+EXPLAIN EXTENDED SELECT 'abcd����# Test normal utf8
+SET NAMES utf8;
+EXPLAIN EXTENDED SELECT 'abcd����������', _latin1'abcd����������', _utf8'abcd�����== modified file 'mysql-test/t/flush.test'
--- a/mysql-test/t/flush.test	2010-11-11 17:11:05 +0000
+++ b/mysql-test/t/flush.test	2011-03-07 09:08:10 +0000
@@ -644,3 +644,27 @@ disconnect con2;
 --source include/wait_until_disconnected.inc
 connection default;
 drop tables t1, t2;
+
+
+--echo #
+--echo # Bug#57649 FLUSH TABLES under FLUSH TABLES <list> WITH READ LOCK leads
+--echo #           to assert failure.
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+CREATE TABLE t1 (a INT);
+FLUSH TABLES t1 WITH READ LOCK;
+
+# All these triggered the assertion
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+FLUSH TABLES;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+CREATE TRIGGER t1_bi BEFORE INSERT ON t1 FOR EACH ROW SET @a= 1;
+--error ER_TABLE_NOT_LOCKED_FOR_WRITE
+ALTER TABLE t1 COMMENT 'test';
+
+UNLOCK TABLES;
+DROP TABLE t1;

=== added file 'mysql-test/t/func_encrypt_ucs2.test'
--- a/mysql-test/t/func_encrypt_ucs2.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/func_encrypt_ucs2.test	2011-03-03 12:27:36 +0000
@@ -0,0 +1,12 @@
+-- source include/have_ssl_crypto_functs.inc
+-- source include/have_ucs2.inc
+
+--echo #
+--echo # Bug#59648 my_strtoll10_mb2: Assertion `(*endptr - s) % 2 == 0' failed.
+--echo #
+
+SELECT CHAR_LENGTH(DES_ENCRYPT(0, CHAR('1' USING ucs2)));
+SELECT CONVERT(DES_ENCRYPT(0, CHAR('1' USING ucs2)),UNSIGNED);
+
+SELECT CHAR_LENGTH(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' USING ucs2)));
+SELECT CONVERT(DES_DECRYPT(0xFF0DC9FC9537CA75F4, CHAR('1' using ucs2)), UNSIGNED);

=== modified file 'mysql-test/t/func_set.test'
--- a/mysql-test/t/func_set.test	2009-06-16 14:36:15 +0000
+++ b/mysql-test/t/func_set.test	2011-03-04 14:46:17 +0000
@@ -97,3 +97,25 @@ SELECT CONVERT( a USING latin1 ) FROM t1
 SELECT CONVERT( a USING latin1 ) FROM t2;
 
 DROP TABLE t1, t2;
+
+--echo #
+--echo # BUG#59405: FIND_IN_SET won't work normaly after upgrade from 5.1 to 5.5
+--echo #
+
+CREATE TABLE t1(days set('1','2','3','4','5','6','7'));
+INSERT INTO t1 VALUES('1,2,3,4,5,6,7'), (NULL), ('1,2,3,4,5,6,7');
+
+--echo
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days);
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), days) IS UNKNOWN; 
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL);
+SELECT * FROM t1 WHERE FIND_IN_SET(DAYOFWEEK(CURRENT_DATE()), NULL) IS UNKNOWN; 
+SELECT * FROM t1 WHERE FIND_IN_SET(7, days);
+SELECT * FROM t1 WHERE FIND_IN_SET(8, days);
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days); 
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, days) IS UNKNOWN; 
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL); 
+SELECT * FROM t1 WHERE FIND_IN_SET(NULL, NULL) IS UNKNOWN; 
+
+--echo
+DROP TABLE t1;

=== modified file 'mysql-test/t/grant_lowercase_fs.test'
--- a/mysql-test/t/grant_lowercase_fs.test	2009-10-27 08:09:19 +0000
+++ b/mysql-test/t/grant_lowercase_fs.test	2011-03-08 13:23:30 +0000
@@ -1,4 +1,4 @@
--- source include/have_case_insensitive_fs.inc
+-- source include/have_case_insensitive_file_system.inc
 -- source include/not_embedded.inc
 
 

=== modified file 'mysql-test/t/innodb_mysql_sync.test'
--- a/mysql-test/t/innodb_mysql_sync.test	2011-01-26 13:23:29 +0000
+++ b/mysql-test/t/innodb_mysql_sync.test	2011-03-07 13:30:49 +0000
@@ -253,26 +253,23 @@ connection con1;
 --reap
 
 --echo # Test 4: Secondary unique index, should not block reads.
-# This requires HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE to be supported
-# by InnoDB. Adding this flag currently introduces a regression so
-# this test is disabled until the regression has been fixed.
 
 --echo # Connection default
 connection default;
-#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
-#--echo # Sending:
-#--send ALTER TABLE t1 ADD UNIQUE (b)
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+--echo # Sending:
+--send ALTER TABLE t1 ADD UNIQUE (b)
 
-#--echo # Connection con1
-#connection con1;
-#SET DEBUG_SYNC= "now WAIT_FOR manage";
-#SELECT * FROM t1;
-#SET DEBUG_SYNC= "now SIGNAL query";
+--echo # Connection con1
+connection con1;
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+SELECT * FROM t1;
+SET DEBUG_SYNC= "now SIGNAL query";
 
-#--echo # Connection default
-#connection default;
-#--echo # Reaping: ALTER TABLE t1 ADD UNIQUE (b)
-#--reap
+--echo # Connection default
+connection default;
+--echo # Reaping: ALTER TABLE t1 ADD UNIQUE (b)
+--reap
 
 disconnect con1;
 disconnect con2;

=== modified file 'mysql-test/t/mysqlcheck.test'
--- a/mysql-test/t/mysqlcheck.test	2010-10-25 13:49:55 +0000
+++ b/mysql-test/t/mysqlcheck.test	2011-03-08 09:21:39 +0000
@@ -2,6 +2,8 @@
 # Embedded server doesn't support external clients
 --source include/not_embedded.inc
 
+--source include/have_innodb.inc
+
 # check that CSV engine was compiled in, as the result of the test
 # depends on the presence of the log tables (which are CSV-based).
 --source include/have_csv.inc
@@ -34,7 +36,7 @@ drop database if exists client_test_db;
 #
 # Bug #16502: mysqlcheck tries to check views
 #
-create table t1 (a int);
+create table t1 (a int) engine=myisam;
 create view v1 as select * from t1;
 --replace_result 'Table is already up to date' OK
 --exec $MYSQL_CHECK --analyze --databases test
@@ -48,8 +50,8 @@ drop table t1;
 #
 # Bug #30654: mysqlcheck fails during upgrade of tables whose names include backticks
 #
-create table `t``1`(a int);
-create table `t 1`(a int);
+create table `t``1`(a int) engine=myisam;
+create table `t 1`(a int) engine=myisam;
 --replace_result 'Table is already up to date' OK
 --exec $MYSQL_CHECK --databases test
 drop table `t``1`, `t 1`;
@@ -59,7 +61,7 @@ drop table `t``1`, `t 1`;
 #
 create database d_bug25347;
 use d_bug25347;
-create table t_bug25347 (a int);
+create table t_bug25347 (a int) engine=myisam;
 create view v_bug25347 as select * from t_bug25347;
 insert into t_bug25347 values (1),(2),(3);
 flush tables;
@@ -91,8 +93,8 @@ drop view v1;
 # Bug#37527: mysqlcheck fails to report entire database 
 # when frm file corruption
 #
-CREATE TABLE t1(a INT);
-CREATE TABLE t2(a INT);
+CREATE TABLE t1(a INT) engine=myisam;
+CREATE TABLE t2(a INT) engine=myisam;
 # backup then null t1.frm
 --copy_file $MYSQLD_DATADIR/test/t1.frm $MYSQLD_DATADIR/test/t1.frm.bak
 --remove_file $MYSQLD_DATADIR/test/t1.frm
@@ -112,7 +114,7 @@ DROP TABLE t1, t2;
 #
 # Bug #30679: 5.1 name encoding not performed for views during upgrade
 #
-create table t1(a int);
+create table t1(a int) engine=myisam;
 create view v1 as select * from t1;
 show tables;
 let $MYSQLD_DATADIR= `select @@datadir`;
@@ -131,7 +133,7 @@ drop table t1;
 #             triggers
 #
 SET NAMES utf8;
-CREATE TABLE `#mysql50#@` (a INT);
+CREATE TABLE `#mysql50#@` (a INT) engine=myisam;
 SHOW TABLES;
 SET NAMES DEFAULT;
 --echo mysqlcheck --fix-table-names --databases test
@@ -140,7 +142,7 @@ SET NAMES utf8;
 SHOW TABLES;
 DROP TABLE `@`;
 
-CREATE TABLE `��` (a INT);
+CREATE TABLE `��` (a INT) engine=myisam;
 SET NAMES DEFAULT;
 --echo mysqlcheck --default-character-set="latin1" --databases test
 # Error returned depends on platform, replace it with "Table doesn't exist"
@@ -154,8 +156,8 @@ SET NAMES DEFAULT;
 
 CREATE DATABASE `#mysql50#a@b`;
 USE `#mysql50#a@b`;
-CREATE TABLE `#mysql50#c@d` (a INT);
-CREATE TABLE t1 (a INT);
+CREATE TABLE `#mysql50#c@d` (a INT) engine=myisam;
+CREATE TABLE t1 (a INT) engine=myisam;
 
 # Create 5.0 like triggers
 let $MYSQLTEST_VARDIR= `select @@datadir`;
@@ -207,12 +209,12 @@ USE test;
 drop table if exists `#mysql50#t1-1`;
 --enable_warnings
 
-create table `#mysql50#t1-1` (a int);
+create table `#mysql50#t1-1` (a int) engine=myisam;
 --exec $MYSQL_CHECK --all-in-1 --fix-table-names --databases test
 show tables like 't1-1';
 drop table `t1-1`;
 
-create table `#mysql50#t1-1` (a int);
+create table `#mysql50#t1-1` (a int) engine=myisam;
 --exec $MYSQL_CHECK --all-in-1 --fix-table-names test "#mysql50#t1-1"
 show tables like 't1-1';
 drop table `t1-1`;
@@ -234,3 +236,83 @@ drop table `t1-1`;
 --error 1
 --exec $MYSQL_CHECK -aoc test "#mysql50#t1-1"
 
+
+--echo #
+--echo # Bug#11755431 47205: MAP 'REPAIR TABLE' TO RECREATE +ANALYZE FOR
+--echo #              ENGINES NOT SUPPORTING NATIVE
+--echo #
+
+--disable_warnings
+DROP TABLE IF EXISTS bug47205;
+--enable_warnings
+
+--echo #
+--echo # Test 1: Check that ALTER TABLE ... rebuilds the table
+
+CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY)
+  DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb;
+
+INSERT INTO bug47205 VALUES ("foobar");
+FLUSH TABLE bug47205;
+
+--echo # Replace the FRM with a 5.0 FRM that will require upgrade
+let $MYSQLD_DATADIR= `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/test/bug47205.frm
+--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm
+
+--echo # Should indicate that ALTER TABLE ... FORCE is needed
+CHECK TABLE bug47205 FOR UPGRADE;
+
+--echo # ALTER TABLE ... FORCE should rebuild the table
+--echo # and therefore output "affected rows: 1"
+--enable_info
+ALTER TABLE bug47205 FORCE;
+--disable_info
+
+--echo # Table should now be ok
+CHECK TABLE bug47205 FOR UPGRADE;
+
+DROP TABLE bug47205;
+
+--echo #
+--echo # Test 2: InnoDB - REPAIR not supported
+
+CREATE TABLE bug47205(a VARCHAR(20) PRIMARY KEY)
+  DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci engine=innodb;
+
+FLUSH TABLE bug47205;
+
+--echo # Replace the FRM with a 5.0 FRM that will require upgrade
+let $MYSQLD_DATADIR= `select @@datadir`;
+--remove_file $MYSQLD_DATADIR/test/bug47205.frm
+--copy_file std_data/bug47205.frm $MYSQLD_DATADIR/test/bug47205.frm
+
+--echo # Should indicate that ALTER TABLE .. FORCE is needed
+CHECK TABLE bug47205 FOR UPGRADE;
+
+--echo # Running mysqlcheck to check and upgrade
+--exec $MYSQL_CHECK --check-upgrade --auto-repair test
+
+--echo # Table should now be ok
+CHECK TABLE bug47205 FOR UPGRADE;
+
+DROP TABLE bug47205;
+
+--echo #
+--echo # Test 3: MyISAM - REPAIR supported
+
+--echo # Use an old FRM that will require upgrade
+--copy_file std_data/bug36055.frm $MYSQLD_DATADIR/test/bug47205.frm
+--copy_file std_data/bug36055.MYD $MYSQLD_DATADIR/test/bug47205.MYD
+--copy_file std_data/bug36055.MYI $MYSQLD_DATADIR/test/bug47205.MYI
+
+--echo # Should indicate that REPAIR TABLE is needed
+CHECK TABLE bug47205 FOR UPGRADE;
+
+--echo # Running mysqlcheck to check and upgrade
+--exec $MYSQL_CHECK --check-upgrade --auto-repair test
+
+--echo # Table should now be ok
+CHECK TABLE bug47205 FOR UPGRADE;
+
+DROP TABLE bug47205;

=== modified file 'mysql-test/t/partition.test'
--- a/mysql-test/t/partition.test	2011-02-24 15:48:27 +0000
+++ b/mysql-test/t/partition.test	2011-03-08 19:14:42 +0000
@@ -15,6 +15,16 @@ drop table if exists t1, t2;
 --enable_warnings
 
 --echo #
+--echo # Bug#59503: explain extended crash in get_mm_leaf
+--echo #
+CREATE TABLE t1 (a VARCHAR(51) CHARACTER SET latin1)
+ENGINE=MyISAM
+PARTITION BY KEY (a) PARTITIONS 1;
+INSERT INTO t1 VALUES ('a'),('b'),('c');
+EXPLAIN EXTENDED SELECT 1 FROM t1 WHERE a > 1;
+DROP TABLE t1;
+
+--echo #
 --echo # Bug#57778: failed primary key add to partitioned innodb table
 --echo #            inconsistent and crashes
 --echo #

=== modified file 'mysql-test/t/xml.test'
--- a/mysql-test/t/xml.test	2011-01-18 06:53:45 +0000
+++ b/mysql-test/t/xml.test	2011-03-01 14:47:01 +0000
@@ -646,6 +646,11 @@ SELECT EXTRACTVALUE('', LPAD(0.1111E-15,
 SELECT UPDATEXML(CONVERT(_latin1'<' USING utf8),'1','1');
 SELECT UPDATEXML(CONVERT(_latin1'<!--' USING utf8),'1','1');
 
+--echo #
+--echo # Bug#11766725 (bug#59901): EXTRACTVALUE STILL BROKEN AFTER FIX FOR BUG #44332
+--echo #
+SELECT ExtractValue(CONVERT('<\"', BINARY(10)), 1);
+
 --echo End of 5.1 tests
 
 

=== modified file 'mysys/default.c'
--- a/mysys/default.c	2011-02-09 22:34:20 +0000
+++ b/mysys/default.c	2011-03-04 15:38:00 +0000
@@ -140,7 +140,7 @@ static int search_default_file_with_ext(
   - Unix:        /etc/
   - Unix:        /etc/mysql/
   - Unix:        --sysconfdir=<path> (compile-time option)
-  - ALL:         getenv(DEFAULT_HOME_ENV)
+  - ALL:         getenv("MYSQL_HOME")
   - ALL:         --defaults-extra-file=<path> (run-time option)
   - Unix:        ~/
 
@@ -1234,7 +1234,7 @@ static const char **init_default_directo
 
 #endif
 
-  if ((env= getenv(STRINGIFY_ARG(DEFAULT_HOME_ENV))))
+  if ((env= getenv("MYSQL_HOME")))
     errors += add_directory(alloc, env, dirs);
 
   /* Placeholder for --defaults-extra-file=<path> */

=== modified file 'mysys/my_init.c'
--- a/mysys/my_init.c	2011-01-13 11:31:20 +0000
+++ b/mysys/my_init.c	2011-03-01 13:39:58 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000-2003 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011 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
@@ -37,8 +37,6 @@ static my_bool win32_init_tcp_ip();
 #define SCALE_USEC      10000
 
 my_bool my_init_done= 0;
-/** True if @c my_basic_init() has been called. */
-my_bool my_basic_init_done= 0;
 uint	mysys_usage_id= 0;              /* Incremented for each my_init() */
 ulong   my_thread_stack_size= 65536;
 
@@ -56,23 +54,22 @@ static ulong atoi_octal(const char *str)
 MYSQL_FILE *mysql_stdin= NULL;
 static MYSQL_FILE instrumented_stdin;
 
+
 /**
-  Perform a limited initialisation of mysys.
-  This initialisation is sufficient to:
-  - allocate memory,
-  - read configuration files,
-  - parse command lines arguments.
-  To complete the mysys initialisation,
-  call my_init().
-  @return 0 on success
+  Initialize my_sys functions, resources and variables
+
+  @return Initialization result
+    @retval 0 Success
+    @retval 1 Error. Couldn't initialize environment
 */
-my_bool my_basic_init(void)
+my_bool my_init(void)
 {
-  char * str;
+  char *str;
 
-  if (my_basic_init_done)
+  if (my_init_done)
     return 0;
-  my_basic_init_done= 1;
+
+  my_init_done= 1;
 
   mysys_usage_id++;
   my_umask= 0660;                       /* Default umask for new files */
@@ -105,41 +102,11 @@ my_bool my_basic_init(void)
 #if defined(HAVE_PTHREAD_INIT)
   pthread_init();			/* Must be called before DBUG_ENTER */
 #endif
-  if (my_thread_basic_global_init())
-    return 1;
 
   /* $HOME is needed early to parse configuration files located in ~/ */
   if ((home_dir= getenv("HOME")) != 0)
     home_dir= intern_filename(home_dir_buff, home_dir);
 
-  return 0;
-}
-
-
-/*
-  Init my_sys functions and my_sys variabels
-
-  SYNOPSIS
-    my_init()
-
-  RETURN
-    0  ok
-    1  Couldn't initialize environment
-*/
-
-my_bool my_init(void)
-{
-  if (my_init_done)
-    return 0;
-
-  my_init_done= 1;
-
-  if (my_basic_init())
-    return 1;
-
-  if (my_thread_global_init())
-    return 1;
-
   {
     DBUG_ENTER("my_init");
     DBUG_PROCESS((char*) (my_progname ? my_progname : "unknown"));
@@ -256,7 +223,6 @@ Voluntary context switches %ld, Involunt
 #endif /* __WIN__ */
 
   my_init_done=0;
-  my_basic_init_done= 0;
 } /* my_end */
 
 

=== modified file 'mysys/my_thr_init.c'
--- a/mysys/my_thr_init.c	2011-01-13 11:31:20 +0000
+++ b/mysys/my_thr_init.c	2011-03-01 13:39:58 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011 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
@@ -66,86 +66,40 @@ nptl_pthread_exit_hack_handler(void *arg
 
 static uint get_thread_lib(void);
 
-/** True if @c my_thread_basic_global_init() has been called. */
-static my_bool my_thread_basic_global_init_done= 0;
+/** True if @c my_thread_global_init() has been called. */
+static my_bool my_thread_global_init_done= 0;
 
-/**
-  Perform a minimal initialisation of mysys, when compiled with threads.
-  The initialisation performed is sufficient to:
-  - allocate memory
-  - perform file operations
-  - use charsets
-  - use my_errno
-  @sa my_basic_init
-  @sa my_thread_basic_global_reinit
-*/
-my_bool my_thread_basic_global_init(void)
-{
-  int pth_ret;
-
-  if (my_thread_basic_global_init_done)
-    return 0;
-  my_thread_basic_global_init_done= 1;
-
-#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
-  /*
-    Set mutex type to "fast" a.k.a "adaptive"
-
-    In this case the thread may steal the mutex from some other thread
-    that is waiting for the same mutex.  This will save us some
-    context switches but may cause a thread to 'starve forever' while
-    waiting for the mutex (not likely if the code within the mutex is
-    short).
-  */
-  pthread_mutexattr_init(&my_fast_mutexattr);
-  pthread_mutexattr_settype(&my_fast_mutexattr,
-                            PTHREAD_MUTEX_ADAPTIVE_NP);
-#endif
-
-#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
-  /*
-    Set mutex type to "errorcheck"
-  */
-  pthread_mutexattr_init(&my_errorcheck_mutexattr);
-  pthread_mutexattr_settype(&my_errorcheck_mutexattr,
-                            PTHREAD_MUTEX_ERRORCHECK);
-#endif
-
-  mysql_mutex_init(key_THR_LOCK_malloc, &THR_LOCK_malloc, MY_MUTEX_INIT_FAST);
-  mysql_mutex_init(key_THR_LOCK_open, &THR_LOCK_open, MY_MUTEX_INIT_FAST);
-  mysql_mutex_init(key_THR_LOCK_charset, &THR_LOCK_charset, MY_MUTEX_INIT_FAST);
-  mysql_mutex_init(key_THR_LOCK_threads, &THR_LOCK_threads, MY_MUTEX_INIT_FAST);
-
-  if ((pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0)
-  {
-    fprintf(stderr, "Can't initialize threads: error %d\n", pth_ret);
-    return 1;
-  }
-
-  if (my_thread_init())
-    return 1;
-
-  return 0;
-}
 
 /**
-  Re-initialize components initialized early with @c my_thread_basic_global_init.
+  Re-initialize components initialized early with @c my_thread_global_init.
   Some mutexes were initialized before the instrumentation.
   Destroy + create them again, now that the instrumentation
   is in place.
   This is safe, since this function() is called before creating new threads,
   so the mutexes are not in use.
 */
-void my_thread_basic_global_reinit(void)
+void my_thread_global_reinit(void)
 {
   struct st_my_thread_var *tmp;
 
-  DBUG_ASSERT(my_thread_basic_global_init_done);
+  DBUG_ASSERT(my_thread_global_init_done);
 
 #ifdef HAVE_PSI_INTERFACE
   my_init_mysys_psi_keys();
 #endif
 
+  mysql_mutex_destroy(&THR_LOCK_isam);
+  mysql_mutex_init(key_THR_LOCK_isam, &THR_LOCK_isam, MY_MUTEX_INIT_SLOW);
+
+  mysql_mutex_destroy(&THR_LOCK_heap);
+  mysql_mutex_init(key_THR_LOCK_heap, &THR_LOCK_heap, MY_MUTEX_INIT_FAST);
+
+  mysql_mutex_destroy(&THR_LOCK_net);
+  mysql_mutex_init(key_THR_LOCK_net, &THR_LOCK_net, MY_MUTEX_INIT_FAST);
+
+  mysql_mutex_destroy(&THR_LOCK_myisam);
+  mysql_mutex_init(key_THR_LOCK_myisam, &THR_LOCK_myisam, MY_MUTEX_INIT_SLOW);
+
   mysql_mutex_destroy(&THR_LOCK_malloc);
   mysql_mutex_init(key_THR_LOCK_malloc, &THR_LOCK_malloc, MY_MUTEX_INIT_FAST);
 
@@ -158,6 +112,9 @@ void my_thread_basic_global_reinit(void)
   mysql_mutex_destroy(&THR_LOCK_threads);
   mysql_mutex_init(key_THR_LOCK_threads, &THR_LOCK_threads, MY_MUTEX_INIT_FAST);
 
+  mysql_cond_destroy(&THR_COND_threads);
+  mysql_cond_init(key_THR_COND_threads, &THR_COND_threads, NULL);
+
   tmp= my_pthread_getspecific(struct st_my_thread_var*, THR_KEY_mysys);
   DBUG_ASSERT(tmp);
 
@@ -181,7 +138,48 @@ void my_thread_basic_global_reinit(void)
 
 my_bool my_thread_global_init(void)
 {
-  if (my_thread_basic_global_init())
+  int pth_ret;
+
+  if (my_thread_global_init_done)
+    return 0;
+  my_thread_global_init_done= 1;
+
+#ifdef PTHREAD_ADAPTIVE_MUTEX_INITIALIZER_NP
+  /*
+    Set mutex type to "fast" a.k.a "adaptive"
+
+    In this case the thread may steal the mutex from some other thread
+    that is waiting for the same mutex.  This will save us some
+    context switches but may cause a thread to 'starve forever' while
+    waiting for the mutex (not likely if the code within the mutex is
+    short).
+  */
+  pthread_mutexattr_init(&my_fast_mutexattr);
+  pthread_mutexattr_settype(&my_fast_mutexattr,
+                            PTHREAD_MUTEX_ADAPTIVE_NP);
+#endif
+
+#ifdef PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP
+  /*
+    Set mutex type to "errorcheck"
+  */
+  pthread_mutexattr_init(&my_errorcheck_mutexattr);
+  pthread_mutexattr_settype(&my_errorcheck_mutexattr,
+                            PTHREAD_MUTEX_ERRORCHECK);
+#endif
+
+  if ((pth_ret= pthread_key_create(&THR_KEY_mysys, NULL)) != 0)
+  {
+    fprintf(stderr, "Can't initialize threads: error %d\n", pth_ret);
+    return 1;
+  }
+
+  mysql_mutex_init(key_THR_LOCK_malloc, &THR_LOCK_malloc, MY_MUTEX_INIT_FAST);
+  mysql_mutex_init(key_THR_LOCK_open, &THR_LOCK_open, MY_MUTEX_INIT_FAST);
+  mysql_mutex_init(key_THR_LOCK_charset, &THR_LOCK_charset, MY_MUTEX_INIT_FAST);
+  mysql_mutex_init(key_THR_LOCK_threads, &THR_LOCK_threads, MY_MUTEX_INIT_FAST);
+
+  if (my_thread_init())
     return 1;
 
   thd_lib_detected= get_thread_lib();
@@ -233,11 +231,6 @@ my_bool my_thread_global_init(void)
   install_sigabrt_handler();
 #endif
 
-  if (my_thread_init())
-  {
-    my_thread_global_end();			/* Clean up */
-    return 1;
-  }
   return 0;
 }
 
@@ -300,7 +293,7 @@ void my_thread_global_end(void)
   mysql_mutex_destroy(&LOCK_gethostbyname_r);
 #endif
 
-  my_thread_basic_global_init_done= 0;
+  my_thread_global_init_done= 0;
 }
 
 static my_thread_id thread_id= 0;

=== modified file 'mysys/stacktrace.c'
--- a/mysys/stacktrace.c	2010-11-30 23:20:32 +0000
+++ b/mysys/stacktrace.c	2011-03-02 23:04:54 +0000
@@ -704,11 +704,11 @@ void my_safe_print_str(const char *val,
 {
   __try
   {
-    fprintf(stderr,"=%.*s\n", len, val);
+    fprintf(stderr, "%.*s\n", len, val);
   }
   __except(EXCEPTION_EXECUTE_HANDLER)
   {
-    fprintf(stderr,"is an invalid string pointer\n");
+    fprintf(stderr, "is an invalid string pointer\n");
   }
 }
 #endif /*__WIN__*/

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	2011-02-24 15:48:27 +0000
+++ b/sql/handler.cc	2011-03-08 19:14:42 +0000
@@ -3431,9 +3431,13 @@ int handler::ha_repair(THD* thd, HA_CHEC
   int result;
   mark_trx_read_write();
 
-  if ((result= repair(thd, check_opt)))
-    return result;
-  return update_frm_version(table);
+  result= repair(thd, check_opt);
+  DBUG_ASSERT(result == HA_ADMIN_NOT_IMPLEMENTED ||
+              ha_table_flags() & HA_CAN_REPAIR);
+
+  if (result == HA_ADMIN_OK)
+    result= update_frm_version(table);
+  return result;
 }
 
 

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2011-02-02 22:02:29 +0000
+++ b/sql/handler.h	2011-03-08 09:21:39 +0000
@@ -153,6 +153,12 @@
     ordered.
 */
 #define HA_DUPLICATE_KEY_NOT_IN_ORDER    (LL(1) << 36)
+/*
+  Engine supports REPAIR TABLE. Used by CHECK TABLE FOR UPGRADE if an
+  incompatible table is detected. If this flag is set, CHECK TABLE FOR UPGRADE
+  will report ER_TABLE_NEEDS_UPGRADE, otherwise ER_TABLE_NEED_REBUILD.
+*/
+#define HA_CAN_REPAIR                    (LL(1) << 37)
 
 /*
   Set of all binlog flags. Currently only contain the capabilities
@@ -2337,7 +2343,10 @@ private:
      upon the table.
   */
   virtual int repair(THD* thd, HA_CHECK_OPT* check_opt)
-  { return HA_ADMIN_NOT_IMPLEMENTED; }
+  {
+    DBUG_ASSERT(!(ha_table_flags() & HA_CAN_REPAIR));
+    return HA_ADMIN_NOT_IMPLEMENTED;
+  }
   virtual void start_bulk_insert(ha_rows rows) {}
   virtual int end_bulk_insert() { return 0; }
 protected:

=== modified file 'sql/item.cc'
--- a/sql/item.cc	2011-02-24 15:48:27 +0000
+++ b/sql/item.cc	2011-03-08 19:14:42 +0000
@@ -2606,7 +2606,9 @@ my_decimal *Item_float::val_decimal(my_d
 
 void Item_string::print(String *str, enum_query_type query_type)
 {
-  if (query_type == QT_ORDINARY && is_cs_specified())
+  const bool print_introducer=
+    !(query_type & QT_WITHOUT_INTRODUCERS) && is_cs_specified();
+  if (print_introducer)
   {
     str->append('_');
     str->append(collation.collation->csname);
@@ -2614,27 +2616,52 @@ void Item_string::print(String *str, enu
 
   str->append('\'');
 
-  if (query_type == QT_ORDINARY ||
-      my_charset_same(str_value.charset(), system_charset_info))
+  if (query_type & QT_TO_SYSTEM_CHARSET)
   {
-    str_value.print(str);
+    if (print_introducer)
+    {
+      /*
+        Because we wrote an introducer, we must print str_value in its
+        charset, and the resulting bytes must not be changed until they
+        reach the end client.
+        But the caller is asking for system_charset_info, and may later
+        convert into character_set_results. That means two conversions: we
+        must ensure that they don't change our printed bytes.
+        So we print str_value in the least common denominator of the three
+        charsets involved: ASCII. Non-ASCII characters are printed as \xFF
+        sequences (which is ASCII too). This way, our bytes will not be
+        changed.
+      */
+      ErrConvString tmp(str_value.ptr(), str_value.length(), &my_charset_bin);
+      str->append(tmp.ptr());
+    }
+    else
+    {
+      if (my_charset_same(str_value.charset(), system_charset_info))
+        str_value.print(str); // already in system_charset_info
+      else // need to convert
+      {
+        THD *thd= current_thd;
+        LEX_STRING utf8_lex_str;
+
+        thd->convert_string(&utf8_lex_str,
+                            system_charset_info,
+                            str_value.c_ptr_safe(),
+                            str_value.length(),
+                            str_value.charset());
+
+        String utf8_str(utf8_lex_str.str,
+                        utf8_lex_str.length,
+                        system_charset_info);
+
+        utf8_str.print(str);
+      }
+    }
   }
   else
   {
-    THD *thd= current_thd;
-    LEX_STRING utf8_lex_str;
-
-    thd->convert_string(&utf8_lex_str,
-                        system_charset_info,
-                        str_value.c_ptr_safe(),
-                        str_value.length(),
-                        str_value.charset());
-
-    String utf8_str(utf8_lex_str.str,
-                    utf8_lex_str.length,
-                    system_charset_info);
-
-    utf8_str.print(str);
+    // Caller wants a result in the charset of str_value.
+    str_value.print(str);
   }
 
   str->append('\'');

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	2011-02-24 15:48:27 +0000
+++ b/sql/item_cmpfunc.cc	2011-03-08 19:14:42 +0000
@@ -3140,20 +3140,59 @@ void Item_func_case::fix_length_and_dec(
     agg[0]= args[first_expr_num];
     left_result_type= agg[0]->result_type();
 
+    /*
+      As the first expression and WHEN expressions
+      are intermixed in args[] array THEN and ELSE items,
+      extract the first expression and all WHEN expressions into 
+      a temporary array, to process them easier.
+    */
     for (nagg= 0; nagg < ncases/2 ; nagg++)
       agg[nagg+1]= args[nagg*2];
     nagg++;
     if (!(found_types= collect_cmp_types(agg, nagg)))
       return;
+    if (found_types & (1 << STRING_RESULT))
+    {
+      /*
+        If we'll do string comparison, we also need to aggregate
+        character set and collation for first/WHEN items and
+        install converters for some of them to cmp_collation when necessary.
+        This is done because cmp_item compatators cannot compare
+        strings in two different character sets.
+        Some examples when we install converters:
+
+        1. Converter installed for the first expression:
+
+           CASE         latin1_item              WHEN utf16_item THEN ... END
+
+        is replaced to:
+
+           CASE CONVERT(latin1_item USING utf16) WHEN utf16_item THEN ... END
+
+        2. Converter installed for the left WHEN item:
+
+          CASE utf16_item WHEN         latin1_item              THEN ... END
+
+        is replaced to:
 
+           CASE utf16_item WHEN CONVERT(latin1_item USING utf16) THEN ... END
+      */
+      if (agg_arg_charsets_for_comparison(cmp_collation, agg, nagg))
+        return;
+      /*
+        Now copy first expression and all WHEN expressions back to args[]
+        arrray, because some of the items might have been changed to converters
+        (e.g. Item_func_conv_charset, or Item_string for constants).
+      */
+      args[first_expr_num]= agg[0];
+      for (nagg= 0; nagg < ncases / 2; nagg++)
+        args[nagg * 2]= agg[nagg + 1];
+    }
     for (i= 0; i <= (uint)DECIMAL_RESULT; i++)
     {
       if (found_types & (1 << i) && !cmp_items[i])
       {
         DBUG_ASSERT((Item_result)i != ROW_RESULT);
-        if ((Item_result)i == STRING_RESULT &&
-            agg_arg_charsets_for_comparison(cmp_collation, agg, nagg))
-          return;
         if (!(cmp_items[i]=
             cmp_item::get_comparator((Item_result)i,
                                      cmp_collation.collation)))

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-02-24 15:48:27 +0000
+++ b/sql/item_func.cc	2011-03-08 19:14:42 +0000
@@ -886,7 +886,7 @@ longlong Item_func_numhybrid::val_int()
       return 0;
 
     char *end= (char*) res->ptr() + res->length();
-    CHARSET_INFO *cs= str_value.charset();
+    CHARSET_INFO *cs= res->charset();
     return (*(cs->cset->strtoll10))(cs, res->ptr(), &end, &err_not_used);
   }
   default:
@@ -3021,6 +3021,8 @@ void Item_func_find_in_set::fix_length_a
       String *find=args[0]->val_str(&value);
       if (find)
       {
+        // find is not NULL pointer so args[0] is not a null-value
+        DBUG_ASSERT(!args[0]->null_value);
 	enum_value= find_type(((Field_enum*) field)->typelib,find->ptr(),
 			      find->length(), 0);
 	enum_bit=0;
@@ -3039,11 +3041,22 @@ longlong Item_func_find_in_set::val_int(
   DBUG_ASSERT(fixed == 1);
   if (enum_value)
   {
-    ulonglong tmp=(ulonglong) args[1]->val_int();
-    if (!(null_value=args[1]->null_value || args[0]->null_value))
+    // enum_value is set iff args[0]->const_item() in fix_length_and_dec().
+    DBUG_ASSERT(args[0]->const_item());
+
+    ulonglong tmp= (ulonglong) args[1]->val_int();
+    null_value= args[1]->null_value;
+    /* 
+      No need to check args[0]->null_value since enum_value is set iff
+      args[0] is a non-null const item. Note: no DBUG_ASSERT on
+      args[0]->null_value here because args[0] may have been replaced
+      by an Item_cache on which val_int() has not been called. See
+      BUG#11766317
+    */
+    if (!null_value)
     {
       if (tmp & enum_bit)
-	return enum_value;
+        return enum_value;
     }
     return 0L;
   }

=== modified file 'sql/item_strfunc.cc'
--- a/sql/item_strfunc.cc	2011-02-10 08:47:05 +0000
+++ b/sql/item_strfunc.cc	2011-03-04 14:59:32 +0000
@@ -796,6 +796,7 @@ String *Item_func_des_encrypt::val_str(S
   tmp_arg[res_length-1]=tail;                   // save extra length
   tmp_value.realloc(res_length+1);
   tmp_value.length(res_length+1);
+  tmp_value.set_charset(&my_charset_bin);
   tmp_value[0]=(char) (128 | key_number);
   // Real encryption
   bzero((char*) &ivec,sizeof(ivec));
@@ -883,6 +884,7 @@ String *Item_func_des_decrypt::val_str(S
   if ((tail=(uint) (uchar) tmp_value[length-2]) > 8)
     goto wrong_key;				     // Wrong key
   tmp_value.length(length-1-tail);
+  tmp_value.set_charset(&my_charset_bin);
   return &tmp_value;
 
 error:
@@ -3597,14 +3599,68 @@ String *Item_func_quote::val_str(String
   }
 
   arg_length= arg->length();
-  new_length= arg_length+2; /* for beginning and ending ' signs */
 
-  for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++)
-    new_length+= get_esc_bit(escmask, (uchar) *from);
+  if (collation.collation->mbmaxlen == 1)
+  {
+    new_length= arg_length + 2; /* for beginning and ending ' signs */
+    for (from= (char*) arg->ptr(), end= from + arg_length; from < end; from++)
+      new_length+= get_esc_bit(escmask, (uchar) *from);
+  }
+  else
+  {
+    new_length= (arg_length * 2) +  /* For string characters */
+                (2 * collation.collation->mbmaxlen); /* For quotes */
+  }
 
   if (tmp_value.alloc(new_length))
     goto null;
 
+  if (collation.collation->mbmaxlen > 1)
+  {
+    CHARSET_INFO *cs= collation.collation;
+    int mblen;
+    uchar *to_end;
+    to= (char*) tmp_value.ptr();
+    to_end= (uchar*) to + new_length;
+
+    /* Put leading quote */
+    if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0)
+      goto null;
+    to+= mblen;
+
+    for (start= (char*) arg->ptr(), end= start + arg_length; start < end; )
+    {
+      my_wc_t wc;
+      bool escape;
+      if ((mblen= cs->cset->mb_wc(cs, &wc, (uchar*) start, (uchar*) end)) <= 0)
+        goto null;
+      start+= mblen;
+      switch (wc) {
+        case 0:      escape= 1; wc= '0'; break;
+        case '\032': escape= 1; wc= 'Z'; break;
+        case '\'':   escape= 1; break;
+        case '\\':   escape= 1; break;
+        default:     escape= 0; break;
+      }
+      if (escape)
+      {
+        if ((mblen= cs->cset->wc_mb(cs, '\\', (uchar*) to, to_end)) <= 0)
+          goto null;
+        to+= mblen;
+      }
+      if ((mblen= cs->cset->wc_mb(cs, wc, (uchar*) to, to_end)) <= 0)
+        goto null;
+      to+= mblen;
+    }
+
+    /* Put trailing quote */
+    if ((mblen= cs->cset->wc_mb(cs, '\'', (uchar *) to, to_end)) <= 0)
+      goto null;
+    to+= mblen;
+    new_length= to - tmp_value.ptr();
+    goto ret;
+  }
+
   /*
     We replace characters from the end to the beginning
   */
@@ -3636,6 +3692,8 @@ String *Item_func_quote::val_str(String
     }
   }
   *to= '\'';
+
+ret:
   tmp_value.length(new_length);
   tmp_value.set_charset(collation.collation);
   null_value= 0;

=== modified file 'sql/item_strfunc.h'
--- a/sql/item_strfunc.h	2011-02-10 08:47:05 +0000
+++ b/sql/item_strfunc.h	2011-03-04 14:59:32 +0000
@@ -808,9 +808,10 @@ public:
   String *val_str(String *);
   void fix_length_and_dec()
   {
-    ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 + 2;
-    max_length= (uint32) min(max_result_length, MAX_BLOB_WIDTH);
     collation.set(args[0]->collation);
+    ulonglong max_result_length= (ulonglong) args[0]->max_length * 2 +
+                                  2 * collation.collation->mbmaxlen;
+    max_length= (uint32) min(max_result_length, MAX_BLOB_WIDTH);
   }
 };
 

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-02-22 02:58:40 +0000
+++ b/sql/mysqld.cc	2011-03-01 12:05:37 +0000
@@ -1289,11 +1289,14 @@ static void __cdecl kill_server(int sig_
   /*    
    Send event to smem_event_connect_request for aborting    
    */    
-  if (!SetEvent(smem_event_connect_request))    
-  {      
-	  DBUG_PRINT("error",
-		("Got error: %ld from SetEvent of smem_event_connect_request",
-		 GetLastError()));    
+  if (opt_enable_shared_memory)
+  {
+    if (!SetEvent(smem_event_connect_request))    
+    {      
+      DBUG_PRINT("error",
+                 ("Got error: %ld from SetEvent of smem_event_connect_request",
+                  GetLastError()));    
+    }
   }
 #endif  
   
@@ -4467,11 +4470,14 @@ int mysqld_main(int argc, char **argv)
     to be able to read defaults files and parse options.
   */
   my_progname= argv[0];
-  if (my_basic_init())
+#ifndef _WIN32
+  // For windows, my_init() is called from the win specific mysqld_main
+  if (my_init())                 // init my_sys library & pthreads
   {
-    fprintf(stderr, "my_basic_init() failed.");
+    fprintf(stderr, "my_init() failed.");
     return 1;
   }
+#endif
 
   orig_argc= argc;
   orig_argv= argv;
@@ -4571,11 +4577,10 @@ int mysqld_main(int argc, char **argv)
       recreate objects which were initialised early,
       so that they are instrumented as well.
     */
-    my_thread_basic_global_reinit();
+    my_thread_global_reinit();
   }
 #endif /* HAVE_PSI_INTERFACE */
 
-  my_init();                                   // init my_sys library & pthreads
   init_error_log_mutex();
 
   /* Set signal used to kill MySQL */
@@ -5013,6 +5018,12 @@ int mysqld_main(int argc, char **argv)
   /* Must be initialized early for comparison of service name */
   system_charset_info= &my_charset_utf8_general_ci;
 
+  if (my_init())
+  {
+    fprintf(stderr, "my_init() failed.");
+    return 1;
+  }
+
   if (Service.GetOS())	/* true NT family */
   {
     char file_path[FN_REFLEN];

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2011-02-18 11:39:05 +0000
+++ b/sql/mysqld.h	2011-03-04 15:55:18 +0000
@@ -414,16 +414,16 @@ enum options_mysqld
 
 
 /**
-  Query type constants.
-
-  QT_ORDINARY -- ordinary SQL query.
-  QT_IS -- SQL query to be shown in INFORMATION_SCHEMA (in utf8 and without
-  character set introducers).
+   Query type constants (usable as bitmap flags).
 */
 enum enum_query_type
 {
-  QT_ORDINARY,
-  QT_IS
+  /// Nothing specific, ordinary SQL query.
+  QT_ORDINARY= 0,
+  /// In utf8.
+  QT_TO_SYSTEM_CHARSET= (1 << 0),
+  /// Without character set introducers.
+  QT_WITHOUT_INTRODUCERS= (1 << 1)
 };
 
 /* query_id */

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	2011-02-02 22:02:29 +0000
+++ b/sql/opt_range.cc	2011-03-03 22:26:19 +0000
@@ -692,7 +692,8 @@ public:
   /* 
     If true, the index descriptions describe real indexes (and it is ok to
     call field->optimize_range(real_keynr[...], ...).
-    Otherwise index description describes fake indexes.
+    Otherwise index description describes fake indexes, like a partitioning
+    expression.
   */
   bool using_real_indexes;
   
@@ -5780,7 +5781,8 @@ get_mm_leaf(RANGE_OPT_PARAM *param, Item
       !(conf_func->compare_collation()->state & MY_CS_BINSORT &&
         (type == Item_func::EQUAL_FUNC || type == Item_func::EQ_FUNC)))
   {
-    if (param->thd->lex->describe & DESCRIBE_EXTENDED)
+    if (param->using_real_indexes &&
+        param->thd->lex->describe & DESCRIBE_EXTENDED)
       push_warning_printf(
               param->thd,
               MYSQL_ERROR::WARN_LEVEL_WARN, 
@@ -5912,7 +5914,8 @@ get_mm_leaf(RANGE_OPT_PARAM *param, Item
       value->result_type() != STRING_RESULT &&
       field->cmp_type() != value->result_type())
   {
-    if (param->thd->lex->describe & DESCRIBE_EXTENDED)
+    if (param->using_real_indexes &&
+        param->thd->lex->describe & DESCRIBE_EXTENDED)
       push_warning_printf(
               param->thd,
               MYSQL_ERROR::WARN_LEVEL_WARN, 

=== modified file 'sql/share/errmsg-utf8.txt'
--- a/sql/share/errmsg-utf8.txt	2011-02-21 15:55:58 +0000
+++ b/sql/share/errmsg-utf8.txt	2011-03-08 09:21:39 +0000
@@ -6487,3 +6487,8 @@ ER_NO_SUCH_PARTITION
   slo "Partition '%-.64s' doesn't exist"
   spa "Particion '%-.64s' no existe"
   swe "Det finns ingen partition som heter '%-.64s'"
+
+# When translating this error message make sure to include "ALTER TABLE" in the
+# message as mysqlcheck parses the error message looking for ALTER TABLE.
+ER_TABLE_NEEDS_REBUILD
+        eng "Table rebuild required. Please do \"ALTER TABLE `%-.32s` FORCE\" or dump/reload to fix it!"

=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc	2011-01-10 13:26:13 +0000
+++ b/sql/sql_admin.cc	2011-03-08 09:21:39 +0000
@@ -777,8 +777,12 @@ send_result_message:
       size_t length;
 
       protocol->store(STRING_WITH_LEN("error"), system_charset_info);
-      length=my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE),
-                         table->table_name);
+      if (table->table->file->ha_table_flags() & HA_CAN_REPAIR)
+        length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_UPGRADE),
+                            table->table_name);
+      else
+        length= my_snprintf(buf, sizeof(buf), ER(ER_TABLE_NEEDS_REBUILD),
+                            table->table_name);
       protocol->store(buf, length, system_charset_info);
       fatal_error=1;
       break;

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2011-02-14 10:28:11 +0000
+++ b/sql/sql_base.cc	2011-03-07 09:23:36 +0000
@@ -1032,7 +1032,7 @@ bool close_cached_tables(THD *thd, TABLE
          table_list= table_list->next_global)
     {
       /* A check that the table was locked for write is done by the caller. */
-      TABLE *table= find_table_for_mdl_upgrade(thd->open_tables, table_list->db,
+      TABLE *table= find_table_for_mdl_upgrade(thd, table_list->db,
                                                table_list->table_name, TRUE);
 
       /* May return NULL if this table has already been closed via an alias. */
@@ -3126,22 +3126,26 @@ TABLE *find_locked_table(TABLE *list, co
    lock from the list of open tables, emit error if no such table
    found.
 
-   @param list       List of TABLE objects to be searched
+   @param thd        Thread context
    @param db         Database name.
    @param table_name Name of table.
    @param no_error   Don't emit error if no suitable TABLE
                      instance were found.
 
+   @note This function checks if the connection holds a global IX
+         metadata lock. If no such lock is found, it is not safe to
+         upgrade the lock and ER_TABLE_NOT_LOCKED_FOR_WRITE will be
+         reported.
+
    @return Pointer to TABLE instance with MDL_SHARED_NO_WRITE,
            MDL_SHARED_NO_READ_WRITE, or MDL_EXCLUSIVE metadata
            lock, NULL otherwise.
 */
 
-TABLE *find_table_for_mdl_upgrade(TABLE *list, const char *db,
-                                  const char *table_name,
-                                  bool no_error)
+TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db,
+                                  const char *table_name, bool no_error)
 {
-  TABLE *tab= find_locked_table(list, db, table_name);
+  TABLE *tab= find_locked_table(thd->open_tables, db, table_name);
 
   if (!tab)
   {
@@ -3149,19 +3153,29 @@ TABLE *find_table_for_mdl_upgrade(TABLE
       my_error(ER_TABLE_NOT_LOCKED, MYF(0), table_name);
     return NULL;
   }
-  else
+
+  /*
+    It is not safe to upgrade the metadata lock without a global IX lock.
+    This can happen with FLUSH TABLES <list> WITH READ LOCK as we in these
+    cases don't take a global IX lock in order to be compatible with
+    global read lock.
+  */
+  if (!thd->mdl_context.is_lock_owner(MDL_key::GLOBAL, "", "",
+                                      MDL_INTENTION_EXCLUSIVE))
   {
-    while (tab->mdl_ticket != NULL &&
-           !tab->mdl_ticket->is_upgradable_or_exclusive() &&
-           (tab= find_locked_table(tab->next, db, table_name)))
-      continue;
-    if (!tab)
-    {
-      if (!no_error)
-        my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), table_name);
-      return 0;
-    }
+    if (!no_error)
+      my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), table_name);
+    return NULL;
   }
+
+  while (tab->mdl_ticket != NULL &&
+         !tab->mdl_ticket->is_upgradable_or_exclusive() &&
+         (tab= find_locked_table(tab->next, db, table_name)))
+    continue;
+
+  if (!tab && !no_error)
+    my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0), table_name);
+
   return tab;
 }
 
@@ -4660,8 +4674,7 @@ open_tables_check_upgradable_mdl(THD *th
         Note that find_table_for_mdl_upgrade() will report an error if
         no suitable ticket is found.
       */
-      if (!find_table_for_mdl_upgrade(thd->open_tables, table->db,
-                                      table->table_name, FALSE))
+      if (!find_table_for_mdl_upgrade(thd, table->db, table->table_name, false))
         return TRUE;
     }
   }

=== modified file 'sql/sql_base.h'
--- a/sql/sql_base.h	2010-11-23 22:37:59 +0000
+++ b/sql/sql_base.h	2011-03-07 09:23:36 +0000
@@ -297,7 +297,7 @@ bool tdc_open_view(THD *thd, TABLE_LIST
                    char *cache_key, uint cache_key_length,
                    MEM_ROOT *mem_root, uint flags);
 void tdc_flush_unused_tables();
-TABLE *find_table_for_mdl_upgrade(TABLE *list, const char *db,
+TABLE *find_table_for_mdl_upgrade(THD *thd, const char *db,
                                   const char *table_name,
                                   bool no_error);
 void mark_tmp_table_for_reuse(TABLE *table);

=== modified file 'sql/sql_lex.h'
--- a/sql/sql_lex.h	2011-02-24 15:48:27 +0000
+++ b/sql/sql_lex.h	2011-03-08 19:14:42 +0000
@@ -889,21 +889,20 @@ inline bool st_select_lex_unit::is_union
 #define ALTER_CHANGE_COLUMN_DEFAULT (1L << 8)
 #define ALTER_KEYS_ONOFF        (1L << 9)
 #define ALTER_CONVERT           (1L << 10)
-#define ALTER_FORCE		(1L << 11)
-#define ALTER_RECREATE          (1L << 12)
-#define ALTER_ADD_PARTITION     (1L << 13)
-#define ALTER_DROP_PARTITION    (1L << 14)
-#define ALTER_COALESCE_PARTITION (1L << 15)
-#define ALTER_REORGANIZE_PARTITION (1L << 16) 
-#define ALTER_PARTITION          (1L << 17)
-#define ALTER_ADMIN_PARTITION    (1L << 18)
-#define ALTER_TABLE_REORG        (1L << 19)
-#define ALTER_REBUILD_PARTITION  (1L << 20)
-#define ALTER_ALL_PARTITION      (1L << 21)
-#define ALTER_REMOVE_PARTITIONING (1L << 22)
-#define ALTER_FOREIGN_KEY        (1L << 23)
-#define ALTER_EXCHANGE_PARTITION (1L << 24)
-#define ALTER_TRUNCATE_PARTITION (1L << 25)
+#define ALTER_RECREATE          (1L << 11)
+#define ALTER_ADD_PARTITION     (1L << 12)
+#define ALTER_DROP_PARTITION    (1L << 13)
+#define ALTER_COALESCE_PARTITION (1L << 14)
+#define ALTER_REORGANIZE_PARTITION (1L << 15) 
+#define ALTER_PARTITION          (1L << 16)
+#define ALTER_ADMIN_PARTITION    (1L << 17)
+#define ALTER_TABLE_REORG        (1L << 18)
+#define ALTER_REBUILD_PARTITION  (1L << 19)
+#define ALTER_ALL_PARTITION      (1L << 20)
+#define ALTER_REMOVE_PARTITIONING (1L << 21)
+#define ALTER_FOREIGN_KEY        (1L << 22)
+#define ALTER_EXCHANGE_PARTITION (1L << 23)
+#define ALTER_TRUNCATE_PARTITION (1L << 24)
 
 enum enum_alter_table_change_level
 {

=== modified file 'sql/sql_parse.cc'
--- a/sql/sql_parse.cc	2011-02-24 15:48:27 +0000
+++ b/sql/sql_parse.cc	2011-03-08 19:14:42 +0000
@@ -4495,7 +4495,11 @@ static bool execute_sqlcom_select(THD *t
         char buff[1024];
         String str(buff,(uint32) sizeof(buff), system_charset_info);
         str.length(0);
-        thd->lex->unit.print(&str, QT_ORDINARY);
+        /*
+          The warnings system requires input in utf8, @see
+          mysqld_show_warnings().
+        */
+        thd->lex->unit.print(&str, QT_TO_SYSTEM_CHARSET);
         str.append('\0');
         push_warning(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
                      ER_YES, str.ptr());

=== modified file 'sql/sql_reload.cc'
--- a/sql/sql_reload.cc	2010-12-10 16:55:50 +0000
+++ b/sql/sql_reload.cc	2011-03-07 09:23:36 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2011, 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
@@ -221,12 +221,26 @@ bool reload_acl_and_cache(THD *thd, unsi
         if (tables)
         {
           for (TABLE_LIST *t= tables; t; t= t->next_local)
-            if (!find_table_for_mdl_upgrade(thd->open_tables, t->db,
-                                            t->table_name, FALSE))
+            if (!find_table_for_mdl_upgrade(thd, t->db, t->table_name, false))
               return 1;
         }
         else
         {
+          /*
+            It is not safe to upgrade the metadata lock without GLOBAL IX lock.
+            This can happen with FLUSH TABLES <list> WITH READ LOCK as we in these
+            cases don't take a GLOBAL IX lock in order to be compatible with
+            global read lock.
+          */
+          if (thd->open_tables &&
+              !thd->mdl_context.is_lock_owner(MDL_key::GLOBAL, "", "",
+                                              MDL_INTENTION_EXCLUSIVE))
+          {
+            my_error(ER_TABLE_NOT_LOCKED_FOR_WRITE, MYF(0),
+                     thd->open_tables->s->table_name.str);
+            return true;
+          }
+
           for (TABLE *tab= thd->open_tables; tab; tab= tab->next)
           {
             if (! tab->mdl_ticket->is_upgradable_or_exclusive())

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2011-02-02 22:02:29 +0000
+++ b/sql/sql_table.cc	2011-03-07 09:23:36 +0000
@@ -2095,7 +2095,7 @@ bool mysql_rm_table(THD *thd,TABLE_LIST
             by parser) it is safe to cache pointer to the TABLE instances
             in its elements.
           */
-          table->table= find_table_for_mdl_upgrade(thd->open_tables, table->db,
+          table->table= find_table_for_mdl_upgrade(thd, table->db,
                                                    table->table_name, false);
           if (!table->table)
             DBUG_RETURN(true);

=== modified file 'sql/sql_trigger.cc'
--- a/sql/sql_trigger.cc	2010-11-29 16:27:58 +0000
+++ b/sql/sql_trigger.cc	2011-03-07 09:23:36 +0000
@@ -467,8 +467,7 @@ bool mysql_create_or_drop_trigger(THD *t
   if (thd->locked_tables_mode)
   {
     /* Under LOCK TABLES we must only accept write locked tables. */
-    if (!(tables->table= find_table_for_mdl_upgrade(thd->open_tables,
-                                                    tables->db,
+    if (!(tables->table= find_table_for_mdl_upgrade(thd, tables->db,
                                                     tables->table_name,
                                                     FALSE)))
       goto end;

=== modified file 'sql/sql_truncate.cc'
--- a/sql/sql_truncate.cc	2010-11-18 13:50:08 +0000
+++ b/sql/sql_truncate.cc	2011-03-07 09:23:36 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2011, 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
@@ -327,7 +327,7 @@ bool Sql_cmd_truncate_table::lock_table(
   */
   if (thd->locked_tables_mode)
   {
-    if (!(table= find_table_for_mdl_upgrade(thd->open_tables, table_ref->db,
+    if (!(table= find_table_for_mdl_upgrade(thd, table_ref->db,
                                             table_ref->table_name, FALSE)))
       DBUG_RETURN(TRUE);
 

=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc	2011-02-24 15:48:27 +0000
+++ b/sql/sql_view.cc	2011-03-08 19:14:42 +0000
@@ -840,7 +840,8 @@ static int mysql_register_view(THD *thd,
     thd->variables.sql_mode&= ~MODE_ANSI_QUOTES;
 
     lex->unit.print(&view_query, QT_ORDINARY);
-    lex->unit.print(&is_query, QT_IS);
+    lex->unit.print(&is_query,
+                    enum_query_type(QT_TO_SYSTEM_CHARSET | QT_WITHOUT_INTRODUCERS));
 
     thd->variables.sql_mode|= sql_mode;
   }

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2011-02-21 11:34:14 +0000
+++ b/sql/sql_yacc.yy	2011-03-08 09:21:39 +0000
@@ -6861,7 +6861,7 @@ alter_list_item:
           }
         | FORCE_SYM
           {
-            Lex->alter_info.flags|= ALTER_FORCE;
+            Lex->alter_info.flags|= ALTER_RECREATE;
           }
         | alter_order_clause
           {

=== modified file 'storage/archive/ha_archive.h'
--- a/storage/archive/ha_archive.h	2010-10-07 12:47:15 +0000
+++ b/storage/archive/ha_archive.h	2011-03-08 09:21:39 +0000
@@ -90,7 +90,7 @@ public:
     return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_CAN_BIT_FIELD |
             HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
             HA_STATS_RECORDS_IS_EXACT |
-            HA_HAS_RECORDS |
+            HA_HAS_RECORDS | HA_CAN_REPAIR |
             HA_FILE_BASED | HA_CAN_INSERT_DELAYED | HA_CAN_GEOMETRY);
   }
   ulong index_flags(uint idx, uint part, bool all_parts) const

=== modified file 'storage/csv/ha_tina.h'
--- a/storage/csv/ha_tina.h	2010-07-08 21:20:08 +0000
+++ b/storage/csv/ha_tina.h	2011-03-08 08:41:57 +0000
@@ -106,7 +106,8 @@ public:
   ulonglong table_flags() const
   {
     return (HA_NO_TRANSACTIONS | HA_REC_NOT_IN_SEQ | HA_NO_AUTO_INCREMENT |
-            HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE);
+            HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
+            HA_CAN_REPAIR);
   }
   ulong index_flags(uint idx, uint part, bool all_parts) const
   {

=== modified file 'storage/federated/ha_federated.h'
--- a/storage/federated/ha_federated.h	2010-10-06 14:34:28 +0000
+++ b/storage/federated/ha_federated.h	2011-03-08 08:41:57 +0000
@@ -149,7 +149,8 @@ public:
             HA_BINLOG_ROW_CAPABLE | HA_BINLOG_STMT_CAPABLE |
             HA_NO_PREFIX_CHAR_KEYS | HA_PRIMARY_KEY_REQUIRED_FOR_DELETE |
             HA_NO_TRANSACTIONS /* until fixed by WL#2952 */ |
-            HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY);
+            HA_PARTIAL_COLUMN_READ | HA_NULL_IN_KEY |
+            HA_CAN_REPAIR);
   }
   /*
     This is a bitmap of flags that says how the storage engine

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2011-02-24 15:48:27 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-03-08 19:14:42 +0000
@@ -2830,6 +2830,7 @@ innobase_alter_table_flags(
 		| HA_INPLACE_ADD_INDEX_NO_WRITE
 		| HA_INPLACE_DROP_INDEX_NO_READ_WRITE
 		| HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE
+		| HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE
 		| HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE
 		| HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE);
 }

=== modified file 'storage/myisam/ha_myisam.cc'
--- a/storage/myisam/ha_myisam.cc	2011-01-13 07:33:03 +0000
+++ b/storage/myisam/ha_myisam.cc	2011-03-08 09:21:39 +0000
@@ -639,7 +639,7 @@ ha_myisam::ha_myisam(handlerton *hton, T
                   HA_DUPLICATE_POS | HA_CAN_INDEX_BLOBS | HA_AUTO_PART_KEY |
                   HA_FILE_BASED | HA_CAN_GEOMETRY | HA_NO_TRANSACTIONS |
                   HA_CAN_INSERT_DELAYED | HA_CAN_BIT_FIELD | HA_CAN_RTREEKEYS |
-                  HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT),
+                  HA_HAS_RECORDS | HA_STATS_RECORDS_IS_EXACT | HA_CAN_REPAIR),
    can_enable_indexes(1)
 {}
 

=== modified file 'storage/perfschema/unittest/pfs-t.cc'
--- a/storage/perfschema/unittest/pfs-t.cc	2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/unittest/pfs-t.cc	2011-03-08 17:24:34 +0000
@@ -1370,6 +1370,8 @@ void test_event_name_index()
 
 void do_all_tests()
 {
+  /* Using initialize_performance_schema(), no partial init needed. */
+
   test_bootstrap();
   test_bad_registration();
   test_init_disabled();

=== modified file 'storage/perfschema/unittest/pfs_instr-oom-t.cc'
--- a/storage/perfschema/unittest/pfs_instr-oom-t.cc	2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/unittest/pfs_instr-oom-t.cc	2011-03-08 17:24:34 +0000
@@ -224,7 +224,11 @@ void test_oom()
 
 void do_all_tests()
 {
+  PFS_atomic::init();
+
   test_oom();
+
+  PFS_atomic::cleanup();
 }
 
 int main(int, char **)

=== modified file 'storage/perfschema/unittest/pfs_instr-t.cc'
--- a/storage/perfschema/unittest/pfs_instr-t.cc	2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/unittest/pfs_instr-t.cc	2011-03-08 17:24:34 +0000
@@ -333,9 +333,13 @@ void test_with_instances()
 
 void do_all_tests()
 {
+  PFS_atomic::init();
+
   test_no_instruments();
   test_no_instances();
   test_with_instances();
+
+  PFS_atomic::cleanup();
 }
 
 int main(int, char **)

=== modified file 'storage/perfschema/unittest/pfs_instr_class-oom-t.cc'
--- a/storage/perfschema/unittest/pfs_instr_class-oom-t.cc	2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/unittest/pfs_instr_class-oom-t.cc	2011-03-08 17:24:34 +0000
@@ -47,7 +47,11 @@ void test_oom()
 
 void do_all_tests()
 {
+  PFS_atomic::init();
+
   test_oom();
+
+  PFS_atomic::cleanup();
 }
 
 int main(int, char **)

=== modified file 'storage/perfschema/unittest/pfs_instr_class-t.cc'
--- a/storage/perfschema/unittest/pfs_instr_class-t.cc	2010-12-02 15:05:07 +0000
+++ b/storage/perfschema/unittest/pfs_instr_class-t.cc	2011-03-08 17:24:34 +0000
@@ -566,6 +566,8 @@ void test_instruments_reset()
 
 void do_all_tests()
 {
+  PFS_atomic::init();
+
   test_no_registration();
   test_mutex_registration();
   test_rwlock_registration();
@@ -574,6 +576,8 @@ void do_all_tests()
   test_file_registration();
   test_table_registration();
   test_instruments_reset();
+
+  PFS_atomic::cleanup();
 }
 
 int main(int, char **)

=== modified file 'storage/perfschema/unittest/pfs_timer-t.cc'
--- a/storage/perfschema/unittest/pfs_timer-t.cc	2010-07-16 01:28:30 +0000
+++ b/storage/perfschema/unittest/pfs_timer-t.cc	2011-03-08 17:24:34 +0000
@@ -105,7 +105,11 @@ void test_timers()
 
 void do_all_tests()
 {
+  PFS_atomic::init();
+
   test_timers();
+
+  PFS_atomic::cleanup();
 }
 
 int main(int, char **)

=== modified file 'strings/xml.c'
--- a/strings/xml.c	2011-01-19 13:17:52 +0000
+++ b/strings/xml.c	2011-03-01 12:30:18 +0000
@@ -165,11 +165,16 @@ static int my_xml_scan(MY_XML_PARSER *p,
   }
   else if ( (p->cur[0] == '"') || (p->cur[0] == '\'') )
   {
+    /*
+      "string" or 'string' found.
+      Scan until the closing quote/doublequote, or until the END-OF-INPUT.
+    */
     p->cur++;
     for (; ( p->cur < p->end ) && (p->cur[0] != a->beg[0]); p->cur++)
     {}
     a->end=p->cur;
-    if (a->beg[0] == p->cur[0])p->cur++;
+    if (p->cur < p->end) /* Closing quote or doublequote has been found */
+      p->cur++;
     a->beg++;
     if (!(p->flags & MY_XML_FLAG_SKIP_TEXT_NORMALIZATION))
       my_xml_norm_text(a);

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-mtr branch (bjorn.munch:3042 to 3044) Bjorn Munch8 Mar