List:Commits« Previous MessageNext Message »
From:Christopher Powers Date:September 2 2011 10:05pm
Subject:bzr push into mysql-trunk-wl5908 branch (chris.powers:3419 to 3421)
View as plain text  
 3421 Christopher Powers	2011-09-02 [merge]
      local merge

    removed:
      mysql-test/std_data/bug57108.cnf
    added:
      mysql-test/suite/sys_vars/t/plugin_dir_basic-master.opt
    modified:
      client/mysqltest.cc
      cmake/build_configurations/mysql_release.cmake
      cmake/install_macros.cmake
      mysql-test/collections/disabled-daily.list
      mysql-test/include/mtr_check.sql
      mysql-test/include/mysqld--help.inc
      mysql-test/include/subquery_sj.inc
      mysql-test/lib/mtr_cases.pm
      mysql-test/mysql-test-run.pl
      mysql-test/r/alter_table.result
      mysql-test/r/execution_constants.result
      mysql-test/r/group_by.result
      mysql-test/r/mysqltest.result
      mysql-test/r/subquery_sj_all.result
      mysql-test/r/subquery_sj_all_bka.result
      mysql-test/r/subquery_sj_all_bkaunique.result
      mysql-test/r/subquery_sj_dupsweed.result
      mysql-test/r/subquery_sj_dupsweed_bka.result
      mysql-test/r/subquery_sj_dupsweed_bkaunique.result
      mysql-test/r/subquery_sj_firstmatch.result
      mysql-test/r/subquery_sj_firstmatch_bka.result
      mysql-test/r/subquery_sj_firstmatch_bkaunique.result
      mysql-test/r/subquery_sj_loosescan.result
      mysql-test/r/subquery_sj_loosescan_bka.result
      mysql-test/r/subquery_sj_loosescan_bkaunique.result
      mysql-test/r/subquery_sj_mat.result
      mysql-test/r/subquery_sj_mat_bka.result
      mysql-test/r/subquery_sj_mat_bkaunique.result
      mysql-test/r/subquery_sj_mat_nosj.result
      mysql-test/r/subquery_sj_none.result
      mysql-test/r/subquery_sj_none_bka.result
      mysql-test/r/subquery_sj_none_bka_nobnl.result
      mysql-test/r/subquery_sj_none_bkaunique.result
      mysql-test/suite/sys_vars/r/plugin_dir_basic.result
      mysql-test/suite/sys_vars/t/plugin_dir_basic.test
      mysql-test/t/alter_table.test
      mysql-test/t/execution_constants.test
      mysql-test/t/group_by.test
      mysql-test/t/mysqltest.test
      mysql-test/valgrind.supp
      sql/CMakeLists.txt
      sql/filesort.cc
      sql/sql_select.cc
      sql/sql_table.cc
      support-files/mysql.spec.sh
 3420 Christopher Powers	2011-09-02
      WL#5908 "File IO Summary Table Extensions"
      
      Full worklog implementation to track file timer and IO per operation:
      - Split file_summary_by_instance and _by_event_name into separate files
      - Removed file_summary.cc
      - Updated file visitor methods
      - Updated test cases

    removed:
      storage/perfschema/table_file_summary.cc
      storage/perfschema/table_file_summary.h
    added:
      storage/perfschema/table_file_summary_by_event_name.cc
      storage/perfschema/table_file_summary_by_event_name.h
      storage/perfschema/table_file_summary_by_instance.cc
      storage/perfschema/table_file_summary_by_instance.h
    modified:
      mysql-test/suite/perfschema/r/pfs_upgrade.result
      mysql-test/suite/perfschema/r/relaylog.result
      mysql-test/suite/perfschema/r/schema.result
      mysql-test/suite/perfschema/r/start_server_nothing.result
      mysql-test/suite/perfschema/r/table_schema.result
      scripts/mysql_system_tables.sql
      storage/perfschema/CMakeLists.txt
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_engine_table.cc
      storage/perfschema/pfs_instr.cc
      storage/perfschema/pfs_instr.h
      storage/perfschema/pfs_stat.h
      storage/perfschema/pfs_visitor.cc
      storage/perfschema/pfs_visitor.h
      storage/perfschema/table_helper.h
      storage/perfschema/table_socket_summary_by_instance.cc
 3419 Marc Alff	2011-08-29
      New branch

    modified:
      .bzr-mysql/default.conf
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2011-08-19 13:24:24 +0000
+++ b/client/mysqltest.cc	2011-08-22 13:24:38 +0000
@@ -503,6 +503,7 @@ void str_to_file(const char *fname, char
 void str_to_file2(const char *fname, char *str, int size, my_bool append);
 
 void fix_win_paths(const char *val, int len);
+const char *get_errname_from_code (uint error_code);
 
 #ifdef __WIN__
 void free_tmp_sh_file();
@@ -2272,6 +2273,7 @@ void var_set_int(const char* name, int v
 void var_set_errno(int sql_errno)
 {
   var_set_int("$mysql_errno", sql_errno);
+  var_set_string("$mysql_errname", get_errname_from_code(sql_errno));
 }
 
 
@@ -4646,8 +4648,7 @@ void do_shutdown_server(struct st_comman
 }
 
 
-#if MYSQL_VERSION_ID >= 50000
-/* List of error names to error codes, available from 5.0 */
+/* List of error names to error codes */
 typedef struct
 {
   const char *name;
@@ -4657,6 +4658,7 @@ typedef struct
 
 static st_error global_error_names[] =
 {
+  { "<No error>", -1, "" },
 #include <mysqld_ername.h>
   { 0, 0, 0 }
 };
@@ -4687,16 +4689,28 @@ uint get_errcode_from_name(char *error_n
     die("Unknown SQL error name '%s'", error_name);
   DBUG_RETURN(0);
 }
-#else
-uint get_errcode_from_name(char *error_name __attribute__((unused)),
-                           char *error_end __attribute__((unused)))
+
+const char *get_errname_from_code (uint error_code)
 {
-  abort_not_in_this_version();
-  return 0; /* Never reached */
-}
-#endif
+   st_error *e= global_error_names;
 
+   DBUG_ENTER("get_errname_from_code");
+   DBUG_PRINT("enter", ("error_code: %d", error_code));
 
+   if (! error_code)
+   {
+     DBUG_RETURN("");
+   }
+   for (; e->name; e++)
+   {
+     if (e->code == error_code)
+     {
+       DBUG_RETURN(e->name);
+     }
+   }
+   /* Apparently, errors without known names may occur */
+   DBUG_RETURN("<Unknown>");
+} 
 
 void do_get_errcodes(struct st_command *command)
 {
@@ -8688,11 +8702,6 @@ int main(int argc, char **argv)
         /* Check for special property for this query */
         display_result_vertically|= (command->type == Q_QUERY_VERTICAL);
 
-	if (save_file[0])
-	{
-	  strmake(command->require_file, save_file, sizeof(save_file) - 1);
-	  save_file[0]= 0;
-	}
         /*
           We run EXPLAIN _before_ the query. If query is UPDATE/DELETE is
           matters: a DELETE may delete rows, and then EXPLAIN DELETE will
@@ -8700,6 +8709,12 @@ int main(int argc, char **argv)
           interesting, EXPLAIN is now first.
         */
 	run_explain(cur_con, command, flags);
+	/* Check for 'require' */
+	if (*save_file)
+	{
+	  strmake(command->require_file, save_file, sizeof(save_file) - 1);
+	  *save_file= 0;
+	}
 	run_query(cur_con, command, flags);
 	display_opt_trace(cur_con, command, flags);
 	command_executed++;

=== modified file 'cmake/build_configurations/mysql_release.cmake'
--- a/cmake/build_configurations/mysql_release.cmake	2011-07-04 12:27:08 +0000
+++ b/cmake/build_configurations/mysql_release.cmake	2011-08-17 09:22:05 +0000
@@ -96,6 +96,8 @@ OPTION(ENABLED_LOCAL_INFILE "" ON)
 SET(WITH_SSL bundled CACHE STRING "")
 SET(WITH_ZLIB bundled CACHE STRING "")
 
+OPTION(DEBUG_EXTNAME "" ON)
+
 IF(NOT COMPILATION_COMMENT)
   SET(COMPILATION_COMMENT "MySQL Community Server (GPL)")
 ENDIF()

=== modified file 'cmake/install_macros.cmake'
--- a/cmake/install_macros.cmake	2011-06-30 15:50:45 +0000
+++ b/cmake/install_macros.cmake	2011-08-17 09:22:05 +0000
@@ -245,7 +245,7 @@ SET(DEBUGBUILDDIR "${BINARY_PARENTDIR}/d
 
 FUNCTION(INSTALL_DEBUG_TARGET target)
  MYSQL_PARSE_ARGUMENTS(ARG
-  "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT"
+  "DESTINATION;RENAME;PDB_DESTINATION;COMPONENT;SUFFIX"
   ""
   ${ARGN}
   )
@@ -264,6 +264,12 @@ FUNCTION(INSTALL_DEBUG_TARGET target)
   ELSE()
    STRING(REPLACE "${CMAKE_CFG_INTDIR}" "Debug"  debug_target_location "${target_location}" )
   ENDIF()
+  IF(ARG_SUFFIX) 
+    GET_FILENAME_COMPONENT(ext ${debug_target_location} EXT)
+    GET_FILENAME_COMPONENT(fn  ${debug_target_location} NAME_WE)
+    STRING(REPLACE "${fn}${ext}" "${fn}${ARG_SUFFIX}${ext}"
+           debug_target_location "${debug_target_location}" )
+  ENDIF()
   IF(NOT ARG_COMPONENT)
     SET(ARG_COMPONENT DebugBinaries)
   ENDIF()

=== modified file 'mysql-test/collections/disabled-daily.list'
--- a/mysql-test/collections/disabled-daily.list	2011-02-14 12:41:46 +0000
+++ b/mysql-test/collections/disabled-daily.list	2011-08-17 09:22:05 +0000
@@ -1,9 +0,0 @@
-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.

=== modified file 'mysql-test/include/mtr_check.sql'
--- a/mysql-test/include/mtr_check.sql	2011-08-18 07:28:08 +0000
+++ b/mysql-test/include/mtr_check.sql	2011-08-22 13:24:38 +0000
@@ -105,3 +105,13 @@ BEGIN
     mysql.user;
 
 END||
+
+--
+-- Procedure used by test case used to force all
+-- servers to restart after testcase and thus skipping
+-- check test case after test
+--
+CREATE DEFINER=root@localhost PROCEDURE force_restart()
+BEGIN
+  SELECT 1 INTO OUTFILE 'force_restart';
+END||

=== modified file 'mysql-test/include/mysqld--help.inc'
--- a/mysql-test/include/mysqld--help.inc	2011-02-22 05:37:44 +0000
+++ b/mysql-test/include/mysqld--help.inc	2011-08-22 13:24:38 +0000
@@ -26,7 +26,7 @@ perl;
 
   # And substitute the content some environment variables with their
   # names:
-  @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_LIBDIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR/;
+  @env=qw/MYSQLTEST_VARDIR MYSQL_TEST_DIR MYSQL_CHARSETSDIR MYSQL_SHAREDIR/;
 
   $re1=join('|', @skipvars, @plugins);
   $re2=join('|', @plugins);

=== modified file 'mysql-test/include/subquery_sj.inc'
--- a/mysql-test/include/subquery_sj.inc	2011-06-27 07:17:26 +0000
+++ b/mysql-test/include/subquery_sj.inc	2011-08-25 06:59:49 +0000
@@ -3907,4 +3907,45 @@ eval $query;
 
 DROP TABLE t1, t2;
 
---echo # End of the test for bug#12603183.
+--echo # End of test for bug#12603183.
+
+--echo #
+--echo # Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+--echo #
+
+CREATE TABLE t1 (
+ col_int_key INT NOT NULL,
+ col_datetime_key DATETIME NOT NULL,
+ col_varchar_key VARCHAR(1) NOT NULL,
+ KEY col_int_key (col_int_key),
+ KEY col_datetime_key(col_datetime_key),
+ KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+
+INSERT INTO t1 VALUES
+ (7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+ (9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+ (4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+ (5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+ (1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+ (6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+ (5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+ (204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+ (9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+ (0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+
+CREATE TABLE t2 (
+ col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+                          FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+
+DROP TABLE t1, t2;
+
+--echo # End of test for bug#12818569.

=== modified file 'mysql-test/lib/mtr_cases.pm'
--- a/mysql-test/lib/mtr_cases.pm	2011-08-19 13:24:24 +0000
+++ b/mysql-test/lib/mtr_cases.pm	2011-08-22 12:48:51 +0000
@@ -337,17 +337,41 @@ sub collect_one_suite($)
   for my $skip (@disabled_collection)
     {
       if ( open(DISABLED, $skip ) )
-      {
-        while ( <DISABLED> )
-          {
-            chomp;
-            if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
-              {
-                $disabled{$1}= $2 if not exists $disabled{$1};
-              }
-          }
-        close DISABLED;
-      }
+	{
+	  # $^O on Windows considered not generic enough
+	  my $plat= (IS_WINDOWS) ? 'windows' : $^O;
+
+	  while ( <DISABLED> )
+	    {
+	      chomp;
+	      #diasble the test case if platform matches
+	      if ( /\@/ )
+		{
+		  if ( /\@$plat/ )
+		    {
+		      /^\s*(\S+)\s*\@$plat.*:\s*(.*?)\s*$/ ;
+		      $disabled{$1}= $2 if not exists $disabled{$1};
+		    }
+		  elsif ( /\@!(\S*)/ )
+		    {
+		      if ( $1 ne $plat)
+			{
+			  /^\s*(\S+)\s*\@!.*:\s*(.*?)\s*$/ ;
+			  $disabled{$1}= $2 if not exists $disabled{$1};
+			}
+		    }
+		}
+	      elsif ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
+		{
+		  chomp;
+		  if ( /^\s*(\S+)\s*:\s*(.*?)\s*$/ )
+		    {
+		      $disabled{$1}= $2 if not exists $disabled{$1};
+		    }
+		}
+	    }
+	  close DISABLED;
+	}
     }
 
   # Read suite.opt file

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	2011-08-19 10:27:23 +0000
+++ b/mysql-test/mysql-test-run.pl	2011-08-30 10:49:24 +0000
@@ -2149,8 +2149,10 @@ sub find_plugin($$)
   my $lib_plugin=
     mtr_file_exists(vs_config_dirs($location,$plugin_filename),
                     "$basedir/lib/plugin/".$plugin_filename,
+                    "$basedir/lib64/plugin/".$plugin_filename,
                     "$basedir/$location/.libs/".$plugin_filename,
                     "$basedir/lib/mysql/plugin/".$plugin_filename,
+                    "$basedir/lib64/mysql/plugin/".$plugin_filename,
                     );
   return $lib_plugin;
 }
@@ -2316,12 +2318,6 @@ sub environment_setup {
   $ENV{'DEFAULT_MASTER_PORT'}= $mysqld_variables{'port'};
   $ENV{'MYSQL_TMP_DIR'}=      $opt_tmpdir;
   $ENV{'MYSQLTEST_VARDIR'}=   $opt_vardir;
-  # Used for guessing default plugin dir, we can't really know for sure
-  $ENV{'MYSQL_LIBDIR'}=       "$basedir/lib";
-  # Override if this does not exist, but lib64 does (best effort)
-  if (! -d "$basedir/lib" && -d "$basedir/lib64") {
-    $ENV{'MYSQL_LIBDIR'}=     "$basedir/lib64";
-  }
   $ENV{'MYSQL_BINDIR'}=       "$bindir";
   $ENV{'MYSQL_SHAREDIR'}=     $path_language;
   $ENV{'MYSQL_CHARSETSDIR'}=  $path_charsetsdir;

=== modified file 'mysql-test/r/alter_table.result'
--- a/mysql-test/r/alter_table.result	2011-07-07 10:25:51 +0000
+++ b/mysql-test/r/alter_table.result	2011-08-30 04:28:18 +0000
@@ -1461,3 +1461,17 @@ ALTER TABLE t1 FORCE;
 affected rows: 2
 info: Records: 2  Duplicates: 0  Warnings: 0
 DROP TABLE t1;
+# Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't
+#                                         identify correct column name.
+#
+CREATE TABLE t1 (c1 int unsigned , c2 char(100) not null default '');
+ALTER TABLE t1 ADD c3 char(16) NOT NULL DEFAULT '' AFTER c2,
+MODIFY c2 char(100) NOT NULL DEFAULT '' AFTER c1;
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(10) unsigned DEFAULT NULL,
+  `c2` char(100) NOT NULL DEFAULT '',
+  `c3` char(16) NOT NULL DEFAULT ''
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+DROP TABLE t1;

=== modified file 'mysql-test/r/execution_constants.result'
--- a/mysql-test/r/execution_constants.result	2006-09-27 18:42:56 +0000
+++ b/mysql-test/r/execution_constants.result	2011-08-22 11:58:49 +0000
@@ -7,6 +7,6 @@ PRIMARY KEY  (`ID_MEMBER`,`ID_BOARD`),
 KEY `logTime` (`logTime`)
 ) ENGINE=MyISAM DEFAULT CHARSET=cp1251 COLLATE=cp1251_bulgarian_ci;
 INSERT INTO `t_bug21476` VALUES (2,2,1154870939,0),(1,2,1154870957,0),(2,183,1154941362,0),(2,84,1154904301,0),(1,84,1154905867,0),(2,13,1154947484,10271),(3,84,1154880549,0),(1,6,1154892183,0),(2,25,1154947581,10271),(3,25,1154904760,0),(1,25,1154947373,10271),(1,179,1154899992,0),(2,179,1154899410,0),(5,25,1154901666,0),(2,329,1154902026,0),(3,329,1154902040,0),(1,329,1154902058,0),(1,13,1154930841,0),(3,85,1154904987,0),(1,183,1154929665,0),(3,13,1154931268,0),(1,85,1154936888,0),(1,169,1154937959,0),(2,169,1154941717,0),(3,183,1154939810,0),(3,169,1154941734,0);
-Assertion: mysql_errno 1436 == 1436
+Assertion: mysql_errname ER_STACK_OVERRUN_NEED_MORE == ER_STACK_OVERRUN_NEED_MORE
 DROP TABLE `t_bug21476`;
 End of 5.0 tests.

=== modified file 'mysql-test/r/group_by.result'
--- a/mysql-test/r/group_by.result	2011-08-17 11:50:34 +0000
+++ b/mysql-test/r/group_by.result	2011-08-30 10:04:45 +0000
@@ -1892,6 +1892,38 @@ a	AVG(t1.b)	t11c	t12c
 1	4.0000	6	6
 2	2.0000	7	7
 DROP TABLE t1;
+#
+# Bug#11765254 (58200): Assertion failed: param.sort_length when grouping
+# by functions
+#
+SET BIG_TABLES=1;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0),(0);
+SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
+1
+1
+SELECT 1 FROM t1 GROUP BY TRIM(LEADING RAND() FROM '');
+1
+1
+SELECT 1 FROM t1 GROUP BY SUBSTRING('',SLEEP(0),'');
+1
+1
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: ''
+Warning	1292	Truncated incorrect INTEGER value: ''
+Warning	1292	Truncated incorrect INTEGER value: ''
+SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<');
+1
+1
+Warnings:
+Warning	1292	Truncated incorrect INTEGER value: 'K'
+Warning	1292	Truncated incorrect INTEGER value: 'jxW<'
+Warning	1292	Truncated incorrect INTEGER value: 'K'
+Warning	1292	Truncated incorrect INTEGER value: 'jxW<'
+Warning	1292	Truncated incorrect INTEGER value: 'K'
+Warning	1292	Truncated incorrect INTEGER value: 'jxW<'
+DROP TABLE t1;
+SET BIG_TABLES=0;
 # End of 5.1 tests
 #
 # Bug#49771: Incorrect MIN (date) when minimum value is 0000-00-00

=== modified file 'mysql-test/r/mysqltest.result'
--- a/mysql-test/r/mysqltest.result	2011-03-07 15:17:39 +0000
+++ b/mysql-test/r/mysqltest.result	2011-08-22 13:24:38 +0000
@@ -1,6 +1,5 @@
-select 0 as "before_use_test" ;
-before_use_test
-0
+-1 before test
+<No error> before test
 select otto from (select 1 as otto) as t1;
 otto
 1
@@ -21,27 +20,32 @@ mysqltest: At line 1: query 'select frie
 select otto from (select 1 as otto) as t1;
 otto
 1
+
 select 0 as "after_successful_stmt_errno" ;
 after_successful_stmt_errno
 0
 garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+ER_PARSE_ERROR
 select 1064 as "after_wrong_syntax_errno" ;
 after_wrong_syntax_errno
 1064
 garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+ER_PARSE_ERROR
 select 1064 as "after_let_var_equal_value" ;
 after_let_var_equal_value
 1064
 garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 set @my_var= 'abc' ;
+
 select 0 as "after_set_var_equal_value" ;
 after_set_var_equal_value
 0
 garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+ER_PARSE_ERROR
 select 1064 as "after_disable_warnings_command" ;
 after_disable_warnings_command
 1064
@@ -49,6 +53,7 @@ drop table if exists t1 ;
 garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 drop table if exists t1 ;
+
 select 0 as "after_disable_warnings" ;
 after_disable_warnings
 0
@@ -56,6 +61,7 @@ garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 select 3 from t1 ;
 ERROR 42S02: Table 'test.t1' doesn't exist
+ER_NO_SUCH_TABLE
 select 1146 as "after_minus_masked" ;
 after_minus_masked
 1146
@@ -63,6 +69,7 @@ garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 select 3 from t1 ;
 ERROR 42S02: Table 'test.t1' doesn't exist
+ER_NO_SUCH_TABLE
 select 1146 as "after_!_masked" ;
 after_!_masked
 1146
@@ -75,6 +82,7 @@ garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 prepare stmt from "select 3 from t1" ;
 ERROR 42S02: Table 'test.t1' doesn't exist
+ER_NO_SUCH_TABLE
 select 1146 as "after_failing_prepare" ;
 after_failing_prepare
 1146
@@ -82,6 +90,7 @@ create table t1 ( f1 char(10));
 garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 prepare stmt from "select 3 from t1" ;
+
 select 0 as "after_successful_prepare" ;
 after_successful_prepare
 0
@@ -89,6 +98,7 @@ garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 execute stmt;
 3
+
 select 0 as "after_successful_execute" ;
 after_successful_execute
 0
@@ -97,6 +107,7 @@ garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 execute stmt;
 ERROR 42S02: Table 'test.t1' doesn't exist
+ER_NO_SUCH_TABLE
 select 1146 as "after_failing_execute" ;
 after_failing_execute
 1146
@@ -104,12 +115,14 @@ garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 execute __stmt_;
 ERROR HY000: Unknown prepared statement handler (__stmt_) given to EXECUTE
+ER_UNKNOWN_STMT_HANDLER
 select 1243 as "after_failing_execute" ;
 after_failing_execute
 1243
 garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 deallocate prepare stmt;
+
 select 0 as "after_successful_deallocate" ;
 after_successful_deallocate
 0
@@ -117,11 +130,13 @@ garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
 deallocate prepare __stmt_;
 ERROR HY000: Unknown prepared statement handler (__stmt_) given to DEALLOCATE PREPARE
+ER_UNKNOWN_STMT_HANDLER
 select 1243 as "after_failing_deallocate" ;
 after_failing_deallocate
 1243
 garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+ER_PARSE_ERROR
 select 1064 as "after_--disable_abort_on_error" ;
 after_--disable_abort_on_error
 1064
@@ -131,12 +146,14 @@ select 3 from t1 ;
 ERROR 42S02: Table 'test.t1' doesn't exist
 select 3 from t1 ;
 ERROR 42S02: Table 'test.t1' doesn't exist
+ER_NO_SUCH_TABLE
 select 1146 as "after_!errno_masked_error" ;
 after_!errno_masked_error
 1146
 mysqltest: At line 1: query 'select 3 from t1' failed with wrong errno 1146: 'Table 'test.t1' doesn't exist', instead of 1000...
 garbage ;
 ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'garbage' at line 1
+ER_PARSE_ERROR
 select 1064 as "after_--enable_abort_on_error" ;
 after_--enable_abort_on_error
 1064

=== modified file 'mysql-test/r/subquery_sj_all.result'
--- a/mysql-test/r/subquery_sj_all.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/subquery_sj_all.result	2011-08-25 06:59:49 +0000
@@ -6594,5 +6594,43 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_all_bka.result'
--- a/mysql-test/r/subquery_sj_all_bka.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_all_bka.result	2011-08-25 06:59:49 +0000
@@ -6595,6 +6595,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_all_bkaunique.result'
--- a/mysql-test/r/subquery_sj_all_bkaunique.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_all_bkaunique.result	2011-08-25 06:59:49 +0000
@@ -6596,6 +6596,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_dupsweed.result'
--- a/mysql-test/r/subquery_sj_dupsweed.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed.result	2011-08-29 13:03:30 +0000
@@ -6594,5 +6594,43 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bka.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bka.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bka.result	2011-08-29 13:03:30 +0000
@@ -6595,6 +6595,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_dupsweed_bkaunique.result'
--- a/mysql-test/r/subquery_sj_dupsweed_bkaunique.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_dupsweed_bkaunique.result	2011-08-29 13:03:30 +0000
@@ -6596,6 +6596,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_firstmatch.result'
--- a/mysql-test/r/subquery_sj_firstmatch.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch.result	2011-08-25 06:59:49 +0000
@@ -6595,7 +6595,45 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 #
 # Bug#51457 Firstmatch semijoin strategy gives wrong results for
 #           certain query plans

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bka.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bka.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bka.result	2011-08-25 06:59:49 +0000
@@ -6596,7 +6596,45 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 #
 # Bug#51457 Firstmatch semijoin strategy gives wrong results for
 #           certain query plans

=== modified file 'mysql-test/r/subquery_sj_firstmatch_bkaunique.result'
--- a/mysql-test/r/subquery_sj_firstmatch_bkaunique.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_firstmatch_bkaunique.result	2011-08-25 06:59:49 +0000
@@ -6597,7 +6597,45 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 #
 # Bug#51457 Firstmatch semijoin strategy gives wrong results for
 #           certain query plans

=== modified file 'mysql-test/r/subquery_sj_loosescan.result'
--- a/mysql-test/r/subquery_sj_loosescan.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/subquery_sj_loosescan.result	2011-08-29 13:03:30 +0000
@@ -6595,5 +6595,43 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_loosescan_bka.result'
--- a/mysql-test/r/subquery_sj_loosescan_bka.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bka.result	2011-08-29 13:03:30 +0000
@@ -6596,6 +6596,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_loosescan_bkaunique.result'
--- a/mysql-test/r/subquery_sj_loosescan_bkaunique.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_loosescan_bkaunique.result	2011-08-29 13:03:30 +0000
@@ -6597,6 +6597,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_mat.result'
--- a/mysql-test/r/subquery_sj_mat.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/subquery_sj_mat.result	2011-08-29 13:03:30 +0000
@@ -6594,5 +6594,43 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_mat_bka.result'
--- a/mysql-test/r/subquery_sj_mat_bka.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_mat_bka.result	2011-08-29 13:03:30 +0000
@@ -6595,6 +6595,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_mat_bkaunique.result'
--- a/mysql-test/r/subquery_sj_mat_bkaunique.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_mat_bkaunique.result	2011-08-29 13:03:30 +0000
@@ -6596,6 +6596,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_mat_nosj.result'
--- a/mysql-test/r/subquery_sj_mat_nosj.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/subquery_sj_mat_nosj.result	2011-08-25 06:59:49 +0000
@@ -6671,5 +6671,43 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_none.result'
--- a/mysql-test/r/subquery_sj_none.result	2011-08-03 11:29:20 +0000
+++ b/mysql-test/r/subquery_sj_none.result	2011-08-25 06:59:49 +0000
@@ -6606,5 +6606,43 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_none_bka.result'
--- a/mysql-test/r/subquery_sj_none_bka.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_none_bka.result	2011-08-25 06:59:49 +0000
@@ -6607,6 +6607,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_none_bka_nobnl.result'
--- a/mysql-test/r/subquery_sj_none_bka_nobnl.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_none_bka_nobnl.result	2011-08-29 13:03:30 +0000
@@ -6607,6 +6607,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_sj_none_bkaunique.result'
--- a/mysql-test/r/subquery_sj_none_bkaunique.result	2011-08-18 09:21:45 +0000
+++ b/mysql-test/r/subquery_sj_none_bkaunique.result	2011-08-25 06:59:49 +0000
@@ -6608,6 +6608,44 @@ w
 -- Notice that Materialize-scan algorithm reports wrong result for this query.
 -- This problem will be filed as a separate bug and dealt with in WL#5561.
 DROP TABLE t1, t2;
-# End of the test for bug#12603183.
+# End of test for bug#12603183.
+#
+# Bug#12818569: Diff nr of rows returned when using IN/ALL+subquery
+#
+CREATE TABLE t1 (
+col_int_key INT NOT NULL,
+col_datetime_key DATETIME NOT NULL,
+col_varchar_key VARCHAR(1) NOT NULL,
+KEY col_int_key (col_int_key),
+KEY col_datetime_key(col_datetime_key),
+KEY col_varchar_key (col_varchar_key,col_int_key)
+) ENGINE=InnoDB;
+INSERT INTO t1 VALUES
+(7,'2004-06-06 04:22:12','v'), (0,'2005-11-13 01:12:31','s'),
+(9,'2002-05-04 01:50:00','l'), (3,'2004-10-27 10:28:45','y'),
+(4,'2006-07-22 05:24:23','c'), (2,'2002-05-16 21:34:03','i'),
+(5,'2008-04-17 10:45:30','h'), (3,'2009-04-21 02:58:02','q'),
+(1,'2008-01-11 11:01:51','a'), (3,'1900-01-01 00:00:00','v'),
+(6,'2007-05-17 18:24:57','u'), (7,'2007-08-07 00:00:00','s'),
+(5,'2001-08-28 00:00:00','y'), (1,'2004-04-16 00:27:28','z'),
+(204,'2005-05-03 07:06:22','h'), (224,'2009-03-11 17:09:50','p'),
+(9,'2007-12-08 01:54:28','e'), (5,'2009-07-28 18:19:54','i'),
+(0,'2008-06-08 00:00:00','y'), (3,'2005-02-09 09:20:26','w');
+CREATE TABLE t2 (
+col_varchar_nokey VARCHAR(1) NOT NULL
+) ENGINE=InnoDB;
+INSERT INTO t2 VALUES ('v'), ('y'), ('j'), ('c'), ('d'), ('r');
+SELECT col_varchar_key
+FROM t1
+WHERE col_varchar_key IN (SELECT col_varchar_nokey
+FROM t2)
+ORDER BY col_datetime_key LIMIT 4;
+col_varchar_key
+v
+y
+v
+y
+DROP TABLE t1, t2;
+# End of test for bug#12818569.
 set optimizer_switch=default;
 set optimizer_switch=default;

=== removed file 'mysql-test/std_data/bug57108.cnf'
--- a/mysql-test/std_data/bug57108.cnf	2010-11-04 10:00:59 +0000
+++ b/mysql-test/std_data/bug57108.cnf	1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
-[mysqld]
-open-files-limit=1024
-character-set-server=latin1
-connect-timeout=4711
-log-bin-trust-function-creators=1
-key_buffer_size=1M
-sort_buffer=256K
-max_heap_table_size=1M
-loose-innodb_data_file_path=ibdata1:10M:autoextend
-loose-innodb_buffer_pool_size=8M
-loose-innodb_write_io_threads=2
-loose-innodb_read_io_threads=2
-loose-innodb_log_buffer_size=1M
-loose-innodb_log_file_size=5M
-loose-innodb_additional_mem_pool_size=1M
-loose-innodb_log_files_in_group=2
-slave-net-timeout=120
-log-bin=mysqld-bin
-loose-enable-performance-schema
-loose-performance-schema-max-mutex-instances=10000
-loose-performance-schema-max-rwlock-instances=10000
-loose-performance-schema-max-table-instances=500
-loose-performance-schema-max-table-handles=1000
-binlog-direct-non-transactional-updates
-
-[mysql]
-default-character-set=latin1
-
-[mysqlshow]
-default-character-set=latin1
-
-[mysqlimport]
-default-character-set=latin1
-
-[mysqlcheck]
-default-character-set=latin1
-
-[mysql_upgrade]
-default-character-set=latin1
-tmpdir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp
-
-[mysqld.1]
-#!run-master-sh
-log-bin=master-bin
-loose-enable-performance-schema
-basedir=/home/bzr/bugs/b57108-5.5-bugteam
-tmpdir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1
-character-sets-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/charsets
-lc-messages-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/
-datadir=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/data
-pid-file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/run/mysqld.1.pid
-#host=localhost
-port=13000
-socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
-#log-error=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/log/mysqld.1.err
-general_log=1
-general_log_file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/mysqld.log
-slow_query_log=1
-slow_query_log_file=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/mysqld.1/mysqld-slow.log
-#user=root
-#password=
-server-id=1
-secure-file-priv=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var
-ssl-ca=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/cacert.pem
-ssl-cert=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/server-cert.pem
-ssl-key=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/server-key.pem
-
-[mysqlbinlog]
-disable-force-if-open
-character-sets-dir=/home/bzr/bugs/b57108-5.5-bugteam/sql/share/charsets
-
-[ENV]
-MASTER_MYPORT=13000
-MASTER_MYSOCK=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
-
-[client]
-password=
-user=root
-port=13000
-host=localhost
-socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
-
-[mysqltest]
-ssl-ca=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/cacert.pem
-ssl-cert=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/client-cert.pem
-ssl-key=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/std_data/client-key.pem
-skip-ssl=1
-
-[client.1]
-password=
-user=root
-port=13000
-host=localhost
-socket=/home/bzr/bugs/b57108-5.5-bugteam/mysql-test/var/tmp/mysqld.1.sock
-

=== modified file 'mysql-test/suite/perfschema/r/pfs_upgrade.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result	2011-08-20 00:25:14 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result	2011-09-02 20:03:36 +0000
@@ -19,44 +19,44 @@ ERROR 1050 (42S01) at line 222: Table 'e
 ERROR 1050 (42S01) at line 235: Table 'events_waits_summary_by_thread_by_event_name' already exists
 ERROR 1050 (42S01) at line 247: Table 'events_waits_summary_global_by_event_name' already exists
 ERROR 1050 (42S01) at line 256: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 267: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 279: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 292: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 322: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 351: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 360: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 374: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 384: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 394: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 403: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 411: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 420: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 431: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 439: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 484: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 528: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 607: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 627: Table 'threads' already exists
-ERROR 1050 (42S01) at line 642: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 657: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 672: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 685: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 698: Table 'events_stages_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 711: Table 'events_stages_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 725: Table 'events_stages_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 737: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 780: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 823: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 866: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 898: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 930: Table 'events_statements_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 962: Table 'events_statements_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 995: Table 'events_statements_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 1026: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 1035: Table 'hosts' already exists
-ERROR 1050 (42S01) at line 1044: Table 'users' already exists
-ERROR 1050 (42S01) at line 1054: Table 'accounts' already exists
-ERROR 1644 (HY000) at line 1474: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 285: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 316: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 329: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 359: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 388: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 397: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 411: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 421: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 431: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 440: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 448: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 457: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 468: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 476: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 521: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 565: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 644: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 664: Table 'threads' already exists
+ERROR 1050 (42S01) at line 679: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 694: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 709: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 722: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 735: Table 'events_stages_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 748: Table 'events_stages_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 762: Table 'events_stages_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 774: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 817: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 860: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 903: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 935: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 967: Table 'events_statements_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 999: Table 'events_statements_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 1032: Table 'events_statements_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 1063: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 1072: Table 'hosts' already exists
+ERROR 1050 (42S01) at line 1081: Table 'users' already exists
+ERROR 1050 (42S01) at line 1091: Table 'accounts' already exists
+ERROR 1644 (HY000) at line 1511: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_table";
 Tables_in_performance_schema (user_table)
@@ -80,44 +80,44 @@ ERROR 1050 (42S01) at line 222: Table 'e
 ERROR 1050 (42S01) at line 235: Table 'events_waits_summary_by_thread_by_event_name' already exists
 ERROR 1050 (42S01) at line 247: Table 'events_waits_summary_global_by_event_name' already exists
 ERROR 1050 (42S01) at line 256: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 267: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 279: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 292: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 322: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 351: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 360: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 374: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 384: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 394: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 403: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 411: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 420: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 431: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 439: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 484: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 528: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 607: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 627: Table 'threads' already exists
-ERROR 1050 (42S01) at line 642: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 657: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 672: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 685: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 698: Table 'events_stages_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 711: Table 'events_stages_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 725: Table 'events_stages_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 737: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 780: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 823: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 866: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 898: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 930: Table 'events_statements_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 962: Table 'events_statements_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 995: Table 'events_statements_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 1026: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 1035: Table 'hosts' already exists
-ERROR 1050 (42S01) at line 1044: Table 'users' already exists
-ERROR 1050 (42S01) at line 1054: Table 'accounts' already exists
-ERROR 1644 (HY000) at line 1474: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 285: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 316: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 329: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 359: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 388: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 397: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 411: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 421: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 431: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 440: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 448: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 457: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 468: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 476: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 521: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 565: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 644: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 664: Table 'threads' already exists
+ERROR 1050 (42S01) at line 679: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 694: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 709: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 722: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 735: Table 'events_stages_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 748: Table 'events_stages_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 762: Table 'events_stages_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 774: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 817: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 860: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 903: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 935: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 967: Table 'events_statements_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 999: Table 'events_statements_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 1032: Table 'events_statements_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 1063: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 1072: Table 'hosts' already exists
+ERROR 1050 (42S01) at line 1081: Table 'users' already exists
+ERROR 1050 (42S01) at line 1091: Table 'accounts' already exists
+ERROR 1644 (HY000) at line 1511: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 show tables like "user_view";
 Tables_in_performance_schema (user_view)
@@ -139,44 +139,44 @@ ERROR 1050 (42S01) at line 222: Table 'e
 ERROR 1050 (42S01) at line 235: Table 'events_waits_summary_by_thread_by_event_name' already exists
 ERROR 1050 (42S01) at line 247: Table 'events_waits_summary_global_by_event_name' already exists
 ERROR 1050 (42S01) at line 256: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 267: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 279: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 292: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 322: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 351: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 360: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 374: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 384: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 394: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 403: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 411: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 420: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 431: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 439: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 484: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 528: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 607: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 627: Table 'threads' already exists
-ERROR 1050 (42S01) at line 642: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 657: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 672: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 685: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 698: Table 'events_stages_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 711: Table 'events_stages_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 725: Table 'events_stages_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 737: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 780: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 823: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 866: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 898: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 930: Table 'events_statements_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 962: Table 'events_statements_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 995: Table 'events_statements_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 1026: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 1035: Table 'hosts' already exists
-ERROR 1050 (42S01) at line 1044: Table 'users' already exists
-ERROR 1050 (42S01) at line 1054: Table 'accounts' already exists
-ERROR 1644 (HY000) at line 1474: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 285: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 316: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 329: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 359: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 388: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 397: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 411: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 421: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 431: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 440: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 448: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 457: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 468: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 476: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 521: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 565: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 644: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 664: Table 'threads' already exists
+ERROR 1050 (42S01) at line 679: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 694: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 709: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 722: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 735: Table 'events_stages_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 748: Table 'events_stages_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 762: Table 'events_stages_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 774: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 817: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 860: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 903: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 935: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 967: Table 'events_statements_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 999: Table 'events_statements_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 1032: Table 'events_statements_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 1063: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 1072: Table 'hosts' already exists
+ERROR 1050 (42S01) at line 1081: Table 'users' already exists
+ERROR 1050 (42S01) at line 1091: Table 'accounts' already exists
+ERROR 1644 (HY000) at line 1511: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -198,44 +198,44 @@ ERROR 1050 (42S01) at line 222: Table 'e
 ERROR 1050 (42S01) at line 235: Table 'events_waits_summary_by_thread_by_event_name' already exists
 ERROR 1050 (42S01) at line 247: Table 'events_waits_summary_global_by_event_name' already exists
 ERROR 1050 (42S01) at line 256: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 267: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 279: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 292: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 322: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 351: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 360: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 374: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 384: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 394: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 403: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 411: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 420: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 431: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 439: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 484: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 528: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 607: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 627: Table 'threads' already exists
-ERROR 1050 (42S01) at line 642: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 657: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 672: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 685: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 698: Table 'events_stages_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 711: Table 'events_stages_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 725: Table 'events_stages_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 737: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 780: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 823: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 866: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 898: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 930: Table 'events_statements_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 962: Table 'events_statements_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 995: Table 'events_statements_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 1026: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 1035: Table 'hosts' already exists
-ERROR 1050 (42S01) at line 1044: Table 'users' already exists
-ERROR 1050 (42S01) at line 1054: Table 'accounts' already exists
-ERROR 1644 (HY000) at line 1474: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 285: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 316: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 329: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 359: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 388: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 397: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 411: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 421: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 431: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 440: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 448: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 457: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 468: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 476: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 521: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 565: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 644: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 664: Table 'threads' already exists
+ERROR 1050 (42S01) at line 679: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 694: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 709: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 722: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 735: Table 'events_stages_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 748: Table 'events_stages_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 762: Table 'events_stages_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 774: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 817: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 860: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 903: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 935: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 967: Table 'events_statements_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 999: Table 'events_statements_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 1032: Table 'events_statements_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 1063: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 1072: Table 'hosts' already exists
+ERROR 1050 (42S01) at line 1081: Table 'users' already exists
+ERROR 1050 (42S01) at line 1091: Table 'accounts' already exists
+ERROR 1644 (HY000) at line 1511: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.proc where db='performance_schema';
 name
@@ -257,44 +257,44 @@ ERROR 1050 (42S01) at line 222: Table 'e
 ERROR 1050 (42S01) at line 235: Table 'events_waits_summary_by_thread_by_event_name' already exists
 ERROR 1050 (42S01) at line 247: Table 'events_waits_summary_global_by_event_name' already exists
 ERROR 1050 (42S01) at line 256: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 267: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 279: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 292: Table 'socket_instances' already exists
-ERROR 1050 (42S01) at line 322: Table 'socket_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 351: Table 'socket_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 360: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 374: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 384: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 394: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 403: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 411: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 420: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 431: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 439: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 484: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 528: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 607: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 627: Table 'threads' already exists
-ERROR 1050 (42S01) at line 642: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 657: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 672: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 685: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 698: Table 'events_stages_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 711: Table 'events_stages_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 725: Table 'events_stages_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 737: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 780: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 823: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 866: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 898: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 930: Table 'events_statements_summary_by_host_by_event_name' already exists
-ERROR 1050 (42S01) at line 962: Table 'events_statements_summary_by_user_by_event_name' already exists
-ERROR 1050 (42S01) at line 995: Table 'events_statements_summary_by_account_by_event_name' already exists
-ERROR 1050 (42S01) at line 1026: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 1035: Table 'hosts' already exists
-ERROR 1050 (42S01) at line 1044: Table 'users' already exists
-ERROR 1050 (42S01) at line 1054: Table 'accounts' already exists
-ERROR 1644 (HY000) at line 1474: Unexpected content found in the performance_schema database.
+ERROR 1050 (42S01) at line 285: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 316: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 329: Table 'socket_instances' already exists
+ERROR 1050 (42S01) at line 359: Table 'socket_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 388: Table 'socket_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 397: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 411: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 421: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 431: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 440: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 448: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 457: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 468: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 476: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 521: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 565: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 644: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 664: Table 'threads' already exists
+ERROR 1050 (42S01) at line 679: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 694: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 709: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 722: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 735: Table 'events_stages_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 748: Table 'events_stages_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 762: Table 'events_stages_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 774: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 817: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 860: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 903: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 935: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 967: Table 'events_statements_summary_by_host_by_event_name' already exists
+ERROR 1050 (42S01) at line 999: Table 'events_statements_summary_by_user_by_event_name' already exists
+ERROR 1050 (42S01) at line 1032: Table 'events_statements_summary_by_account_by_event_name' already exists
+ERROR 1050 (42S01) at line 1063: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 1072: Table 'hosts' already exists
+ERROR 1050 (42S01) at line 1081: Table 'users' already exists
+ERROR 1050 (42S01) at line 1091: Table 'accounts' already exists
+ERROR 1644 (HY000) at line 1511: Unexpected content found in the performance_schema database.
 FATAL ERROR: Upgrade failed
 select name from mysql.event where db='performance_schema';
 name

=== modified file 'mysql-test/suite/perfschema/r/relaylog.result'
--- a/mysql-test/suite/perfschema/r/relaylog.result	2011-06-29 20:25:37 +0000
+++ b/mysql-test/suite/perfschema/r/relaylog.result	2011-09-02 20:03:36 +0000
@@ -23,7 +23,7 @@ master-bin.000001	wait/io/file/sql/binlo
 master-bin.index	wait/io/file/sql/binlog_index	NONE	NONE	NONE	NONE
 select * from performance_schema.file_summary_by_instance
 where file_name like "%slave-%" order by file_name;
-FILE_NAME	EVENT_NAME	COUNT_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_READ	SUM_NUMBER_OF_BYTES_WRITE
+FILE_NAME	EVENT_NAME	OBJECT_INSTANCE_BEGIN	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT	COUNT_READ	SUM_TIMER_READ	MIN_TIMER_READ	AVG_TIMER_READ	MAX_TIMER_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_TIMER_WRITE	MIN_TIMER_WRITE	AVG_TIMER_WRITE	MAX_TIMER_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	SUM_TIMER_MISC	MIN_TIMER_MISC	AVG_TIMER_MISC	MAX_TIMER_MISC
 "Expect a master binlog + binlog_index"
 select
 substring(file_name, locate("master-", file_name)) as FILE_NAME,
@@ -62,12 +62,12 @@ wait/synch/mutex/sql/MYSQL_BIN_LOG::LOCK
 "Expect no slave relay log"
 select * from performance_schema.file_summary_by_instance
 where event_name like "%relaylog%" order by file_name;
-FILE_NAME	EVENT_NAME	COUNT_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_READ	SUM_NUMBER_OF_BYTES_WRITE
+FILE_NAME	EVENT_NAME	OBJECT_INSTANCE_BEGIN	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT	COUNT_READ	SUM_TIMER_READ	MIN_TIMER_READ	AVG_TIMER_READ	MAX_TIMER_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_TIMER_WRITE	MIN_TIMER_WRITE	AVG_TIMER_WRITE	MAX_TIMER_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	SUM_TIMER_MISC	MIN_TIMER_MISC	AVG_TIMER_MISC	MAX_TIMER_MISC
 select * from performance_schema.file_summary_by_event_name
 where event_name like "%relaylog%" order by event_name;
-EVENT_NAME	COUNT_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_READ	SUM_NUMBER_OF_BYTES_WRITE
-wait/io/file/sql/relaylog	0	0	0	0
-wait/io/file/sql/relaylog_index	0	0	0	0
+EVENT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT	COUNT_READ	SUM_TIMER_READ	MIN_TIMER_READ	AVG_TIMER_READ	MAX_TIMER_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_TIMER_WRITE	MIN_TIMER_WRITE	AVG_TIMER_WRITE	MAX_TIMER_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	SUM_TIMER_MISC	MIN_TIMER_MISC	AVG_TIMER_MISC	MAX_TIMER_MISC
+wait/io/file/sql/relaylog	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
+wait/io/file/sql/relaylog_index	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0	0
 select * from performance_schema.events_waits_summary_global_by_event_name
 where event_name like "%MYSQL_RELAY_LOG%"
   and event_name not like "%MYSQL_RELAY_LOG::update_cond"
@@ -77,7 +77,7 @@ wait/synch/mutex/sql/MYSQL_RELAY_LOG::LO
 "============ Performance schema on slave ============"
 select * from performance_schema.file_summary_by_instance
 where file_name like "%master-%" order by file_name;
-FILE_NAME	EVENT_NAME	COUNT_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_READ	SUM_NUMBER_OF_BYTES_WRITE
+FILE_NAME	EVENT_NAME	OBJECT_INSTANCE_BEGIN	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT	COUNT_READ	SUM_TIMER_READ	MIN_TIMER_READ	AVG_TIMER_READ	MAX_TIMER_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_TIMER_WRITE	MIN_TIMER_WRITE	AVG_TIMER_WRITE	MAX_TIMER_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	SUM_TIMER_MISC	MIN_TIMER_MISC	AVG_TIMER_MISC	MAX_TIMER_MISC
 select
 substring(file_name, locate("slave-", file_name)) as FILE_NAME,
 EVENT_NAME,

=== modified file 'mysql-test/suite/perfschema/r/schema.result'
--- a/mysql-test/suite/perfschema/r/schema.result	2011-08-11 03:11:58 +0000
+++ b/mysql-test/suite/perfschema/r/schema.result	2011-09-02 20:03:36 +0000
@@ -579,20 +579,57 @@ show create table file_summary_by_event_
 Table	Create Table
 file_summary_by_event_name	CREATE TABLE `file_summary_by_event_name` (
   `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL,
   `COUNT_READ` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_READ` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_READ` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_READ` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_READ` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
   `COUNT_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_READ` bigint(20) NOT NULL,
-  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) NOT NULL
+  `SUM_TIMER_WRITE` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WRITE` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WRITE` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL,
+  `COUNT_MISC` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_MISC` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_MISC` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_MISC` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_MISC` bigint(20) unsigned NOT NULL
 ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
 show create table file_summary_by_instance;
 Table	Create Table
 file_summary_by_instance	CREATE TABLE `file_summary_by_instance` (
   `FILE_NAME` varchar(512) NOT NULL,
   `EVENT_NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) unsigned NOT NULL,
+  `COUNT_STAR` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WAIT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WAIT` bigint(20) unsigned NOT NULL,
   `COUNT_READ` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_READ` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_READ` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_READ` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_READ` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
   `COUNT_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_READ` bigint(20) NOT NULL,
-  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) NOT NULL
+  `SUM_TIMER_WRITE` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WRITE` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WRITE` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL,
+  `COUNT_MISC` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_MISC` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_MISC` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_MISC` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_MISC` bigint(20) unsigned NOT NULL
 ) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
 show create table hosts;
 Table	Create Table

=== modified file 'mysql-test/suite/perfschema/r/start_server_nothing.result'
--- a/mysql-test/suite/perfschema/r/start_server_nothing.result	2011-08-11 03:11:58 +0000
+++ b/mysql-test/suite/perfschema/r/start_server_nothing.result	2011-09-02 20:03:36 +0000
@@ -220,9 +220,9 @@ idle	0	0	0	0	0
 select * from performance_schema.file_instances;
 FILE_NAME	EVENT_NAME	OPEN_COUNT
 select * from performance_schema.file_summary_by_event_name;
-EVENT_NAME	COUNT_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_READ	SUM_NUMBER_OF_BYTES_WRITE
+EVENT_NAME	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT	COUNT_READ	SUM_TIMER_READ	MIN_TIMER_READ	AVG_TIMER_READ	MAX_TIMER_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_TIMER_WRITE	MIN_TIMER_WRITE	AVG_TIMER_WRITE	MAX_TIMER_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	SUM_TIMER_MISC	MIN_TIMER_MISC	AVG_TIMER_MISC	MAX_TIMER_MISC
 select * from performance_schema.file_summary_by_instance;
-FILE_NAME	EVENT_NAME	COUNT_READ	COUNT_WRITE	SUM_NUMBER_OF_BYTES_READ	SUM_NUMBER_OF_BYTES_WRITE
+FILE_NAME	EVENT_NAME	OBJECT_INSTANCE_BEGIN	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT	COUNT_READ	SUM_TIMER_READ	MIN_TIMER_READ	AVG_TIMER_READ	MAX_TIMER_READ	SUM_NUMBER_OF_BYTES_READ	COUNT_WRITE	SUM_TIMER_WRITE	MIN_TIMER_WRITE	AVG_TIMER_WRITE	MAX_TIMER_WRITE	SUM_NUMBER_OF_BYTES_WRITE	COUNT_MISC	SUM_TIMER_MISC	MIN_TIMER_MISC	AVG_TIMER_MISC	MAX_TIMER_MISC
 select * from performance_schema.socket_instances;
 EVENT_NAME	OBJECT_INSTANCE_BEGIN	THREAD_ID	SOCKET_ID	IP	PORT	STATE
 select * from performance_schema.socket_summary_by_instance;

=== modified file 'mysql-test/suite/perfschema/r/table_schema.result'
--- a/mysql-test/suite/perfschema/r/table_schema.result	2011-08-11 03:11:58 +0000
+++ b/mysql-test/suite/perfschema/r/table_schema.result	2011-09-02 20:03:36 +0000
@@ -410,16 +410,53 @@ def	performance_schema	file_instances	FI
 def	performance_schema	file_instances	EVENT_NAME	2	NULL	NO	varchar	128	384	NULL	NULL	utf8	utf8_general_ci	varchar(128)			select,insert,update,references	
 def	performance_schema	file_instances	OPEN_COUNT	3	NULL	NO	int	NULL	NULL	10	0	NULL	NULL	int(10) unsigned			select,insert,update,references	
 def	performance_schema	file_summary_by_event_name	EVENT_NAME	1	NULL	NO	varchar	128	384	NULL	NULL	utf8	utf8_general_ci	varchar(128)			select,insert,update,references	
-def	performance_schema	file_summary_by_event_name	COUNT_READ	2	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
-def	performance_schema	file_summary_by_event_name	COUNT_WRITE	3	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
-def	performance_schema	file_summary_by_event_name	SUM_NUMBER_OF_BYTES_READ	4	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
-def	performance_schema	file_summary_by_event_name	SUM_NUMBER_OF_BYTES_WRITE	5	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	COUNT_STAR	2	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	SUM_TIMER_WAIT	3	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	MIN_TIMER_WAIT	4	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	AVG_TIMER_WAIT	5	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	MAX_TIMER_WAIT	6	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	COUNT_READ	7	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	SUM_TIMER_READ	8	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	MIN_TIMER_READ	9	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	AVG_TIMER_READ	10	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	MAX_TIMER_READ	11	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	SUM_NUMBER_OF_BYTES_READ	12	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	COUNT_WRITE	13	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	SUM_TIMER_WRITE	14	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	MIN_TIMER_WRITE	15	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	AVG_TIMER_WRITE	16	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	MAX_TIMER_WRITE	17	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	SUM_NUMBER_OF_BYTES_WRITE	18	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	COUNT_MISC	19	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	SUM_TIMER_MISC	20	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	MIN_TIMER_MISC	21	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	AVG_TIMER_MISC	22	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_event_name	MAX_TIMER_MISC	23	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
 def	performance_schema	file_summary_by_instance	FILE_NAME	1	NULL	NO	varchar	512	1536	NULL	NULL	utf8	utf8_general_ci	varchar(512)			select,insert,update,references	
 def	performance_schema	file_summary_by_instance	EVENT_NAME	2	NULL	NO	varchar	128	384	NULL	NULL	utf8	utf8_general_ci	varchar(128)			select,insert,update,references	
-def	performance_schema	file_summary_by_instance	COUNT_READ	3	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
-def	performance_schema	file_summary_by_instance	COUNT_WRITE	4	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
-def	performance_schema	file_summary_by_instance	SUM_NUMBER_OF_BYTES_READ	5	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
-def	performance_schema	file_summary_by_instance	SUM_NUMBER_OF_BYTES_WRITE	6	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	OBJECT_INSTANCE_BEGIN	3	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	COUNT_STAR	4	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	SUM_TIMER_WAIT	5	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	MIN_TIMER_WAIT	6	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	AVG_TIMER_WAIT	7	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	MAX_TIMER_WAIT	8	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	COUNT_READ	9	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	SUM_TIMER_READ	10	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	MIN_TIMER_READ	11	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	AVG_TIMER_READ	12	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	MAX_TIMER_READ	13	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	SUM_NUMBER_OF_BYTES_READ	14	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	COUNT_WRITE	15	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	SUM_TIMER_WRITE	16	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	MIN_TIMER_WRITE	17	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	AVG_TIMER_WRITE	18	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	MAX_TIMER_WRITE	19	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	SUM_NUMBER_OF_BYTES_WRITE	20	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	COUNT_MISC	21	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	SUM_TIMER_MISC	22	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	MIN_TIMER_MISC	23	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	AVG_TIMER_MISC	24	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
+def	performance_schema	file_summary_by_instance	MAX_TIMER_MISC	25	NULL	NO	bigint	NULL	NULL	20	0	NULL	NULL	bigint(20) unsigned			select,insert,update,references	
 def	performance_schema	hosts	HOST	1	NULL	YES	char	60	180	NULL	NULL	utf8	utf8_bin	char(60)			select,insert,update,references	
 def	performance_schema	hosts	CURRENT_CONNECTIONS	2	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	
 def	performance_schema	hosts	TOTAL_CONNECTIONS	3	NULL	NO	bigint	NULL	NULL	19	0	NULL	NULL	bigint(20)			select,insert,update,references	

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

=== added file 'mysql-test/suite/sys_vars/t/plugin_dir_basic-master.opt'
--- a/mysql-test/suite/sys_vars/t/plugin_dir_basic-master.opt	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/sys_vars/t/plugin_dir_basic-master.opt	2011-08-16 09:08:10 +0000
@@ -0,0 +1 @@
+--plugin-dir=$MYSQL_TMP_DIR

=== modified file 'mysql-test/suite/sys_vars/t/plugin_dir_basic.test'
--- a/mysql-test/suite/sys_vars/t/plugin_dir_basic.test	2009-12-22 09:35:56 +0000
+++ b/mysql-test/suite/sys_vars/t/plugin_dir_basic.test	2011-08-16 09:08:10 +0000
@@ -3,20 +3,20 @@
 #
 
 #
-# on windows it's <basedir>/lib/plugin
-# on unix it's <basedir>/lib/mysql/plugin
+# Don't rely on being able to guess the correct default.
+# -master.opt file for this test sets plugin_dir to a known directory
 #
---replace_result $MYSQL_LIBDIR MYSQL_LIBDIR /mysql/ /
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR /mysql/ /
 select @@global.plugin_dir;
 --error ER_INCORRECT_GLOBAL_LOCAL_VAR
 select @@session.plugin_dir;
---replace_result $MYSQL_LIBDIR MYSQL_LIBDIR /mysql/ /
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR /mysql/ /
 show global variables like 'plugin_dir';
---replace_result $MYSQL_LIBDIR MYSQL_LIBDIR /mysql/ /
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR /mysql/ /
 show session variables like 'plugin_dir';
---replace_result $MYSQL_LIBDIR MYSQL_LIBDIR /mysql/ /
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR /mysql/ /
 select * from information_schema.global_variables where variable_name='plugin_dir';
---replace_result $MYSQL_LIBDIR MYSQL_LIBDIR /mysql/ /
+--replace_result $MYSQL_TMP_DIR MYSQL_TMP_DIR /mysql/ /
 select * from information_schema.session_variables where variable_name='plugin_dir';
 
 #

=== modified file 'mysql-test/t/alter_table.test'
--- a/mysql-test/t/alter_table.test	2011-07-07 10:25:51 +0000
+++ b/mysql-test/t/alter_table.test	2011-08-30 04:28:18 +0000
@@ -1244,3 +1244,14 @@ ALTER TABLE t1 FORCE;
 --disable_info
 
 DROP TABLE t1;
+
+--echo # Bug#11748057 (formerly known as 34972): ALTER TABLE statement doesn't
+--echo #                                         identify correct column name.
+--echo #
+
+CREATE TABLE t1 (c1 int unsigned , c2 char(100) not null default '');
+ALTER TABLE t1 ADD c3 char(16) NOT NULL DEFAULT '' AFTER c2,
+               MODIFY c2 char(100) NOT NULL DEFAULT '' AFTER c1;
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+

=== modified file 'mysql-test/t/execution_constants.test'
--- a/mysql-test/t/execution_constants.test	2010-11-17 10:16:13 +0000
+++ b/mysql-test/t/execution_constants.test	2011-08-22 11:58:49 +0000
@@ -38,7 +38,7 @@ while ($i)
 {
   # If we SEGV because the min stack size is exceeded, this would return error
   # 2013 .
-  error 0,1436 //
+  error 0,ER_STACK_OVERRUN_NEED_MORE //
   eval $query_head 0 $query_tail//
 
   if ($mysql_errno)
@@ -48,10 +48,10 @@ while ($i)
     # limit, we still have enough space reserved to report an error.
     let $i = 1//
 
-    # Check that mysql_errno is 1436
-    if ($mysql_errno != 1436)
+    # Check that mysql_errname is ER_STACK_OVERRUN_NEED_MORE
+    if ($mysql_errname != ER_STACK_OVERRUN_NEED_MORE)
     {
-      die Wrong error triggered, expected 1436 but got $mysql_errno//
+      die Wrong error triggered, expected ER_STACK_OVERRUN_NEED_MORE but got $mysql_errname//
     }
 
   }
@@ -76,7 +76,7 @@ while ($i)
 enable_result_log//
 enable_query_log//
 
-echo Assertion: mysql_errno 1436 == $mysql_errno//
+echo Assertion: mysql_errname ER_STACK_OVERRUN_NEED_MORE == $mysql_errname//
 
 delimiter ;//
 DROP TABLE `t_bug21476`;

=== modified file 'mysql-test/t/group_by.test'
--- a/mysql-test/t/group_by.test	2011-08-15 09:13:05 +0000
+++ b/mysql-test/t/group_by.test	2011-08-30 09:01:05 +0000
@@ -1285,6 +1285,20 @@ FROM t1 GROUP BY a;
 
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#11765254 (58200): Assertion failed: param.sort_length when grouping
+--echo # by functions
+--echo #
+
+SET BIG_TABLES=1;
+CREATE TABLE t1(a INT);
+INSERT INTO t1 VALUES (0),(0);
+SELECT 1 FROM t1 GROUP BY IF(`a`,'','');
+SELECT 1 FROM t1 GROUP BY TRIM(LEADING RAND() FROM '');
+SELECT 1 FROM t1 GROUP BY SUBSTRING('',SLEEP(0),'');
+SELECT 1 FROM t1 GROUP BY SUBSTRING(SYSDATE() FROM 'K' FOR 'jxW<');
+DROP TABLE t1;
+SET BIG_TABLES=0;
 
 --echo # End of 5.1 tests
 

=== modified file 'mysql-test/t/mysqltest.test'
--- a/mysql-test/t/mysqltest.test	2011-03-07 15:17:39 +0000
+++ b/mysql-test/t/mysqltest.test	2011-08-22 13:24:38 +0000
@@ -1,3 +1,14 @@
+# ----------------------------------------------------------------------------
+# $mysql_errno contains the return code of the last command
+# sent to the server.
+# ----------------------------------------------------------------------------
+# get $mysql_errno before the first statement
+#     $mysql_errno should be -1
+# get $mysql_errname as well
+
+echo $mysql_errno before test;
+echo $mysql_errname before test;
+
 -- source include/have_log_bin.inc
 
 # This test should work in embedded server after mysqltest is fixed
@@ -34,15 +45,6 @@
 # ============================================================================
 
 # ----------------------------------------------------------------------------
-# $mysql_errno contains the return code of the last command
-# sent to the server.
-# ----------------------------------------------------------------------------
-# get $mysql_errno before the first statement
-#     $mysql_errno should be -1
-eval select $mysql_errno as "before_use_test" ;
-
-
-# ----------------------------------------------------------------------------
 # Positive case(statement)
 # ----------------------------------------------------------------------------
 
@@ -134,6 +136,7 @@ select friedrich from (select 1 as otto)
 # check mysql_errno = 0 after successful statement
 # ----------------------------------------------------------------------------
 select otto from (select 1 as otto) as t1;
+echo $mysql_errname;
 eval select $mysql_errno as "after_successful_stmt_errno" ;
 
 #----------------------------------------------------------------------------
@@ -142,6 +145,7 @@ eval select $mysql_errno as "after_succe
 --error ER_PARSE_ERROR
 
 garbage ;
+echo $mysql_errname;
 eval select $mysql_errno as "after_wrong_syntax_errno" ;
 
 # ----------------------------------------------------------------------------
@@ -151,6 +155,7 @@ eval select $mysql_errno as "after_wrong
 
 garbage ;
 let $my_var= 'abc' ;
+echo $mysql_errname;
 eval select $mysql_errno as "after_let_var_equal_value" ;
 
 # ----------------------------------------------------------------------------
@@ -160,6 +165,7 @@ eval select $mysql_errno as "after_let_v
 
 garbage ;
 set @my_var= 'abc' ;
+echo $mysql_errname;
 eval select $mysql_errno as "after_set_var_equal_value" ;
 
 # ----------------------------------------------------------------------------
@@ -170,6 +176,7 @@ eval select $mysql_errno as "after_set_v
 
 garbage ;
 --disable_warnings
+echo $mysql_errname;
 eval select $mysql_errno as "after_disable_warnings_command" ;
 
 # ----------------------------------------------------------------------------
@@ -182,6 +189,7 @@ drop table if exists t1 ;
 
 garbage ;
 drop table if exists t1 ;
+echo $mysql_errname;
 eval select $mysql_errno as "after_disable_warnings" ;
 --enable_warnings
 
@@ -194,6 +202,7 @@ garbage ;
 --error ER_NO_SUCH_TABLE
 
 select 3 from t1 ;
+echo $mysql_errname;
 eval select $mysql_errno as "after_minus_masked" ;
 --error ER_PARSE_ERROR
 
@@ -201,6 +210,7 @@ garbage ;
 --error ER_NO_SUCH_TABLE
 
 select 3 from t1 ;
+echo $mysql_errname;
 eval select $mysql_errno as "after_!_masked" ;
 
 # ----------------------------------------------------------------------------
@@ -222,6 +232,7 @@ garbage ;
 --error ER_NO_SUCH_TABLE
 
 prepare stmt from "select 3 from t1" ;
+echo $mysql_errname;
 eval select $mysql_errno as "after_failing_prepare" ;
 create table t1 ( f1 char(10));
 
@@ -230,6 +241,7 @@ create table t1 ( f1 char(10));
 
 garbage ;
 prepare stmt from "select 3 from t1" ;
+echo $mysql_errname;
 eval select $mysql_errno as "after_successful_prepare" ;
 
 # successful execute
@@ -237,6 +249,7 @@ eval select $mysql_errno as "after_succe
 
 garbage ;
 execute stmt;
+echo $mysql_errname;
 eval select $mysql_errno as "after_successful_execute" ;
 
 # failing execute (table has been dropped)
@@ -247,6 +260,7 @@ garbage ;
 --error ER_NO_SUCH_TABLE
 
 execute stmt;
+echo $mysql_errname;
 eval select $mysql_errno as "after_failing_execute" ;
 
 # failing execute (unknown statement)
@@ -256,6 +270,7 @@ garbage ;
 --error ER_UNKNOWN_STMT_HANDLER
 
 execute __stmt_;
+echo $mysql_errname;
 eval select $mysql_errno as "after_failing_execute" ;
 
 # successful deallocate
@@ -263,6 +278,7 @@ eval select $mysql_errno as "after_faili
 
 garbage ;
 deallocate prepare stmt;
+echo $mysql_errname;
 eval select $mysql_errno as "after_successful_deallocate" ;
 
 # failing deallocate ( statement handle does not exist )
@@ -272,6 +288,7 @@ garbage ;
 --error ER_UNKNOWN_STMT_HANDLER
 
 deallocate prepare __stmt_;
+echo $mysql_errname;
 eval select $mysql_errno as "after_failing_deallocate" ;
 
 
@@ -299,6 +316,7 @@ eval select $mysql_errno as "after_faili
 
 garbage ;
 --disable_abort_on_error
+echo $mysql_errname;
 eval select $mysql_errno as "after_--disable_abort_on_error" ;
 
 # ----------------------------------------------------------------------------
@@ -316,6 +334,7 @@ select 3 from t1 ;
 --error ER_NO_SUCH_TABLE
 
 select 3 from t1 ;
+echo $mysql_errname;
 eval select $mysql_errno as "after_!errno_masked_error" ;
 # expected error <> response
 # --error 1000
@@ -341,6 +360,7 @@ EOF
 
 garbage ;
 --enable_abort_on_error
+echo $mysql_errname;
 eval select $mysql_errno as "after_--enable_abort_on_error" ;
 
 # ----------------------------------------------------------------------------

=== modified file 'mysql-test/valgrind.supp'
--- a/mysql-test/valgrind.supp	2011-08-29 08:42:45 +0000
+++ b/mysql-test/valgrind.supp	2011-08-31 14:53:56 +0000
@@ -958,6 +958,9 @@
    fun:buf_buddy_free
 }
 
+# Note the wildcard in the (mangled) function signatures of
+# write_keys() and find_all_keys().
+# They both return ha_rows, which is platform dependent.
 {
    Bug#12856915 VALGRIND FAILURE IN FILESORT/CREATE_SORT_INDEX / one
    Memcheck:Param
@@ -967,21 +970,22 @@
    fun:inline_mysql_file_write
    fun:my_b_flush_io_cache
    fun:_my_b_write
-   fun:_ZL10write_keysP10Sort_paramPPhjP11st_io_cacheS4_
-   fun:_ZL13find_all_keysP10Sort_paramP10SQL_SELECTPPhP11st_io_cacheS6_P13Bounded_queueIhhEPy
+   fun:_Z*10write_keysP10Sort_paramPPhjP11st_io_cacheS4_
+   fun:_Z*13find_all_keysP10Sort_paramP10SQL_SELECTPPhP11st_io_cacheS6_P13Bounded_queueIhhEPy
    fun:_Z8filesortP3THDP5TABLEP13st_sort_fieldjP10SQL_SELECTybPyS7_
 }
 
-## {
-##    Bug#12856915 VALGRIND FAILURE IN FILESORT/CREATE_SORT_INDEX / two
-##    Memcheck:Param
-##    write(buf)
-##    obj:*/libpthread*.so
-##    fun:my_write
-##    fun:my_b_flush_io_cache
-##    fun:_Z15merge_many_buffP13st_sort_paramPhP10st_buffpekPjP11st_io_cache
-##    fun:_Z8filesortP3THDP8st_tableP13st_sort_fieldjP10SQL_SELECTybPy
-## }
+{
+   Bug#12856915 VALGRIND FAILURE IN FILESORT/CREATE_SORT_INDEX / two
+   Memcheck:Param
+   write(buf)
+   obj:*/libpthread*.so
+   fun:my_write
+   fun:inline_mysql_file_write
+   fun:my_b_flush_io_cache
+   fun:_Z15merge_many_buffP13st_sort_paramPhP10st_buffpekPjP11st_io_cache
+   fun:_Z8filesortP3THDP5TABLEP13st_sort_fieldjP10SQL_SELECTybPyS7_
+}
 
 ## {
 ##    Bug#12856915 VALGRIND FAILURE IN FILESORT/CREATE_SORT_INDEX / three

=== modified file 'scripts/mysql_system_tables.sql'
--- a/scripts/mysql_system_tables.sql	2011-08-20 00:25:14 +0000
+++ b/scripts/mysql_system_tables.sql	2011-09-02 20:03:36 +0000
@@ -107,31 +107,31 @@ CREATE TABLE IF NOT EXISTS slave_master_
 CREATE TABLE IF NOT EXISTS slave_worker_info (Master_id INTEGER UNSIGNED NOT NULL, Worker_id INTEGER UNSIGNED NOT NULL, Relay_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, Relay_log_pos BIGINT UNSIGNED NOT NULL, Master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, Master_log_pos BIGINT UNSIGNED NOT NULL, Checkpoint_relay_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, Checkpoint_relay_log_pos BIGINT UNSIGNED NOT NULL, Checkpoint_master_log_name TEXT CHARACTER SET utf8 COLLATE utf8_bin NOT NULL, Checkpoint_master_log_pos BIGINT UNSIGNED NOT NULL, Checkpoint_seqno INT UNSIGNED NOT NULL, Checkpoint_group_size INTEGER UNSIGNED NOT NULL, Checkpoint_group_bitmap BLOB NOT NULL, PRIMARY KEY(Master_id, Worker_id)) ENGINE=MYISAM DEFAULT CHARSET=utf8 COMMENT 'Worker Information';
 
 CREATE TABLE IF NOT EXISTS innodb_table_stats (
-	database_name			VARCHAR(64) NOT NULL,
-	table_name			VARCHAR(64) NOT NULL,
-	stats_timestamp			TIMESTAMP NOT NULL,
-	n_rows				BIGINT UNSIGNED NOT NULL,
-	clustered_index_size		BIGINT UNSIGNED NOT NULL,
-	sum_of_other_index_sizes	BIGINT UNSIGNED NOT NULL,
-	PRIMARY KEY (database_name, table_name)
+   database_name        VARCHAR(64) NOT NULL,
+   table_name        VARCHAR(64) NOT NULL,
+   stats_timestamp         TIMESTAMP NOT NULL,
+   n_rows            BIGINT UNSIGNED NOT NULL,
+   clustered_index_size    BIGINT UNSIGNED NOT NULL,
+   sum_of_other_index_sizes   BIGINT UNSIGNED NOT NULL,
+   PRIMARY KEY (database_name, table_name)
 ) ENGINE=INNODB DEFAULT CHARSET=utf8;
 
 CREATE TABLE IF NOT EXISTS innodb_index_stats (
-	database_name			VARCHAR(64) NOT NULL,
-	table_name			VARCHAR(64) NOT NULL,
-	index_name			VARCHAR(64) NOT NULL,
-	stat_timestamp			TIMESTAMP NOT NULL,
-	/* there are at least:
-	stat_name='size'
-	stat_name='n_leaf_pages'
-	stat_name='n_diff_pfx%' */
-	stat_name			VARCHAR(64) NOT NULL,
-	stat_value			BIGINT UNSIGNED NOT NULL,
-	sample_size			BIGINT UNSIGNED,
-	stat_description		VARCHAR(1024) NOT NULL,
-	PRIMARY KEY (database_name, table_name, index_name, stat_name),
-	FOREIGN KEY (database_name, table_name)
-	  REFERENCES innodb_table_stats (database_name, table_name)
+   database_name        VARCHAR(64) NOT NULL,
+   table_name        VARCHAR(64) NOT NULL,
+   index_name        VARCHAR(64) NOT NULL,
+   stat_timestamp       TIMESTAMP NOT NULL,
+   /* there are at least:
+   stat_name='size'
+   stat_name='n_leaf_pages'
+   stat_name='n_diff_pfx%' */
+   stat_name         VARCHAR(64) NOT NULL,
+   stat_value        BIGINT UNSIGNED NOT NULL,
+   sample_size       BIGINT UNSIGNED,
+   stat_description     VARCHAR(1024) NOT NULL,
+   PRIMARY KEY (database_name, table_name, index_name, stat_name),
+   FOREIGN KEY (database_name, table_name)
+     REFERENCES innodb_table_stats (database_name, table_name)
 ) ENGINE=INNODB DEFAULT CHARSET=utf8;
 
 --
@@ -438,10 +438,28 @@ DROP PREPARE stmt;
 
 SET @cmd="CREATE TABLE performance_schema.file_summary_by_event_name("
   "EVENT_NAME VARCHAR(128) not null,"
+  "COUNT_STAR BIGINT unsigned not null,"
+  "SUM_TIMER_WAIT BIGINT unsigned not null,"
+  "MIN_TIMER_WAIT BIGINT unsigned not null,"
+  "AVG_TIMER_WAIT BIGINT unsigned not null,"
+  "MAX_TIMER_WAIT BIGINT unsigned not null,"
   "COUNT_READ BIGINT unsigned not null,"
+  "SUM_TIMER_READ BIGINT unsigned not null,"
+  "MIN_TIMER_READ BIGINT unsigned not null,"
+  "AVG_TIMER_READ BIGINT unsigned not null,"
+  "MAX_TIMER_READ BIGINT unsigned not null,"
+  "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"
   "COUNT_WRITE BIGINT unsigned not null,"
-  "SUM_NUMBER_OF_BYTES_READ BIGINT not null,"
-  "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null"
+  "SUM_TIMER_WRITE BIGINT unsigned not null,"
+  "MIN_TIMER_WRITE BIGINT unsigned not null,"
+  "AVG_TIMER_WRITE BIGINT unsigned not null,"
+  "MAX_TIMER_WRITE BIGINT unsigned not null,"
+  "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null,"
+  "COUNT_MISC BIGINT unsigned not null,"
+  "SUM_TIMER_MISC BIGINT unsigned not null,"
+  "MIN_TIMER_MISC BIGINT unsigned not null,"
+  "AVG_TIMER_MISC BIGINT unsigned not null,"
+  "MAX_TIMER_MISC BIGINT unsigned not null"
   ")ENGINE=PERFORMANCE_SCHEMA;";
 
 SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
@@ -456,10 +474,29 @@ DROP PREPARE stmt;
 SET @cmd="CREATE TABLE performance_schema.file_summary_by_instance("
   "FILE_NAME VARCHAR(512) not null,"
   "EVENT_NAME VARCHAR(128) not null,"
+  "OBJECT_INSTANCE_BEGIN BIGINT unsigned not null,"
+  "COUNT_STAR BIGINT unsigned not null,"
+  "SUM_TIMER_WAIT BIGINT unsigned not null,"
+  "MIN_TIMER_WAIT BIGINT unsigned not null,"
+  "AVG_TIMER_WAIT BIGINT unsigned not null,"
+  "MAX_TIMER_WAIT BIGINT unsigned not null,"
   "COUNT_READ BIGINT unsigned not null,"
+  "SUM_TIMER_READ BIGINT unsigned not null,"
+  "MIN_TIMER_READ BIGINT unsigned not null,"
+  "AVG_TIMER_READ BIGINT unsigned not null,"
+  "MAX_TIMER_READ BIGINT unsigned not null,"
+  "SUM_NUMBER_OF_BYTES_READ BIGINT unsigned not null,"
   "COUNT_WRITE BIGINT unsigned not null,"
-  "SUM_NUMBER_OF_BYTES_READ BIGINT not null,"
-  "SUM_NUMBER_OF_BYTES_WRITE BIGINT not null"
+  "SUM_TIMER_WRITE BIGINT unsigned not null,"
+  "MIN_TIMER_WRITE BIGINT unsigned not null,"
+  "AVG_TIMER_WRITE BIGINT unsigned not null,"
+  "MAX_TIMER_WRITE BIGINT unsigned not null,"
+  "SUM_NUMBER_OF_BYTES_WRITE BIGINT unsigned not null,"
+  "COUNT_MISC BIGINT unsigned not null,"
+  "SUM_TIMER_MISC BIGINT unsigned not null,"
+  "MIN_TIMER_MISC BIGINT unsigned not null,"
+  "AVG_TIMER_MISC BIGINT unsigned not null,"
+  "MAX_TIMER_MISC BIGINT unsigned not null"
   ")ENGINE=PERFORMANCE_SCHEMA;";
 
 SET @str = IF(@have_pfs = 1, @cmd, 'SET @dummy = 0');
@@ -467,6 +504,7 @@ PREPARE stmt FROM @str;
 EXECUTE stmt;
 DROP PREPARE stmt;
 
+
 --
 -- TABLE SOCKET_INSTANCES
 --

=== modified file 'sql/CMakeLists.txt'
--- a/sql/CMakeLists.txt	2011-08-22 10:28:31 +0000
+++ b/sql/CMakeLists.txt	2011-08-22 12:48:51 +0000
@@ -221,6 +221,13 @@ ENDIF()
 
 MYSQL_ADD_EXECUTABLE(mysqld ${MYSQLD_SOURCE} DESTINATION ${INSTALL_SBINDIR} COMPONENT Server)
 
+OPTION(DEBUG_EXTNAME "Build server as mysqld-debug (debug builds only)" OFF)
+MARK_AS_ADVANCED(DEBUG_EXTNAME)
+
+IF(DEBUG_EXTNAME)
+  SET_TARGET_PROPERTIES(mysqld PROPERTIES DEBUG_OUTPUT_NAME "mysqld-debug")
+ENDIF()
+
 IF(APPLE) 
   # Add CoreServices framework since some dloadable plugins may need it 
   FIND_LIBRARY(CORESERVICES NAMES CoreServices) 
@@ -286,10 +293,17 @@ IF(WITH_MYSQLD_LDFLAGS)
   SET_TARGET_PROPERTIES(mysqld PROPERTIES LINK_FLAGS 
      "${MYSQLD_LINK_FLAGS} ${WITH_MYSQLD_LDFLAGS}")
 ENDIF()
-INSTALL_DEBUG_TARGET(mysqld 
-  DESTINATION ${INSTALL_SBINDIR} 
-  PDB_DESTINATION ${INSTALL_SBINDIR}/debug
-  RENAME mysqld-debug)
+IF(DEBUG_EXTNAME)
+  INSTALL_DEBUG_TARGET(mysqld 
+    DESTINATION ${INSTALL_SBINDIR} 
+    PDB_DESTINATION ${INSTALL_SBINDIR}
+    SUFFIX "-debug")
+ELSE()
+  INSTALL_DEBUG_TARGET(mysqld 
+    DESTINATION ${INSTALL_SBINDIR} 
+    PDB_DESTINATION ${INSTALL_SBINDIR}/debug
+    RENAME mysqld-debug)
+ENDIF()
 
 # Handle out-of-source build from source package with possibly broken 
 # bison. Copy bison output to from source to build directory, if not already 

=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc	2011-08-29 08:09:57 +0000
+++ b/sql/filesort.cc	2011-08-30 09:01:05 +0000
@@ -189,8 +189,6 @@ ha_rows filesort(THD *thd, TABLE *table,
                           table,
                           thd->variables.max_length_for_sort_data,
                           max_rows, sort_positions);
-  /* filesort cannot handle zero-length records. */
-  DBUG_ASSERT(param.sort_length);
 
   table_sort.addon_buf= 0;
   table_sort.addon_length= param.addon_length;
@@ -284,6 +282,9 @@ ha_rows filesort(THD *thd, TABLE *table,
   }
   else
   {
+    /* filesort cannot handle zero-length records during merge. */
+    DBUG_ASSERT(param.sort_length != 0);
+
     if (table_sort.buffpek && table_sort.buffpek_len < maxbuffer)
     {
       my_free(table_sort.buffpek);

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-08-25 10:54:34 +0000
+++ b/sql/sql_select.cc	2011-08-30 10:04:45 +0000
@@ -3460,29 +3460,30 @@ JOIN::exec()
     }
     {
       if (group)
-	curr_join->m_select_limit= HA_POS_ERROR;
+        curr_join->m_select_limit= HA_POS_ERROR;
       else
       {
-	/*
-	  We can abort sorting after thd->select_limit rows if we there is no
-	  WHERE clause for any tables after the sorted one.
-	*/
-	JOIN_TAB *curr_table= &curr_join->join_tab[curr_join->const_tables+1];
-	JOIN_TAB *end_table= &curr_join->join_tab[curr_join->tables];
-	for (; curr_table < end_table ; curr_table++)
-	{
-	  /*
-	    table->keyuse is set in the case there was an original WHERE clause
-	    on the table that was optimized away.
-	  */
-	  if (curr_table->condition() ||
-	      (curr_table->keyuse && !curr_table->first_inner))
-	  {
-	    /* We have to sort all rows */
-	    curr_join->m_select_limit= HA_POS_ERROR;
-	    break;
-	  }
-	}
+        /*
+          We can abort sorting after thd->select_limit rows if there are no
+          filter conditions for any tables after the sorted one.
+          Filter conditions come in several forms:
+           - as a condition item attached to the join_tab,
+           - as a keyuse attached to the join_tab (ref access),
+           - as a semi-join equality attached to materialization semi-join nest.
+        */
+        JOIN_TAB *curr_table= &curr_join->join_tab[curr_join->const_tables+1];
+        JOIN_TAB *end_table= &curr_join->join_tab[curr_join->tables];
+        for (; curr_table < end_table ; curr_table++)
+        {
+          if (curr_table->condition() ||
+              (curr_table->keyuse && !curr_table->first_inner) ||
+              curr_table->get_sj_strategy() == SJ_OPT_MATERIALIZE_LOOKUP)
+          {
+            /* We have to sort all rows */
+            curr_join->m_select_limit= HA_POS_ERROR;
+            break;
+          }
+        }
       }
       if (curr_join->join_tab == join_tab && save_join_tab())
       {

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2011-08-29 06:53:25 +0000
+++ b/sql/sql_table.cc	2011-08-30 04:28:18 +0000
@@ -5614,10 +5614,22 @@ mysql_prepare_alter_table(THD *thd, TABL
     if (def)
     {						// Field is changed
       def->field=field;
+      /*
+        Add column being updated to the list of new columns.
+        Note that columns with AFTER clauses are added to the end
+        of the list for now. Their positions will be corrected later.
+      */
+      new_create_list.push_back(def);
       if (!def->after)
       {
-	new_create_list.push_back(def);
-	def_it.remove();
+        /*
+          If this ALTER TABLE doesn't have an AFTER clause for the modified
+          column then remove this column from the list of columns to be
+          processed. So later we can iterate over the columns remaining
+          in this list and process modified columns with AFTER clause or
+          add new columns.
+        */
+        def_it.remove();
       }
     }
     else
@@ -5677,25 +5689,43 @@ mysql_prepare_alter_table(THD *thd, TABL
     }
     if (!def->after)
       new_create_list.push_back(def);
-    else if (def->after == first_keyword)
-    {
-      new_create_list.push_front(def);
-    }
     else
     {
       Create_field *find;
-      find_it.rewind();
-      while ((find=find_it++))			// Add new columns
+      if (def->change)
       {
-	if (!my_strcasecmp(system_charset_info,def->after, find->field_name))
-	  break;
+        find_it.rewind();
+        /*
+          For columns being modified with AFTER clause we should first remove
+          these columns from the list and then add them back at their correct
+          positions.
+        */
+        while ((find=find_it++))
+        {
+          if (!my_strcasecmp(system_charset_info, def->field_name, find->field_name))
+          {
+            find_it.remove();
+            break;
+          }
+        }
       }
-      if (!find)
+      if (def->after == first_keyword)
+        new_create_list.push_front(def);
+      else
       {
-	my_error(ER_BAD_FIELD_ERROR, MYF(0), def->after, table->s->table_name.str);
-        goto err;
+        find_it.rewind();
+        while ((find=find_it++))
+        {
+          if (!my_strcasecmp(system_charset_info, def->after, find->field_name))
+            break;
+        }
+        if (!find)
+        {
+          my_error(ER_BAD_FIELD_ERROR, MYF(0), def->after, table->s->table_name.str);
+          goto err;
+        }
+        find_it.after(def);			// Put column after this
       }
-      find_it.after(def);			// Put element after this
     }
   }
   if (alter_info->alter_list.elements)

=== modified file 'storage/perfschema/CMakeLists.txt'
--- a/storage/perfschema/CMakeLists.txt	2011-08-17 21:08:59 +0000
+++ b/storage/perfschema/CMakeLists.txt	2011-09-02 20:03:36 +0000
@@ -76,7 +76,8 @@ table_ews_by_thread_by_event_name.h
 table_ews_by_user_by_event_name.h
 table_ews_global_by_event_name.h
 table_file_instances.h
-table_file_summary.h
+table_file_summary_by_instance.h
+table_file_summary_by_event_name.h
 table_socket_instances.h
 table_socket_summary_by_instance.h
 table_socket_summary_by_event_name.h
@@ -143,7 +144,8 @@ table_ews_by_thread_by_event_name.cc
 table_ews_by_user_by_event_name.cc
 table_ews_global_by_event_name.cc
 table_file_instances.cc
-table_file_summary.cc
+table_file_summary_by_instance.cc
+table_file_summary_by_event_name.cc
 table_socket_instances.cc
 table_socket_summary_by_instance.cc
 table_socket_summary_by_event_name.cc

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	2011-08-25 07:53:21 +0000
+++ b/storage/perfschema/pfs.cc	2011-09-02 20:03:36 +0000
@@ -3889,30 +3889,68 @@ static void start_file_wait_v1(PSI_file_
   @sa PSI_v1::end_file_wait.
 */
 static void end_file_wait_v1(PSI_file_locker *locker,
-                             size_t count)
+                             size_t byte_count)
 {
   PSI_file_locker_state *state= reinterpret_cast<PSI_file_locker_state*> (locker);
   DBUG_ASSERT(state != NULL);
-  ulonglong timer_end= 0;
-  ulonglong wait_time= 0;
-
   PFS_file *file= reinterpret_cast<PFS_file *> (state->m_file);
   DBUG_ASSERT(file != NULL);
   PFS_thread *thread= reinterpret_cast<PFS_thread *> (state->m_thread);
 
+  ulonglong timer_end= 0;
+  ulonglong wait_time= 0;
+  PFS_byte_stat *byte_stat;
   register uint flags= state->m_flags;
+  size_t bytes= ((int)byte_count > -1 ? byte_count : 0);
+
+  switch (state->m_operation)
+  {
+    /* Group read operations */
+    case PSI_FILE_READ:
+      byte_stat= &file->m_file_stat.m_io_stat.m_read;
+      break;
+    /* Group write operations */
+    case PSI_FILE_WRITE:
+      byte_stat= &file->m_file_stat.m_io_stat.m_write;
+      break;
+    /* Group remaining operations as miscellaneous */
+    case PSI_FILE_CREATE:
+    case PSI_FILE_CREATE_TMP:
+    case PSI_FILE_OPEN:
+    case PSI_FILE_STREAM_OPEN:
+    case PSI_FILE_STREAM_CLOSE:
+    case PSI_FILE_SEEK:
+    case PSI_FILE_TELL:
+    case PSI_FILE_FLUSH:
+    case PSI_FILE_FSTAT:
+    case PSI_FILE_CHSIZE:
+    case PSI_FILE_DELETE:
+    case PSI_FILE_RENAME:
+    case PSI_FILE_SYNC:
+    case PSI_FILE_STAT:
+      byte_stat= &file->m_file_stat.m_io_stat.m_misc;
+      break;
+    case PSI_FILE_CLOSE:
+      byte_stat= &file->m_file_stat.m_io_stat.m_misc;
+      break;
+    default:
+      DBUG_ASSERT(false);
+      byte_stat= NULL;
+      break;
+  }
 
+  /* Aggregation for EVENTS_WAITS_SUMMARY_BY_INSTANCE */
   if (flags & STATE_FLAG_TIMED)
   {
     timer_end= state->m_timer();
     wait_time= timer_end - state->m_timer_start;
     /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (timed) */
-    file->m_wait_stat.aggregate_value(wait_time);
+    byte_stat->aggregate(wait_time, bytes);
   }
   else
   {
     /* Aggregate to EVENTS_WAITS_SUMMARY_BY_INSTANCE (counted) */
-    file->m_wait_stat.aggregate_counted();
+    byte_stat->aggregate_counted(bytes);
   }
 
   if (flags & STATE_FLAG_THREAD)
@@ -3940,7 +3978,7 @@ static void end_file_wait_v1(PSI_file_lo
       DBUG_ASSERT(wait != NULL);
 
       wait->m_timer_end= timer_end;
-      wait->m_number_of_bytes= count;
+      wait->m_number_of_bytes= bytes;
       if (flag_events_waits_history)
         insert_events_waits_history(thread, wait);
       if (flag_events_waits_history_long)
@@ -3949,15 +3987,9 @@ static void end_file_wait_v1(PSI_file_lo
     }
   }
 
-  /* FIXME: Have file aggregates for every operation */
+  /* Release or destroy the file if necessary */
   switch(state->m_operation)
   {
-  case PSI_FILE_READ:
-    file->m_file_stat.m_io_stat.aggregate_read(count);
-    break;
-  case PSI_FILE_WRITE:
-    file->m_file_stat.m_io_stat.aggregate_write(count);
-    break;
   case PSI_FILE_CLOSE:
   case PSI_FILE_STREAM_CLOSE:
   case PSI_FILE_STAT:

=== modified file 'storage/perfschema/pfs_engine_table.cc'
--- a/storage/perfschema/pfs_engine_table.cc	2011-08-11 03:11:58 +0000
+++ b/storage/perfschema/pfs_engine_table.cc	2011-09-02 20:03:36 +0000
@@ -35,7 +35,8 @@
 #include "table_os_global_by_type.h"
 #include "table_sync_instances.h"
 #include "table_file_instances.h"
-#include "table_file_summary.h"
+#include "table_file_summary_by_instance.h"
+#include "table_file_summary_by_event_name.h"
 #include "table_threads.h"
 
 #include "table_ews_by_host_by_event_name.h"

=== modified file 'storage/perfschema/pfs_instr.cc'
--- a/storage/perfschema/pfs_instr.cc	2011-08-25 07:53:21 +0000
+++ b/storage/perfschema/pfs_instr.cc	2011-09-02 20:03:36 +0000
@@ -1188,6 +1188,7 @@ search:
         pfs->m_wait_stat.reset();
         pfs->m_file_stat.m_open_count= 1;
         pfs->m_file_stat.m_io_stat.reset();
+        pfs->m_identity= (const void *)pfs;
 
         int res;
         res= lf_hash_insert(&filename_hash, thread->m_filename_hash_pins,
@@ -1552,7 +1553,7 @@ static void reset_file_waits_by_instance
   PFS_file *pfs_last= file_array + file_max;
 
   for ( ; pfs < pfs_last; pfs++)
-    pfs->m_wait_stat.reset();
+    pfs->m_file_stat.reset();
 }
 
 static void reset_socket_waits_by_instance(void)

=== modified file 'storage/perfschema/pfs_instr.h'
--- a/storage/perfschema/pfs_instr.h	2011-08-18 12:27:21 +0000
+++ b/storage/perfschema/pfs_instr.h	2011-09-02 20:03:36 +0000
@@ -144,6 +144,8 @@ struct PFS_file : public PFS_instr
   uint32 get_version()
   { return m_lock.get_version(); }
 
+  /** File identity */
+  const void *m_identity;
   /** File name. */
   char m_filename[FN_REFLEN];
   /** File name length in bytes. */

=== modified file 'storage/perfschema/pfs_stat.h'
--- a/storage/perfschema/pfs_stat.h	2011-08-11 03:11:58 +0000
+++ b/storage/perfschema/pfs_stat.h	2011-09-02 20:03:36 +0000
@@ -147,45 +147,44 @@ struct PFS_cond_stat
   ulonglong m_broadcast_count;
 };
 
-/** Statistics for FILE IO usage. */
+/** Statistics for FILE IO. Used for both waits and byte counts. */
 struct PFS_file_io_stat
 {
-  /** Count of READ operations. */
-  ulonglong m_count_read;
-  /** Count of WRITE operations. */
-  ulonglong m_count_write;
-  /** Number of bytes read. */
-  ulonglong m_read_bytes;
-  /** Number of bytes written. */
-  ulonglong m_write_bytes;
+  /** READ statistics */
+  PFS_byte_stat m_read;
+  /** WRITE statistics */
+  PFS_byte_stat m_write;
+  /** Miscelleanous statistics */
+  PFS_byte_stat m_misc;
 
-  /** Reset file statistic. */
   inline void reset(void)
   {
-    m_count_read= 0;
-    m_count_write= 0;
-    m_read_bytes= 0;
-    m_write_bytes= 0;
+    m_read.reset();
+    m_write.reset();
+    m_misc.reset();
   }
 
   inline void aggregate(const PFS_file_io_stat *stat)
   {
-    m_count_read+= stat->m_count_read;
-    m_count_write+= stat->m_count_write;
-    m_read_bytes+= stat->m_read_bytes;
-    m_write_bytes+= stat->m_write_bytes;
+    m_read.aggregate(&stat->m_read);
+    m_write.aggregate(&stat->m_write);
+    m_misc.aggregate(&stat->m_misc);
   }
 
-  inline void aggregate_read(ulonglong bytes)
+  /* Sum waits and byte counts */
+  inline void sum(PFS_byte_stat *stat)
   {
-    m_count_read++;
-    m_read_bytes+= bytes;
+    stat->aggregate(&m_read);
+    stat->aggregate(&m_write);
+    stat->aggregate(&m_misc);
   }
 
-  inline void aggregate_write(ulonglong bytes)
+  /* Sum waits only */
+  inline void sum_waits(PFS_single_stat *stat)
   {
-    m_count_write++;
-    m_write_bytes+= bytes;
+    stat->aggregate(&m_read);
+    stat->aggregate(&m_write);
+    stat->aggregate(&m_misc);
   }
 };
 
@@ -196,6 +195,12 @@ struct PFS_file_stat
   ulong m_open_count;
   /** File IO statistics. */
   PFS_file_io_stat m_io_stat;
+
+  /** Reset file statistics. */
+  inline void reset(void)
+  {
+    m_io_stat.reset();
+  }
 };
 
 /** Statistics for stage usage. */

=== modified file 'storage/perfschema/pfs_visitor.cc'
--- a/storage/perfschema/pfs_visitor.cc	2011-08-11 03:11:58 +0000
+++ b/storage/perfschema/pfs_visitor.cc	2011-09-02 20:03:36 +0000
@@ -935,7 +935,10 @@ void PFS_instance_wait_visitor::visit_co
 
 void PFS_instance_wait_visitor::visit_file(PFS_file *pfs) 
 {
-  m_stat.aggregate(& pfs->m_wait_stat);
+  /* Combine per-operation file wait stats before aggregating */
+  PFS_single_stat stat;
+  pfs->m_file_stat.m_io_stat.sum_waits(&stat);
+  m_stat.aggregate(&stat);
 }
 
 void PFS_instance_wait_visitor::visit_socket(PFS_socket *pfs) 
@@ -1137,4 +1140,22 @@ void PFS_instance_socket_io_stat_visitor
   m_socket_io_stat.aggregate(&pfs->m_socket_stat.m_io_stat);
 }
 
+
+PFS_instance_file_io_stat_visitor::PFS_instance_file_io_stat_visitor()
+{}
+
+PFS_instance_file_io_stat_visitor::~PFS_instance_file_io_stat_visitor()
+{}
+
+void PFS_instance_file_io_stat_visitor::visit_file_class(PFS_file_class *pfs) 
+{
+  /* Aggregate wait times, event counts and byte counts */
+  m_file_io_stat.aggregate(&pfs->m_file_stat.m_io_stat);
+}
+
+void PFS_instance_file_io_stat_visitor::visit_file(PFS_file *pfs) 
+{
+  /* Aggregate wait times, event counts and byte counts */
+  m_file_io_stat.aggregate(&pfs->m_file_stat.m_io_stat);
+}
 /** @} */

=== modified file 'storage/perfschema/pfs_visitor.h'
--- a/storage/perfschema/pfs_visitor.h	2011-08-11 03:11:58 +0000
+++ b/storage/perfschema/pfs_visitor.h	2011-09-02 20:03:36 +0000
@@ -546,6 +546,23 @@ public:
   /** Wait and byte count statistics collected. */
   PFS_socket_io_stat m_socket_io_stat;
 };
+
+/**
+  A concrete instance visitor that aggregates
+  file wait and byte count statistics.
+*/
+class PFS_instance_file_io_stat_visitor : public PFS_instance_visitor
+{
+public:
+  PFS_instance_file_io_stat_visitor();
+  virtual ~PFS_instance_file_io_stat_visitor();
+  virtual void visit_file_class(PFS_file_class *pfs);
+  virtual void visit_file(PFS_file *pfs);
+
+  /** Wait and byte count statistics collected. */
+  PFS_file_io_stat m_file_io_stat;
+};
+
 /** @} */
 #endif
 

=== removed file 'storage/perfschema/table_file_summary.cc'
--- a/storage/perfschema/table_file_summary.cc	2010-11-15 07:40:07 +0000
+++ b/storage/perfschema/table_file_summary.cc	1970-01-01 00:00:00 +0000
@@ -1,390 +0,0 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; version 2 of the License.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software Foundation,
-  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-
-/**
-  @file storage/perfschema/table_file_summary.cc
-  Table FILE_SUMMARY_BY_xxx (implementation).
-*/
-
-#include "my_global.h"
-#include "my_pthread.h"
-#include "pfs_instr_class.h"
-#include "pfs_column_types.h"
-#include "pfs_column_values.h"
-#include "table_file_summary.h"
-#include "pfs_global.h"
-
-THR_LOCK table_file_summary_by_event_name::m_table_lock;
-
-static const TABLE_FIELD_TYPE fs_by_event_name_field_types[]=
-{
-  {
-    { C_STRING_WITH_LEN("EVENT_NAME") },
-    { C_STRING_WITH_LEN("varchar(128)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("COUNT_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("COUNT_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  }
-};
-
-TABLE_FIELD_DEF
-table_file_summary_by_event_name::m_field_def=
-{ 5, fs_by_event_name_field_types };
-
-PFS_engine_table_share
-table_file_summary_by_event_name::m_share=
-{
-  { C_STRING_WITH_LEN("file_summary_by_event_name") },
-  &pfs_truncatable_acl,
-  &table_file_summary_by_event_name::create,
-  NULL, /* write_row */
-  table_file_summary_by_event_name::delete_all_rows,
-  NULL, /* get_row_count */
-  1000, /* records */
-  sizeof(PFS_simple_index),
-  &m_table_lock,
-  &m_field_def,
-  false /* checked */
-};
-
-PFS_engine_table* table_file_summary_by_event_name::create(void)
-{
-  return new table_file_summary_by_event_name();
-}
-
-int table_file_summary_by_event_name::delete_all_rows(void)
-{
-  reset_file_instance_io();
-  reset_file_class_io();
-  return 0;
-}
-
-table_file_summary_by_event_name::table_file_summary_by_event_name()
-  : PFS_engine_table(&m_share, &m_pos),
-  m_pos(1), m_next_pos(1)
-{}
-
-void table_file_summary_by_event_name::reset_position(void)
-{
-  m_pos.m_index= 1;
-  m_next_pos.m_index= 1;
-}
-
-int table_file_summary_by_event_name::rnd_next(void)
-{
-  PFS_file_class *file_class;
-
-  m_pos.set_at(&m_next_pos);
-
-  file_class= find_file_class(m_pos.m_index);
-  if (file_class)
-  {
-    make_row(file_class);
-    m_next_pos.set_after(&m_pos);
-    return 0;
-  }
-
-  return HA_ERR_END_OF_FILE;
-}
-
-int table_file_summary_by_event_name::rnd_pos(const void *pos)
-{
-  PFS_file_class *file_class;
-
-  set_position(pos);
-
-  file_class= find_file_class(m_pos.m_index);
-  if (file_class)
-  {
-    make_row(file_class);
-    return 0;
-  }
-
-  return HA_ERR_RECORD_DELETED;
-}
-
-/**
-  Build a row.
-  @param klass            the file class the cursor is reading
-*/
-void table_file_summary_by_event_name::make_row(PFS_file_class *klass)
-{
-  m_row.m_name= &klass->m_name[0];
-  m_row.m_name_length= klass->m_name_length;
-  m_row.m_file_io_stat= klass->m_file_stat.m_io_stat;
-
-  /* For all file instances ... */
-  PFS_file *pfs= file_array;
-  PFS_file *pfs_last= file_array + file_max;
-  for ( ; pfs < pfs_last; pfs++)
-  {
-    if ((pfs->m_class == klass) && pfs->m_lock.is_populated())
-    {
-      /*
-        If the instance belongs to this class,
-        aggregate the instance statistics.
-      */
-      m_row.m_file_io_stat.aggregate(& pfs->m_file_stat.m_io_stat);
-    }
-  }
-}
-
-int table_file_summary_by_event_name::read_row_values(TABLE *table,
-                                                      unsigned char *,
-                                                      Field **fields,
-                                                      bool read_all)
-{
-  Field *f;
-
-  /* Set the null bits */
-  DBUG_ASSERT(table->s->null_bytes == 0);
-
-  /* The row always exists for classes */
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (read_all || bitmap_is_set(table->read_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case 0: /* NAME */
-        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
-        break;
-      case 1: /* COUNT_READ */
-        set_field_ulonglong(f, m_row.m_file_io_stat.m_count_read);
-        break;
-      case 2: /* COUNT_WRITE */
-        set_field_ulonglong(f, m_row.m_file_io_stat.m_count_write);
-        break;
-      case 3: /* READ_BYTES */
-        set_field_ulonglong(f, m_row.m_file_io_stat.m_read_bytes);
-        break;
-      case 4: /* WRITE_BYTES */
-        set_field_ulonglong(f, m_row.m_file_io_stat.m_write_bytes);
-        break;
-      default:
-        DBUG_ASSERT(false);
-      }
-    }
-  }
-
-  return 0;
-}
-
-THR_LOCK table_file_summary_by_instance::m_table_lock;
-
-static const TABLE_FIELD_TYPE fs_by_instance_field_types[]=
-{
-  {
-    { C_STRING_WITH_LEN("FILE_NAME") },
-    { C_STRING_WITH_LEN("varchar(512)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("EVENT_NAME") },
-    { C_STRING_WITH_LEN("varchar(128)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("COUNT_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("COUNT_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  },
-  {
-    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
-    { C_STRING_WITH_LEN("bigint(20)") },
-    { NULL, 0}
-  }
-};
-
-TABLE_FIELD_DEF
-table_file_summary_by_instance::m_field_def=
-{ 6, fs_by_instance_field_types };
-
-PFS_engine_table_share
-table_file_summary_by_instance::m_share=
-{
-  { C_STRING_WITH_LEN("file_summary_by_instance") },
-  &pfs_truncatable_acl,
-  &table_file_summary_by_instance::create,
-  NULL, /* write_row */
-  table_file_summary_by_instance::delete_all_rows,
-  NULL, /* get_row_count */
-  1000, /* records */
-  sizeof(PFS_simple_index),
-  &m_table_lock,
-  &m_field_def,
-  false /* checked */
-};
-
-PFS_engine_table* table_file_summary_by_instance::create(void)
-{
-  return new table_file_summary_by_instance();
-}
-
-int table_file_summary_by_instance::delete_all_rows(void)
-{
-  reset_file_instance_io();
-  return 0;
-}
-
-table_file_summary_by_instance::table_file_summary_by_instance()
-  : PFS_engine_table(&m_share, &m_pos),
-  m_row_exists(false), m_pos(0), m_next_pos(0)
-{}
-
-void table_file_summary_by_instance::reset_position(void)
-{
-  m_pos.m_index= 0;
-  m_next_pos.m_index= 0;
-}
-
-int table_file_summary_by_instance::rnd_next(void)
-{
-  PFS_file *pfs;
-
-  for (m_pos.set_at(&m_next_pos);
-       m_pos.m_index < file_max;
-       m_pos.next())
-  {
-    pfs= &file_array[m_pos.m_index];
-    if (pfs->m_lock.is_populated())
-    {
-      make_row(pfs);
-      m_next_pos.set_after(&m_pos);
-      return 0;
-    }
-  }
-
-  return HA_ERR_END_OF_FILE;
-}
-
-int table_file_summary_by_instance::rnd_pos(const void *pos)
-{
-  PFS_file *pfs;
-
-  set_position(pos);
-  DBUG_ASSERT(m_pos.m_index < file_max);
-  pfs= &file_array[m_pos.m_index];
-
-  if (! pfs->m_lock.is_populated())
-    return HA_ERR_RECORD_DELETED;
-
-  make_row(pfs);
-  return 0;
-}
-
-/**
-  Build a row.
-  @param pfs              the file the cursor is reading
-*/
-void table_file_summary_by_instance::make_row(PFS_file *pfs)
-{
-  pfs_lock lock;
-  PFS_file_class *safe_class;
-
-  m_row_exists= false;
-
-  /* Protect this reader against a file delete */
-  pfs->m_lock.begin_optimistic_lock(&lock);
-
-  safe_class= sanitize_file_class(pfs->m_class);
-  if (unlikely(safe_class == NULL))
-    return;
-
-  m_row.m_filename= pfs->m_filename;
-  m_row.m_filename_length= pfs->m_filename_length;
-  m_row.m_name= safe_class->m_name;
-  m_row.m_name_length= safe_class->m_name_length;
-  m_row.m_file_io_stat= pfs->m_file_stat.m_io_stat;
-
-  if (pfs->m_lock.end_optimistic_lock(&lock))
-    m_row_exists= true;
-}
-
-int table_file_summary_by_instance::read_row_values(TABLE *table,
-                                                          unsigned char *,
-                                                          Field **fields,
-                                                          bool read_all)
-{
-  Field *f;
-
-  if (unlikely(! m_row_exists))
-    return HA_ERR_RECORD_DELETED;
-
-  /* Set the null bits */
-  DBUG_ASSERT(table->s->null_bytes == 0);
-
-  for (; (f= *fields) ; fields++)
-  {
-    if (read_all || bitmap_is_set(table->read_set, f->field_index))
-    {
-      switch(f->field_index)
-      {
-      case 0: /* FILENAME */
-        set_field_varchar_utf8(f, m_row.m_filename, m_row.m_filename_length);
-        break;
-      case 1: /* NAME */
-        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
-        break;
-      case 2: /* COUNT_READ */
-        set_field_ulonglong(f, m_row.m_file_io_stat.m_count_read);
-        break;
-      case 3: /* COUNT_WRITE */
-        set_field_ulonglong(f, m_row.m_file_io_stat.m_count_write);
-        break;
-      case 4: /* READ_BYTES */
-        set_field_ulonglong(f, m_row.m_file_io_stat.m_read_bytes);
-        break;
-      case 5: /* WRITE_BYTES */
-        set_field_ulonglong(f, m_row.m_file_io_stat.m_write_bytes);
-        break;
-      default:
-        DBUG_ASSERT(false);
-      }
-    }
-  }
-
-  return 0;
-}
-

=== removed file 'storage/perfschema/table_file_summary.h'
--- a/storage/perfschema/table_file_summary.h	2010-09-23 16:08:54 +0000
+++ b/storage/perfschema/table_file_summary.h	1970-01-01 00:00:00 +0000
@@ -1,151 +0,0 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
-
-  This program is free software; you can redistribute it and/or modify
-  it under the terms of the GNU General Public License as published by
-  the Free Software Foundation; version 2 of the License.
-
-  This program is distributed in the hope that it will be useful,
-  but WITHOUT ANY WARRANTY; without even the implied warranty of
-  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-  GNU General Public License for more details.
-
-  You should have received a copy of the GNU General Public License
-  along with this program; if not, write to the Free Software Foundation,
-  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
-
-#ifndef TABLE_FILE_SUMMARY_H
-#define TABLE_FILE_SUMMARY_H
-
-/**
-  @file storage/perfschema/table_file_summary.h
-  Table FILE_SUMMARY_BY_xxx (declarations).
-*/
-
-#include "pfs_column_types.h"
-#include "pfs_engine_table.h"
-#include "pfs_instr_class.h"
-#include "pfs_instr.h"
-
-/**
-  @addtogroup Performance_schema_tables
-  @{
-*/
-
-/** A row of PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */
-struct row_file_summary_by_event_name
-{
-  /** Column EVENT_NAME. */
-  const char *m_name;
-  /** Length in bytes of @c m_name. */
-  uint m_name_length;
-  /**
-    Columns COUNT_READ, COUNT_WRITE,
-    SUM_NUMBER_OF_BYTES_READ, SUM_NUMBER_OF_BYTES_WRITE.
-  */
-  PFS_file_io_stat m_file_io_stat;
-};
-
-/** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */
-class table_file_summary_by_event_name : public PFS_engine_table
-{
-public:
-  /** Table share */
-  static PFS_engine_table_share m_share;
-  static PFS_engine_table* create();
-  static int delete_all_rows();
-
-  virtual int rnd_next();
-  virtual int rnd_pos(const void *pos);
-  virtual void reset_position(void);
-
-protected:
-  void make_row(PFS_file_class *klass);
-
-  virtual int read_row_values(TABLE *table,
-                              unsigned char *buf,
-                              Field **fields,
-                              bool read_all);
-
-  table_file_summary_by_event_name();
-
-public:
-  ~table_file_summary_by_event_name()
-  {}
-
-private:
-  /** Table share lock. */
-  static THR_LOCK m_table_lock;
-  /** Fields definition. */
-  static TABLE_FIELD_DEF m_field_def;
-
-  /** Current row. */
-  row_file_summary_by_event_name m_row;
-  /** Current position. */
-  PFS_simple_index m_pos;
-  /** Next position. */
-  PFS_simple_index m_next_pos;
-};
-
-/** A row of PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_INSTANCE. */
-struct row_file_summary_by_instance
-{
-  /** Column FILE_NAME. */
-  const char *m_filename;
-  /** Length in bytes of @c m_filename. */
-  uint m_filename_length;
-  /** Column EVENT_NAME. */
-  const char *m_name;
-  /** Length in bytes of @c m_name. */
-  uint m_name_length;
-  /**
-    Columns COUNT_READ, COUNT_WRITE,
-    SUM_NUMBER_OF_BYTES_READ, SUM_NUMBER_OF_BYTES_WRITE.
-  */
-  PFS_file_io_stat m_file_io_stat;
-};
-
-/** Table PERFORMANCE_SCHEMA.FILE_UMMARY_BY_INSTANCE. */
-class table_file_summary_by_instance : public PFS_engine_table
-{
-public:
-  /** Table share */
-  static PFS_engine_table_share m_share;
-  static PFS_engine_table* create();
-  static int delete_all_rows();
-
-  virtual int rnd_next();
-  virtual int rnd_pos(const void *pos);
-  virtual void reset_position(void);
-
-protected:
-  void make_row(PFS_file *pfs);
-
-  virtual int read_row_values(TABLE *table,
-                              unsigned char *buf,
-                              Field **fields,
-                              bool read_all);
-
-  table_file_summary_by_instance();
-
-public:
-  ~table_file_summary_by_instance()
-  {}
-
-private:
-  /** Table share lock. */
-  static THR_LOCK m_table_lock;
-  /** Fields definition. */
-  static TABLE_FIELD_DEF m_field_def;
-
-  /** Current row. */
-  row_file_summary_by_instance m_row;
-  /** True if the current row exists. */
-  bool m_row_exists;
-  /** Current position. */
-  PFS_simple_index m_pos;
-  /** Next position. */
-  PFS_simple_index m_next_pos;
-};
-
-/** @} */
-#endif

=== added file 'storage/perfschema/table_file_summary_by_event_name.cc'
--- a/storage/perfschema/table_file_summary_by_event_name.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_file_summary_by_event_name.cc	2011-09-02 20:03:36 +0000
@@ -0,0 +1,352 @@
+/* Copyright (c) 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
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/**
+  @file storage/perfschema/table_file_summary.cc
+  Table FILE_SUMMARY_BY_EVENT_NAME(implementation).
+*/
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "pfs_instr_class.h"
+#include "pfs_column_types.h"
+#include "pfs_column_values.h"
+#include "table_file_summary_by_event_name.h"
+#include "pfs_global.h"
+#include "pfs_visitor.h"
+
+THR_LOCK table_file_summary_by_event_name::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("EVENT_NAME") },
+    { C_STRING_WITH_LEN("varchar(128)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_STAR") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Read */
+  {
+    { C_STRING_WITH_LEN("COUNT_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Write */
+  {
+    { C_STRING_WITH_LEN("COUNT_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Misc */
+  {
+    { C_STRING_WITH_LEN("COUNT_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  }
+};
+
+TABLE_FIELD_DEF
+table_file_summary_by_event_name::m_field_def=
+{ 23, field_types };
+
+PFS_engine_table_share
+table_file_summary_by_event_name::m_share=
+{
+  { C_STRING_WITH_LEN("file_summary_by_event_name") },
+  &pfs_truncatable_acl,
+  &table_file_summary_by_event_name::create,
+  NULL, /* write_row */
+  table_file_summary_by_event_name::delete_all_rows,
+  NULL, /* get_row_count */
+  1000, /* records */
+  sizeof(PFS_simple_index),
+  &m_table_lock,
+  &m_field_def,
+  false /* checked */
+};
+
+PFS_engine_table* table_file_summary_by_event_name::create(void)
+{
+  return new table_file_summary_by_event_name();
+}
+
+int table_file_summary_by_event_name::delete_all_rows(void)
+{
+  reset_file_instance_io();
+  reset_file_class_io();
+  return 0;
+}
+
+table_file_summary_by_event_name::table_file_summary_by_event_name()
+  : PFS_engine_table(&m_share, &m_pos),
+  m_pos(1), m_next_pos(1)
+{}
+
+void table_file_summary_by_event_name::reset_position(void)
+{
+  m_pos.m_index= 1;
+  m_next_pos.m_index= 1;
+}
+
+int table_file_summary_by_event_name::rnd_next(void)
+{
+  PFS_file_class *file_class;
+
+  m_pos.set_at(&m_next_pos);
+
+  file_class= find_file_class(m_pos.m_index);
+  if (file_class)
+  {
+    make_row(file_class);
+    m_next_pos.set_after(&m_pos);
+    return 0;
+  }
+
+  return HA_ERR_END_OF_FILE;
+}
+
+int table_file_summary_by_event_name::rnd_pos(const void *pos)
+{
+  PFS_file_class *file_class;
+
+  set_position(pos);
+
+  file_class= find_file_class(m_pos.m_index);
+  if (file_class)
+  {
+    make_row(file_class);
+    return 0;
+  }
+
+  return HA_ERR_RECORD_DELETED;
+}
+
+/**
+  Build a row.
+  @param klass            the file class the cursor is reading
+*/
+void table_file_summary_by_event_name::make_row(PFS_file_class *file_class)
+{
+  m_row.m_event_name.make_row(file_class);
+
+  PFS_instance_file_io_stat_visitor visitor;
+  PFS_instance_iterator::visit_file_instances(file_class, &visitor);
+
+  time_normalizer *normalizer= time_normalizer::get(wait_timer);
+  
+  /* Collect timer and byte count stats */
+  m_row.m_io_stat.set(normalizer, &visitor.m_file_io_stat);
+  m_row_exists= true;
+
+}
+
+int table_file_summary_by_event_name::read_row_values(TABLE *table,
+                                                      unsigned char *,
+                                                      Field **fields,
+                                                      bool read_all)
+{
+  Field *f;
+
+  if (unlikely(!m_row_exists))
+    return HA_ERR_RECORD_DELETED;
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 0);
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case  0: /* EVENT_NAME */
+        m_row.m_event_name.set_field(f);
+        break;
+      case  1: /* COUNT_STAR */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_count);
+        break;
+      case  2: /* SUM_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_sum);
+        break;
+      case  3: /* MIN_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_min);
+        break;
+      case  4: /* AVG_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_avg);
+        break;
+      case  5: /* MAX_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_max);
+        break;
+
+      case  6: /* COUNT_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_count);
+        break;
+      case  7: /* SUM_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_sum);
+        break;
+      case  8: /* MIN_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_min);
+        break;
+      case  9: /* AVG_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_avg);
+        break;
+      case 10: /* MAX_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_max);
+        break;
+      case 11: /* SUM_NUMBER_OF_BYTES_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_bytes);
+        break;
+
+      case 12: /* COUNT_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_count);
+        break;
+      case 13: /* SUM_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_sum);
+        break;
+      case 14: /* MIN_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_min);
+        break;
+      case 15: /* AVG_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_avg);
+        break;
+      case 16: /* MAX_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_max);
+        break;
+      case 17: /* SUM_NUMBER_OF_BYTES_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_bytes);
+        break;
+
+      case 18: /* COUNT_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_count);
+        break;
+      case 19: /* SUM_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_sum);
+        break;
+      case 20: /* MIN_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_min);
+        break;
+      case 21: /* AVG_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_avg);
+        break;
+      case 22: /* MAX_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_max);
+        break;
+
+      default:
+        DBUG_ASSERT(false);
+        break;
+      }
+    } // if
+  } // for
+
+  return 0;
+}

=== added file 'storage/perfschema/table_file_summary_by_event_name.h'
--- a/storage/perfschema/table_file_summary_by_event_name.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_file_summary_by_event_name.h	2011-09-02 20:03:36 +0000
@@ -0,0 +1,91 @@
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef TABLE_FILE_SUMMARY_H
+#define TABLE_FILE_SUMMARY_H
+
+/**
+  @file storage/perfschema/table_file_summary_by_event_name.h
+  Table FILE_SUMMARY_BY_EVENT_NAME (declarations).
+*/
+
+#include "pfs_column_types.h"
+#include "pfs_engine_table.h"
+#include "pfs_instr_class.h"
+#include "pfs_instr.h"
+#include "table_helper.h"
+
+/**
+  @addtogroup Performance_schema_tables
+  @{
+*/
+
+/** A row of PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */
+struct row_file_summary_by_event_name
+{
+  /** Column EVENT_NAME. */
+  PFS_event_name_row m_event_name;
+
+  /** Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER and NUMBER_OF_BYTES
+      for READ, WRITE and MISC operation types.
+  */
+  PFS_file_io_stat_row m_io_stat;
+};
+
+/** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_EVENT_NAME. */
+class table_file_summary_by_event_name : public PFS_engine_table
+{
+public:
+  /** Table share */
+  static PFS_engine_table_share m_share;
+  static PFS_engine_table* create();
+  static int delete_all_rows();
+
+  virtual int rnd_next();
+  virtual int rnd_pos(const void *pos);
+  virtual void reset_position(void);
+
+private:
+  virtual int read_row_values(TABLE *table,
+                              unsigned char *buf,
+                              Field **fields,
+                              bool read_all);
+
+  table_file_summary_by_event_name();
+
+public:
+  ~table_file_summary_by_event_name()
+  {}
+
+private:
+  void make_row(PFS_file_class *klass);
+
+  /** Table share lock. */
+  static THR_LOCK m_table_lock;
+  /** Fields definition. */
+  static TABLE_FIELD_DEF m_field_def;
+
+  /** Current row. */
+  row_file_summary_by_event_name m_row;
+  /** True if the current row exists. */
+  bool m_row_exists;
+  /** Current position. */
+  PFS_simple_index m_pos;
+  /** Next position. */
+  PFS_simple_index m_next_pos;
+};
+
+/** @} */
+#endif

=== added file 'storage/perfschema/table_file_summary_by_instance.cc'
--- a/storage/perfschema/table_file_summary_by_instance.cc	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_file_summary_by_instance.cc	2011-09-02 20:03:36 +0000
@@ -0,0 +1,381 @@
+/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+
+  This program is free software; you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+/**
+  @file storage/perfschema/table_file_summary.cc
+  Table FILE_SUMMARY_BY_INSTANCE (implementation).
+*/
+
+#include "my_global.h"
+#include "my_pthread.h"
+#include "pfs_instr_class.h"
+#include "pfs_column_types.h"
+#include "pfs_column_values.h"
+#include "table_file_summary_by_instance.h"
+#include "pfs_global.h"
+
+THR_LOCK table_file_summary_by_instance::m_table_lock;
+
+static const TABLE_FIELD_TYPE field_types[]=
+{
+  {
+    { C_STRING_WITH_LEN("FILE_NAME") },
+    { C_STRING_WITH_LEN("varchar(512)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("EVENT_NAME") },
+    { C_STRING_WITH_LEN("varchar(128)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("OBJECT_INSTANCE_BEGIN") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("COUNT_STAR") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WAIT") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Read */
+  {
+    { C_STRING_WITH_LEN("COUNT_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_READ") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Write */
+  {
+    { C_STRING_WITH_LEN("COUNT_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_NUMBER_OF_BYTES_WRITE") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+
+  /** Misc */
+  {
+    { C_STRING_WITH_LEN("COUNT_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("SUM_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MIN_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("AVG_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  },
+  {
+    { C_STRING_WITH_LEN("MAX_TIMER_MISC") },
+    { C_STRING_WITH_LEN("bigint(20)") },
+    { NULL, 0}
+  }
+};
+
+TABLE_FIELD_DEF
+table_file_summary_by_instance::m_field_def=
+{ 25, field_types };
+
+PFS_engine_table_share
+table_file_summary_by_instance::m_share=
+{
+  { C_STRING_WITH_LEN("file_summary_by_instance") },
+  &pfs_truncatable_acl,
+  &table_file_summary_by_instance::create,
+  NULL, /* write_row */
+  table_file_summary_by_instance::delete_all_rows,
+  NULL, /* get_row_count */
+  1000, /* records */
+  sizeof(PFS_simple_index),
+  &m_table_lock,
+  &m_field_def,
+  false /* checked */
+};
+
+PFS_engine_table* table_file_summary_by_instance::create(void)
+{
+  return new table_file_summary_by_instance();
+}
+
+int table_file_summary_by_instance::delete_all_rows(void)
+{
+  reset_file_instance_io();
+  return 0;
+}
+
+table_file_summary_by_instance::table_file_summary_by_instance()
+  : PFS_engine_table(&m_share, &m_pos),
+  m_row_exists(false), m_pos(0), m_next_pos(0)
+{}
+
+void table_file_summary_by_instance::reset_position(void)
+{
+  m_pos.m_index= 0;
+  m_next_pos.m_index= 0;
+}
+
+int table_file_summary_by_instance::rnd_next(void)
+{
+  PFS_file *pfs;
+
+  for (m_pos.set_at(&m_next_pos);
+       m_pos.m_index < file_max;
+       m_pos.next())
+  {
+    pfs= &file_array[m_pos.m_index];
+    if (pfs->m_lock.is_populated())
+    {
+      make_row(pfs);
+      m_next_pos.set_after(&m_pos);
+      return 0;
+    }
+  }
+
+  return HA_ERR_END_OF_FILE;
+}
+
+int table_file_summary_by_instance::rnd_pos(const void *pos)
+{
+  PFS_file *pfs;
+
+  set_position(pos);
+  DBUG_ASSERT(m_pos.m_index < file_max);
+  pfs= &file_array[m_pos.m_index];
+
+  if (! pfs->m_lock.is_populated())
+    return HA_ERR_RECORD_DELETED;
+
+  make_row(pfs);
+  return 0;
+}
+
+/**
+  Build a row.
+  @param pfs              the file the cursor is reading
+*/
+void table_file_summary_by_instance::make_row(PFS_file *pfs)
+{
+  pfs_lock lock;
+  PFS_file_class *safe_class;
+
+  m_row_exists= false;
+
+  /* Protect this reader against a file delete */
+  pfs->m_lock.begin_optimistic_lock(&lock);
+
+  safe_class= sanitize_file_class(pfs->m_class);
+  if (unlikely(safe_class == NULL))
+    return;
+
+  m_row.m_filename= pfs->m_filename;
+  m_row.m_filename_length= pfs->m_filename_length;
+  m_row.m_event_name.make_row(safe_class);
+  m_row.m_identity= pfs->m_identity;
+
+  time_normalizer *normalizer= time_normalizer::get(wait_timer);
+
+  /* Collect timer and byte count stats */
+  m_row.m_io_stat.set(normalizer, &pfs->m_file_stat.m_io_stat);
+
+  if (pfs->m_lock.end_optimistic_lock(&lock))
+    m_row_exists= true;
+}
+
+int table_file_summary_by_instance::read_row_values(TABLE *table,
+                                                          unsigned char *,
+                                                          Field **fields,
+                                                          bool read_all)
+{
+  Field *f;
+
+  if (unlikely(! m_row_exists))
+    return HA_ERR_RECORD_DELETED;
+
+  /* Set the null bits */
+  DBUG_ASSERT(table->s->null_bytes == 0);
+
+  for (; (f= *fields) ; fields++)
+  {
+    if (read_all || bitmap_is_set(table->read_set, f->field_index))
+    {
+      switch(f->field_index)
+      {
+      case  0: /* FILE_NAME */
+        set_field_varchar_utf8(f, m_row.m_filename, m_row.m_filename_length);
+        break;
+      case  1: /* EVENT_NAME */
+        m_row.m_event_name.set_field(f);
+        break;
+      case  2: /* OBJECT_INSTANCE */
+        set_field_ulonglong(f, (ulonglong)m_row.m_identity);
+        break;
+
+      case  3:/* COUNT_STAR */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_count);
+        break;
+      case  4:/* SUM_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_sum);
+        break;
+      case  5: /* MIN_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_min);
+        break;
+      case  6: /* AVG_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_avg);
+        break;
+      case  7: /* MAX_TIMER_WAIT */
+        set_field_ulonglong(f, m_row.m_io_stat.m_all.m_waits.m_max);
+        break;
+
+      case  8: /* COUNT_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_count);
+        break;
+      case  9: /* SUM_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_sum);
+        break;
+      case 10: /* MIN_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_min);
+        break;
+      case 11: /* AVG_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_avg);
+        break;
+      case 12: /* MAX_TIMER_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_waits.m_max);
+        break;
+      case 13: /* SUM_NUMBER_OF_BYTES_READ */
+        set_field_ulonglong(f, m_row.m_io_stat.m_read.m_bytes);
+        break;
+
+      case 14: /* COUNT_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_count);
+        break;
+      case 15: /* SUM_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_sum);
+        break;
+      case 16: /* MIN_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_min);
+        break;
+      case 17: /* AVG_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_avg);
+        break;
+      case 18: /* MAX_TIMER_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_waits.m_max);
+        break;
+      case 19: /* SUM_NUMBER_OF_BYTES_WRITE */
+        set_field_ulonglong(f, m_row.m_io_stat.m_write.m_bytes);
+        break;
+
+      case 20: /* COUNT_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_count);
+        break;
+      case 21: /* SUM_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_sum);
+        break;
+      case 22: /* MIN_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_min);
+        break;
+      case 23: /* AVG_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_avg);
+        break;
+      case 24: /* MAX_TIMER_MISC */
+        set_field_ulonglong(f, m_row.m_io_stat.m_misc.m_waits.m_max);
+        break;
+      default:
+        DBUG_ASSERT(false);
+      }
+    }
+  }
+
+  return 0;
+}
+

=== added file 'storage/perfschema/table_file_summary_by_instance.h'
--- a/storage/perfschema/table_file_summary_by_instance.h	1970-01-01 00:00:00 +0000
+++ b/storage/perfschema/table_file_summary_by_instance.h	2011-09-02 20:03:36 +0000
@@ -0,0 +1,99 @@
+/* Copyright (c) 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
+  the Free Software Foundation; version 2 of the License.
+
+  This program is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with this program; if not, write to the Free Software Foundation,
+  51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA */
+
+#ifndef TABLE_FILE_SUMMARY_BY_INSTANCE_H
+#define TABLE_FILE_SUMMARY_BY_INSTANCE_H
+
+/**
+  @file storage/perfschema/table_file_summary_by_instance.h
+  Table FILE_SUMMARY_BY_INSTANCE (declarations).
+*/
+
+#include "pfs_column_types.h"
+#include "pfs_engine_table.h"
+#include "pfs_instr_class.h"
+#include "pfs_instr.h"
+#include "table_helper.h"
+
+/**
+  @addtogroup Performance_schema_tables
+  @{
+*/
+
+/** A row of PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_INSTANCE. */
+struct row_file_summary_by_instance
+{
+  /** Column FILE_NAME. */
+  const char *m_filename;
+  /** Length in bytes of @c m_filename. */
+  uint m_filename_length;
+
+  /** Column EVENT_NAME. */
+  PFS_event_name_row m_event_name;
+
+  /** Column OBJECT_INSTANCE_BEGIN */
+  const void *m_identity;
+  /**
+    Columns COUNT_STAR, SUM/MIN/AVG/MAX TIMER and NUMBER_OF_BYTES for READ,
+    WRITE and MISC operation types.
+  */
+  PFS_file_io_stat_row m_io_stat;
+};
+
+/** Table PERFORMANCE_SCHEMA.FILE_SUMMARY_BY_INSTANCE. */
+class table_file_summary_by_instance : public PFS_engine_table
+{
+public:
+  /** Table share */
+  static PFS_engine_table_share m_share;
+  static PFS_engine_table* create();
+  static int delete_all_rows();
+
+  virtual int rnd_next();
+  virtual int rnd_pos(const void *pos);
+  virtual void reset_position(void);
+
+private:
+  virtual int read_row_values(TABLE *table,
+                              unsigned char *buf,
+                              Field **fields,
+                              bool read_all);
+
+  table_file_summary_by_instance();
+
+public:
+  ~table_file_summary_by_instance()
+  {}
+
+private:
+  void make_row(PFS_file *pfs);
+
+  /** Table share lock. */
+  static THR_LOCK m_table_lock;
+  /** Fields definition. */
+  static TABLE_FIELD_DEF m_field_def;
+
+  /** Current row. */
+  row_file_summary_by_instance m_row;
+  /** True if the current row exists. */
+  bool m_row_exists;
+  /** Current position. */
+  PFS_simple_index m_pos;
+  /** Next position. */
+  PFS_simple_index m_next_pos;
+};
+
+/** @} */
+#endif

=== modified file 'storage/perfschema/table_helper.h'
--- a/storage/perfschema/table_helper.h	2011-08-11 03:11:58 +0000
+++ b/storage/perfschema/table_helper.h	2011-09-02 20:03:36 +0000
@@ -440,24 +440,40 @@ struct PFS_socket_io_stat_row
   inline void set(time_normalizer *normalizer, const PFS_socket_io_stat *stat)
   {
     PFS_byte_stat all;
-    PFS_byte_stat read= stat->m_read;
-    PFS_byte_stat write= stat->m_write;
-    PFS_byte_stat misc= stat->m_misc;
 
-    m_read.set(normalizer, &read);
-    m_write.set(normalizer, &write);
-    m_misc.set(normalizer, &misc);
-  //m_read.set(normalizer, &stat->m_read);
-  //m_write.set(normalizer, &stat->m_write);
-  //m_misc.set(normalizer, &stat->m_misc);
+    m_read.set(normalizer, &stat->m_read);
+    m_write.set(normalizer, &stat->m_write);
+    m_misc.set(normalizer, &stat->m_misc);
     
     /* Combine stats for all operations */
-    all.aggregate(&read);
-    all.aggregate(&write);
-    all.aggregate(&misc);
-  //all.aggregate(&stat->m_read);
-  //all.aggregate(&stat->m_write);
-  //all.aggregate(&stat->m_misc);
+    all.aggregate(&stat->m_read);
+    all.aggregate(&stat->m_write);
+    all.aggregate(&stat->m_misc);
+
+    m_all.set(normalizer, &all);
+  }
+};
+
+/** Row fragment for file io statistics columns. */
+struct PFS_file_io_stat_row
+{
+  PFS_byte_stat_row m_read;
+  PFS_byte_stat_row m_write;
+  PFS_byte_stat_row m_misc;
+  PFS_byte_stat_row m_all;
+  
+  inline void set(time_normalizer *normalizer, const PFS_file_io_stat *stat)
+  {
+    PFS_byte_stat all;
+
+    m_read.set(normalizer, &stat->m_read);
+    m_write.set(normalizer, &stat->m_write);
+    m_misc.set(normalizer, &stat->m_misc);
+    
+    /* Combine stats for all operations */
+    all.aggregate(&stat->m_read);
+    all.aggregate(&stat->m_write);
+    all.aggregate(&stat->m_misc);
 
     m_all.set(normalizer, &all);
   }

=== modified file 'storage/perfschema/table_socket_summary_by_instance.cc'
--- a/storage/perfschema/table_socket_summary_by_instance.cc	2011-08-18 12:27:21 +0000
+++ b/storage/perfschema/table_socket_summary_by_instance.cc	2011-09-02 20:03:36 +0000
@@ -15,7 +15,7 @@
 
 /**
   @file storage/perfschema/table_socket_summary_by_instance.cc
-  Table SOCKET_INSTANCES (implementation).
+  Table SOCKET_SUMMARY_BY_INSTANCE (implementation).
 */
 
 #include "my_global.h"

=== modified file 'support-files/mysql.spec.sh'
--- a/support-files/mysql.spec.sh	2011-08-19 17:33:26 +0000
+++ b/support-files/mysql.spec.sh	2011-08-30 11:12:13 +0000
@@ -970,6 +970,7 @@ echo "====="
 %doc %attr(644, root, man) %{_mandir}/man1/mysqld_safe.1*
 %doc %attr(644, root, man) %{_mandir}/man1/mysqldumpslow.1*
 %doc %attr(644, root, man) %{_mandir}/man1/mysql_install_db.1*
+%doc %attr(644, root, man) %{_mandir}/man1/mysql_plugin.1*
 %doc %attr(644, root, man) %{_mandir}/man1/mysql_secure_installation.1*
 %doc %attr(644, root, man) %{_mandir}/man1/mysql_setpermission.1*
 %doc %attr(644, root, man) %{_mandir}/man1/mysql_upgrade.1*
@@ -996,11 +997,11 @@ echo "====="
 %attr(755, root, root) %{_bindir}/mysql_convert_table_format
 %attr(755, root, root) %{_bindir}/mysql_fix_extensions
 %attr(755, root, root) %{_bindir}/mysql_install_db
+%attr(755, root, root) %{_bindir}/mysql_plugin
 %attr(755, root, root) %{_bindir}/mysql_secure_installation
 %attr(755, root, root) %{_bindir}/mysql_setpermission
 %attr(755, root, root) %{_bindir}/mysql_tzinfo_to_sql
 %attr(755, root, root) %{_bindir}/mysql_upgrade
-%attr(755, root, root) %{_bindir}/mysql_plugin
 %attr(755, root, root) %{_bindir}/mysql_zap
 %attr(755, root, root) %{_bindir}/mysqlbug
 %attr(755, root, root) %{_bindir}/mysqld_multi
@@ -1133,6 +1134,10 @@ echo "====="
 # merging BK trees)
 ##############################################################################
 %changelog
+* Tue Aug 30 2011 Joerg Bruehe <joerg.bruehe@stripped>
+
+- Add the manual page for "mysql_plugin" to the server package.
+
 * Fri Aug 19 2011 Joerg Bruehe <joerg.bruehe@stripped>
 
 - Null-upmerge the fix of bug#37165: This spec file is not affected.

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5908 branch (chris.powers:3419 to 3421) Christopher Powers5 Sep