List:Commits« Previous MessageNext Message »
From:Mikael Ronstrom Date:May 19 2011 9:53am
Subject:bzr commit into mysql-trunk branch (mikael.ronstrom:3373)
View as plain text  
#At file:///home/mikael/mysql_clones/mysql-trunk-wl5136_community/ based on revid:mikael.ronstrom@stripped

 3373 Mikael Ronstrom	2011-05-19 [merge]
      merge

    removed:
      mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result
      mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result
      mysql-test/suite/perfschema/r/schema_lc0.result
      mysql-test/suite/perfschema/r/schema_lc1.result
      mysql-test/suite/perfschema/r/schema_lc2.result
      mysql-test/suite/perfschema/t/pfs_upgrade_lc0.test
      mysql-test/suite/perfschema/t/pfs_upgrade_lc1.test
      mysql-test/suite/perfschema/t/pfs_upgrade_lc2.test
      mysql-test/suite/perfschema/t/schema_lc0.test
      mysql-test/suite/perfschema/t/schema_lc1.test
      mysql-test/suite/perfschema/t/schema_lc2.test
    added:
      mysql-test/r/implicit_char_to_num_conversion.result
      mysql-test/suite/perfschema/r/pfs_upgrade.result
      mysql-test/suite/perfschema/r/schema.result
      mysql-test/suite/perfschema/t/pfs_upgrade.test
      mysql-test/suite/perfschema/t/schema.test
      mysql-test/t/implicit_char_to_num_conversion.test
      sql/mem_root_array.h
      unittest/gunit/dynarray-t.cc
    modified:
      .bzrignore
      client/mysql.cc
      include/mysql/thread_pool_priv.h
      libmysqld/lib_sql.cc
      mysql-test/collections/default.experimental
      mysql-test/include/mrr_tests.inc
      mysql-test/include/subquery.inc
      mysql-test/r/func_in_all.result
      mysql-test/r/func_time.result
      mysql-test/r/having.result
      mysql-test/r/innodb_mrr.result
      mysql-test/r/innodb_mrr_all.result
      mysql-test/r/innodb_mrr_cost.result
      mysql-test/r/innodb_mrr_cost_all.result
      mysql-test/r/innodb_mrr_cost_icp.result
      mysql-test/r/innodb_mrr_icp.result
      mysql-test/r/innodb_mrr_none.result
      mysql-test/r/myisam_mrr.result
      mysql-test/r/myisam_mrr_all.result
      mysql-test/r/myisam_mrr_cost.result
      mysql-test/r/myisam_mrr_cost_all.result
      mysql-test/r/myisam_mrr_cost_icp.result
      mysql-test/r/myisam_mrr_icp.result
      mysql-test/r/myisam_mrr_none.result
      mysql-test/r/subquery_all.result
      mysql-test/r/subquery_all_jcl6.result
      mysql-test/r/subquery_nomat_nosj.result
      mysql-test/r/subquery_nomat_nosj_jcl6.result
      mysql-test/r/subquery_none.result
      mysql-test/r/subquery_none_jcl6.result
      mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result
      mysql-test/suite/rpl/r/rpl_checksum.result
      mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test
      mysql-test/suite/rpl/t/rpl_checksum.test
      mysql-test/t/func_time.test
      mysql-test/t/having.test
      mysys/lf_alloc-pin.c
      mysys/thr_alarm.c
      packaging/WiX/ca/CMakeLists.txt
      packaging/WiX/create_msi.cmake.in
      packaging/WiX/custom_ui.wxs
      sql/binlog.h
      sql/filesort.cc
      sql/filesort_utils.cc
      sql/ha_ndbcluster.cc
      sql/ha_partition.cc
      sql/ha_partition.h
      sql/handler.cc
      sql/item_cmpfunc.cc
      sql/item_func.h
      sql/item_timefunc.cc
      sql/item_xmlfunc.cc
      sql/item_xmlfunc.h
      sql/log_event.cc
      sql/mysqld.cc
      sql/mysqld.h
      sql/opt_range.cc
      sql/rpl_info_file.cc
      sql/rpl_injector.cc
      sql/rpl_injector.h
      sql/rpl_master.cc
      sql/rpl_rli.cc
      sql/rpl_rli.h
      sql/rpl_slave.cc
      sql/sql_acl.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_const.h
      sql/sql_partition.h
      sql/sql_select.cc
      sql/sql_select.h
      sql/sql_test.cc
      sql/sql_test.h
      sql/transaction.cc
      sql/uniques.cc
      storage/innobase/handler/i_s.cc
      storage/perfschema/pfs.cc
      storage/perfschema/pfs_instr_class.cc
      storage/perfschema/pfs_instr_class.h
      storage/perfschema/pfs_setup_object.h
      storage/perfschema/table_setup_instruments.cc
      storage/perfschema/table_setup_instruments.h
      strings/decimal.c
      unittest/gunit/CMakeLists.txt
      unittest/mysys/lf-t.c
=== modified file '.bzrignore'
--- a/.bzrignore	revid:mikael.ronstrom@stripped
+++ b/.bzrignore	revid:mikael.ronstrom@stripped
@@ -3159,3 +3159,4 @@ VERSION.dep
 info_macros.cmake
 Docs/INFO_BIN
 Docs/INFO_SRC
+Testing

=== modified file 'client/mysql.cc'
--- a/client/mysql.cc	revid:mikael.ronstrom@stripped
+++ b/client/mysql.cc	revid:mikael.ronstrom@stripped
@@ -3764,8 +3764,6 @@ com_tee(String *buffer __attribute__((un
 {
   char file_name[FN_REFLEN], *end, *param;
 
-  if (status.batch)
-    return 0;
   while (my_isspace(charset_info,*line))
     line++;
   if (!(param = strchr(line, ' '))) // if outfile wasn't given, use the default

=== modified file 'include/mysql/thread_pool_priv.h'
--- a/include/mysql/thread_pool_priv.h	revid:mikael.ronstrom@stripped
+++ b/include/mysql/thread_pool_priv.h	revid:mikael.ronstrom@stripped
@@ -94,8 +94,10 @@ bool thd_is_connection_alive(THD *thd);
 void close_connection(THD *thd, uint errcode);
 /* End the connection before closing it */
 void end_connection(THD *thd);
+/* Decrement connection counter */
+void dec_connection_count();
 /* Destroy THD object */
-void unlink_thd(THD *thd);
+void delete_thd(THD *thd);
 
 /*
   thread_created is maintained by thread pool when activated since

=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc	revid:mikael.ronstrom@stripped
+++ b/libmysqld/lib_sql.cc	revid:mikael.ronstrom@stripped
@@ -50,6 +50,24 @@ extern "C" void unireg_clear(int exit_co
   DBUG_VOID_RETURN;
 }
 
+/*
+  Wrapper error handler for embedded server to call client/server error 
+  handler based on whether thread is in client/server context
+*/
+
+static void embedded_error_handler(uint error, const char *str, myf MyFlags)
+{
+  DBUG_ENTER("embedded_error_handler");
+
+  /* 
+    If current_thd is NULL, it means restore_global has been called and 
+    thread is in client context, then call client error handler else call 
+    server error handler.
+  */
+  DBUG_RETURN(current_thd ? my_message_sql(error, str, MyFlags):
+              my_message_stderr(error, str, MyFlags));
+}
+
 
 /*
   Reads error information from the MYSQL_DATA and puts
@@ -106,7 +124,8 @@ emb_advanced_command(MYSQL *mysql, enum 
   if (mysql->status != MYSQL_STATUS_READY)
   {
     set_mysql_error(mysql, CR_COMMANDS_OUT_OF_SYNC, unknown_sqlstate);
-    return 1;
+    result= 1;
+    goto end;
   }
 
   /* Clear result variables */
@@ -147,6 +166,9 @@ emb_advanced_command(MYSQL *mysql, enum 
 #if defined(ENABLED_PROFILING)
   thd->profiling.finish_current_query();
 #endif
+
+end:
+  thd->restore_globals();
   return result;
 }
 
@@ -555,7 +577,10 @@ int init_embedded_server(int argc, char 
     return 1;
   }
 
-  error_handler_hook = my_message_sql;
+  /* 
+    set error_handler_hook to embedded_error_handler wrapper.
+  */
+  error_handler_hook= embedded_error_handler;
 
   acl_error= 0;
 #ifndef NO_EMBEDDED_ACCESS_CHECKS

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	revid:mikael.ronstrom@stripped
+++ b/mysql-test/collections/default.experimental	revid:mikael.ronstrom@stripped
@@ -37,7 +37,7 @@ sys_vars.wait_timeout_func              
 sys_vars.ndb_log_update_as_write_basic
 sys_vars.have_ndbcluster_basic
 sys_vars.ndb_log_updated_only_basic
-sys_vars.rpl_init_slave_func # Bug#12535301 2011-05-09 andrei sys_vars.rpl_init_slave_func mismatches in daily-5.5
+sys_vars.rpl_init_slave_func		 # Bug#12535301 2011-05-09 andrei sys_vars.rpl_init_slave_func mismatches in daily-5.5
 
 rpl_bhs.*                                # skozlov : WL#5139 - rpl_bhs suite generated "on-the-fly" at testing moment from rpl suite
 main.gis-rtree                           # svoj: due to BUG#38965

=== modified file 'mysql-test/include/mrr_tests.inc'
--- a/mysql-test/include/mrr_tests.inc	revid:mikael.ronstrom@stripped
+++ b/mysql-test/include/mrr_tests.inc	revid:mikael.ronstrom@stripped
@@ -377,3 +377,36 @@ eval EXPLAIN $query;
 eval $query;
 
 DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+--echo #
+
+# This test should run with join cache level 0
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+
+CREATE TABLE t1 (
+  pk INTEGER,
+  c1 VARCHAR(1) NOT NULL,
+  PRIMARY KEY (pk)
+);
+
+CREATE TABLE t2 (
+  c1 VARCHAR(1) NOT NULL
+);
+
+INSERT INTO t2 VALUES ('v'), ('c');
+
+let query=
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+
+eval EXPLAIN $query;
+eval $query;
+
+DROP TABLE t1,t2;
+
+# Restore join cache level to its original value
+set optimizer_join_cache_level= @save_join_cache_level;

=== modified file 'mysql-test/include/subquery.inc'
--- a/mysql-test/include/subquery.inc	revid:mikael.ronstrom@stripped
+++ b/mysql-test/include/subquery.inc	revid:mikael.ronstrom@stripped
@@ -4740,8 +4740,6 @@ CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN (
 CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
 DROP VIEW v1, v2;
 
---echo End of 5.1 tests.
-
 #
 # Bug #47904 Incorrect results w/ table subquery, derived SQs, and LEFT JOIN on index
 #
@@ -5101,6 +5099,54 @@ SELECT 1 FROM 
 
 DROP TABLE t1;
 
+--echo #
+--echo # Bug#11764086: Null left operand to NOT IN in WHERE clause
+--echo # behaves differently than real NULL
+--echo #
+
+CREATE TABLE parent (id int);
+INSERT INTO parent VALUES (1), (2);
+
+CREATE TABLE child (parent_id int, other int);
+INSERT INTO child VALUES (1,NULL);
+
+--echo # Offending query (c.parent_id is NULL for null-complemented rows only)
+
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id NOT IN (
+              SELECT parent_id 
+              FROM   child
+              WHERE  parent_id = 3
+          );
+
+--echo # Some syntactic variations with IS FALSE and IS NOT TRUE
+
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+              SELECT parent_id 
+              FROM   child
+              WHERE  parent_id = 3
+          ) IS NOT TRUE;
+
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+              SELECT parent_id 
+              FROM   child
+              WHERE  parent_id = 3
+          ) IS FALSE;
+
+DROP TABLE parent, child;
+
+--echo # End of test for bug#11764086.
 
 --echo End of 5.5 tests.
 

=== modified file 'mysql-test/r/func_in_all.result'
--- a/mysql-test/r/func_in_all.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/func_in_all.result	revid:mikael.ronstrom@stripped
@@ -806,5 +806,16 @@ WHERE 1+NULL NOT IN
 (SELECT i FROM subq WHERE subq.pk = t1.pk);
 pk	i
 DROP TABLE t1,subq;
+#
+# Bug #11766270  59343: YEAR(4): INCORRECT RESULT AND VALGRIND WARNINGS WITH MIN/MAX, UNION
+#
+CREATE TABLE t1(f1 YEAR(4));
+INSERT INTO t1 VALUES (0000),(2001);
+(SELECT MAX(f1) FROM t1) UNION (SELECT MAX(f1) FROM t1);
+Catalog	Database	Table	Table_alias	Column	Column_alias	Type	Length	Max length	Is_null	Flags	Decimals	Charsetnr
+def				MAX(f1)	MAX(f1)	13	4	4	Y	32864	0	63
+MAX(f1)
+2001
+DROP TABLE t1;
 End of 5.1 tests
 set optimizer_switch=default;

=== modified file 'mysql-test/r/func_time.result'
--- a/mysql-test/r/func_time.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/func_time.result	revid:mikael.ronstrom@stripped
@@ -1389,6 +1389,15 @@ NULL
 SELECT DATE_FORMAT('0000-00-11', '%w');
 DATE_FORMAT('0000-00-11', '%w')
 NULL
+#
+# Bug#12403504  AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0
+#
+SELECT MAKEDATE(11111111,1);
+MAKEDATE(11111111,1)
+NULL
+SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
+WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1)
+NULL
 End of 5.1 tests
 #
 # BUG#43578 "MyISAM&Maria gives wrong rows with range access

=== modified file 'mysql-test/r/having.result'
--- a/mysql-test/r/having.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/having.result	revid:mikael.ronstrom@stripped
@@ -589,3 +589,27 @@ pk	field1
 1	7
 drop table `t1`;
 End of 5.5 tests
+#
+# Bug#12402590 ASSERT AT PROTOCOL::END_STATEMENT ON MYSQL-TRUNK
+#              RUNNING RQG_OPT_SUBQUERY TEST
+#
+CREATE TABLE t2 (
+f1 INT,
+PRIMARY KEY (f1)
+);
+INSERT INTO t2 VALUES (1), (2);
+CREATE TABLE t1 (
+f1 INT,
+f2 VARCHAR(1),
+f3 VARCHAR(1),
+PRIMARY KEY (f1),
+KEY (f2, f1)
+);
+INSERT INTO t1 VALUES (8, 'g', 'g'), (11, 'a', 'a');
+SELECT t1.f1 FROM t1 JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f3 AND t1.f2 IN ('f')
+HAVING (1 ,6) IN (SELECT 3, 6)
+ORDER BY t1.f1;
+f1
+DROP TABLE t1, t2;
+End of 5.6 tests

=== added file 'mysql-test/r/implicit_char_to_num_conversion.result'
--- a/mysql-test/r/implicit_char_to_num_conversion.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/implicit_char_to_num_conversion.result	revid:mikael.ronstrom@stripped
@@ -0,0 +1,366 @@
+DROP TABLE IF EXISTS t5;
+CREATE TABLE t5(c1  BIT(2) PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (0), (1), (2);
+SELECT HEX(c1) FROM t5 ORDER BY c1;
+HEX(c1)
+0
+1
+2
+SELECT HEX(c1) FROM t5 WHERE c1 = b'1' ORDER BY c1;
+HEX(c1)
+1
+SELECT HEX(c1) FROM t5 WHERE c1 <=> b'1' ORDER BY c1;
+HEX(c1)
+1
+SELECT HEX(c1) FROM t5 WHERE c1 != b'1' ORDER BY c1;
+HEX(c1)
+0
+2
+SELECT HEX(c1) FROM t5 WHERE c1 >= '1' ORDER BY c1;
+HEX(c1)
+1
+2
+SELECT HEX(c1) FROM t5 WHERE c1 <= '1' ORDER BY c1;
+HEX(c1)
+0
+1
+SELECT HEX(c1) FROM t5 WHERE c1 < '1' ORDER BY c1;
+HEX(c1)
+0
+SELECT HEX(c1) FROM t5 WHERE c1 > '0' ORDER BY c1;
+HEX(c1)
+1
+2
+DROP TABLE t5;
+CREATE TABLE t5(c1 FLOAT(5,2) PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (95.95), (-10.10), (1), (0);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-10.10
+0.00
+1.00
+95.95
+SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
+c1
+95.95
+SELECT c1 FROM t5 WHERE c1 <= '10.10' ORDER BY c1;
+c1
+-10.10
+0.00
+1.00
+SELECT c1 FROM t5 WHERE c1 != '1' ORDER BY c1;
+c1
+-10.10
+0.00
+95.95
+SELECT c1 FROM t5 WHERE c1 < '1' ORDER BY c1;
+c1
+-10.10
+0.00
+SELECT c1 FROM t5 WHERE c1 > '0' ORDER BY c1;
+c1
+1.00
+95.95
+DROP TABLE t5;
+CREATE TABLE t5(c1 TINYINT PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (95), (10),(11),(-8);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-8
+10
+11
+95
+SELECT c1 FROM t5 WHERE c1 = '10' ORDER BY c1;
+c1
+10
+SELECT c1 FROM t5 WHERE c1 <=> '10' ORDER BY c1;
+c1
+10
+SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
+c1
+95
+SELECT c1 FROM t5 WHERE c1 <= '11' ORDER BY c1;
+c1
+-8
+10
+11
+SELECT c1 FROM t5 WHERE c1 != '-8' ORDER BY c1;
+c1
+10
+11
+95
+SELECT c1 FROM t5 WHERE c1 < '11' ORDER BY c1;
+c1
+-8
+10
+SELECT c1 FROM t5 WHERE c1 > '10' ORDER BY c1;
+c1
+11
+95
+DROP TABLE t5;
+CREATE TABLE t5(c1 SMALLINT PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (395), (-200), (100), (111);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-200
+100
+111
+395
+SELECT c1 FROM t5 WHERE c1 = '100' ORDER BY c1;
+c1
+100
+SELECT c1 FROM t5 WHERE c1 <=> '100' ORDER BY c1;
+c1
+100
+SELECT c1 FROM t5 WHERE c1 >= '395' ORDER BY c1;
+c1
+395
+SELECT c1 FROM t5 WHERE c1 <= '-200' ORDER BY c1;
+c1
+-200
+SELECT c1 FROM t5 WHERE c1 != '100' ORDER BY c1;
+c1
+-200
+111
+395
+SELECT c1 FROM t5 WHERE c1 < '111' ORDER BY c1;
+c1
+-200
+100
+SELECT c1 FROM t5 WHERE c1 > '111' ORDER BY c1;
+c1
+395
+DROP TABLE t5;
+CREATE TABLE t5(c1 MEDIUMINT PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (-8388607), (311),(215),(88608);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-8388607
+215
+311
+88608
+SELECT c1 FROM t5 WHERE c1 = '311' ORDER BY c1;
+c1
+311
+SELECT c1 FROM t5 WHERE c1 <=> '311' ORDER BY c1;
+c1
+311
+SELECT c1 FROM t5 WHERE c1 >= '215' ORDER BY c1;
+c1
+215
+311
+88608
+SELECT c1 FROM t5 WHERE c1 <= '88608' ORDER BY c1;
+c1
+-8388607
+215
+311
+88608
+SELECT c1 FROM t5 WHERE c1 != '-8388607' ORDER BY c1;
+c1
+215
+311
+88608
+SELECT c1 FROM t5 WHERE c1 < '215' ORDER BY c1;
+c1
+-8388607
+SELECT c1 FROM t5 WHERE c1 > '215' ORDER BY c1;
+c1
+311
+88608
+DROP TABLE t5;
+CREATE TABLE t5(c1 INT PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (-2147483647), (1011),(15),(9388607);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-2147483647
+15
+1011
+9388607
+SELECT c1 FROM t5 WHERE c1 = '9388607' ORDER BY c1;
+c1
+9388607
+SELECT c1 FROM t5 WHERE c1 <=> '9388607' ORDER BY c1;
+c1
+9388607
+SELECT c1 FROM t5 WHERE c1 >= '15' ORDER BY c1;
+c1
+15
+1011
+9388607
+SELECT c1 FROM t5 WHERE c1 <= '1011' ORDER BY c1;
+c1
+-2147483647
+15
+1011
+SELECT c1 FROM t5 WHERE c1 != '-2147483647' ORDER BY c1;
+c1
+15
+1011
+9388607
+SELECT c1 FROM t5 WHERE c1 < '15' ORDER BY c1;
+c1
+-2147483647
+SELECT c1 FROM t5 WHERE c1 > '15' ORDER BY c1;
+c1
+1011
+9388607
+DROP TABLE t5;
+CREATE TABLE t5(c1 BIGINT PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (-9223372036854775807), (12011),(500),(3372036854775808);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-9223372036854775807
+500
+12011
+3372036854775808
+SELECT c1 FROM t5 WHERE c1 = '-9223372036854775807' ORDER BY c1;
+c1
+-9223372036854775807
+SELECT c1 FROM t5 WHERE c1 <=> '-9223372036854775807' ORDER BY c1;
+c1
+-9223372036854775807
+SELECT c1 FROM t5 WHERE c1 >= '12011' ORDER BY c1;
+c1
+12011
+3372036854775808
+SELECT c1 FROM t5 WHERE c1 <= '500' ORDER BY c1;
+c1
+-9223372036854775807
+500
+SELECT c1 FROM t5 WHERE c1 != '3372036854775808' ORDER BY c1;
+c1
+-9223372036854775807
+500
+12011
+SELECT c1 FROM t5 WHERE c1 < '12011' ORDER BY c1;
+c1
+-9223372036854775807
+500
+SELECT c1 FROM t5 WHERE c1 > '12011' ORDER BY c1;
+c1
+3372036854775808
+DROP TABLE t5;
+CREATE TABLE t5(c1 DOUBLE(5,2) PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+DROP TABLE t5;
+CREATE TABLE t5(c1 NUMERIC(5,2) PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+DROP TABLE t5;
+CREATE TABLE t5(c1 DECIMAL(5,2)  PRIMARY KEY) ENGINE = <default_engine>;
+INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
+SELECT c1 FROM t5 ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
+c1
+11.11
+SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
+c1
+-908.92
+5.00
+11.11
+SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
+c1
+5.00
+11.11
+95.95
+DROP TABLE t5;

=== modified file 'mysql-test/r/innodb_mrr.result'
--- a/mysql-test/r/innodb_mrr.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/innodb_mrr.result	revid:mikael.ronstrom@stripped
@@ -543,6 +543,32 @@ ORDER BY i1;
 i1
 DROP TABLE t1, t2;
 #
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
+#
 # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
 #
 SET AUTOCOMMIT=0;

=== modified file 'mysql-test/r/innodb_mrr_all.result'
--- a/mysql-test/r/innodb_mrr_all.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/innodb_mrr_all.result	revid:mikael.ronstrom@stripped
@@ -543,6 +543,32 @@ ORDER BY i1;
 i1
 DROP TABLE t1, t2;
 #
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition; Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
+#
 # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
 #
 SET AUTOCOMMIT=0;

=== modified file 'mysql-test/r/innodb_mrr_cost.result'
--- a/mysql-test/r/innodb_mrr_cost.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/innodb_mrr_cost.result	revid:mikael.ronstrom@stripped
@@ -543,6 +543,32 @@ ORDER BY i1;
 i1
 DROP TABLE t1, t2;
 #
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
+#
 # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
 #
 SET AUTOCOMMIT=0;

=== modified file 'mysql-test/r/innodb_mrr_cost_all.result'
--- a/mysql-test/r/innodb_mrr_cost_all.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/innodb_mrr_cost_all.result	revid:mikael.ronstrom@stripped
@@ -543,6 +543,32 @@ ORDER BY i1;
 i1
 DROP TABLE t1, t2;
 #
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition; Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
+#
 # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
 #
 SET AUTOCOMMIT=0;

=== modified file 'mysql-test/r/innodb_mrr_cost_icp.result'
--- a/mysql-test/r/innodb_mrr_cost_icp.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/innodb_mrr_cost_icp.result	revid:mikael.ronstrom@stripped
@@ -543,6 +543,32 @@ ORDER BY i1;
 i1
 DROP TABLE t1, t2;
 #
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition; Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
+#
 # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
 #
 SET AUTOCOMMIT=0;

=== modified file 'mysql-test/r/innodb_mrr_icp.result'
--- a/mysql-test/r/innodb_mrr_icp.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/innodb_mrr_icp.result	revid:mikael.ronstrom@stripped
@@ -543,6 +543,32 @@ ORDER BY i1;
 i1
 DROP TABLE t1, t2;
 #
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition; Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
+#
 # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
 #
 SET AUTOCOMMIT=0;

=== modified file 'mysql-test/r/innodb_mrr_none.result'
--- a/mysql-test/r/innodb_mrr_none.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/innodb_mrr_none.result	revid:mikael.ronstrom@stripped
@@ -542,6 +542,32 @@ ORDER BY i1;
 i1
 DROP TABLE t1, t2;
 #
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
+#
 # Bug#41029 "MRR: SELECT FOR UPDATE fails to lock gaps (InnoDB table)"
 #
 SET AUTOCOMMIT=0;

=== modified file 'mysql-test/r/myisam_mrr.result'
--- a/mysql-test/r/myisam_mrr.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/myisam_mrr.result	revid:mikael.ronstrom@stripped
@@ -544,5 +544,31 @@ AND t2.pk IS  NULL
 ORDER BY i1;
 i1
 DROP TABLE t1, t2;
+#
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using where; Using MRR
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
 set @@read_rnd_buffer_size= @read_rnd_buffer_size_save;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/myisam_mrr_all.result'
--- a/mysql-test/r/myisam_mrr_all.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/myisam_mrr_all.result	revid:mikael.ronstrom@stripped
@@ -544,5 +544,31 @@ AND t2.pk IS  NULL
 ORDER BY i1;
 i1
 DROP TABLE t1, t2;
+#
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition; Using where; Using MRR
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
 set @@read_rnd_buffer_size= @read_rnd_buffer_size_save;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/myisam_mrr_cost.result'
--- a/mysql-test/r/myisam_mrr_cost.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/myisam_mrr_cost.result	revid:mikael.ronstrom@stripped
@@ -544,5 +544,31 @@ AND t2.pk IS  NULL
 ORDER BY i1;
 i1
 DROP TABLE t1, t2;
+#
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
 set @@read_rnd_buffer_size= @read_rnd_buffer_size_save;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/myisam_mrr_cost_all.result'
--- a/mysql-test/r/myisam_mrr_cost_all.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/myisam_mrr_cost_all.result	revid:mikael.ronstrom@stripped
@@ -544,5 +544,31 @@ AND t2.pk IS  NULL
 ORDER BY i1;
 i1
 DROP TABLE t1, t2;
+#
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition; Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
 set @@read_rnd_buffer_size= @read_rnd_buffer_size_save;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/myisam_mrr_cost_icp.result'
--- a/mysql-test/r/myisam_mrr_cost_icp.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/myisam_mrr_cost_icp.result	revid:mikael.ronstrom@stripped
@@ -544,5 +544,31 @@ AND t2.pk IS  NULL
 ORDER BY i1;
 i1
 DROP TABLE t1, t2;
+#
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition; Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
 set @@read_rnd_buffer_size= @read_rnd_buffer_size_save;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/myisam_mrr_icp.result'
--- a/mysql-test/r/myisam_mrr_icp.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/myisam_mrr_icp.result	revid:mikael.ronstrom@stripped
@@ -544,5 +544,31 @@ AND t2.pk IS  NULL
 ORDER BY i1;
 i1
 DROP TABLE t1, t2;
+#
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition; Using where; Using MRR
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
 set @@read_rnd_buffer_size= @read_rnd_buffer_size_save;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/myisam_mrr_none.result'
--- a/mysql-test/r/myisam_mrr_none.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/myisam_mrr_none.result	revid:mikael.ronstrom@stripped
@@ -543,5 +543,31 @@ AND t2.pk IS  NULL
 ORDER BY i1;
 i1
 DROP TABLE t1, t2;
+#
+# Bug#12321461: CRASH IN DSMRR_IMPL::DSMRR_INIT ON SELECT STRAIGHT_JOIN
+#
+set @save_join_cache_level= @@optimizer_join_cache_level;
+set optimizer_join_cache_level=0;
+CREATE TABLE t1 (
+pk INTEGER,
+c1 VARCHAR(1) NOT NULL,
+PRIMARY KEY (pk)
+);
+CREATE TABLE t2 (
+c1 VARCHAR(1) NOT NULL
+);
+INSERT INTO t2 VALUES ('v'), ('c');
+EXPLAIN SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t2	ALL	NULL	NULL	NULL	NULL	2	
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using where
+SELECT STRAIGHT_JOIN t1.c1
+FROM t1 RIGHT OUTER JOIN t2 ON t1.c1 = t2.c1
+WHERE t1.pk > 176;
+c1
+DROP TABLE t1,t2;
+set optimizer_join_cache_level= @save_join_cache_level;
 set @@read_rnd_buffer_size= @read_rnd_buffer_size_save;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/subquery_all.result'
--- a/mysql-test/r/subquery_all.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/subquery_all.result	revid:mikael.ronstrom@stripped
@@ -5900,7 +5900,6 @@ Note	1249	Select 2 was reduced during op
 CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
 CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
 DROP VIEW v1, v2;
-End of 5.1 tests.
 Set up test tables.
 CREATE TABLE t1 (
 t1_id INT UNSIGNED,
@@ -6242,6 +6241,54 @@ SELECT 1 FROM 
 1) FROM t1) AS e;
 ERROR 21000: Operand should contain 1 column(s)
 DROP TABLE t1;
+#
+# Bug#11764086: Null left operand to NOT IN in WHERE clause
+# behaves differently than real NULL
+#
+CREATE TABLE parent (id int);
+INSERT INTO parent VALUES (1), (2);
+CREATE TABLE child (parent_id int, other int);
+INSERT INTO child VALUES (1,NULL);
+# Offending query (c.parent_id is NULL for null-complemented rows only)
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id NOT IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+);
+id	parent_id
+1	1
+2	NULL
+# Some syntactic variations with IS FALSE and IS NOT TRUE
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS NOT TRUE;
+id	parent_id
+1	1
+2	NULL
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS FALSE;
+id	parent_id
+1	1
+2	NULL
+DROP TABLE parent, child;
+# End of test for bug#11764086.
 End of 5.5 tests.
 #
 # BUG#48920: COUNT DISTINCT returns 1 for NULL values when in a subquery 

=== modified file 'mysql-test/r/subquery_all_jcl6.result'
--- a/mysql-test/r/subquery_all_jcl6.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/subquery_all_jcl6.result	revid:mikael.ronstrom@stripped
@@ -5904,7 +5904,6 @@ Note	1249	Select 2 was reduced during op
 CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
 CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
 DROP VIEW v1, v2;
-End of 5.1 tests.
 Set up test tables.
 CREATE TABLE t1 (
 t1_id INT UNSIGNED,
@@ -6217,6 +6216,24 @@ id	select_type	table	type	possible_keys	
 DROP TABLE t2;
 DROP TABLE t1;
 #
+# Bug #11765713 58705:
+# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
+# CREATED BY OPT_SUM_QUERY
+#
+CREATE TABLE t1(a INT NOT NULL, KEY (a));
+INSERT INTO t1 VALUES (0), (1);
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1)
+);
+ERROR 21000: Subquery returns more than 1 row
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1 where a is null)
+);
+foo
+DROP TABLE t1;
+#
 # Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool): 
 #             Assertion `file' failed.
 #
@@ -6228,6 +6245,54 @@ SELECT 1 FROM 
 1) FROM t1) AS e;
 ERROR 21000: Operand should contain 1 column(s)
 DROP TABLE t1;
+#
+# Bug#11764086: Null left operand to NOT IN in WHERE clause
+# behaves differently than real NULL
+#
+CREATE TABLE parent (id int);
+INSERT INTO parent VALUES (1), (2);
+CREATE TABLE child (parent_id int, other int);
+INSERT INTO child VALUES (1,NULL);
+# Offending query (c.parent_id is NULL for null-complemented rows only)
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id NOT IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+);
+id	parent_id
+1	1
+2	NULL
+# Some syntactic variations with IS FALSE and IS NOT TRUE
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS NOT TRUE;
+id	parent_id
+1	1
+2	NULL
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS FALSE;
+id	parent_id
+1	1
+2	NULL
+DROP TABLE parent, child;
+# End of test for bug#11764086.
 End of 5.5 tests.
 #
 # BUG#48920: COUNT DISTINCT returns 1 for NULL values when in a subquery 

=== modified file 'mysql-test/r/subquery_nomat_nosj.result'
--- a/mysql-test/r/subquery_nomat_nosj.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/subquery_nomat_nosj.result	revid:mikael.ronstrom@stripped
@@ -5900,7 +5900,6 @@ Note	1249	Select 2 was reduced during op
 CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
 CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
 DROP VIEW v1, v2;
-End of 5.1 tests.
 Set up test tables.
 CREATE TABLE t1 (
 t1_id INT UNSIGNED,
@@ -6242,6 +6241,54 @@ SELECT 1 FROM 
 1) FROM t1) AS e;
 ERROR 21000: Operand should contain 1 column(s)
 DROP TABLE t1;
+#
+# Bug#11764086: Null left operand to NOT IN in WHERE clause
+# behaves differently than real NULL
+#
+CREATE TABLE parent (id int);
+INSERT INTO parent VALUES (1), (2);
+CREATE TABLE child (parent_id int, other int);
+INSERT INTO child VALUES (1,NULL);
+# Offending query (c.parent_id is NULL for null-complemented rows only)
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id NOT IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+);
+id	parent_id
+1	1
+2	NULL
+# Some syntactic variations with IS FALSE and IS NOT TRUE
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS NOT TRUE;
+id	parent_id
+1	1
+2	NULL
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS FALSE;
+id	parent_id
+1	1
+2	NULL
+DROP TABLE parent, child;
+# End of test for bug#11764086.
 End of 5.5 tests.
 #
 # BUG#48920: COUNT DISTINCT returns 1 for NULL values when in a subquery 

=== modified file 'mysql-test/r/subquery_nomat_nosj_jcl6.result'
--- a/mysql-test/r/subquery_nomat_nosj_jcl6.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/subquery_nomat_nosj_jcl6.result	revid:mikael.ronstrom@stripped
@@ -5904,7 +5904,6 @@ Note	1249	Select 2 was reduced during op
 CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
 CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
 DROP VIEW v1, v2;
-End of 5.1 tests.
 Set up test tables.
 CREATE TABLE t1 (
 t1_id INT UNSIGNED,
@@ -6217,6 +6216,24 @@ id	select_type	table	type	possible_keys	
 DROP TABLE t2;
 DROP TABLE t1;
 #
+# Bug #11765713 58705:
+# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
+# CREATED BY OPT_SUM_QUERY
+#
+CREATE TABLE t1(a INT NOT NULL, KEY (a));
+INSERT INTO t1 VALUES (0), (1);
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1)
+);
+ERROR 21000: Subquery returns more than 1 row
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1 where a is null)
+);
+foo
+DROP TABLE t1;
+#
 # Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool): 
 #             Assertion `file' failed.
 #
@@ -6228,6 +6245,54 @@ SELECT 1 FROM 
 1) FROM t1) AS e;
 ERROR 21000: Operand should contain 1 column(s)
 DROP TABLE t1;
+#
+# Bug#11764086: Null left operand to NOT IN in WHERE clause
+# behaves differently than real NULL
+#
+CREATE TABLE parent (id int);
+INSERT INTO parent VALUES (1), (2);
+CREATE TABLE child (parent_id int, other int);
+INSERT INTO child VALUES (1,NULL);
+# Offending query (c.parent_id is NULL for null-complemented rows only)
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id NOT IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+);
+id	parent_id
+1	1
+2	NULL
+# Some syntactic variations with IS FALSE and IS NOT TRUE
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS NOT TRUE;
+id	parent_id
+1	1
+2	NULL
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS FALSE;
+id	parent_id
+1	1
+2	NULL
+DROP TABLE parent, child;
+# End of test for bug#11764086.
 End of 5.5 tests.
 #
 # BUG#48920: COUNT DISTINCT returns 1 for NULL values when in a subquery 

=== modified file 'mysql-test/r/subquery_none.result'
--- a/mysql-test/r/subquery_none.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/subquery_none.result	revid:mikael.ronstrom@stripped
@@ -5899,7 +5899,6 @@ Note	1249	Select 2 was reduced during op
 CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
 CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
 DROP VIEW v1, v2;
-End of 5.1 tests.
 Set up test tables.
 CREATE TABLE t1 (
 t1_id INT UNSIGNED,
@@ -6241,6 +6240,54 @@ SELECT 1 FROM 
 1) FROM t1) AS e;
 ERROR 21000: Operand should contain 1 column(s)
 DROP TABLE t1;
+#
+# Bug#11764086: Null left operand to NOT IN in WHERE clause
+# behaves differently than real NULL
+#
+CREATE TABLE parent (id int);
+INSERT INTO parent VALUES (1), (2);
+CREATE TABLE child (parent_id int, other int);
+INSERT INTO child VALUES (1,NULL);
+# Offending query (c.parent_id is NULL for null-complemented rows only)
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id NOT IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+);
+id	parent_id
+1	1
+2	NULL
+# Some syntactic variations with IS FALSE and IS NOT TRUE
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS NOT TRUE;
+id	parent_id
+1	1
+2	NULL
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS FALSE;
+id	parent_id
+1	1
+2	NULL
+DROP TABLE parent, child;
+# End of test for bug#11764086.
 End of 5.5 tests.
 #
 # BUG#48920: COUNT DISTINCT returns 1 for NULL values when in a subquery 

=== modified file 'mysql-test/r/subquery_none_jcl6.result'
--- a/mysql-test/r/subquery_none_jcl6.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/r/subquery_none_jcl6.result	revid:mikael.ronstrom@stripped
@@ -5903,7 +5903,6 @@ Note	1249	Select 2 was reduced during op
 CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
 CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
 DROP VIEW v1, v2;
-End of 5.1 tests.
 Set up test tables.
 CREATE TABLE t1 (
 t1_id INT UNSIGNED,
@@ -6216,6 +6215,24 @@ id	select_type	table	type	possible_keys	
 DROP TABLE t2;
 DROP TABLE t1;
 #
+# Bug #11765713 58705:
+# OPTIMIZER LET ENGINE DEPEND ON UNINITIALIZED VALUES
+# CREATED BY OPT_SUM_QUERY
+#
+CREATE TABLE t1(a INT NOT NULL, KEY (a));
+INSERT INTO t1 VALUES (0), (1);
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1)
+);
+ERROR 21000: Subquery returns more than 1 row
+SELECT 1 as foo FROM t1 WHERE a < SOME
+(SELECT a FROM t1 WHERE a <=>
+(SELECT a FROM t1 where a is null)
+);
+foo
+DROP TABLE t1;
+#
 # Bug #57704: Cleanup code dies with void TABLE::set_keyread(bool): 
 #             Assertion `file' failed.
 #
@@ -6227,6 +6244,54 @@ SELECT 1 FROM 
 1) FROM t1) AS e;
 ERROR 21000: Operand should contain 1 column(s)
 DROP TABLE t1;
+#
+# Bug#11764086: Null left operand to NOT IN in WHERE clause
+# behaves differently than real NULL
+#
+CREATE TABLE parent (id int);
+INSERT INTO parent VALUES (1), (2);
+CREATE TABLE child (parent_id int, other int);
+INSERT INTO child VALUES (1,NULL);
+# Offending query (c.parent_id is NULL for null-complemented rows only)
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id NOT IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+);
+id	parent_id
+1	1
+2	NULL
+# Some syntactic variations with IS FALSE and IS NOT TRUE
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS NOT TRUE;
+id	parent_id
+1	1
+2	NULL
+SELECT    p.id, c.parent_id
+FROM      parent p
+LEFT JOIN child  c
+ON        p.id = c.parent_id
+WHERE     c.parent_id IN (
+SELECT parent_id 
+FROM   child
+WHERE  parent_id = 3
+) IS FALSE;
+id	parent_id
+1	1
+2	NULL
+DROP TABLE parent, child;
+# End of test for bug#11764086.
 End of 5.5 tests.
 #
 # BUG#48920: COUNT DISTINCT returns 1 for NULL values when in a subquery 

=== added file 'mysql-test/suite/perfschema/r/pfs_upgrade.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade.result	revid:mikael.ronstrom@stripped
@@ -0,0 +1,228 @@
+drop table if exists test.user_table;
+drop procedure if exists test.user_proc;
+drop function if exists test.user_func;
+drop event if exists test.user_event;
+"Testing mysql_upgrade with TABLE performance_schema.user_table"
+create table test.user_table(a int);
+use performance_schema;
+show tables like "user_table";
+Tables_in_performance_schema (user_table)
+user_table
+ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 487: Table 'threads' already exists
+ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+show tables like "user_table";
+Tables_in_performance_schema (user_table)
+user_table
+use test;
+drop table test.user_table;
+"Testing mysql_upgrade with VIEW performance_schema.user_view"
+create view test.user_view as select "Not supposed to be here";
+use performance_schema;
+show tables like "user_view";
+Tables_in_performance_schema (user_view)
+user_view
+ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 487: Table 'threads' already exists
+ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+show tables like "user_view";
+Tables_in_performance_schema (user_view)
+user_view
+use test;
+drop view test.user_view;
+"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
+create procedure test.user_proc()
+select "Not supposed to be here";
+update mysql.proc set db='performance_schema' where name='user_proc';
+ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 487: Table 'threads' already exists
+ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.proc where db='performance_schema';
+name
+user_proc
+update mysql.proc set db='test' where name='user_proc';
+drop procedure test.user_proc;
+"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
+create function test.user_func() returns integer
+return 0;
+update mysql.proc set db='performance_schema' where name='user_func';
+ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 487: Table 'threads' already exists
+ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.proc where db='performance_schema';
+name
+user_func
+update mysql.proc set db='test' where name='user_func';
+drop function test.user_func;
+"Testing mysql_upgrade with EVENT performance_schema.user_event"
+create event test.user_event on schedule every 1 day do
+select "not supposed to be here";
+update mysql.event set db='performance_schema' where name='user_event';
+ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
+ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
+ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
+ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
+ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
+ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
+ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
+ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
+ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
+ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
+ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
+ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
+ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
+ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
+ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
+ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
+ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
+ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
+ERROR 1050 (42S01) at line 487: Table 'threads' already exists
+ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
+ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
+ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
+ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
+ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
+ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
+ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
+ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
+ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
+ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
+FATAL ERROR: Upgrade failed
+select name from mysql.event where db='performance_schema';
+name
+user_event
+update mysql.event set db='test' where name='user_event';
+drop event test.user_event;

=== removed file 'mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_lc0.result	1970-01-01 00:00:00 +0000
@@ -1,228 +0,0 @@
-drop table if exists test.user_table;
-drop procedure if exists test.user_proc;
-drop function if exists test.user_func;
-drop event if exists test.user_event;
-"Testing mysql_upgrade with TABLE performance_schema.user_table"
-create table test.user_table(a int);
-use performance_schema;
-show tables like "user_table";
-Tables_in_performance_schema (user_table)
-user_table
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-show tables like "user_table";
-Tables_in_performance_schema (user_table)
-user_table
-use test;
-drop table test.user_table;
-"Testing mysql_upgrade with VIEW performance_schema.user_view"
-create view test.user_view as select "Not supposed to be here";
-use performance_schema;
-show tables like "user_view";
-Tables_in_performance_schema (user_view)
-user_view
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-show tables like "user_view";
-Tables_in_performance_schema (user_view)
-user_view
-use test;
-drop view test.user_view;
-"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
-create procedure test.user_proc()
-select "Not supposed to be here";
-update mysql.proc set db='performance_schema' where name='user_proc';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.proc where db='performance_schema';
-name
-user_proc
-update mysql.proc set db='test' where name='user_proc';
-drop procedure test.user_proc;
-"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
-create function test.user_func() returns integer
-return 0;
-update mysql.proc set db='performance_schema' where name='user_func';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.proc where db='performance_schema';
-name
-user_func
-update mysql.proc set db='test' where name='user_func';
-drop function test.user_func;
-"Testing mysql_upgrade with EVENT performance_schema.user_event"
-create event test.user_event on schedule every 1 day do
-select "not supposed to be here";
-update mysql.event set db='performance_schema' where name='user_event';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.event where db='performance_schema';
-name
-user_event
-update mysql.event set db='test' where name='user_event';
-drop event test.user_event;

=== removed file 'mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_lc1.result	1970-01-01 00:00:00 +0000
@@ -1,228 +0,0 @@
-drop table if exists test.user_table;
-drop procedure if exists test.user_proc;
-drop function if exists test.user_func;
-drop event if exists test.user_event;
-"Testing mysql_upgrade with TABLE performance_schema.user_table"
-create table test.user_table(a int);
-use performance_schema;
-show tables like "user_table";
-Tables_in_performance_schema (user_table)
-user_table
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-show tables like "user_table";
-Tables_in_performance_schema (user_table)
-user_table
-use test;
-drop table test.user_table;
-"Testing mysql_upgrade with VIEW performance_schema.user_view"
-create view test.user_view as select "Not supposed to be here";
-use performance_schema;
-show tables like "user_view";
-Tables_in_performance_schema (user_view)
-user_view
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-show tables like "user_view";
-Tables_in_performance_schema (user_view)
-user_view
-use test;
-drop view test.user_view;
-"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
-create procedure test.user_proc()
-select "Not supposed to be here";
-update mysql.proc set db='performance_schema' where name='user_proc';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.proc where db='performance_schema';
-name
-user_proc
-update mysql.proc set db='test' where name='user_proc';
-drop procedure test.user_proc;
-"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
-create function test.user_func() returns integer
-return 0;
-update mysql.proc set db='performance_schema' where name='user_func';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.proc where db='performance_schema';
-name
-user_func
-update mysql.proc set db='test' where name='user_func';
-drop function test.user_func;
-"Testing mysql_upgrade with EVENT performance_schema.user_event"
-create event test.user_event on schedule every 1 day do
-select "not supposed to be here";
-update mysql.event set db='performance_schema' where name='user_event';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.event where db='performance_schema';
-name
-user_event
-update mysql.event set db='test' where name='user_event';
-drop event test.user_event;

=== removed file 'mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result'
--- a/mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/r/pfs_upgrade_lc2.result	1970-01-01 00:00:00 +0000
@@ -1,228 +0,0 @@
-drop table if exists test.user_table;
-drop procedure if exists test.user_proc;
-drop function if exists test.user_func;
-drop event if exists test.user_event;
-"Testing mysql_upgrade with TABLE performance_schema.user_table"
-create table test.user_table(a int);
-use performance_schema;
-show tables like "user_table";
-Tables_in_performance_schema (user_table)
-user_table
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-show tables like "user_table";
-Tables_in_performance_schema (user_table)
-user_table
-use test;
-drop table test.user_table;
-"Testing mysql_upgrade with VIEW performance_schema.user_view"
-create view test.user_view as select "Not supposed to be here";
-use performance_schema;
-show tables like "user_view";
-Tables_in_performance_schema (user_view)
-user_view
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-show tables like "user_view";
-Tables_in_performance_schema (user_view)
-user_view
-use test;
-drop view test.user_view;
-"Testing mysql_upgrade with PROCEDURE performance_schema.user_proc"
-create procedure test.user_proc()
-select "Not supposed to be here";
-update mysql.proc set db='performance_schema' where name='user_proc';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.proc where db='performance_schema';
-name
-user_proc
-update mysql.proc set db='test' where name='user_proc';
-drop procedure test.user_proc;
-"Testing mysql_upgrade with FUNCTION performance_schema.user_func"
-create function test.user_func() returns integer
-return 0;
-update mysql.proc set db='performance_schema' where name='user_func';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.proc where db='performance_schema';
-name
-user_func
-update mysql.proc set db='test' where name='user_func';
-drop function test.user_func;
-"Testing mysql_upgrade with EVENT performance_schema.user_event"
-create event test.user_event on schedule every 1 day do
-select "not supposed to be here";
-update mysql.event set db='performance_schema' where name='user_event';
-ERROR 1050 (42S01) at line 70: Table 'cond_instances' already exists
-ERROR 1050 (42S01) at line 94: Table 'events_waits_current' already exists
-ERROR 1050 (42S01) at line 118: Table 'events_waits_history' already exists
-ERROR 1050 (42S01) at line 142: Table 'events_waits_history_long' already exists
-ERROR 1050 (42S01) at line 155: Table 'events_waits_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 168: Table 'events_waits_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 180: Table 'events_waits_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 189: Table 'file_instances' already exists
-ERROR 1050 (42S01) at line 200: Table 'file_summary_by_event_name' already exists
-ERROR 1050 (42S01) at line 212: Table 'file_summary_by_instance' already exists
-ERROR 1050 (42S01) at line 221: Table 'mutex_instances' already exists
-ERROR 1050 (42S01) at line 235: Table 'objects_summary_global_by_type' already exists
-ERROR 1050 (42S01) at line 245: Table 'performance_timers' already exists
-ERROR 1050 (42S01) at line 255: Table 'rwlock_instances' already exists
-ERROR 1050 (42S01) at line 264: Table 'setup_actors' already exists
-ERROR 1050 (42S01) at line 272: Table 'setup_consumers' already exists
-ERROR 1050 (42S01) at line 281: Table 'setup_instruments' already exists
-ERROR 1050 (42S01) at line 291: Table 'setup_objects' already exists
-ERROR 1050 (42S01) at line 299: Table 'setup_timers' already exists
-ERROR 1050 (42S01) at line 344: Table 'table_io_waits_summary_by_index_usage' already exists
-ERROR 1050 (42S01) at line 388: Table 'table_io_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 467: Table 'table_lock_waits_summary_by_table' already exists
-ERROR 1050 (42S01) at line 487: Table 'threads' already exists
-ERROR 1050 (42S01) at line 502: Table 'events_stages_current' already exists
-ERROR 1050 (42S01) at line 517: Table 'events_stages_history' already exists
-ERROR 1050 (42S01) at line 532: Table 'events_stages_history_long' already exists
-ERROR 1050 (42S01) at line 545: Table 'events_stages_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 557: Table 'events_stages_summary_global_by_event_name' already exists
-ERROR 1050 (42S01) at line 600: Table 'events_statements_current' already exists
-ERROR 1050 (42S01) at line 643: Table 'events_statements_history' already exists
-ERROR 1050 (42S01) at line 686: Table 'events_statements_history_long' already exists
-ERROR 1050 (42S01) at line 718: Table 'events_statements_summary_by_thread_by_event_name' already exists
-ERROR 1050 (42S01) at line 749: Table 'events_statements_summary_global_by_event_name' already exists
-ERROR 1644 (HY000) at line 1169: Unexpected content found in the performance_schema database.
-FATAL ERROR: Upgrade failed
-select name from mysql.event where db='performance_schema';
-name
-user_event
-update mysql.event set db='test' where name='user_event';
-drop event test.user_event;

=== added file 'mysql-test/suite/perfschema/r/schema.result'
--- a/mysql-test/suite/perfschema/r/schema.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/schema.result	revid:mikael.ronstrom@stripped
@@ -0,0 +1,663 @@
+show databases like 'performance_schema';
+Database (performance_schema)
+performance_schema
+show create database performance_schema;
+Database	Create Database
+performance_schema	CREATE DATABASE `performance_schema` /*!40100 DEFAULT CHARACTER SET utf8 */
+use performance_schema;
+show tables;
+Tables_in_performance_schema
+cond_instances
+events_stages_current
+events_stages_history
+events_stages_history_long
+events_stages_summary_by_thread_by_event_name
+events_stages_summary_global_by_event_name
+events_statements_current
+events_statements_history
+events_statements_history_long
+events_statements_summary_by_thread_by_event_name
+events_statements_summary_global_by_event_name
+events_waits_current
+events_waits_history
+events_waits_history_long
+events_waits_summary_by_instance
+events_waits_summary_by_thread_by_event_name
+events_waits_summary_global_by_event_name
+file_instances
+file_summary_by_event_name
+file_summary_by_instance
+mutex_instances
+objects_summary_global_by_type
+performance_timers
+rwlock_instances
+setup_actors
+setup_consumers
+setup_instruments
+setup_objects
+setup_timers
+table_io_waits_summary_by_index_usage
+table_io_waits_summary_by_table
+table_lock_waits_summary_by_table
+threads
+show create table cond_instances;
+Table	Create Table
+cond_instances	CREATE TABLE `cond_instances` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_stages_current;
+Table	Create Table
+events_stages_current	CREATE TABLE `events_stages_current` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_stages_history;
+Table	Create Table
+events_stages_history	CREATE TABLE `events_stages_history` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_stages_history_long;
+Table	Create Table
+events_stages_history_long	CREATE TABLE `events_stages_history_long` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_stages_summary_by_thread_by_event_name;
+Table	Create Table
+events_stages_summary_by_thread_by_event_name	CREATE TABLE `events_stages_summary_by_thread_by_event_name` (
+  `THREAD_ID` int(11) NOT NULL,
+  `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
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_stages_summary_global_by_event_name;
+Table	Create Table
+events_stages_summary_global_by_event_name	CREATE TABLE `events_stages_summary_global_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
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_statements_current;
+Table	Create Table
+events_statements_current	CREATE TABLE `events_statements_current` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `LOCK_TIME` bigint(20) unsigned NOT NULL,
+  `SQL_TEXT` longtext,
+  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
+  `MYSQL_ERRNO` int(11) DEFAULT NULL,
+  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
+  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
+  `ERRORS` bigint(20) unsigned NOT NULL,
+  `WARNINGS` bigint(20) unsigned NOT NULL,
+  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
+  `ROWS_SENT` bigint(20) unsigned NOT NULL,
+  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
+  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
+  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
+  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
+  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
+  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
+  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
+  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
+  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
+  `SORT_RANGE` bigint(20) unsigned NOT NULL,
+  `SORT_ROWS` bigint(20) unsigned NOT NULL,
+  `SORT_SCAN` bigint(20) unsigned NOT NULL,
+  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
+  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_statements_history;
+Table	Create Table
+events_statements_history	CREATE TABLE `events_statements_history` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `LOCK_TIME` bigint(20) unsigned NOT NULL,
+  `SQL_TEXT` longtext,
+  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
+  `MYSQL_ERRNO` int(11) DEFAULT NULL,
+  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
+  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
+  `ERRORS` bigint(20) unsigned NOT NULL,
+  `WARNINGS` bigint(20) unsigned NOT NULL,
+  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
+  `ROWS_SENT` bigint(20) unsigned NOT NULL,
+  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
+  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
+  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
+  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
+  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
+  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
+  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
+  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
+  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
+  `SORT_RANGE` bigint(20) unsigned NOT NULL,
+  `SORT_ROWS` bigint(20) unsigned NOT NULL,
+  `SORT_SCAN` bigint(20) unsigned NOT NULL,
+  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
+  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_statements_history_long;
+Table	Create Table
+events_statements_history_long	CREATE TABLE `events_statements_history_long` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `LOCK_TIME` bigint(20) unsigned NOT NULL,
+  `SQL_TEXT` longtext,
+  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
+  `MYSQL_ERRNO` int(11) DEFAULT NULL,
+  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
+  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
+  `ERRORS` bigint(20) unsigned NOT NULL,
+  `WARNINGS` bigint(20) unsigned NOT NULL,
+  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
+  `ROWS_SENT` bigint(20) unsigned NOT NULL,
+  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
+  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
+  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
+  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
+  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
+  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
+  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
+  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
+  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
+  `SORT_RANGE` bigint(20) unsigned NOT NULL,
+  `SORT_ROWS` bigint(20) unsigned NOT NULL,
+  `SORT_SCAN` bigint(20) unsigned NOT NULL,
+  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
+  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_statements_summary_by_thread_by_event_name;
+Table	Create Table
+events_statements_summary_by_thread_by_event_name	CREATE TABLE `events_statements_summary_by_thread_by_event_name` (
+  `THREAD_ID` int(11) NOT NULL,
+  `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,
+  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,
+  `SUM_ERRORS` bigint(20) unsigned NOT NULL,
+  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,
+  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
+  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,
+  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
+  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
+  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
+  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
+  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
+  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,
+  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
+  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,
+  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
+  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,
+  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,
+  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,
+  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,
+  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_statements_summary_global_by_event_name;
+Table	Create Table
+events_statements_summary_global_by_event_name	CREATE TABLE `events_statements_summary_global_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,
+  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,
+  `SUM_ERRORS` bigint(20) unsigned NOT NULL,
+  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,
+  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
+  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,
+  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
+  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
+  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
+  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
+  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
+  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,
+  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
+  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,
+  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
+  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,
+  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,
+  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,
+  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,
+  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_waits_current;
+Table	Create Table
+events_waits_current	CREATE TABLE `events_waits_current` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `INDEX_NAME` varchar(64) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
+  `OPERATION` varchar(32) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_waits_history;
+Table	Create Table
+events_waits_history	CREATE TABLE `events_waits_history` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `INDEX_NAME` varchar(64) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
+  `OPERATION` varchar(32) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_waits_history_long;
+Table	Create Table
+events_waits_history_long	CREATE TABLE `events_waits_history_long` (
+  `THREAD_ID` int(11) NOT NULL,
+  `EVENT_ID` bigint(20) unsigned NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `SOURCE` varchar(64) DEFAULT NULL,
+  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
+  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
+  `SPINS` int(10) unsigned DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(512) DEFAULT NULL,
+  `INDEX_NAME` varchar(64) DEFAULT NULL,
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
+  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
+  `OPERATION` varchar(32) NOT NULL,
+  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
+  `FLAGS` int(10) unsigned DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_waits_summary_by_instance;
+Table	Create Table
+events_waits_summary_by_instance	CREATE TABLE `events_waits_summary_by_instance` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) 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
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_waits_summary_by_thread_by_event_name;
+Table	Create Table
+events_waits_summary_by_thread_by_event_name	CREATE TABLE `events_waits_summary_by_thread_by_event_name` (
+  `THREAD_ID` int(11) NOT NULL,
+  `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
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table events_waits_summary_global_by_event_name;
+Table	Create Table
+events_waits_summary_global_by_event_name	CREATE TABLE `events_waits_summary_global_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
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table file_instances;
+Table	Create Table
+file_instances	CREATE TABLE `file_instances` (
+  `FILE_NAME` varchar(512) NOT NULL,
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `OPEN_COUNT` int(10) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table file_summary_by_event_name;
+Table	Create Table
+file_summary_by_event_name	CREATE TABLE `file_summary_by_event_name` (
+  `EVENT_NAME` varchar(128) NOT NULL,
+  `COUNT_READ` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_WRITE` 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,
+  `COUNT_READ` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
+  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table mutex_instances;
+Table	Create Table
+mutex_instances	CREATE TABLE `mutex_instances` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table objects_summary_global_by_type;
+Table	Create Table
+objects_summary_global_by_type	CREATE TABLE `objects_summary_global_by_type` (
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(64) DEFAULT 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
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table performance_timers;
+Table	Create Table
+performance_timers	CREATE TABLE `performance_timers` (
+  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL,
+  `TIMER_FREQUENCY` bigint(20) DEFAULT NULL,
+  `TIMER_RESOLUTION` bigint(20) DEFAULT NULL,
+  `TIMER_OVERHEAD` bigint(20) DEFAULT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table rwlock_instances;
+Table	Create Table
+rwlock_instances	CREATE TABLE `rwlock_instances` (
+  `NAME` varchar(128) NOT NULL,
+  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
+  `WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
+  `READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table setup_actors;
+Table	Create Table
+setup_actors	CREATE TABLE `setup_actors` (
+  `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
+  `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
+  `ROLE` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%'
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table setup_consumers;
+Table	Create Table
+setup_consumers	CREATE TABLE `setup_consumers` (
+  `NAME` varchar(64) NOT NULL,
+  `ENABLED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table setup_instruments;
+Table	Create Table
+setup_instruments	CREATE TABLE `setup_instruments` (
+  `NAME` varchar(128) NOT NULL,
+  `ENABLED` enum('YES','NO') NOT NULL,
+  `TIMED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table setup_objects;
+Table	Create Table
+setup_objects	CREATE TABLE `setup_objects` (
+  `OBJECT_TYPE` enum('TABLE') NOT NULL DEFAULT 'TABLE',
+  `OBJECT_SCHEMA` varchar(64) DEFAULT '%',
+  `OBJECT_NAME` varchar(64) NOT NULL DEFAULT '%',
+  `TIMED` enum('YES','NO') NOT NULL DEFAULT 'YES'
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table setup_timers;
+Table	Create Table
+setup_timers	CREATE TABLE `setup_timers` (
+  `NAME` varchar(64) NOT NULL,
+  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table table_io_waits_summary_by_index_usage;
+Table	Create Table
+table_io_waits_summary_by_index_usage	CREATE TABLE `table_io_waits_summary_by_index_usage` (
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(64) DEFAULT NULL,
+  `INDEX_NAME` varchar(64) DEFAULT 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,
+  `COUNT_WRITE` bigint(20) unsigned 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,
+  `COUNT_FETCH` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_FETCH` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_FETCH` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_FETCH` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_FETCH` bigint(20) unsigned NOT NULL,
+  `COUNT_INSERT` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_INSERT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_INSERT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_INSERT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_INSERT` bigint(20) unsigned NOT NULL,
+  `COUNT_UPDATE` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
+  `COUNT_DELETE` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_DELETE` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_DELETE` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_DELETE` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_DELETE` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table table_io_waits_summary_by_table;
+Table	Create Table
+table_io_waits_summary_by_table	CREATE TABLE `table_io_waits_summary_by_table` (
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(64) DEFAULT 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,
+  `COUNT_WRITE` bigint(20) unsigned 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,
+  `COUNT_FETCH` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_FETCH` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_FETCH` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_FETCH` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_FETCH` bigint(20) unsigned NOT NULL,
+  `COUNT_INSERT` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_INSERT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_INSERT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_INSERT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_INSERT` bigint(20) unsigned NOT NULL,
+  `COUNT_UPDATE` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
+  `COUNT_DELETE` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_DELETE` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_DELETE` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_DELETE` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_DELETE` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table table_lock_waits_summary_by_table;
+Table	Create Table
+table_lock_waits_summary_by_table	CREATE TABLE `table_lock_waits_summary_by_table` (
+  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
+  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
+  `OBJECT_NAME` varchar(64) DEFAULT 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,
+  `COUNT_WRITE` bigint(20) unsigned 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,
+  `COUNT_READ_NORMAL` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
+  `COUNT_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
+  `COUNT_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
+  `COUNT_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
+  `COUNT_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
+  `COUNT_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
+  `SUM_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
+  `MIN_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
+  `AVG_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
+  `MAX_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
+show create table threads;
+Table	Create Table
+threads	CREATE TABLE `threads` (
+  `THREAD_ID` int(11) NOT NULL,
+  `NAME` varchar(128) NOT NULL,
+  `TYPE` varchar(10) NOT NULL,
+  `PROCESSLIST_ID` int(11) DEFAULT NULL,
+  `PROCESSLIST_USER` varchar(16) DEFAULT NULL,
+  `PROCESSLIST_HOST` varchar(60) DEFAULT NULL,
+  `PROCESSLIST_DB` varchar(64) DEFAULT NULL,
+  `PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL,
+  `PROCESSLIST_TIME` bigint(20) DEFAULT NULL,
+  `PROCESSLIST_STATE` varchar(64) DEFAULT NULL,
+  `PROCESSLIST_INFO` longtext,
+  `PARENT_THREAD_ID` int(11) DEFAULT NULL,
+  `ROLE` varchar(64) DEFAULT NULL,
+  `INSTRUMENTED` enum('YES','NO') NOT NULL
+) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8

=== removed file 'mysql-test/suite/perfschema/r/schema_lc0.result'
--- a/mysql-test/suite/perfschema/r/schema_lc0.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/r/schema_lc0.result	1970-01-01 00:00:00 +0000
@@ -1,663 +0,0 @@
-show databases like 'performance_schema';
-Database (performance_schema)
-performance_schema
-show create database performance_schema;
-Database	Create Database
-performance_schema	CREATE DATABASE `performance_schema` /*!40100 DEFAULT CHARACTER SET utf8 */
-use performance_schema;
-show tables;
-Tables_in_performance_schema
-cond_instances
-events_stages_current
-events_stages_history
-events_stages_history_long
-events_stages_summary_by_thread_by_event_name
-events_stages_summary_global_by_event_name
-events_statements_current
-events_statements_history
-events_statements_history_long
-events_statements_summary_by_thread_by_event_name
-events_statements_summary_global_by_event_name
-events_waits_current
-events_waits_history
-events_waits_history_long
-events_waits_summary_by_instance
-events_waits_summary_by_thread_by_event_name
-events_waits_summary_global_by_event_name
-file_instances
-file_summary_by_event_name
-file_summary_by_instance
-mutex_instances
-objects_summary_global_by_type
-performance_timers
-rwlock_instances
-setup_actors
-setup_consumers
-setup_instruments
-setup_objects
-setup_timers
-table_io_waits_summary_by_index_usage
-table_io_waits_summary_by_table
-table_lock_waits_summary_by_table
-threads
-show create table cond_instances;
-Table	Create Table
-cond_instances	CREATE TABLE `cond_instances` (
-  `NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_current;
-Table	Create Table
-events_stages_current	CREATE TABLE `events_stages_current` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_history;
-Table	Create Table
-events_stages_history	CREATE TABLE `events_stages_history` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_history_long;
-Table	Create Table
-events_stages_history_long	CREATE TABLE `events_stages_history_long` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_summary_by_thread_by_event_name;
-Table	Create Table
-events_stages_summary_by_thread_by_event_name	CREATE TABLE `events_stages_summary_by_thread_by_event_name` (
-  `THREAD_ID` int(11) NOT NULL,
-  `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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_summary_global_by_event_name;
-Table	Create Table
-events_stages_summary_global_by_event_name	CREATE TABLE `events_stages_summary_global_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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_current;
-Table	Create Table
-events_statements_current	CREATE TABLE `events_statements_current` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SQL_TEXT` longtext,
-  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
-  `MYSQL_ERRNO` int(11) DEFAULT NULL,
-  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
-  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
-  `ERRORS` bigint(20) unsigned NOT NULL,
-  `WARNINGS` bigint(20) unsigned NOT NULL,
-  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_history;
-Table	Create Table
-events_statements_history	CREATE TABLE `events_statements_history` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SQL_TEXT` longtext,
-  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
-  `MYSQL_ERRNO` int(11) DEFAULT NULL,
-  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
-  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
-  `ERRORS` bigint(20) unsigned NOT NULL,
-  `WARNINGS` bigint(20) unsigned NOT NULL,
-  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_history_long;
-Table	Create Table
-events_statements_history_long	CREATE TABLE `events_statements_history_long` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SQL_TEXT` longtext,
-  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
-  `MYSQL_ERRNO` int(11) DEFAULT NULL,
-  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
-  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
-  `ERRORS` bigint(20) unsigned NOT NULL,
-  `WARNINGS` bigint(20) unsigned NOT NULL,
-  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_summary_by_thread_by_event_name;
-Table	Create Table
-events_statements_summary_by_thread_by_event_name	CREATE TABLE `events_statements_summary_by_thread_by_event_name` (
-  `THREAD_ID` int(11) NOT NULL,
-  `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,
-  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SUM_ERRORS` bigint(20) unsigned NOT NULL,
-  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_summary_global_by_event_name;
-Table	Create Table
-events_statements_summary_global_by_event_name	CREATE TABLE `events_statements_summary_global_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,
-  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SUM_ERRORS` bigint(20) unsigned NOT NULL,
-  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_current;
-Table	Create Table
-events_waits_current	CREATE TABLE `events_waits_current` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `SPINS` int(10) unsigned DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(512) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
-  `OPERATION` varchar(32) NOT NULL,
-  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
-  `FLAGS` int(10) unsigned DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_history;
-Table	Create Table
-events_waits_history	CREATE TABLE `events_waits_history` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `SPINS` int(10) unsigned DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(512) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
-  `OPERATION` varchar(32) NOT NULL,
-  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
-  `FLAGS` int(10) unsigned DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_history_long;
-Table	Create Table
-events_waits_history_long	CREATE TABLE `events_waits_history_long` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `SPINS` int(10) unsigned DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(512) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
-  `OPERATION` varchar(32) NOT NULL,
-  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
-  `FLAGS` int(10) unsigned DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_summary_by_instance;
-Table	Create Table
-events_waits_summary_by_instance	CREATE TABLE `events_waits_summary_by_instance` (
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) 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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_summary_by_thread_by_event_name;
-Table	Create Table
-events_waits_summary_by_thread_by_event_name	CREATE TABLE `events_waits_summary_by_thread_by_event_name` (
-  `THREAD_ID` int(11) NOT NULL,
-  `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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_summary_global_by_event_name;
-Table	Create Table
-events_waits_summary_global_by_event_name	CREATE TABLE `events_waits_summary_global_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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table file_instances;
-Table	Create Table
-file_instances	CREATE TABLE `file_instances` (
-  `FILE_NAME` varchar(512) NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `OPEN_COUNT` int(10) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table file_summary_by_event_name;
-Table	Create Table
-file_summary_by_event_name	CREATE TABLE `file_summary_by_event_name` (
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `COUNT_READ` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_WRITE` 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,
-  `COUNT_READ` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table mutex_instances;
-Table	Create Table
-mutex_instances	CREATE TABLE `mutex_instances` (
-  `NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table objects_summary_global_by_type;
-Table	Create Table
-objects_summary_global_by_type	CREATE TABLE `objects_summary_global_by_type` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT 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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table performance_timers;
-Table	Create Table
-performance_timers	CREATE TABLE `performance_timers` (
-  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL,
-  `TIMER_FREQUENCY` bigint(20) DEFAULT NULL,
-  `TIMER_RESOLUTION` bigint(20) DEFAULT NULL,
-  `TIMER_OVERHEAD` bigint(20) DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table rwlock_instances;
-Table	Create Table
-rwlock_instances	CREATE TABLE `rwlock_instances` (
-  `NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
-  `READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_actors;
-Table	Create Table
-setup_actors	CREATE TABLE `setup_actors` (
-  `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
-  `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
-  `ROLE` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%'
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_consumers;
-Table	Create Table
-setup_consumers	CREATE TABLE `setup_consumers` (
-  `NAME` varchar(64) NOT NULL,
-  `ENABLED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_instruments;
-Table	Create Table
-setup_instruments	CREATE TABLE `setup_instruments` (
-  `NAME` varchar(128) NOT NULL,
-  `ENABLED` enum('YES','NO') NOT NULL,
-  `TIMED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_objects;
-Table	Create Table
-setup_objects	CREATE TABLE `setup_objects` (
-  `OBJECT_TYPE` enum('TABLE') NOT NULL DEFAULT 'TABLE',
-  `OBJECT_SCHEMA` varchar(64) DEFAULT '%',
-  `OBJECT_NAME` varchar(64) NOT NULL DEFAULT '%',
-  `TIMED` enum('YES','NO') NOT NULL DEFAULT 'YES'
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_timers;
-Table	Create Table
-setup_timers	CREATE TABLE `setup_timers` (
-  `NAME` varchar(64) NOT NULL,
-  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table table_io_waits_summary_by_index_usage;
-Table	Create Table
-table_io_waits_summary_by_index_usage	CREATE TABLE `table_io_waits_summary_by_index_usage` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT 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,
-  `COUNT_WRITE` bigint(20) unsigned 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,
-  `COUNT_FETCH` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `COUNT_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_UPDATE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `COUNT_DELETE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_DELETE` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table table_io_waits_summary_by_table;
-Table	Create Table
-table_io_waits_summary_by_table	CREATE TABLE `table_io_waits_summary_by_table` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT 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,
-  `COUNT_WRITE` bigint(20) unsigned 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,
-  `COUNT_FETCH` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `COUNT_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_UPDATE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `COUNT_DELETE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_DELETE` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table table_lock_waits_summary_by_table;
-Table	Create Table
-table_lock_waits_summary_by_table	CREATE TABLE `table_lock_waits_summary_by_table` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT 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,
-  `COUNT_WRITE` bigint(20) unsigned 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,
-  `COUNT_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table threads;
-Table	Create Table
-threads	CREATE TABLE `threads` (
-  `THREAD_ID` int(11) NOT NULL,
-  `NAME` varchar(128) NOT NULL,
-  `TYPE` varchar(10) NOT NULL,
-  `PROCESSLIST_ID` int(11) DEFAULT NULL,
-  `PROCESSLIST_USER` varchar(16) DEFAULT NULL,
-  `PROCESSLIST_HOST` varchar(60) DEFAULT NULL,
-  `PROCESSLIST_DB` varchar(64) DEFAULT NULL,
-  `PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL,
-  `PROCESSLIST_TIME` bigint(20) DEFAULT NULL,
-  `PROCESSLIST_STATE` varchar(64) DEFAULT NULL,
-  `PROCESSLIST_INFO` longtext,
-  `PARENT_THREAD_ID` int(11) DEFAULT NULL,
-  `ROLE` varchar(64) DEFAULT NULL,
-  `INSTRUMENTED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8

=== removed file 'mysql-test/suite/perfschema/r/schema_lc1.result'
--- a/mysql-test/suite/perfschema/r/schema_lc1.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/r/schema_lc1.result	1970-01-01 00:00:00 +0000
@@ -1,663 +0,0 @@
-show databases like 'performance_schema';
-Database (performance_schema)
-performance_schema
-show create database performance_schema;
-Database	Create Database
-performance_schema	CREATE DATABASE `performance_schema` /*!40100 DEFAULT CHARACTER SET utf8 */
-use performance_schema;
-show tables;
-Tables_in_performance_schema
-cond_instances
-events_stages_current
-events_stages_history
-events_stages_history_long
-events_stages_summary_by_thread_by_event_name
-events_stages_summary_global_by_event_name
-events_statements_current
-events_statements_history
-events_statements_history_long
-events_statements_summary_by_thread_by_event_name
-events_statements_summary_global_by_event_name
-events_waits_current
-events_waits_history
-events_waits_history_long
-events_waits_summary_by_instance
-events_waits_summary_by_thread_by_event_name
-events_waits_summary_global_by_event_name
-file_instances
-file_summary_by_event_name
-file_summary_by_instance
-mutex_instances
-objects_summary_global_by_type
-performance_timers
-rwlock_instances
-setup_actors
-setup_consumers
-setup_instruments
-setup_objects
-setup_timers
-table_io_waits_summary_by_index_usage
-table_io_waits_summary_by_table
-table_lock_waits_summary_by_table
-threads
-show create table cond_instances;
-Table	Create Table
-cond_instances	CREATE TABLE `cond_instances` (
-  `NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_current;
-Table	Create Table
-events_stages_current	CREATE TABLE `events_stages_current` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_history;
-Table	Create Table
-events_stages_history	CREATE TABLE `events_stages_history` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_history_long;
-Table	Create Table
-events_stages_history_long	CREATE TABLE `events_stages_history_long` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_summary_by_thread_by_event_name;
-Table	Create Table
-events_stages_summary_by_thread_by_event_name	CREATE TABLE `events_stages_summary_by_thread_by_event_name` (
-  `THREAD_ID` int(11) NOT NULL,
-  `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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_summary_global_by_event_name;
-Table	Create Table
-events_stages_summary_global_by_event_name	CREATE TABLE `events_stages_summary_global_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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_current;
-Table	Create Table
-events_statements_current	CREATE TABLE `events_statements_current` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SQL_TEXT` longtext,
-  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
-  `MYSQL_ERRNO` int(11) DEFAULT NULL,
-  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
-  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
-  `ERRORS` bigint(20) unsigned NOT NULL,
-  `WARNINGS` bigint(20) unsigned NOT NULL,
-  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_history;
-Table	Create Table
-events_statements_history	CREATE TABLE `events_statements_history` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SQL_TEXT` longtext,
-  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
-  `MYSQL_ERRNO` int(11) DEFAULT NULL,
-  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
-  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
-  `ERRORS` bigint(20) unsigned NOT NULL,
-  `WARNINGS` bigint(20) unsigned NOT NULL,
-  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_history_long;
-Table	Create Table
-events_statements_history_long	CREATE TABLE `events_statements_history_long` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SQL_TEXT` longtext,
-  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
-  `MYSQL_ERRNO` int(11) DEFAULT NULL,
-  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
-  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
-  `ERRORS` bigint(20) unsigned NOT NULL,
-  `WARNINGS` bigint(20) unsigned NOT NULL,
-  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_summary_by_thread_by_event_name;
-Table	Create Table
-events_statements_summary_by_thread_by_event_name	CREATE TABLE `events_statements_summary_by_thread_by_event_name` (
-  `THREAD_ID` int(11) NOT NULL,
-  `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,
-  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SUM_ERRORS` bigint(20) unsigned NOT NULL,
-  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_summary_global_by_event_name;
-Table	Create Table
-events_statements_summary_global_by_event_name	CREATE TABLE `events_statements_summary_global_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,
-  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SUM_ERRORS` bigint(20) unsigned NOT NULL,
-  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_current;
-Table	Create Table
-events_waits_current	CREATE TABLE `events_waits_current` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `SPINS` int(10) unsigned DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(512) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
-  `OPERATION` varchar(32) NOT NULL,
-  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
-  `FLAGS` int(10) unsigned DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_history;
-Table	Create Table
-events_waits_history	CREATE TABLE `events_waits_history` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `SPINS` int(10) unsigned DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(512) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
-  `OPERATION` varchar(32) NOT NULL,
-  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
-  `FLAGS` int(10) unsigned DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_history_long;
-Table	Create Table
-events_waits_history_long	CREATE TABLE `events_waits_history_long` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `SPINS` int(10) unsigned DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(512) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
-  `OPERATION` varchar(32) NOT NULL,
-  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
-  `FLAGS` int(10) unsigned DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_summary_by_instance;
-Table	Create Table
-events_waits_summary_by_instance	CREATE TABLE `events_waits_summary_by_instance` (
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) 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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_summary_by_thread_by_event_name;
-Table	Create Table
-events_waits_summary_by_thread_by_event_name	CREATE TABLE `events_waits_summary_by_thread_by_event_name` (
-  `THREAD_ID` int(11) NOT NULL,
-  `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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_summary_global_by_event_name;
-Table	Create Table
-events_waits_summary_global_by_event_name	CREATE TABLE `events_waits_summary_global_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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table file_instances;
-Table	Create Table
-file_instances	CREATE TABLE `file_instances` (
-  `FILE_NAME` varchar(512) NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `OPEN_COUNT` int(10) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table file_summary_by_event_name;
-Table	Create Table
-file_summary_by_event_name	CREATE TABLE `file_summary_by_event_name` (
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `COUNT_READ` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_WRITE` 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,
-  `COUNT_READ` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table mutex_instances;
-Table	Create Table
-mutex_instances	CREATE TABLE `mutex_instances` (
-  `NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table objects_summary_global_by_type;
-Table	Create Table
-objects_summary_global_by_type	CREATE TABLE `objects_summary_global_by_type` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT 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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table performance_timers;
-Table	Create Table
-performance_timers	CREATE TABLE `performance_timers` (
-  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL,
-  `TIMER_FREQUENCY` bigint(20) DEFAULT NULL,
-  `TIMER_RESOLUTION` bigint(20) DEFAULT NULL,
-  `TIMER_OVERHEAD` bigint(20) DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table rwlock_instances;
-Table	Create Table
-rwlock_instances	CREATE TABLE `rwlock_instances` (
-  `NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
-  `READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_actors;
-Table	Create Table
-setup_actors	CREATE TABLE `setup_actors` (
-  `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
-  `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
-  `ROLE` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%'
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_consumers;
-Table	Create Table
-setup_consumers	CREATE TABLE `setup_consumers` (
-  `NAME` varchar(64) NOT NULL,
-  `ENABLED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_instruments;
-Table	Create Table
-setup_instruments	CREATE TABLE `setup_instruments` (
-  `NAME` varchar(128) NOT NULL,
-  `ENABLED` enum('YES','NO') NOT NULL,
-  `TIMED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_objects;
-Table	Create Table
-setup_objects	CREATE TABLE `setup_objects` (
-  `OBJECT_TYPE` enum('TABLE') NOT NULL DEFAULT 'TABLE',
-  `OBJECT_SCHEMA` varchar(64) DEFAULT '%',
-  `OBJECT_NAME` varchar(64) NOT NULL DEFAULT '%',
-  `TIMED` enum('YES','NO') NOT NULL DEFAULT 'YES'
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_timers;
-Table	Create Table
-setup_timers	CREATE TABLE `setup_timers` (
-  `NAME` varchar(64) NOT NULL,
-  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table table_io_waits_summary_by_index_usage;
-Table	Create Table
-table_io_waits_summary_by_index_usage	CREATE TABLE `table_io_waits_summary_by_index_usage` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT 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,
-  `COUNT_WRITE` bigint(20) unsigned 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,
-  `COUNT_FETCH` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `COUNT_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_UPDATE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `COUNT_DELETE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_DELETE` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table table_io_waits_summary_by_table;
-Table	Create Table
-table_io_waits_summary_by_table	CREATE TABLE `table_io_waits_summary_by_table` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT 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,
-  `COUNT_WRITE` bigint(20) unsigned 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,
-  `COUNT_FETCH` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `COUNT_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_UPDATE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `COUNT_DELETE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_DELETE` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table table_lock_waits_summary_by_table;
-Table	Create Table
-table_lock_waits_summary_by_table	CREATE TABLE `table_lock_waits_summary_by_table` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT 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,
-  `COUNT_WRITE` bigint(20) unsigned 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,
-  `COUNT_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table threads;
-Table	Create Table
-threads	CREATE TABLE `threads` (
-  `THREAD_ID` int(11) NOT NULL,
-  `NAME` varchar(128) NOT NULL,
-  `TYPE` varchar(10) NOT NULL,
-  `PROCESSLIST_ID` int(11) DEFAULT NULL,
-  `PROCESSLIST_USER` varchar(16) DEFAULT NULL,
-  `PROCESSLIST_HOST` varchar(60) DEFAULT NULL,
-  `PROCESSLIST_DB` varchar(64) DEFAULT NULL,
-  `PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL,
-  `PROCESSLIST_TIME` bigint(20) DEFAULT NULL,
-  `PROCESSLIST_STATE` varchar(64) DEFAULT NULL,
-  `PROCESSLIST_INFO` longtext,
-  `PARENT_THREAD_ID` int(11) DEFAULT NULL,
-  `ROLE` varchar(64) DEFAULT NULL,
-  `INSTRUMENTED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8

=== removed file 'mysql-test/suite/perfschema/r/schema_lc2.result'
--- a/mysql-test/suite/perfschema/r/schema_lc2.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/r/schema_lc2.result	1970-01-01 00:00:00 +0000
@@ -1,663 +0,0 @@
-show databases like 'performance_schema';
-Database (performance_schema)
-performance_schema
-show create database performance_schema;
-Database	Create Database
-performance_schema	CREATE DATABASE `performance_schema` /*!40100 DEFAULT CHARACTER SET utf8 */
-use performance_schema;
-show tables;
-Tables_in_performance_schema
-cond_instances
-events_stages_current
-events_stages_history
-events_stages_history_long
-events_stages_summary_by_thread_by_event_name
-events_stages_summary_global_by_event_name
-events_statements_current
-events_statements_history
-events_statements_history_long
-events_statements_summary_by_thread_by_event_name
-events_statements_summary_global_by_event_name
-events_waits_current
-events_waits_history
-events_waits_history_long
-events_waits_summary_by_instance
-events_waits_summary_by_thread_by_event_name
-events_waits_summary_global_by_event_name
-file_instances
-file_summary_by_event_name
-file_summary_by_instance
-mutex_instances
-objects_summary_global_by_type
-performance_timers
-rwlock_instances
-setup_actors
-setup_consumers
-setup_instruments
-setup_objects
-setup_timers
-table_io_waits_summary_by_index_usage
-table_io_waits_summary_by_table
-table_lock_waits_summary_by_table
-threads
-show create table cond_instances;
-Table	Create Table
-cond_instances	CREATE TABLE `cond_instances` (
-  `NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_current;
-Table	Create Table
-events_stages_current	CREATE TABLE `events_stages_current` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_history;
-Table	Create Table
-events_stages_history	CREATE TABLE `events_stages_history` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_history_long;
-Table	Create Table
-events_stages_history_long	CREATE TABLE `events_stages_history_long` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_summary_by_thread_by_event_name;
-Table	Create Table
-events_stages_summary_by_thread_by_event_name	CREATE TABLE `events_stages_summary_by_thread_by_event_name` (
-  `THREAD_ID` int(11) NOT NULL,
-  `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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_stages_summary_global_by_event_name;
-Table	Create Table
-events_stages_summary_global_by_event_name	CREATE TABLE `events_stages_summary_global_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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_current;
-Table	Create Table
-events_statements_current	CREATE TABLE `events_statements_current` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SQL_TEXT` longtext,
-  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
-  `MYSQL_ERRNO` int(11) DEFAULT NULL,
-  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
-  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
-  `ERRORS` bigint(20) unsigned NOT NULL,
-  `WARNINGS` bigint(20) unsigned NOT NULL,
-  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_history;
-Table	Create Table
-events_statements_history	CREATE TABLE `events_statements_history` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SQL_TEXT` longtext,
-  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
-  `MYSQL_ERRNO` int(11) DEFAULT NULL,
-  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
-  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
-  `ERRORS` bigint(20) unsigned NOT NULL,
-  `WARNINGS` bigint(20) unsigned NOT NULL,
-  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_history_long;
-Table	Create Table
-events_statements_history_long	CREATE TABLE `events_statements_history_long` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SQL_TEXT` longtext,
-  `CURRENT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) DEFAULT NULL,
-  `MYSQL_ERRNO` int(11) DEFAULT NULL,
-  `RETURNED_SQLSTATE` varchar(5) DEFAULT NULL,
-  `MESSAGE_TEXT` varchar(128) DEFAULT NULL,
-  `ERRORS` bigint(20) unsigned NOT NULL,
-  `WARNINGS` bigint(20) unsigned NOT NULL,
-  `ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_summary_by_thread_by_event_name;
-Table	Create Table
-events_statements_summary_by_thread_by_event_name	CREATE TABLE `events_statements_summary_by_thread_by_event_name` (
-  `THREAD_ID` int(11) NOT NULL,
-  `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,
-  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SUM_ERRORS` bigint(20) unsigned NOT NULL,
-  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_statements_summary_global_by_event_name;
-Table	Create Table
-events_statements_summary_global_by_event_name	CREATE TABLE `events_statements_summary_global_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,
-  `SUM_LOCK_TIME` bigint(20) unsigned NOT NULL,
-  `SUM_ERRORS` bigint(20) unsigned NOT NULL,
-  `SUM_WARNINGS` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_AFFECTED` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_SENT` bigint(20) unsigned NOT NULL,
-  `SUM_ROWS_EXAMINED` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_DISK_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_CREATED_TMP_TABLES` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_FULL_RANGE_JOIN` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_RANGE_CHECK` bigint(20) unsigned NOT NULL,
-  `SUM_SELECT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_MERGE_PASSES` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_RANGE` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_ROWS` bigint(20) unsigned NOT NULL,
-  `SUM_SORT_SCAN` bigint(20) unsigned NOT NULL,
-  `SUM_NO_INDEX_USED` bigint(20) unsigned NOT NULL,
-  `SUM_NO_GOOD_INDEX_USED` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_current;
-Table	Create Table
-events_waits_current	CREATE TABLE `events_waits_current` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `SPINS` int(10) unsigned DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(512) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
-  `OPERATION` varchar(32) NOT NULL,
-  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
-  `FLAGS` int(10) unsigned DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_history;
-Table	Create Table
-events_waits_history	CREATE TABLE `events_waits_history` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `SPINS` int(10) unsigned DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(512) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
-  `OPERATION` varchar(32) NOT NULL,
-  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
-  `FLAGS` int(10) unsigned DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_history_long;
-Table	Create Table
-events_waits_history_long	CREATE TABLE `events_waits_history_long` (
-  `THREAD_ID` int(11) NOT NULL,
-  `EVENT_ID` bigint(20) unsigned NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `SOURCE` varchar(64) DEFAULT NULL,
-  `TIMER_START` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_END` bigint(20) unsigned DEFAULT NULL,
-  `TIMER_WAIT` bigint(20) unsigned DEFAULT NULL,
-  `SPINS` int(10) unsigned DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(512) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT NULL,
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `NESTING_EVENT_ID` bigint(20) unsigned DEFAULT NULL,
-  `NESTING_EVENT_TYPE` enum('STATEMENT','STAGE','WAIT') DEFAULT NULL,
-  `OPERATION` varchar(32) NOT NULL,
-  `NUMBER_OF_BYTES` bigint(20) unsigned DEFAULT NULL,
-  `FLAGS` int(10) unsigned DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_summary_by_instance;
-Table	Create Table
-events_waits_summary_by_instance	CREATE TABLE `events_waits_summary_by_instance` (
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) 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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_summary_by_thread_by_event_name;
-Table	Create Table
-events_waits_summary_by_thread_by_event_name	CREATE TABLE `events_waits_summary_by_thread_by_event_name` (
-  `THREAD_ID` int(11) NOT NULL,
-  `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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table events_waits_summary_global_by_event_name;
-Table	Create Table
-events_waits_summary_global_by_event_name	CREATE TABLE `events_waits_summary_global_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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table file_instances;
-Table	Create Table
-file_instances	CREATE TABLE `file_instances` (
-  `FILE_NAME` varchar(512) NOT NULL,
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `OPEN_COUNT` int(10) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table file_summary_by_event_name;
-Table	Create Table
-file_summary_by_event_name	CREATE TABLE `file_summary_by_event_name` (
-  `EVENT_NAME` varchar(128) NOT NULL,
-  `COUNT_READ` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_WRITE` 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,
-  `COUNT_READ` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_READ` bigint(20) unsigned NOT NULL,
-  `SUM_NUMBER_OF_BYTES_WRITE` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table mutex_instances;
-Table	Create Table
-mutex_instances	CREATE TABLE `mutex_instances` (
-  `NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table objects_summary_global_by_type;
-Table	Create Table
-objects_summary_global_by_type	CREATE TABLE `objects_summary_global_by_type` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT 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
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table performance_timers;
-Table	Create Table
-performance_timers	CREATE TABLE `performance_timers` (
-  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL,
-  `TIMER_FREQUENCY` bigint(20) DEFAULT NULL,
-  `TIMER_RESOLUTION` bigint(20) DEFAULT NULL,
-  `TIMER_OVERHEAD` bigint(20) DEFAULT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table rwlock_instances;
-Table	Create Table
-rwlock_instances	CREATE TABLE `rwlock_instances` (
-  `NAME` varchar(128) NOT NULL,
-  `OBJECT_INSTANCE_BEGIN` bigint(20) NOT NULL,
-  `WRITE_LOCKED_BY_THREAD_ID` int(11) DEFAULT NULL,
-  `READ_LOCKED_BY_COUNT` int(10) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_actors;
-Table	Create Table
-setup_actors	CREATE TABLE `setup_actors` (
-  `HOST` char(60) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
-  `USER` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%',
-  `ROLE` char(16) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL DEFAULT '%'
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_consumers;
-Table	Create Table
-setup_consumers	CREATE TABLE `setup_consumers` (
-  `NAME` varchar(64) NOT NULL,
-  `ENABLED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_instruments;
-Table	Create Table
-setup_instruments	CREATE TABLE `setup_instruments` (
-  `NAME` varchar(128) NOT NULL,
-  `ENABLED` enum('YES','NO') NOT NULL,
-  `TIMED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_objects;
-Table	Create Table
-setup_objects	CREATE TABLE `setup_objects` (
-  `OBJECT_TYPE` enum('TABLE') NOT NULL DEFAULT 'TABLE',
-  `OBJECT_SCHEMA` varchar(64) DEFAULT '%',
-  `OBJECT_NAME` varchar(64) NOT NULL DEFAULT '%',
-  `TIMED` enum('YES','NO') NOT NULL DEFAULT 'YES'
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table setup_timers;
-Table	Create Table
-setup_timers	CREATE TABLE `setup_timers` (
-  `NAME` varchar(64) NOT NULL,
-  `TIMER_NAME` enum('CYCLE','NANOSECOND','MICROSECOND','MILLISECOND','TICK') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table table_io_waits_summary_by_index_usage;
-Table	Create Table
-table_io_waits_summary_by_index_usage	CREATE TABLE `table_io_waits_summary_by_index_usage` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT NULL,
-  `INDEX_NAME` varchar(64) DEFAULT 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,
-  `COUNT_WRITE` bigint(20) unsigned 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,
-  `COUNT_FETCH` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `COUNT_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_UPDATE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `COUNT_DELETE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_DELETE` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table table_io_waits_summary_by_table;
-Table	Create Table
-table_io_waits_summary_by_table	CREATE TABLE `table_io_waits_summary_by_table` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT 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,
-  `COUNT_WRITE` bigint(20) unsigned 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,
-  `COUNT_FETCH` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_FETCH` bigint(20) unsigned NOT NULL,
-  `COUNT_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_UPDATE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_UPDATE` bigint(20) unsigned NOT NULL,
-  `COUNT_DELETE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_DELETE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_DELETE` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table table_lock_waits_summary_by_table;
-Table	Create Table
-table_lock_waits_summary_by_table	CREATE TABLE `table_lock_waits_summary_by_table` (
-  `OBJECT_TYPE` varchar(64) DEFAULT NULL,
-  `OBJECT_SCHEMA` varchar(64) DEFAULT NULL,
-  `OBJECT_NAME` varchar(64) DEFAULT 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,
-  `COUNT_WRITE` bigint(20) unsigned 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,
-  `COUNT_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_NORMAL` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_WITH_SHARED_LOCKS` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_HIGH_PRIORITY` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_NO_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_READ_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_ALLOW_WRITE` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_CONCURRENT_INSERT` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_DELAYED` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_LOW_PRIORITY` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_NORMAL` bigint(20) unsigned NOT NULL,
-  `COUNT_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `SUM_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MIN_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `AVG_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL,
-  `MAX_TIMER_WRITE_EXTERNAL` bigint(20) unsigned NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8
-show create table threads;
-Table	Create Table
-threads	CREATE TABLE `threads` (
-  `THREAD_ID` int(11) NOT NULL,
-  `NAME` varchar(128) NOT NULL,
-  `TYPE` varchar(10) NOT NULL,
-  `PROCESSLIST_ID` int(11) DEFAULT NULL,
-  `PROCESSLIST_USER` varchar(16) DEFAULT NULL,
-  `PROCESSLIST_HOST` varchar(60) DEFAULT NULL,
-  `PROCESSLIST_DB` varchar(64) DEFAULT NULL,
-  `PROCESSLIST_COMMAND` varchar(16) DEFAULT NULL,
-  `PROCESSLIST_TIME` bigint(20) DEFAULT NULL,
-  `PROCESSLIST_STATE` varchar(64) DEFAULT NULL,
-  `PROCESSLIST_INFO` longtext,
-  `PARENT_THREAD_ID` int(11) DEFAULT NULL,
-  `ROLE` varchar(64) DEFAULT NULL,
-  `INSTRUMENTED` enum('YES','NO') NOT NULL
-) ENGINE=PERFORMANCE_SCHEMA DEFAULT CHARSET=utf8

=== added file 'mysql-test/suite/perfschema/t/pfs_upgrade.test'
--- a/mysql-test/suite/perfschema/t/pfs_upgrade.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade.test	revid:mikael.ronstrom@stripped
@@ -0,0 +1,24 @@
+# Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# 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
+
+# Tests for PERFORMANCE_SCHEMA
+# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
+# database.
+# 
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source ../include/pfs_upgrade.inc
+

=== removed file 'mysql-test/suite/perfschema/t/pfs_upgrade_lc0.test'
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_lc0.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_lc0.test	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-# Copyright (c) 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
-
-# Tests for PERFORMANCE_SCHEMA
-# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
-# database.
-# 
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
---source include/have_lowercase0.inc
---source ../include/pfs_upgrade.inc
-
-

=== removed file 'mysql-test/suite/perfschema/t/pfs_upgrade_lc1.test'
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_lc1.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_lc1.test	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-# Copyright (c) 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
-
-# Tests for PERFORMANCE_SCHEMA
-# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
-# database.
-# 
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
---source include/have_lowercase1.inc
---source ../include/pfs_upgrade.inc
-
-

=== removed file 'mysql-test/suite/perfschema/t/pfs_upgrade_lc2.test'
--- a/mysql-test/suite/perfschema/t/pfs_upgrade_lc2.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/t/pfs_upgrade_lc2.test	1970-01-01 00:00:00 +0000
@@ -1,26 +0,0 @@
-# Copyright (c) 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
-
-# Tests for PERFORMANCE_SCHEMA
-# Make sure mysql_upgrade does not destroy data in a 'performance_schema'
-# database.
-# 
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
---source include/have_lowercase2.inc
---source ../include/pfs_upgrade.inc
-
-

=== added file 'mysql-test/suite/perfschema/t/schema.test'
--- a/mysql-test/suite/perfschema/t/schema.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/schema.test	revid:mikael.ronstrom@stripped
@@ -0,0 +1,22 @@
+# Copyright (c) 2008, 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
+
+# Tests for PERFORMANCE_SCHEMA
+#    Show existing objects and information about their structure
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+--source ../include/schema.inc
+

=== removed file 'mysql-test/suite/perfschema/t/schema_lc0.test'
--- a/mysql-test/suite/perfschema/t/schema_lc0.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/t/schema_lc0.test	1970-01-01 00:00:00 +0000
@@ -1,23 +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
-
-# Tests for PERFORMANCE_SCHEMA
-#    Show existing objects and information about their structure
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
---source include/have_lowercase0.inc
---source ../include/schema.inc
-

=== removed file 'mysql-test/suite/perfschema/t/schema_lc1.test'
--- a/mysql-test/suite/perfschema/t/schema_lc1.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/t/schema_lc1.test	1970-01-01 00:00:00 +0000
@@ -1,23 +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
-
-# Tests for PERFORMANCE_SCHEMA
-#    Show existing objects and information about their structure
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
---source include/have_lowercase1.inc
---source ../include/schema.inc
-

=== removed file 'mysql-test/suite/perfschema/t/schema_lc2.test'
--- a/mysql-test/suite/perfschema/t/schema_lc2.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/perfschema/t/schema_lc2.test	1970-01-01 00:00:00 +0000
@@ -1,23 +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
-
-# Tests for PERFORMANCE_SCHEMA
-#    Show existing objects and information about their structure
-
---source include/not_embedded.inc
---source include/have_perfschema.inc
---source include/have_lowercase2.inc
---source ../include/schema.inc
-

=== modified file 'mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result'
--- a/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/rpl/r/rpl_begin_commit_rollback.result	revid:mikael.ronstrom@stripped
@@ -350,8 +350,8 @@ BEGIN
 UPDATE t2 SET c1=3;
 RETURN 2;
 END |
-CREATE TABLE t4 (c1 INT);
-INSERT INTO t4 VAlUES(1),(2);
+CREATE TABLE t4 (c1 INT) |
+INSERT INTO t4 VAlUES(1),(2) |
 CREATE FUNCTION f_multi_update()
 RETURNS INT
 BEGIN

=== modified file 'mysql-test/suite/rpl/r/rpl_checksum.result'
--- a/mysql-test/suite/rpl/r/rpl_checksum.result	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/rpl/r/rpl_checksum.result	revid:mikael.ronstrom@stripped
@@ -68,6 +68,7 @@ Last_IO_Error = 'Got fatal error 1236 fr
 select count(*) as zero from t1;
 zero
 0
+include/stop_slave.inc
 set @@global.debug='';
 include/start_slave.inc
 set @@global.master_verify_checksum = 1;
@@ -84,12 +85,13 @@ include/wait_for_slave_io_error.inc [err
 Last_IO_Error = 'Relay log write failure: could not queue event from master'
 set @@global.debug='';
 start slave io_thread;
-include/wait_for_slave_param.inc [Read_Master_Log_Pos]
+include/sync_slave_io_with_master.inc
 set @@global.slave_sql_verify_checksum = 1;
 set @@global.debug='d,simulate_checksum_test_failure';
 start slave sql_thread;
 include/wait_for_slave_sql_error.inc [errno=1593]
 Last_SQL_Error = 'Error initializing relay log position: I/O error reading event at position 4'
+include/stop_slave.inc
 set @@global.debug='';
 include/start_slave.inc
 select count(*) as 'must be zero' from t2;

=== modified file 'mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test'
--- a/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/rpl/t/rpl_begin_commit_rollback.test	revid:mikael.ronstrom@stripped
@@ -273,8 +273,8 @@ BEGIN
   RETURN 2;
 END |
 
-CREATE TABLE t4 (c1 INT);
-INSERT INTO t4 VAlUES(1),(2);
+CREATE TABLE t4 (c1 INT) |
+INSERT INTO t4 VAlUES(1),(2) |
 CREATE FUNCTION f_multi_update()
 RETURNS INT
 BEGIN

=== modified file 'mysql-test/suite/rpl/t/rpl_checksum.test'
--- a/mysql-test/suite/rpl/t/rpl_checksum.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/suite/rpl/t/rpl_checksum.test	revid:mikael.ronstrom@stripped
@@ -108,6 +108,11 @@ source include/wait_for_slave_io_error.i
 select count(*) as zero from t1;
 
 ###connection master;
+
+# *always* make sure the slave threads are stopped 
+# or in waiting state before updating the global debug
+# variable (see BUG#11765758 for details).
+--source include/stop_slave.inc
 set @@global.debug='';
 
 connection slave;
@@ -145,27 +150,24 @@ start slave io_thread;
 let $slave_io_errno= 1595; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE
 --let $show_slave_io_error= 1
 source include/wait_for_slave_io_error.inc;
+# no need to stop the IO thread, it is already stopped
 set @@global.debug='';
 
 # to make IO thread re-read it again w/o the failure
 start slave io_thread;
-let $slave_param= Read_Master_Log_Pos;
-let $slave_param_value= $pos_master;
-source include/wait_for_slave_param.inc;
+--connection master
+--source include/sync_slave_io_with_master.inc
 
 # C3. Failure by SQL thread
 # instruction to sql thread;
 set @@global.slave_sql_verify_checksum = 1;
-
 set @@global.debug='d,simulate_checksum_test_failure';
-
 start slave sql_thread;
 let $slave_sql_errno= 1593; # ER_SLAVE_FATAL_ERROR
 --let $show_slave_sql_error= 1
 source include/wait_for_slave_sql_error.inc;
-
+--source include/stop_slave.inc
 # resuming SQL thread to parse out the event w/o the failure
-
 set @@global.debug=''; 
 source include/start_slave.inc;
 

=== modified file 'mysql-test/t/func_time.test'
--- a/mysql-test/t/func_time.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/t/func_time.test	revid:mikael.ronstrom@stripped
@@ -902,6 +902,13 @@ SELECT DATE_FORMAT('0000-00-11', '%W');
 SELECT DATE_FORMAT('0000-00-11', '%a');
 SELECT DATE_FORMAT('0000-00-11', '%w');
 
+--echo #
+--echo # Bug#12403504  AFTER FIX FOR #11889186 : ASSERTION FAILED: DELSUM+(INT) Y/4-TEMP > 0
+--echo #
+
+SELECT MAKEDATE(11111111,1);
+SELECT WEEK(DATE_ADD(FROM_DAYS(1),INTERVAL 1 MONTH), 1);
+
 --echo End of 5.1 tests
 
 --echo #

=== modified file 'mysql-test/t/having.test'
--- a/mysql-test/t/having.test	revid:mikael.ronstrom@stripped
+++ b/mysql-test/t/having.test	revid:mikael.ronstrom@stripped
@@ -615,3 +615,31 @@ drop table `t1`;
 
 --echo End of 5.5 tests
 
+--echo #
+--echo # Bug#12402590 ASSERT AT PROTOCOL::END_STATEMENT ON MYSQL-TRUNK
+--echo #              RUNNING RQG_OPT_SUBQUERY TEST
+--echo #
+
+CREATE TABLE t2 (
+  f1 INT,
+  PRIMARY KEY (f1)
+);
+INSERT INTO t2 VALUES (1), (2);
+
+CREATE TABLE t1 (
+  f1 INT,
+  f2 VARCHAR(1),
+  f3 VARCHAR(1),
+  PRIMARY KEY (f1),
+  KEY (f2, f1)
+);
+INSERT INTO t1 VALUES (8, 'g', 'g'), (11, 'a', 'a');
+
+SELECT t1.f1 FROM t1 JOIN t2 ON t2.f1 = t1.f1
+WHERE t1.f3 AND t1.f2 IN ('f')
+HAVING (1 ,6) IN (SELECT 3, 6)
+ORDER BY t1.f1;
+
+DROP TABLE t1, t2;
+
+--echo End of 5.6 tests

=== added file 'mysql-test/t/implicit_char_to_num_conversion.test'
--- a/mysql-test/t/implicit_char_to_num_conversion.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/implicit_char_to_num_conversion.test	revid:mikael.ronstrom@stripped
@@ -0,0 +1,174 @@
+########### implicit_char_to_num_conversion.test #######################
+#                                                                      #
+# This test aims at using string/char literal in comparison operators  #
+# without explicit type-cast. This is a bug test for Bug#11766521      #
+# - Incorrect result is returned if string/char literal is used with   #
+# comparision operator and bit data type column. Test is extended to   #
+# include numeric data type comparison with string/char literal        #
+#                                                                      #
+#                                                                      #
+# Creation:                                                            #
+# 2011-05-10 vfisrekar Implement this test as part of Bug#11766521     #
+#                                                                      #
+########################################################################
+
+--disable_warnings
+DROP TABLE IF EXISTS t5;
+--enable_warnings
+
+let $default_engine = `select @@SESSION.default_storage_engine`;
+
+# Bug#11766521 - BIT Datatype comparison in where clause return incorrect
+# result for '=' , '<=>' operators
+--replace_result $default_engine <default_engine>
+eval CREATE TABLE t5(c1  BIT(2) PRIMARY KEY) ENGINE = $default_engine;
+INSERT INTO t5 VALUES (0), (1), (2);
+SELECT HEX(c1) FROM t5 ORDER BY c1;
+# Enable Following two select after Bug#11766521 fix
+# SELECT HEX(c1) FROM t5 WHERE c1 = '1' ORDER BY c1;
+# SELECT HEX(c1) FROM t5 WHERE c1 <=> '1' ORDER BY c1;
+SELECT HEX(c1) FROM t5 WHERE c1 = b'1' ORDER BY c1;
+SELECT HEX(c1) FROM t5 WHERE c1 <=> b'1' ORDER BY c1;
+SELECT HEX(c1) FROM t5 WHERE c1 != b'1' ORDER BY c1;
+SELECT HEX(c1) FROM t5 WHERE c1 >= '1' ORDER BY c1;
+SELECT HEX(c1) FROM t5 WHERE c1 <= '1' ORDER BY c1;
+SELECT HEX(c1) FROM t5 WHERE c1 < '1' ORDER BY c1;
+SELECT HEX(c1) FROM t5 WHERE c1 > '0' ORDER BY c1;
+DROP TABLE t5;
+
+# FLOAT Data-type
+--replace_result $default_engine <default_engine>
+eval CREATE TABLE t5(c1 FLOAT(5,2) PRIMARY KEY) ENGINE = $default_engine;
+INSERT INTO t5 VALUES (95.95), (-10.10), (1), (0);
+SELECT c1 FROM t5 ORDER BY c1;
+# Compare with string literal
+# Following two queries does not return result may be due to Bug#11766521. 
+# Enable them after Bug#11766521 fix.
+# SELECT c1 FROM t5 WHERE c1 = '10.10' ORDER BY c1;
+# SELECT c1 FROM t5 WHERE c2 <=> '11.11' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <= '10.10' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 != '1' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 < '1' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 > '0' ORDER BY c1;
+DROP TABLE t5;
+
+# TINYINT Datatype
+--replace_result $default_engine <default_engine>
+eval CREATE TABLE t5(c1 TINYINT PRIMARY KEY) ENGINE = $default_engine;
+INSERT INTO t5 VALUES (95), (10),(11),(-8);
+SELECT c1 FROM t5 ORDER BY c1;
+# Compare with string literal
+SELECT c1 FROM t5 WHERE c1 = '10' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <=> '10' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 >= '95' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <= '11' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 != '-8' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 < '11' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 > '10' ORDER BY c1;
+DROP TABLE t5;
+
+# SMALLINT Datatype
+--replace_result $default_engine <default_engine>
+eval CREATE TABLE t5(c1 SMALLINT PRIMARY KEY) ENGINE = $default_engine;
+INSERT INTO t5 VALUES (395), (-200), (100), (111);
+SELECT c1 FROM t5 ORDER BY c1;
+# Compare with string literal
+SELECT c1 FROM t5 WHERE c1 = '100' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <=> '100' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 >= '395' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <= '-200' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 != '100' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 < '111' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 > '111' ORDER BY c1;
+DROP TABLE t5;
+
+# MEDIUMINT Datatype
+--replace_result $default_engine <default_engine>
+eval CREATE TABLE t5(c1 MEDIUMINT PRIMARY KEY) ENGINE = $default_engine;
+INSERT INTO t5 VALUES (-8388607), (311),(215),(88608);
+SELECT c1 FROM t5 ORDER BY c1;
+# Compare with string literal
+SELECT c1 FROM t5 WHERE c1 = '311' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <=> '311' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 >= '215' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <= '88608' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 != '-8388607' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 < '215' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 > '215' ORDER BY c1;
+DROP TABLE t5;
+
+# INT Datatype
+--replace_result $default_engine <default_engine>
+eval CREATE TABLE t5(c1 INT PRIMARY KEY) ENGINE = $default_engine;
+INSERT INTO t5 VALUES (-2147483647), (1011),(15),(9388607);
+SELECT c1 FROM t5 ORDER BY c1;
+# Compare with string literal
+SELECT c1 FROM t5 WHERE c1 = '9388607' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <=> '9388607' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 >= '15' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <= '1011' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 != '-2147483647' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 < '15' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 > '15' ORDER BY c1;
+DROP TABLE t5;
+
+# BIGINT Data-type
+--replace_result $default_engine <default_engine>
+eval CREATE TABLE t5(c1 BIGINT PRIMARY KEY) ENGINE = $default_engine;
+INSERT INTO t5 VALUES (-9223372036854775807), (12011),(500),(3372036854775808);
+SELECT c1 FROM t5 ORDER BY c1;
+# Compare with string literal
+SELECT c1 FROM t5 WHERE c1 = '-9223372036854775807' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <=> '-9223372036854775807' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 >= '12011' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <= '500' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 != '3372036854775808' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 < '12011' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 > '12011' ORDER BY c1;
+DROP TABLE t5;
+
+# DOUBLE Datatype
+--replace_result $default_engine <default_engine>
+eval CREATE TABLE t5(c1 DOUBLE(5,2) PRIMARY KEY) ENGINE = $default_engine;
+INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
+SELECT c1 FROM t5 ORDER BY c1;
+# Compare with string literal
+SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
+DROP TABLE t5;
+
+# NUMERIC Datatype
+--replace_result $default_engine <default_engine>
+eval CREATE TABLE t5(c1 NUMERIC(5,2) PRIMARY KEY) ENGINE = $default_engine;
+INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
+SELECT c1 FROM t5 ORDER BY c1;
+# Compare with string literal
+SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
+DROP TABLE t5;
+
+# DECIMAL Datatype
+--replace_result $default_engine <default_engine>
+eval CREATE TABLE t5(c1 DECIMAL(5,2)  PRIMARY KEY) ENGINE = $default_engine;
+INSERT INTO t5 VALUES (95.95), (11.11),(5),(-908.92);
+SELECT c1 FROM t5 ORDER BY c1;
+# Compare with string literal
+SELECT c1 FROM t5 WHERE c1 = '11.11' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <=> '11.11' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 >= '5' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 <= '95.95' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 != '-908.92' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 < '95.95' ORDER BY c1;
+SELECT c1 FROM t5 WHERE c1 > '-908.92' ORDER BY c1;
+DROP TABLE t5;

=== modified file 'mysys/lf_alloc-pin.c'
--- a/mysys/lf_alloc-pin.c	revid:mikael.ronstrom@stripped
+++ b/mysys/lf_alloc-pin.c	revid:mikael.ronstrom@stripped
@@ -146,6 +146,7 @@ void lf_pinbox_destroy(LF_PINBOX *pinbox
 */
 LF_PINS *_lf_pinbox_get_pins(LF_PINBOX *pinbox)
 {
+  struct st_my_thread_var *var;
   uint32 pins, next, top_ver;
   LF_PINS *el;
   /*
@@ -188,7 +189,12 @@ LF_PINS *_lf_pinbox_get_pins(LF_PINBOX *
   el->link= pins;
   el->purgatory_count= 0;
   el->pinbox= pinbox;
-  el->stack_ends_here= & my_thread_var->stack_ends_here;
+  var= my_thread_var;
+  /*
+    Threads that do not call my_thread_init() should still be
+    able to use the LF_HASH.
+  */
+  el->stack_ends_here= (var ? & var->stack_ends_here : NULL);
   return el;
 }
 
@@ -327,34 +333,36 @@ static int match_pins(LF_PINS *el, void 
 */
 static void _lf_pinbox_real_free(LF_PINS *pins)
 {
-  int npins, alloca_size;
-  void *list, **addr;
+  int npins;
+  void *list;
+  void **addr= NULL;
   void *first= NULL, *last= NULL;
   LF_PINBOX *pinbox= pins->pinbox;
 
   npins= pinbox->pins_in_array+1;
 
 #ifdef HAVE_ALLOCA
-  alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins;
-  /* create a sorted list of pinned addresses, to speed up searches */
-  if (available_stack_size(&pinbox, *pins->stack_ends_here) > alloca_size)
+  if (pins->stack_ends_here != NULL)
   {
-    struct st_harvester hv;
-    addr= (void **) alloca(alloca_size);
-    hv.granary= addr;
-    hv.npins= npins;
-    /* scan the dynarray and accumulate all pinned addresses */
-    _lf_dynarray_iterate(&pinbox->pinarray,
-                         (lf_dynarray_func)harvest_pins, &hv);
-
-    npins= hv.granary-addr;
-    /* and sort them */
-    if (npins)
-      qsort(addr, npins, sizeof(void *), (qsort_cmp)ptr_cmp);
+    int alloca_size= sizeof(void *)*LF_PINBOX_PINS*npins;
+    /* create a sorted list of pinned addresses, to speed up searches */
+    if (available_stack_size(&pinbox, *pins->stack_ends_here) > alloca_size)
+    {
+      struct st_harvester hv;
+      addr= (void **) alloca(alloca_size);
+      hv.granary= addr;
+      hv.npins= npins;
+      /* scan the dynarray and accumulate all pinned addresses */
+      _lf_dynarray_iterate(&pinbox->pinarray,
+                           (lf_dynarray_func)harvest_pins, &hv);
+
+      npins= hv.granary-addr;
+      /* and sort them */
+      if (npins)
+        qsort(addr, npins, sizeof(void *), (qsort_cmp)ptr_cmp);
+    }
   }
-  else
 #endif
-    addr= 0;
 
   list= pins->purgatory;
   pins->purgatory= 0;

=== modified file 'mysys/thr_alarm.c'
--- a/mysys/thr_alarm.c	revid:mikael.ronstrom@stripped
+++ b/mysys/thr_alarm.c	revid:mikael.ronstrom@stripped
@@ -1,4 +1,4 @@
-/* Copyright (C) 2000 MySQL AB, 2008-2009 Sun Microsystems, Inc
+/* Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -260,7 +260,7 @@ void thr_end_alarm(thr_alarm_t *alarmed)
   {
     if ((ALARM*) queue_element(&alarm_queue,i) == alarm_data)
     {
-      queue_remove(&alarm_queue,i),MYF(0);
+      queue_remove(&alarm_queue,i);
       if (alarm_data->malloced)
 	my_free(alarm_data);
       found++;

=== modified file 'packaging/WiX/ca/CMakeLists.txt'
--- a/packaging/WiX/ca/CMakeLists.txt	revid:mikael.ronstrom@stripped
+++ b/packaging/WiX/ca/CMakeLists.txt	revid:mikael.ronstrom@stripped
@@ -13,12 +13,43 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
-INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/inc)
-LINK_DIRECTORIES(${WIX_DIR}/../SDK/lib)
+INCLUDE_DIRECTORIES(${WIX_DIR}/../SDK/inc ${WIX_DIR}/SDK/inc)
+LINK_DIRECTORIES(${WIX_DIR}/../SDK/lib ${WIX_DIR}/SDK/lib)
+
 SET(WIXCA_SOURCES CustomAction.cpp CustomAction.def)
-ADD_LIBRARY(wixca SHARED EXCLUDE_FROM_ALL  ${WIXCA_SOURCES})
+
 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
-  TARGET_LINK_LIBRARIES(wixca wcautil_x64 dutil_x64 msi version)
+  SET(WIX_ARCH_SUFFIX "_x64")
+ELSE()
+  SET(WIX_ARCH_SUFFIX)
+ENDIF()
+
+IF(MSVC_VERSION EQUAL 1400)
+  SET(WIX35_MSVC_SUFFIX "_2005")
+ELSEIF(MSVC_VERSION EQUAL 1500)
+  SET(WIX35_MSVC_SUFFIX "_2008")
+ELSEIF(MSVC_VERSION EQUAL 1600)
+  SET(WIX35_MSVC_SUFFIX "_2010")
 ELSE()
-  TARGET_LINK_LIBRARIES(wixca wcautil dutil msi version)
+  # When next VS is out, add the correct version here
+  MESSAGE(FATAL_ERROR "Unknown VS version")
 ENDIF()
+
+MESSAGE(STATUS "Searching for wcautil${WIX_ARCH_SUFFIX} or wcautil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX} in ${WIX_DIR}/../SDK/lib ${WIX_DIR}/SDK/lib")
+MESSAGE(STATUS "Searching for dutil${WIX_ARCH_SUFFIX} or dutil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX} in ${WIX_DIR}/../SDK/lib ${WIX_DIR}/SDK/lib")
+
+FIND_LIBRARY(WIX_WCAUTIL_LIBRARY 
+  NAMES wcautil${WIX_ARCH_SUFFIX}  wcautil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
+  HINTS ${WIX_DIR}/../SDK/lib ${WIX_DIR}/SDK/lib)
+
+FIND_LIBRARY(WIX_DUTIL_LIBRARY 
+  NAMES dutil${WIX_ARCH_SUFFIX}  dutil${WIX35_MSVC_SUFFIX}${WIX_ARCH_SUFFIX}
+  PATHS ${WIX_DIR}/../SDK/lib ${WIX_DIR}/SDK/lib)
+
+MESSAGE(STATUS "Found: ${WIX_WCAUTIL_LIBRARY}")
+MESSAGE(STATUS "Found: ${WIX_DUTIL_LIBRARY}")
+
+ADD_VERSION_INFO(wixca SHARED WIXCA_SOURCES)
+ADD_LIBRARY(wixca SHARED EXCLUDE_FROM_ALL ${WIXCA_SOURCES})
+TARGET_LINK_LIBRARIES(wixca ${WIX_WCAUTIL_LIBRARY} ${WIX_DUTIL_LIBRARY} 
+  msi version )

=== modified file 'packaging/WiX/create_msi.cmake.in'
--- a/packaging/WiX/create_msi.cmake.in	revid:mikael.ronstrom@stripped
+++ b/packaging/WiX/create_msi.cmake.in	revid:mikael.ronstrom@stripped
@@ -15,6 +15,28 @@ SET(COPYING_RTF "@COPYING_RTF@")
 SET(CPACK_WIX_CONFIG "@CPACK_WIX_CONFIG@")
 SET(CPACK_WIX_INCLUDE "@CPACK_WIX_INCLUDE@")
 
+LIST(APPEND EXCLUDE_DIRS
+     bin/debug
+     data/test
+     lib/plugin/debug
+     mysql-test
+     scripts
+     sql-bench
+)
+
+LIST(APPEND EXCLUDE_FILES
+     bin/echo.exe
+     bin/mysql_client_test_embedded.exe
+     bin/mysqld-debug.exe
+     bin/mysqltest_embedded.exe
+     bin/replace.exe
+     lib/debug/mysqlserver.lib
+     lib/libmysqld.dll
+     lib/libmysqld.lib
+     lib/mysqlserver.lib
+     lib/mysqlservices.lib
+)
+
 IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
   SET(Win64 " Win64='yes'")
   SET(Platform x64)
@@ -197,11 +219,18 @@ ENDMACRO()
 
 
 FUNCTION(TRAVERSE_FILES dir topdir file file_comp  dir_root)
+  FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})
+  IF(dir_rel)
+    LIST(FIND EXCLUDE_DIRS ${dir_rel} TO_EXCLUDE)
+    IF(NOT TO_EXCLUDE EQUAL -1)
+      MESSAGE(STATUS "excluding directory: ${dir_rel}")
+      RETURN()
+    ENDIF()
+  ENDIF()
   FILE(GLOB all_files ${dir}/*)
   IF(NOT all_files)
     RETURN()
   ENDIF()
-  FILE(RELATIVE_PATH dir_rel ${topdir} ${dir})
   IF(dir_rel)
    MAKE_DIRECTORY(${dir_root}/${dir_rel})
    MAKE_WIX_IDENTIFIER("${dir_rel}" id)
@@ -215,18 +244,31 @@ FUNCTION(TRAVERSE_FILES dir topdir file 
   FOREACH(f ${all_files})
     IF(NOT IS_DIRECTORY ${f})
       FILE(RELATIVE_PATH rel ${topdir} ${f})
-      MAKE_WIX_IDENTIFIER("${rel}" id)
-      FILE(TO_NATIVE_PATH ${f} f_native)
-      GET_FILENAME_COMPONENT(f_ext "${f}" EXT)
-      # According to MSDN each DLL or EXE should be in the own component
-      IF(f_ext MATCHES ".exe" OR f_ext MATCHES ".dll")
-
-        FILE(APPEND ${file} "  <Component Id='C.${id}' Guid='*' ${Win64}>\n")
-        FILE(APPEND ${file} "    <File Id='F.${id}' KeyPath='yes' Source='${f_native}'/>\n")
-        FILE(APPEND ${file} "  </Component>\n")
-        FILE(APPEND ${file_comp} "  <ComponentRef Id='C.${id}'/>\n")
-     ELSE()
-      SET(NONEXEFILES  "${NONEXEFILES}\n<File Id='F.${id}' Source='${f_native}'/>" )
+      SET(TO_EXCLUDE)
+      IF(rel MATCHES "\\.pdb$")
+        SET(TO_EXCLUDE TRUE)
+      ELSE()
+        LIST(FIND EXCLUDE_FILES ${rel} RES)
+        IF(NOT RES EQUAL -1)
+          SET(TO_EXCLUDE TRUE)
+        ENDIF()
+      ENDIF()
+      IF(TO_EXCLUDE)
+        MESSAGE(STATUS "excluding file: ${rel}")
+      ELSE()
+	MAKE_WIX_IDENTIFIER("${rel}" id)
+	FILE(TO_NATIVE_PATH ${f} f_native)
+	GET_FILENAME_COMPONENT(f_ext "${f}" EXT)
+	# According to MSDN each DLL or EXE should be in the own component
+	IF(f_ext MATCHES ".exe" OR f_ext MATCHES ".dll")
+
+	  FILE(APPEND ${file} "  <Component Id='C.${id}' Guid='*' ${Win64}>\n")
+	  FILE(APPEND ${file} "    <File Id='F.${id}' KeyPath='yes' Source='${f_native}'/>\n")
+	  FILE(APPEND ${file} "  </Component>\n")
+	  FILE(APPEND ${file_comp} "  <ComponentRef Id='C.${id}'/>\n")
+       ELSE()
+	SET(NONEXEFILES  "${NONEXEFILES}\n<File Id='F.${id}' Source='${f_native}'/>" )
+	ENDIF()
       ENDIF()
     ENDIF()
   ENDFOREACH()
@@ -247,18 +289,18 @@ ENDFUNCTION()
 
 FUNCTION(TRAVERSE_DIRECTORIES dir topdir file prefix)
   FILE(RELATIVE_PATH rel ${topdir} ${dir})
-  IF(rel AND IS_DIRECTORY "${f}")
+  IF(rel)
     MAKE_WIX_IDENTIFIER("${rel}" id)
     GET_FILENAME_COMPONENT(name ${dir} NAME)
     FILE(APPEND ${file} "${prefix}<Directory Id='D.${id}' Name='${name}'>\n")
   ENDIF()
   FILE(GLOB all_files ${dir}/*)
-    FOREACH(f ${all_files})
+  FOREACH(f ${all_files})
     IF(IS_DIRECTORY ${f})
       TRAVERSE_DIRECTORIES(${f} ${topdir} ${file} "${prefix}  ")
     ENDIF()
   ENDFOREACH()
-  IF(rel AND IS_DIRECTORY "${f}")
+  IF(rel)
     FILE(APPEND ${file} "${prefix}</Directory>\n")
   ENDIF()
 ENDFUNCTION()
@@ -317,16 +359,25 @@ ENDIF()
 FILE(REMOVE mysql_server.wixobj)
 EXECUTE_PROCESS(
  COMMAND ${CANDLE_EXECUTABLE} -ext WixUtilExtension  mysql_server.wxs ${EXTRA_CANDLE_ARGS}
+ RESULT_VARIABLE CANDLE_RESULT
 )
+
+IF(CANDLE_RESULT)
+  MESSAGE(FATAL_ERROR "ERROR: can't run candle")
+ENDIF()
+
 EXECUTE_PROCESS(
  COMMAND ${LIGHT_EXECUTABLE} -ext WixUIExtension -ext WixUtilExtension
   mysql_server.wixobj  -out  ${CPACK_PACKAGE_FILE_NAME}.msi
   ${EXTRA_LIGHT_ARGS}
+ RESULT_VARIABLE LIGHT_RESULT
 )
 
+IF(LIGHT_RESULT)
+  MESSAGE(FATAL_ERROR "ERROR: can't run light")
+ENDIF()
+
 # Switch monolithic install on again
 EXECUTE_PROCESS(
   COMMAND ${CMAKE_COMMAND} -DCPACK_MONOLITHIC_INSTALL=1 ${CMAKE_BINARY_DIR}
-  OUTPUT_QUIET
 )
-

=== modified file 'packaging/WiX/custom_ui.wxs'
--- a/packaging/WiX/custom_ui.wxs	revid:mikael.ronstrom@stripped
+++ b/packaging/WiX/custom_ui.wxs	revid:mikael.ronstrom@stripped
@@ -1,7 +1,22 @@
 <Include xmlns="http://schemas.microsoft.com/wix/2006/wi"
          xmlns:util="http://schemas.microsoft.com/wix/UtilExtension">
-  <WixVariable Id="WixUICostingPopupOptOut" Value="1" Overridable="yes" />
   <UI Id="WixUI_Mondo_Custom">
+    <Dialog Id="CustomWelcomeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
+      <Control Id="Cancel" Type="PushButton" X="304" Y="243" Width="56" Height="17" Cancel="yes" Text="!(loc.WixUICancel)">
+        <Publish Event="SpawnDialog" Value="CancelDlg">1</Publish>
+      </Control>
+      <Control Id="Next" Type="PushButton" X="220" Y="243" Width="56" Height="17" Default="yes" Text="!(loc.WixUINext)">
+        <Publish Event="NewDialog" Value="LicenseAgreementDlg">NOT OLDERVERSIONBEINGUPGRADED</Publish>
+        <Publish Event="NewDialog" Value="UpgradeDlg">OLDERVERSIONBEINGUPGRADED</Publish>
+	  </Control>	  
+      <Control Id="Back" Type="PushButton" X="156" Y="243" Width="56" Height="17" Text="!(loc.WixUIBack)" Disabled="yes" />
+      <Control Id="Description" Type="Text" X="135" Y="80" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgDescription)" />
+      <Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.WelcomeDlgTitle)" />
+      <Control Id="CopyrightText" Type="Text" X="135" Y="200" Width="220" Height="40" Transparent="yes" Text="Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved." />
+      <Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.WelcomeDlgBitmap)" />
+      <Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
+    </Dialog>
+
     <Dialog Id="UpgradeDlg" Width="370" Height="270" Title="[ProductName] Setup" NoMinimize="yes">
       <Control Id="Install" Type="PushButton" ElevationShield="yes" X="212" Y="243" Width="80" Height="17" Default="yes"  Text="Upgrade">
         <Publish Event="EndDialog" Value="Return"><![CDATA[OutOfDiskSpace <> 1]]></Publish>
@@ -47,10 +62,7 @@
 
     <Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
 
-    <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="LicenseAgreementDlg" Order="1">NOT OLDERVERSIONBEINGUPGRADED</Publish>
-    <Publish Dialog="WelcomeDlg" Control="Next" Event="NewDialog" Value="UpgradeDlg" Order="2">OLDERVERSIONBEINGUPGRADED</Publish>
-
-    <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
+    <Publish Dialog="LicenseAgreementDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish>
     <Publish Dialog="LicenseAgreementDlg" Control="Next" Event="NewDialog" Value="SetupTypeDlg" Order="2">LicenseAccepted = "1"</Publish>
 
     <Publish Dialog="SetupTypeDlg" Control="Back" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>
@@ -74,7 +86,11 @@
     <Publish Dialog="MaintenanceTypeDlg" Control="RemoveButton" Event="NewDialog" Value="VerifyReadyDlg">1</Publish>
     <Publish Dialog="MaintenanceTypeDlg" Control="Back" Event="NewDialog" Value="MaintenanceWelcomeDlg">1</Publish>
 
-    <Publish Dialog="UpgradeDlg" Control="Back" Event="NewDialog" Value="WelcomeDlg">1</Publish>
+    <Publish Dialog="UpgradeDlg" Control="Back" Event="NewDialog" Value="CustomWelcomeDlg">1</Publish>
+	
+    <InstallUISequence>
+      <Show Dialog="CustomWelcomeDlg" Before="ProgressDlg">NOT Installed</Show>
+    </InstallUISequence>
   </UI>
 
   <UIRef Id="WixUI_Common" />

=== modified file 'sql/binlog.h'
--- a/sql/binlog.h	revid:mikael.ronstrom@stripped
+++ b/sql/binlog.h	revid:mikael.ronstrom@stripped
@@ -1,5 +1,5 @@
 #ifndef BINLOG_H_INCLUDED
-/* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2010, 2011, Oracle and/or its affiliates. All rights reserved.
 
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
@@ -106,8 +106,8 @@ class MYSQL_BIN_LOG: public TC_LOG, priv
   int new_file_impl(bool need_lock);
 
 public:
-  MYSQL_LOG::generate_name;
-  MYSQL_LOG::is_open;
+  using MYSQL_LOG::generate_name;
+  using MYSQL_LOG::is_open;
 
   /* This is relay log */
   bool is_relay_log;

=== modified file 'sql/filesort.cc'
--- a/sql/filesort.cc	revid:mikael.ronstrom@stripped
+++ b/sql/filesort.cc	revid:mikael.ronstrom@stripped
@@ -1226,7 +1226,7 @@ bool check_if_pq_applicable(Sort_param *
                                        row_length);
       /*
         PQ has cost:
-        (insert + qsort) * log(queue size) / TIME_FOR_COMPARE_ROWID +
+        (insert + qsort) * log(queue size) * ROWID_COMPARE_COST +
         cost of file lookup afterwards.
         The lookup cost is a bit pessimistic: we take scan_time and assume
         that on average we find the row after scanning half of the file.
@@ -1235,7 +1235,7 @@ bool check_if_pq_applicable(Sort_param *
       */
       const double pq_cpu_cost= 
         (PQ_slowness * num_rows + param->max_keys_per_buffer) *
-        log((double) param->max_keys_per_buffer) / TIME_FOR_COMPARE_ROWID;
+        log((double) param->max_keys_per_buffer) * ROWID_COMPARE_COST;
       const double pq_io_cost=
         param->max_rows * table->file->scan_time() / 2.0;
       const double pq_cost= pq_cpu_cost + pq_io_cost;

=== modified file 'sql/filesort_utils.cc'
--- a/sql/filesort_utils.cc	revid:mikael.ronstrom@stripped
+++ b/sql/filesort_utils.cc	revid:mikael.ronstrom@stripped
@@ -26,8 +26,7 @@ double get_merge_cost(ha_rows num_elemen
 {
   return 
     2.0 * ((double) num_elements * elem_size) / IO_SIZE
-    + (double) num_elements * log((double) num_buffers) /
-      (TIME_FOR_COMPARE_ROWID * M_LN2);
+    + num_elements * log((double) num_buffers) * ROWID_COMPARE_COST / M_LN2;
 }
 }
 
@@ -49,8 +48,7 @@ double get_merge_many_buffs_cost_fast(ha
   // Calculate CPU cost of sorting buffers.
   total_cost=
     ( num_buffers * num_keys_per_buffer * log(1.0 + num_keys_per_buffer) +
-      last_n_elems * log(1.0 + last_n_elems) )
-    / TIME_FOR_COMPARE_ROWID;
+      last_n_elems * log(1.0 + last_n_elems) ) * ROWID_COMPARE_COST;
   
   // Simulate behavior of merge_many_buff().
   while (num_buffers >= MERGEBUFF2)

=== modified file 'sql/ha_ndbcluster.cc'
--- a/sql/ha_ndbcluster.cc	revid:mikael.ronstrom@stripped
+++ b/sql/ha_ndbcluster.cc	revid:mikael.ronstrom@stripped
@@ -9042,7 +9042,7 @@ ha_ndbcluster::multi_range_read_info_con
       cost->io_count= index_only_read_time(keyno, total_rows);
     else
       cost->io_count= read_time(keyno, n_ranges, total_rows);
-    cost->cpu_cost= (double) total_rows / TIME_FOR_COMPARE + 0.01;
+    cost->cpu_cost= total_rows * ROW_EVALUATE_COST + 0.01;
   }
   return total_rows;
 }

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	revid:mikael.ronstrom@stripped
+++ b/sql/ha_partition.cc	revid:mikael.ronstrom@stripped
@@ -47,10 +47,6 @@
   if this file.
 */
 
-#ifdef __GNUC__
-#pragma implementation				// gcc: Class implementation
-#endif
-
 #include "sql_priv.h"
 #include "sql_parse.h"                          // append_file_to_dir
 #include "binlog.h"                             // mysql_bin_log

=== modified file 'sql/ha_partition.h'
--- a/sql/ha_partition.h	revid:mikael.ronstrom@stripped
+++ b/sql/ha_partition.h	revid:mikael.ronstrom@stripped
@@ -16,15 +16,11 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
-#ifdef __GNUC__
-#pragma interface				/* gcc class implementation */
-#endif
-
 #include "sql_partition.h"      /* part_id_range, partition_element */
 #include "queues.h"             /* QUEUE */
 
 enum partition_keywords
-{ 
+{
   PKW_HASH= 0, PKW_RANGE, PKW_LIST, PKW_KEY, PKW_MAXVALUE, PKW_LINEAR,
   PKW_COLUMNS
 };

=== modified file 'sql/handler.cc'
--- a/sql/handler.cc	revid:mikael.ronstrom@stripped
+++ b/sql/handler.cc	revid:mikael.ronstrom@stripped
@@ -235,7 +235,7 @@ handlerton *ha_checktype(THD *thd, enum 
     return NULL;
   }
 
-  RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+  (void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
 
   switch (database_type) {
   case DB_TYPE_MRG_ISAM:
@@ -1252,7 +1252,7 @@ int ha_commit_trans(THD *thd, bool all)
         goto end;
       }
     DBUG_EXECUTE_IF("crash_commit_after", DBUG_SUICIDE(););
-    RUN_HOOK(transaction, after_commit, (thd, FALSE));
+    (void) RUN_HOOK(transaction, after_commit, (thd, FALSE));
 end:
     if (rw_trans && mdl_request.ticket)
     {
@@ -1421,7 +1421,7 @@ int ha_rollback_trans(THD *thd, bool all
   if (is_real_trans && thd->transaction.all.cannot_safely_rollback() &&
       !thd->slave_thread && thd->killed != THD::KILL_CONNECTION)
     thd->transaction.push_unsafe_rollback_warnings(thd);
-  RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+  (void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
   DBUG_RETURN(error);
 }
 
@@ -4557,7 +4557,7 @@ handler::multi_range_read_info_const(uin
       cost->io_count= index_only_read_time(keyno, total_rows);
     else
       cost->io_count= read_time(keyno, n_ranges, total_rows);
-    cost->cpu_cost= (double) total_rows / TIME_FOR_COMPARE + 0.01;
+    cost->cpu_cost= total_rows * ROW_EVALUATE_COST + 0.01;
   }
   return total_rows;
 }
@@ -4782,19 +4782,19 @@ int DsMrr_impl::dsmrr_init(handler *h_ar
   /* 
     This assert will hit if we have pushed an index condition to the
     primary key index and then "change our mind" and use a different
-    index for retrieving data with MRR.
-
-    This assert is too strict for the existing code. If an index
-    condition has been pushed on the primary index the existing code
-    does not clean up information about the pushed index condition when
-    the index scan is completed. Disables the assert until we have
-    a fix for better cleaning up after a pushed index condition. 
+    index for retrieving data with MRR. One of the following criteria
+    must be true:
+      1. We have not pushed an index conditon on this handler.
+      2. We have pushed an index condition and this is on the currently used
+         index.
+      3. We have pushed an index condition but this is not for the primary key.
+      4. We have pushed an index condition and this has been transferred to 
+         the clone (h2) of the handler object.
   */
-  /*
   DBUG_ASSERT(!h->pushed_idx_cond ||
               h->pushed_idx_cond_keyno == h->active_index ||
-              h->pushed_idx_cond_keyno != table->s->primary_key);
-  */
+              h->pushed_idx_cond_keyno != table->s->primary_key ||
+              (h2 && h->pushed_idx_cond_keyno == h2->active_index));
 
   rowids_buf= buf->buffer;
 
@@ -4867,7 +4867,26 @@ int DsMrr_impl::dsmrr_init(handler *h_ar
     /*
       We get here when the access alternates betwen MRR scan(s) and non-MRR
       scans.
+    */
 
+    /* 
+      Verify consistency between the two handler objects:
+      1. The main handler should either use the primary key or not have an
+         active index at this point since the clone handler (h2) is used for
+         reading the index.
+      2. The index used for ICP should be the same for the two handlers or
+         it should not be set on the clone handler (h2).
+      3. The ICP function should be the same for the two handlers or it should
+         not be set for the clone handler (h2).
+    */
+    DBUG_ASSERT(h->active_index == table->s->primary_key ||
+                h->active_index == MAX_KEY);
+    DBUG_ASSERT(h->pushed_idx_cond_keyno == h2->pushed_idx_cond_keyno || 
+                h2->pushed_idx_cond_keyno == MAX_KEY);
+    DBUG_ASSERT(h->pushed_idx_cond == h2->pushed_idx_cond || 
+                h2->pushed_idx_cond == NULL);
+
+    /*
       Calling h->index_end() will invoke dsmrr_close() for this object,
       which will delete h2. We need to keep it, so save put it away and dont
       let it be deleted:
@@ -5303,7 +5322,7 @@ void get_sort_and_sweep_cost(TABLE *tabl
   {
     get_sweep_read_cost(table, nrows, FALSE, cost);
     /* Add cost of qsort call: n * log2(n) * cost(rowid_comparison) */
-    double cmp_op= rows2double(nrows) * (1.0 / TIME_FOR_COMPARE_ROWID);
+    double cmp_op= rows2double(nrows) * ROWID_COMPARE_COST;
     if (cmp_op < 3)
       cmp_op= 3;
     cost->cpu_cost += cmp_op * log2(cmp_op);

=== modified file 'sql/item_cmpfunc.cc'
--- a/sql/item_cmpfunc.cc	revid:mikael.ronstrom@stripped
+++ b/sql/item_cmpfunc.cc	revid:mikael.ronstrom@stripped
@@ -1764,6 +1764,17 @@ bool Item_in_optimizer::fix_fields(THD *
   with_sum_func= with_sum_func || args[1]->with_sum_func;
   used_tables_cache|= args[1]->used_tables();
   not_null_tables_cache|= args[1]->not_null_tables();
+
+  if (!sub->is_top_level_item())
+  {
+    /*
+      This is a NOT IN subquery predicate (or equivalent). Null values passed
+      from outer tables and used in the left-hand expression of the predicate
+      must be considered in the evaluation, hence filter out these tables
+      from the set of null-rejecting tables.
+    */
+    not_null_tables_cache&= ~args[0]->not_null_tables();
+  }
   const_item_cache&= args[1]->const_item();
   fixed= 1;
   return FALSE;
@@ -1791,6 +1802,7 @@ void Item_in_optimizer::fix_after_pullou
   const_item_cache&= args[1]->const_item();
 }
 
+
 /**
    The implementation of optimized \<outer expression\> [NOT] IN \<subquery\>
    predicates. The implementation works as follows.

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	revid:mikael.ronstrom@stripped
+++ b/sql/item_func.h	revid:mikael.ronstrom@stripped
@@ -37,7 +37,11 @@ protected:
   uint allowed_arg_cols;
 public:
   uint arg_count;
-  table_map used_tables_cache, not_null_tables_cache;
+  /// Value used in calculation of result of used_tables()
+  table_map used_tables_cache;
+  /// Value used in calculation of result of not_null_tables()
+  table_map not_null_tables_cache;
+  /// Value used in calculation of result of const_item()
   bool const_item_cache;
   enum Functype { UNKNOWN_FUNC,EQ_FUNC,EQUAL_FUNC,NE_FUNC,LT_FUNC,LE_FUNC,
 		  GE_FUNC,GT_FUNC,FT_FUNC,

=== modified file 'sql/item_timefunc.cc'
--- a/sql/item_timefunc.cc	revid:mikael.ronstrom@stripped
+++ b/sql/item_timefunc.cc	revid:mikael.ronstrom@stripped
@@ -1588,6 +1588,11 @@ bool Item_func_from_days::get_date(MYSQL
     return 1;
   bzero(ltime, sizeof(MYSQL_TIME));
   get_date_from_daynr((long) value, &ltime->year, &ltime->month, &ltime->day);
+
+  if ((null_value= (fuzzy_date & TIME_NO_ZERO_DATE) &&
+       (ltime->year == 0 || ltime->month == 0 || ltime->day == 0)))
+    return TRUE;
+
   ltime->time_type= MYSQL_TIMESTAMP_DATE;
   return 0;
 }
@@ -2776,7 +2781,7 @@ String *Item_func_makedate::val_str(Stri
   long days;
 
   if (args[0]->null_value || args[1]->null_value ||
-      year < 0 || daynr <= 0)
+      year < 0 || year > 9999 || daynr <= 0)
     goto err;
 
   if (year < 100)
@@ -2819,7 +2824,7 @@ longlong Item_func_makedate::val_int()
   long days;
 
   if (args[0]->null_value || args[1]->null_value ||
-      year < 0 || daynr <= 0)
+      year < 0 || year > 9999 || daynr <= 0)
     goto err;
 
   if (year < 100)

=== modified file 'sql/item_xmlfunc.cc'
--- a/sql/item_xmlfunc.cc	revid:mikael.ronstrom@stripped
+++ b/sql/item_xmlfunc.cc	revid:mikael.ronstrom@stripped
@@ -13,10 +13,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
-#ifdef __GNUC__
-#pragma implementation
-#endif
-
 #include "sql_priv.h"
 /*
   It is necessary to include set_var.h instead of item.h because there

=== modified file 'sql/item_xmlfunc.h'
--- a/sql/item_xmlfunc.h	revid:mikael.ronstrom@stripped
+++ b/sql/item_xmlfunc.h	revid:mikael.ronstrom@stripped
@@ -19,12 +19,6 @@
 
 /* This file defines all XML functions */
 
-
-#ifdef __GNUC__
-#pragma interface			/* gcc class implementation */
-#endif
-
-
 class Item_xml_str_func: public Item_str_func
 {
 protected:

=== modified file 'sql/log_event.cc'
--- a/sql/log_event.cc	revid:mikael.ronstrom@stripped
+++ b/sql/log_event.cc	revid:mikael.ronstrom@stripped
@@ -6754,16 +6754,15 @@ void Create_file_log_event::pack_info(Pr
 #if defined(HAVE_REPLICATION) && !defined(MYSQL_CLIENT)
 int Create_file_log_event::do_apply_event(Relay_log_info const *rli)
 {
-  char proc_info[17+FN_REFLEN+10], *fname_buf;
+  char fname_buf[FN_REFLEN+10];
   char *ext;
   int fd = -1;
   IO_CACHE file;
   int error = 1;
 
+  THD_STAGE_INFO(thd, stage_making_temp_file_create_before_load_data);
   bzero((char*)&file, sizeof(file));
-  fname_buf= strmov(proc_info, "Making temp file ");
   ext= slave_load_file_stem(fname_buf, file_id, server_id, ".info");
-  thd_proc_info(thd, proc_info);
   /* old copy may exist already */
   mysql_file_delete(key_file_log_event_info, fname_buf, MYF(0));
   if ((fd= mysql_file_create(key_file_log_event_info,
@@ -6933,14 +6932,13 @@ int Append_block_log_event::get_create_o
 
 int Append_block_log_event::do_apply_event(Relay_log_info const *rli)
 {
-  char proc_info[17+FN_REFLEN+10], *fname= proc_info+17;
+  char fname[FN_REFLEN+10];
   int fd;
   int error = 1;
   DBUG_ENTER("Append_block_log_event::do_apply_event");
 
-  fname= strmov(proc_info, "Making temp file ");
+  THD_STAGE_INFO(thd, stage_making_temp_file_append_before_load_data);
   slave_load_file_stem(fname, file_id, server_id, ".data");
-  thd_proc_info(thd, proc_info);
   if (get_create_or_append())
   {
     /*

=== added file 'sql/mem_root_array.h'
--- a/sql/mem_root_array.h	1970-01-01 00:00:00 +0000
+++ b/sql/mem_root_array.h	revid:mikael.ronstrom@stripped
@@ -0,0 +1,175 @@
+/* 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, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+
+#ifndef MEM_ROOT_ARRAY_INCLUDED
+#define MEM_ROOT_ARRAY_INCLUDED
+
+#include <my_alloc.h>
+
+/**
+   A typesafe replacement for DYNAMIC_ARRAY.
+   We use MEM_ROOT for allocating storage, rather than the C++ heap.
+   The interface is chosen to be similar to std::vector.
+
+   @remark
+   Unlike DYNAMIC_ARRAY, elements are properly copied
+   (rather than memcpy()d) if the underlying array needs to be expanded.
+
+   @remark
+   Depending on has_trivial_destructor, we destroy objects which are
+   removed from the array (including when the array object itself is destroyed).
+
+   @remark
+   Note that MEM_ROOT has no facility for reusing free space,
+   so don't use this if multiple re-expansions are likely to happen.
+
+   @param Element_type The type of the elements of the container.
+          Elements must be copyable.
+   @param has_trivial_destructor If true, we don't destroy elements.
+          We could have used type traits to determine this.
+          __has_trivial_destructor is supported by some (but not all)
+          compilers we use.
+*/
+template<typename Element_type, bool has_trivial_destructor>
+class Mem_root_array
+{
+public:
+  Mem_root_array(MEM_ROOT *root)
+    : m_root(root), m_array(NULL), m_size(0), m_capacity(0)
+  {
+    DBUG_ASSERT(m_root != NULL);
+  }
+
+  ~Mem_root_array()
+  {
+    clear();
+  }
+
+  Element_type &at(size_t n)
+  {
+    DBUG_ASSERT(n < size());
+    return m_array[n];
+  }
+
+  const Element_type &at(size_t n) const
+  {
+    DBUG_ASSERT(n < size());
+    return m_array[n];
+  }
+
+  // Returns a pointer to the first element in the array.
+  Element_type *begin() { return &m_array[0]; }
+
+  // Returns a pointer to the past-the-end element in the array.
+  Element_type *end() { return &m_array[size()]; }
+
+  // Erases all of the elements. 
+  void clear()
+  {
+    if (!empty())
+      chop(0);
+  }
+
+  /*
+    Chops the tail off the array, erasing all tail elements.
+    @param pos Index of first element to erase.
+  */
+  void chop(const size_t pos)
+  {
+    DBUG_ASSERT(pos < m_size);
+    if (!has_trivial_destructor)
+    {
+      for (size_t ix= pos; ix < m_size; ++ix)
+      {
+        Element_type *p= &m_array[ix];
+        p->~Element_type();              // Destroy discarded element.
+      }
+    }
+    m_size= pos;
+  }
+
+  /*
+    Reserves space for array elements.
+    Copies over existing elements, in case we are re-expanding the array.
+
+    @param  n number of elements.
+    @retval true if out-of-memory, false otherwise.
+  */
+  bool reserve(size_t n)
+  {
+    if (n <= m_capacity)
+      return false;
+
+    void *mem= alloc_root(m_root, n * element_size());
+    if (!mem)
+      return true;
+    Element_type *array= static_cast<Element_type*>(mem);
+
+    // Copy all the existing elements into the new array.
+    for (size_t ix= 0; ix < m_size; ++ix)
+    {
+      Element_type *new_p= &array[ix];
+      Element_type *old_p= &m_array[ix];
+      new (new_p) Element_type(*old_p);         // Copy into new location.
+      if (!has_trivial_destructor)
+        old_p->~Element_type();                 // Destroy the old element.
+    }
+
+    // Forget the old array.
+    m_array= array;
+    m_capacity= n;
+    return false;
+  }
+
+  /*
+    Adds a new element at the end of the array, after its current last
+    element. The content of this new element is initialized to a copy of
+    the input argument.
+
+    @param  element Object to copy.
+    @retval true if out-of-memory, false otherwise.
+  */
+  bool push_back(const Element_type &element)
+  {
+    const size_t min_capacity= 20;
+    const size_t expansion_factor= 2;
+    if (0 == m_capacity && reserve(min_capacity))
+      return true;
+    if (m_size == m_capacity && reserve(m_capacity * expansion_factor))
+      return true;
+    Element_type *p= &m_array[m_size++];
+    new (p) Element_type(element);
+    return false;
+  }
+
+  size_t capacity()     const { return m_capacity; }
+  size_t element_size() const { return sizeof(Element_type); }
+  bool   empty()        const { return size() == 0; }
+  size_t size()         const { return m_size; }
+
+private:
+  MEM_ROOT *const m_root;
+  Element_type   *m_array;
+  size_t          m_size;
+  size_t          m_capacity;
+
+  // Not (yet) implemented.
+  Mem_root_array(const Mem_root_array&);
+  Mem_root_array &operator=(const Mem_root_array&);
+};
+
+
+#endif  // MEM_ROOT_ARRAY_INCLUDED

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	revid:mikael.ronstrom@stripped
+++ b/sql/mysqld.cc	revid:mikael.ronstrom@stripped
@@ -2020,6 +2020,36 @@ extern "C" sig_handler end_thread_signal
 
 
 /*
+  Decrease number of connections
+
+  SYNOPSIS
+    dec_connection_count()
+*/
+
+void dec_connection_count()
+{
+  mysql_mutex_lock(&LOCK_connection_count);
+  --connection_count;
+  mysql_mutex_unlock(&LOCK_connection_count);
+}
+
+
+/*
+  Delete the THD object and decrease number of threads
+
+  SYNOPSIS
+    delete_thd()
+    thd		 Thread handler
+*/
+
+void delete_thd(THD *thd)
+{
+  thread_count--;
+  delete thd;
+}
+
+
+/*
   Unlink thd from global list of available connections and free thd
 
   SYNOPSIS
@@ -2034,15 +2064,10 @@ void unlink_thd(THD *thd)
 {
   DBUG_ENTER("unlink_thd");
   DBUG_PRINT("enter", ("thd: 0x%lx", (long) thd));
-  thd->cleanup();
-
-  mysql_mutex_lock(&LOCK_connection_count);
-  --connection_count;
-  mysql_mutex_unlock(&LOCK_connection_count);
 
+  dec_connection_count();
   mysql_mutex_lock(&LOCK_thread_count);
-  thread_count--;
-  delete thd;
+  delete_thd(thd);
   DBUG_VOID_RETURN;
 }
 
@@ -8371,7 +8396,7 @@ PSI_stage_info stage_end= { 0, "end", 0}
 PSI_stage_info stage_executing= { 0, "executing", 0};
 PSI_stage_info stage_execution_of_init_command= { 0, "Execution of init_command", 0};
 PSI_stage_info stage_finished_reading_one_binlog_switching_to_next_binlog= { 0, "Finished reading one binlog; switching to next binlog", 0};
-PSI_stage_info stage_flushing_relay_log_and_master_info_files= { 0, "Flushing relay log and master info files.", 0};
+PSI_stage_info stage_flushing_relay_log_and_master_info_repository= { 0, "Flushing relay log and master info repository.", 0};
 PSI_stage_info stage_flushing_relay_log_info_file= { 0, "Flushing relay-log info file.", 0};
 PSI_stage_info stage_freeing_items= { 0, "freeing items", 0};
 PSI_stage_info stage_fulltext_initialization= { 0, "FULLTEXT initialization", 0};
@@ -8383,6 +8408,8 @@ PSI_stage_info stage_invalidating_query_
 PSI_stage_info stage_invalidating_query_cache_entries_table_list= { 0, "invalidating query cache entries (table list)", 0};
 PSI_stage_info stage_killing_slave= { 0, "Killing slave", 0};
 PSI_stage_info stage_logging_slow_query= { 0, "logging slow query", 0};
+PSI_stage_info stage_making_temp_file_append_before_load_data= { 0, "Making temporary file (append) before replaying LOAD DATA INFILE.", 0};
+PSI_stage_info stage_making_temp_file_create_before_load_data= { 0, "Making temporary file (create) before replaying LOAD DATA INFILE.", 0};
 PSI_stage_info stage_manage_keys= { 0, "manage keys", 0};
 PSI_stage_info stage_opening_tables= { 0, "Opening tables", 0};
 PSI_stage_info stage_optimizing= { 0, "optimizing", 0};
@@ -8407,6 +8434,7 @@ PSI_stage_info stage_sorting_for_group= 
 PSI_stage_info stage_sorting_for_order= { 0, "Sorting for order", 0};
 PSI_stage_info stage_sorting_result= { 0, "Sorting result", 0};
 PSI_stage_info stage_statistics= { 0, "statistics", 0};
+PSI_stage_info stage_sql_thd_waiting_until_delay= { 0, "Waiting until MASTER_DELAY seconds after master executed event", 0 };
 PSI_stage_info stage_storing_result_in_query_cache= { 0, "storing result in query cache", 0};
 PSI_stage_info stage_storing_row_into_queue= { 0, "storing row into queue", 0};
 PSI_stage_info stage_system_lock= { 0, "System lock", 0};
@@ -8460,7 +8488,7 @@ PSI_stage_info *all_server_stages[]=
   & stage_executing,
   & stage_execution_of_init_command,
   & stage_finished_reading_one_binlog_switching_to_next_binlog,
-  & stage_flushing_relay_log_and_master_info_files,
+  & stage_flushing_relay_log_and_master_info_repository,
   & stage_flushing_relay_log_info_file,
   & stage_freeing_items,
   & stage_fulltext_initialization,
@@ -8472,6 +8500,8 @@ PSI_stage_info *all_server_stages[]=
   & stage_invalidating_query_cache_entries_table_list,
   & stage_killing_slave,
   & stage_logging_slow_query,
+  & stage_making_temp_file_append_before_load_data,
+  & stage_making_temp_file_create_before_load_data,
   & stage_manage_keys,
   & stage_opening_tables,
   & stage_optimizing,
@@ -8495,6 +8525,7 @@ PSI_stage_info *all_server_stages[]=
   & stage_sorting_for_group,
   & stage_sorting_for_order,
   & stage_sorting_result,
+  & stage_sql_thd_waiting_until_delay,
   & stage_statistics,
   & stage_storing_result_in_query_cache,
   & stage_storing_row_into_queue,

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	revid:mikael.ronstrom@stripped
+++ b/sql/mysqld.h	revid:mikael.ronstrom@stripped
@@ -231,6 +231,10 @@ extern char err_shared_dir[];
 extern TYPELIB thread_handling_typelib;
 extern my_decimal decimal_zero;
 
+/*
+  THR_MALLOC is a key which will be used to set/get MEM_ROOT** for a thread,
+  using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
+*/
 extern pthread_key(MEM_ROOT**,THR_MALLOC);
 
 #ifdef HAVE_PSI_INTERFACE
@@ -334,7 +338,7 @@ extern PSI_stage_info stage_end;
 extern PSI_stage_info stage_executing;
 extern PSI_stage_info stage_execution_of_init_command;
 extern PSI_stage_info stage_finished_reading_one_binlog_switching_to_next_binlog;
-extern PSI_stage_info stage_flushing_relay_log_and_master_info_files;
+extern PSI_stage_info stage_flushing_relay_log_and_master_info_repository;
 extern PSI_stage_info stage_flushing_relay_log_info_file;
 extern PSI_stage_info stage_freeing_items;
 extern PSI_stage_info stage_fulltext_initialization;
@@ -346,6 +350,8 @@ extern PSI_stage_info stage_invalidating
 extern PSI_stage_info stage_invalidating_query_cache_entries_table_list;
 extern PSI_stage_info stage_killing_slave;
 extern PSI_stage_info stage_logging_slow_query;
+extern PSI_stage_info stage_making_temp_file_append_before_load_data;
+extern PSI_stage_info stage_making_temp_file_create_before_load_data;
 extern PSI_stage_info stage_manage_keys;
 extern PSI_stage_info stage_opening_tables;
 extern PSI_stage_info stage_optimizing;
@@ -369,6 +375,7 @@ extern PSI_stage_info stage_setup;
 extern PSI_stage_info stage_sorting_for_group;
 extern PSI_stage_info stage_sorting_for_order;
 extern PSI_stage_info stage_sorting_result;
+extern PSI_stage_info stage_sql_thd_waiting_until_delay;
 extern PSI_stage_info stage_statistics;
 extern PSI_stage_info stage_storing_result_in_query_cache;
 extern PSI_stage_info stage_storing_row_into_queue;
@@ -629,6 +636,10 @@ get_thread_running()
 extern "C" THD *_current_thd_noinline();
 #define _current_thd() _current_thd_noinline()
 #else
+/*
+  THR_THD is a key which will be used to set/get THD* for a thread,
+  using my_pthread_setspecific_ptr()/my_thread_getspecific_ptr().
+*/
 extern pthread_key(THD*, THR_THD);
 inline THD *_current_thd(void)
 {

=== modified file 'sql/opt_range.cc'
--- a/sql/opt_range.cc	revid:mikael.ronstrom@stripped
+++ b/sql/opt_range.cc	revid:mikael.ronstrom@stripped
@@ -2223,8 +2223,8 @@ int SQL_SELECT::test_quick_select(THD *t
   records= head->file->stats.records;
   if (!records)
     records++;					/* purecov: inspected */
-  scan_time= (double) records / TIME_FOR_COMPARE + 1;
-  read_time= (double) head->file->scan_time() + scan_time + 1.1;
+  scan_time= records * ROW_EVALUATE_COST + 1;
+  read_time= head->file->scan_time() + scan_time + 1.1;
   if (head->force_index)
     scan_time= read_time= DBL_MAX;
   if (limit < records)
@@ -2324,7 +2324,7 @@ int SQL_SELECT::test_quick_select(THD *t
       double key_read_time= 
         param.table->file->index_only_read_time(key_for_use, 
                                                 rows2double(records)) +
-        (double) records / TIME_FOR_COMPARE;
+        records * ROW_EVALUATE_COST;
       DBUG_PRINT("info",  ("'all'+'using index' scan will be using key %d, "
                            "read time %g", key_for_use, key_read_time));
       if (key_read_time < read_time)
@@ -3877,7 +3877,7 @@ TABLE_READ_PLAN *get_best_disjunct_quick
       Add one ROWID comparison for each row retrieved on non-CPK scan.  (it
       is done in QUICK_RANGE_SELECT::row_in_ranges)
      */
-    imerge_cost += non_cpk_scan_records / TIME_FOR_COMPARE_ROWID;
+    imerge_cost += non_cpk_scan_records * ROWID_COMPARE_COST;
   }
 
   /* Calculate cost(rowid_to_row_scan) */
@@ -3966,7 +3966,7 @@ skip_to_ror_scan:
       cost= param->table->file->
               read_time(param->real_keynr[(*cur_child)->key_idx], 1,
                         (*cur_child)->records) +
-              rows2double((*cur_child)->records) / TIME_FOR_COMPARE;
+              rows2double((*cur_child)->records) * ROW_EVALUATE_COST;
     }
     else
       cost= read_time;
@@ -4013,8 +4013,8 @@ skip_to_ror_scan:
     get_sweep_read_cost(param->table, roru_total_records, is_interrupted,
                         &sweep_cost);
     roru_total_cost= roru_index_costs +
-                     rows2double(roru_total_records)*log((double)n_child_scans) /
-                     (TIME_FOR_COMPARE_ROWID * M_LN2) +
+                     rows2double(roru_total_records) *
+                     log((double)n_child_scans) * ROWID_COMPARE_COST / M_LN2 +
                      sweep_cost.total_cost();
   }
 
@@ -4469,11 +4469,11 @@ static bool ror_intersect_add(ROR_INTERS
   {
     /*
       CPK scan is used to filter out rows. We apply filtering for 
-      each record of every scan. Assuming 1/TIME_FOR_COMPARE_ROWID
+      each record of every scan. Assuming ROWID_COMPARE_COST
       per check this gives us:
     */
-    info->index_scan_costs += rows2double(info->index_records) / 
-                              TIME_FOR_COMPARE_ROWID;
+    info->index_scan_costs += rows2double(info->index_records) * 
+                              ROWID_COMPARE_COST;
   }
   else
   {
@@ -4856,9 +4856,9 @@ TRP_ROR_INTERSECT *get_best_covering_ror
                                            tree->ror_scans, ror_scan_mark););
 
   /* Add priority queue use cost. */
-  total_cost += rows2double(records)*
-                log((double)(ror_scan_mark - tree->ror_scans)) /
-                (TIME_FOR_COMPARE_ROWID * M_LN2);
+  total_cost += rows2double(records) *
+                log((double)(ror_scan_mark - tree->ror_scans)) *
+                ROWID_COMPARE_COST / M_LN2;
   DBUG_PRINT("info", ("Covering ROR-intersect full cost: %g", total_cost));
 
   if (total_cost > read_time)
@@ -10776,7 +10776,7 @@ void cost_group_min_max(TABLE* table, KE
     no CPU cost. We leave it here to make this cost comparable to that of index
     scan as computed in SQL_SELECT::test_quick_select().
   */
-  cpu_cost= (double) num_groups / TIME_FOR_COMPARE;
+  cpu_cost= num_groups * ROW_EVALUATE_COST;
 
   *read_cost= io_cost + cpu_cost;
   *records= num_groups;

=== modified file 'sql/rpl_info_file.cc'
--- a/sql/rpl_info_file.cc	revid:mikael.ronstrom@stripped
+++ b/sql/rpl_info_file.cc	revid:mikael.ronstrom@stripped
@@ -54,7 +54,11 @@ int Rpl_info_file::do_init_info()
       the old descriptor and re-create the old file
     */
     if (info_fd >= 0)
+    {
+      if (my_b_inited(&info_file))
+        end_io_cache(&info_file);
       my_close(info_fd, MYF(MY_WME));
+    }
     if ((info_fd = my_open(info_fname, O_CREAT|O_RDWR|O_BINARY, MYF(MY_WME))) < 0)
     {
       sql_print_error("Failed to create a new info file (\
@@ -170,7 +174,8 @@ void Rpl_info_file::do_end_info()
 
   if (info_fd >= 0)
   {
-    end_io_cache(&info_file);
+    if (my_b_inited(&info_file))
+      end_io_cache(&info_file);
     my_close(info_fd, MYF(MY_WME));
     info_fd = -1;
   }

=== modified file 'sql/rpl_injector.cc'
--- a/sql/rpl_injector.cc	revid:mikael.ronstrom@stripped
+++ b/sql/rpl_injector.cc	revid:mikael.ronstrom@stripped
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 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
@@ -229,17 +229,6 @@ void injector::free_instance()
   }
 }
 
-
-injector::transaction injector::new_trans(THD *thd)
-{
-   DBUG_ENTER("injector::new_trans(THD*)");
-   /*
-     Currently, there is no alternative to using 'mysql_bin_log' since that
-     is hardcoded into the way the handler is using the binary log.
-   */
-   DBUG_RETURN(transaction(&mysql_bin_log, thd));
-}
-
 void injector::new_trans(THD *thd, injector::transaction *ptr)
 {
    DBUG_ENTER("injector::new_trans(THD *, transaction *)");

=== modified file 'sql/rpl_injector.h'
--- a/sql/rpl_injector.h	revid:mikael.ronstrom@stripped
+++ b/sql/rpl_injector.h	revid:mikael.ronstrom@stripped
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2006, 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
@@ -336,21 +336,16 @@ public:
       THD *m_thd;
     };
 
-    /* 
+    /*
        Create a new transaction.  This member function will prepare for a
        sequence of *_row calls by, for example, reserving resources and
-       locking files. There are two overloaded alternatives: one returning a
-       transaction by value and one using placement semantics. The following
-       two calls are equivalent, with the exception that the latter will
-       overwrite the transaction.
-
-         injector::transaction trans1= inj->new_trans(thd);
+       locking files. The call uses placement semantics and will overwrite
+       the transaction.
 
          injector::transaction trans2;
          inj->new_trans(thd, &trans);
      */
-    transaction new_trans(THD *);
-    void        new_trans(THD *, transaction *);
+    void new_trans(THD *, transaction *);
 
     int record_incident(THD*, Incident incident);
     int record_incident(THD*, Incident incident, LEX_STRING const message);

=== modified file 'sql/rpl_master.cc'
--- a/sql/rpl_master.cc	revid:mikael.ronstrom@stripped
+++ b/sql/rpl_master.cc	revid:mikael.ronstrom@stripped
@@ -1252,7 +1252,7 @@ end:
   end_io_cache(&log);
   mysql_file_close(file, MYF(MY_WME));
 
-  RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
+  (void) RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
   my_eof(thd);
   THD_STAGE_INFO(thd, stage_waiting_to_finalize_termination);
   mysql_mutex_lock(&LOCK_thread_count);
@@ -1264,7 +1264,7 @@ end:
 err:
   THD_STAGE_INFO(thd, stage_waiting_to_finalize_termination);
   end_io_cache(&log);
-  RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
+  (void) RUN_HOOK(binlog_transmit, transmit_stop, (thd, flags));
   /*
     Exclude  iteration through thread list
     this is needed for purge_logs() - it will iterate through
@@ -1387,7 +1387,7 @@ int reset_master(THD* thd)
 
   if (mysql_bin_log.reset_logs(thd))
     return 1;
-  RUN_HOOK(binlog_transmit, after_reset_master, (thd, 0 /* flags */));
+  (void) RUN_HOOK(binlog_transmit, after_reset_master, (thd, 0 /* flags */));
   return 0;
 }
 

=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc	revid:mikael.ronstrom@stripped
+++ b/sql/rpl_rli.cc	revid:mikael.ronstrom@stripped
@@ -45,8 +45,6 @@ const char* info_rli_fields[]=
   "sql_delay"
 };
 
-const char *const Relay_log_info::state_delaying_string = "Waiting until MASTER_DELAY seconds after master executed event";
-
 Relay_log_info::Relay_log_info(bool is_slave_recovery
 #ifdef HAVE_PSI_INTERFACE
                                ,PSI_mutex_key *param_key_info_run_lock,

=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h	revid:mikael.ronstrom@stripped
+++ b/sql/rpl_rli.h	revid:mikael.ronstrom@stripped
@@ -551,11 +551,6 @@ public:
   size_t get_number_info_rli_fields();
 
   /**
-    Text used in THD::proc_info when the slave SQL thread is delaying.
-  */
-  static const char *const state_delaying_string;
-
-  /**
     Indicate that a delay starts.
 
     This does not actually sleep; it only sets the state of this
@@ -570,7 +565,7 @@ public:
   {
     mysql_mutex_assert_owner(&data_lock);
     sql_delay_end= delay_end;
-    thd_proc_info(info_thd, state_delaying_string);
+    THD_STAGE_INFO(info_thd, stage_sql_thd_waiting_until_delay);
   }
 
   int32 get_sql_delay() { return sql_delay; }

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	revid:mikael.ronstrom@stripped
+++ b/sql/rpl_slave.cc	revid:mikael.ronstrom@stripped
@@ -634,7 +634,7 @@ int terminate_slave_threads(Master_info*
 
     DBUG_PRINT("info",("Flushing relay-log info file."));
     if (current_thd)
-      thd_proc_info(current_thd, "Flushing relay-log info file.");
+      THD_STAGE_INFO(current_thd, stage_flushing_relay_log_info_file);
 
     /*
       Flushes the relay log info regardles of the sync_relay_log_info option.
@@ -659,7 +659,7 @@ int terminate_slave_threads(Master_info*
 
     DBUG_PRINT("info",("Flushing relay log and master info repository."));
     if (current_thd)
-      thd_proc_info(current_thd, "Flushing relay log and master info repository.");
+      THD_STAGE_INFO(current_thd, stage_flushing_relay_log_and_master_info_repository);
 
     /*
       Flushes the master info regardles of the sync_master_info option.
@@ -2070,6 +2070,10 @@ bool show_master_info(THD* thd, Master_i
     protocol->store(mi->info_thd ? mi->info_thd->proc_info : "", &my_charset_bin);
     mysql_mutex_unlock(&mi->run_lock);
 
+    mysql_mutex_lock(&mi->rli->run_lock);
+    const char *slave_sql_running_state= mi->rli->info_thd ? mi->rli->info_thd->proc_info : "";
+    mysql_mutex_unlock(&mi->rli->run_lock);
+
     mysql_mutex_lock(&mi->data_lock);
     mysql_mutex_lock(&mi->rli->data_lock);
     mysql_mutex_lock(&mi->err_lock);
@@ -2206,10 +2210,7 @@ bool show_master_info(THD* thd, Master_i
     // SQL_Delay
     protocol->store((uint32) mi->rli->get_sql_delay());
     // SQL_Remaining_Delay
-    // THD::proc_info is not protected by any lock, so we read it once
-    // to ensure that we use the same value throughout this function.
-    const char *slave_sql_running_state= mi->rli->info_thd ? mi->rli->info_thd->proc_info : "";
-    if (slave_sql_running_state == Relay_log_info::state_delaying_string)
+    if (slave_sql_running_state == stage_sql_thd_waiting_until_delay.m_name)
     {
       time_t t= my_time(0), sql_delay_end= mi->rli->get_sql_delay_end();
       protocol->store((uint32)(t < sql_delay_end ? sql_delay_end - t : 0));
@@ -3390,7 +3391,7 @@ err:
   // print the current replication position
   sql_print_information("Slave I/O thread exiting, read up to log '%s', position %s",
                   mi->get_io_rpl_log_name(), llstr(mi->get_master_log_pos(), llbuff));
-  RUN_HOOK(binlog_relay_io, thread_stop, (thd, mi));
+  (void) RUN_HOOK(binlog_relay_io, thread_stop, (thd, mi));
   thd->reset_query();
   thd->reset_db(NULL, 0);
   if (mysql)
@@ -3684,7 +3685,7 @@ log '%s' at position %s, relay log '%s' 
 
   while (!sql_slave_killed(thd,rli))
   {
-    thd_proc_info(thd, "Reading event from the relay log");
+    THD_STAGE_INFO(thd, stage_reading_event_from_the_relay_log);
     DBUG_ASSERT(rli->info_thd == thd);
     THD_CHECK_SENTRY(thd);
 
@@ -5723,7 +5724,7 @@ int reset_slave(THD *thd, Master_info* m
     goto err;
   }
 
-  RUN_HOOK(binlog_relay_io, after_reset_slave, (thd, mi));
+  (void) RUN_HOOK(binlog_relay_io, after_reset_slave, (thd, mi));
 err:
   unlock_slave_threads(mi);
   if (error)
@@ -5966,7 +5967,7 @@ bool change_master(THD* thd, Master_info
   if (need_relay_log_purge)
   {
     relay_log_purge= 1;
-    thd_proc_info(thd, "Purging old relay logs");
+    THD_STAGE_INFO(thd, stage_purging_old_relay_logs);
     if (mi->rli->purge_relay_logs(thd,
                                   0 /* not only reset, but also reinit */,
                                   &errmsg))

=== modified file 'sql/sql_acl.cc'
--- a/sql/sql_acl.cc	revid:mikael.ronstrom@stripped
+++ b/sql/sql_acl.cc	revid:mikael.ronstrom@stripped
@@ -3645,6 +3645,7 @@ int mysql_table_grant(THD *thd, TABLE_LI
   {						// Should never happen
     /* Restore the state of binlog format */
     DBUG_ASSERT(!thd->is_current_stmt_binlog_format_row());
+    thd->lex->restore_backup_query_tables_list(&backup);
     if (save_binlog_row_based)
       thd->set_current_stmt_binlog_format_row();
     DBUG_RETURN(TRUE);				/* purecov: deadcode */

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	revid:mikael.ronstrom@stripped
+++ b/sql/sql_class.cc	revid:mikael.ronstrom@stripped
@@ -1628,6 +1628,25 @@ bool THD::store_globals()
   return 0;
 }
 
+/*
+  Remove the thread specific info (THD and mem_root pointer) stored during
+  store_global call for this thread.
+*/
+bool THD::restore_globals()
+{
+  /*
+    Assert that thread_stack is initialized: it's necessary to be able
+    to track stack overrun.
+  */
+  DBUG_ASSERT(thread_stack);
+  
+  /* Undocking the thread specific data. */
+  my_pthread_setspecific_ptr(THR_THD, NULL);
+  my_pthread_setspecific_ptr(THR_MALLOC, NULL);
+  
+  return 0;
+}
+
 
 /*
   Cleanup after query.

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	revid:mikael.ronstrom@stripped
+++ b/sql/sql_class.h	revid:mikael.ronstrom@stripped
@@ -2521,6 +2521,7 @@ public:
   void cleanup(void);
   void cleanup_after_query();
   bool store_globals();
+  bool restore_globals();
 #ifdef SIGNAL_WITH_VIO_CLOSE
   inline void set_active_vio(Vio* vio)
   {

=== modified file 'sql/sql_const.h'
--- a/sql/sql_const.h	revid:mikael.ronstrom@stripped
+++ b/sql/sql_const.h	revid:mikael.ronstrom@stripped
@@ -158,16 +158,15 @@
 
 /**
   The following is used to decide if MySQL should use table scanning
-  instead of reading with keys.  The number says how many evaluation of the
-  WHERE clause is comparable to reading one extra row from a table.
+  instead of reading with keys.  The number says how costly evaluation of the
+  filter condition for a row is compared to reading one extra row from a table.
 */
-#define TIME_FOR_COMPARE   5.0	// 5 compares == one read
+#define ROW_EVALUATE_COST  0.20
 
 /**
-  Number of comparisons of table rowids equivalent to reading one row from a 
-  table.
+  Cost of comparing a rowid compared to reading one row from a table.
 */
-#define TIME_FOR_COMPARE_ROWID  (TIME_FOR_COMPARE*2.0)
+#define ROWID_COMPARE_COST 0.10  // Half the cost of a general row comparison
 
 /*
   For sequential disk seeks the cost formula is:

=== modified file 'sql/sql_partition.h'
--- a/sql/sql_partition.h	revid:mikael.ronstrom@stripped
+++ b/sql/sql_partition.h	revid:mikael.ronstrom@stripped
@@ -16,10 +16,6 @@
    along with this program; if not, write to the Free Software
    Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301  USA */
 
-#ifdef __GNUC__
-#pragma interface				/* gcc class implementation */
-#endif
-
 #include "sql_list.h"                           /* List */
 #include "table.h"                              /* TABLE_LIST */
 

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	revid:mikael.ronstrom@stripped
+++ b/sql/sql_select.cc	revid:mikael.ronstrom@stripped
@@ -38,8 +38,7 @@
 #include "sql_parse.h"                          // check_stack_overrun
 #include "sql_partition.h"       // make_used_partitions_str
 #include "sql_acl.h"             // *_ACL
-#include "sql_test.h"            // print_where, print_keyuse_array,
-                                 // print_sjm, print_plan, TEST_join
+#include "sql_test.h"            // misc. debug printing utilities
 #include "records.h"             // init_read_record, end_read_record
 #include "filesort.h"            // filesort_free_buffers
 #include "sql_union.h"           // mysql_union
@@ -59,11 +58,11 @@ const char *join_type_str[]={ "UNKNOWN",
 
 struct st_sargable_param;
 
-static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array);
+static void optimize_keyuse(JOIN *join, Key_use_array *keyuse_array);
 static bool make_join_statistics(JOIN *join, TABLE_LIST *leaves, Item *conds,
-				 DYNAMIC_ARRAY *keyuse);
+                                Key_use_array *keyuse);
 static bool optimize_semijoin_nests(JOIN *join);
-static bool update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,
+static bool update_ref_and_keys(THD *thd, Key_use_array *keyuse,
                                 JOIN_TAB *join_tab,
                                 uint tables, Item *conds,
                                 COND_EQUAL *cond_equal,
@@ -3342,7 +3341,8 @@ JOIN::exec()
         if (curr_table->pre_idx_push_cond)
         {
           sort_table_cond= make_cond_for_table(curr_join->tmp_having,
-                                               used_tables, used_tables, 0);
+                                               used_tables,
+                                               (table_map) 0, 0);
           if (!sort_table_cond)
             DBUG_VOID_RETURN;
           Item* new_pre_idx_push_cond= 
@@ -3546,7 +3546,7 @@ bool JOIN::destroy()
   while ((sj_nest= sj_list_it++))
     sj_nest->sj_mat_exec= NULL;
 
-  delete_dynamic(&keyuse);
+  keyuse.clear();
   delete procedure;
   DBUG_RETURN(test(error));
 }
@@ -4709,7 +4709,7 @@ static uint get_tmp_table_rec_length(Lis
 
 static bool
 make_join_statistics(JOIN *join, TABLE_LIST *tables_arg, Item *conds,
-		     DYNAMIC_ARRAY *keyuse_array)
+                     Key_use_array *keyuse_array)
 {
   int error;
   TABLE *table;
@@ -6091,7 +6091,7 @@ max_part_bit(key_part_map bits)
 */
 
 static bool
-add_key_part(DYNAMIC_ARRAY *keyuse_array,KEY_FIELD *key_field)
+add_key_part(Key_use_array *keyuse_array, KEY_FIELD *key_field)
 {
   Field *field=key_field->field;
   TABLE *form= field->table;
@@ -6121,7 +6121,7 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array
                                key_field->null_rejecting,
                                key_field->cond_guard,
                                key_field->sj_pred_no);
-          if (insert_dynamic(keyuse_array, &keyuse))
+          if (keyuse_array->push_back(keyuse))
             return TRUE;
 	}
       }
@@ -6134,7 +6134,7 @@ add_key_part(DYNAMIC_ARRAY *keyuse_array
 #define FT_KEYPART   (MAX_REF_PARTS+10)
 
 static bool
-add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
+add_ft_keys(Key_use_array *keyuse_array,
             JOIN_TAB *stat,Item *cond,table_map usable_tables)
 {
   Item_func_match *cond_func=NULL;
@@ -6196,7 +6196,7 @@ add_ft_keys(DYNAMIC_ARRAY *keyuse_array,
                        false,         // null_rejecting
                        NULL,          // cond_guard
                        UINT_MAX);     // sj_pred_no
-  return insert_dynamic(keyuse_array, &keyuse);
+  return keyuse_array->push_back(keyuse);
 }
 
 
@@ -6312,7 +6312,7 @@ static void add_key_fields_for_nj(JOIN *
 */
 
 static bool
-update_ref_and_keys(THD *thd, DYNAMIC_ARRAY *keyuse,JOIN_TAB *join_tab,
+update_ref_and_keys(THD *thd, Key_use_array *keyuse,JOIN_TAB *join_tab,
                     uint tables, Item *cond, COND_EQUAL *cond_equal,
                     table_map normal_tables, SELECT_LEX *select_lex,
                     SARGABLE_PARAM **sargables)
@@ -6355,8 +6355,6 @@ update_ref_and_keys(THD *thd, DYNAMIC_AR
   /* set a barrier for the array of SARGABLE_PARAM */
   (*sargables)[0].field= 0; 
 
-  if (my_init_dynamic_array(keyuse, sizeof(Key_use), 20, 64))
-    return TRUE;
   if (cond)
   {
     add_key_fields(join_tab->join, &end, &and_level, cond, normal_tables,
@@ -6430,21 +6428,21 @@ update_ref_and_keys(THD *thd, DYNAMIC_AR
       used in the query, we drop the partial key parts from consideration).
     Special treatment for ft-keys.
   */
-  if (keyuse->elements)
+  if (!keyuse->empty())
   {
     Key_use *save_pos, *use;
 
-    my_qsort(keyuse->buffer, keyuse->elements, sizeof(Key_use),
+    my_qsort(keyuse->begin(), keyuse->size(), keyuse->element_size(),
              reinterpret_cast<qsort_cmp>(sort_keyuse));
 
     const Key_use key_end(NULL, NULL, 0, 0, 0, 0, 0, 0, false, NULL, 0);
-    if (insert_dynamic(keyuse, &key_end)) // added for easy testing
+    if (keyuse->push_back(key_end)) // added for easy testing
       return TRUE;
 
-    use= save_pos= dynamic_element(keyuse, 0, Key_use *);
+    use= save_pos= keyuse->begin();
     const Key_use *prev= &key_end;
     found_eq_constant=0;
-    for (i=0 ; i < keyuse->elements-1 ; i++,use++)
+    for (i=0 ; i < keyuse->size()-1 ; i++,use++)
     {
       if (!use->used_tables && use->optimize != KEY_OPTIMIZE_REF_OR_NULL)
 	use->table->const_key_parts[use->key]|= use->keypart_map;
@@ -6477,9 +6475,9 @@ update_ref_and_keys(THD *thd, DYNAMIC_AR
       use->table->reginfo.join_tab->checked_keys.set_bit(use->key);
       save_pos++;
     }
-    i= (uint) (save_pos - (Key_use *)keyuse->buffer);
-    (void) set_dynamic(keyuse, &key_end, i);
-    keyuse->elements=i;
+    i= (uint) (save_pos - keyuse->begin());
+    keyuse->at(i) = key_end;
+    keyuse->chop(i);
   }
   DBUG_EXECUTE("opt", print_keyuse_array(keyuse););
   return FALSE;
@@ -6489,12 +6487,11 @@ update_ref_and_keys(THD *thd, DYNAMIC_AR
   Update some values in keyuse for faster choose_table_order() loop.
 */
 
-static void optimize_keyuse(JOIN *join, DYNAMIC_ARRAY *keyuse_array)
+static void optimize_keyuse(JOIN *join, Key_use_array *keyuse_array)
 {
-  Key_use *end, *keyuse= dynamic_element(keyuse_array, 0, Key_use *);
-
-  for (end= keyuse+ keyuse_array->elements ; keyuse < end ; keyuse++)
+  for (size_t ix= 0; ix < keyuse_array->size(); ++ix)
   {
+    Key_use *keyuse= &keyuse_array->at(ix);
     table_map map;
     /*
       If we find a ref, assume this table matches a proportional
@@ -7066,10 +7063,10 @@ best_access_path(JOIN      *join,
                  POSITION *pos,
                  POSITION *loose_scan_pos)
 {
-  THD *thd= join->thd;
+  THD *const thd= join->thd;
   Key_use *best_key=        NULL;
   uint best_max_key_part=   0;
-  my_bool found_constraint= 0;
+  bool found_constraint=    false;
   double best=              DBL_MAX;
   double best_time=         DBL_MAX;
   double records=           DBL_MAX;
@@ -7082,7 +7079,7 @@ best_access_path(JOIN      *join,
   double best_quick_records= DBL_MAX;
   table_map best_ref_depends_map= 0;
   double tmp;
-  bool best_uses_jbuf= FALSE;
+  bool best_uses_jbuf= false;
 
   Loose_scan_opt loose_scan_opt;
   DBUG_ENTER("best_access_path");
@@ -7095,28 +7092,27 @@ best_access_path(JOIN      *join,
   */
   if (unlikely(s->keyuse != NULL))
   {                                            /* Use key if possible */
-    TABLE *table= s->table;
-    Key_use *keyuse;
+    TABLE *const table= s->table;
     double best_records= DBL_MAX;
-    uint max_key_part=0;
 
     /* Test how we can use keys */
     ha_rows rec=
       s->records/MATCHING_ROWS_IN_OTHER_TABLE;  // Assumed records/key
-    for (keyuse=s->keyuse ; keyuse->table == table ;)
+    for (Key_use *keyuse=s->keyuse; keyuse->table == table; )
     {
       key_part_map found_part= 0;
       table_map found_ref= 0;
-      uint key= keyuse->key;
-      KEY *keyinfo= table->key_info+key;
-      bool ft_key=  (keyuse->keypart == FT_KEYPART);
+      const uint key= keyuse->key;
+      uint max_key_part= 0;
+      KEY *const keyinfo= table->key_info+key;
+      const bool ft_key= (keyuse->keypart == FT_KEYPART);
       /* Bitmap of keyparts where the ref access is over 'keypart=const': */
       key_part_map const_part= 0;
       /* The or-null keypart in ref-or-null access: */
       key_part_map ref_or_null_part= 0;
 
       /* Calculate how many key segments of the current key we can use */
-      Key_use *start_key= keyuse;
+      Key_use *const start_key= keyuse;
 
       loose_scan_opt.next_ref_key();
       DBUG_PRINT("info", ("Considering ref access on key %s",
@@ -7130,7 +7126,7 @@ best_access_path(JOIN      *join,
       
       do /* For each keypart */
       {
-        uint keypart= keyuse->keypart;
+        const uint keypart= keyuse->keypart;
         table_map best_part_found_ref= 0;
         double best_prev_record_reads= DBL_MAX;
         
@@ -7452,12 +7448,12 @@ best_access_path(JOIN      *join,
         loose_scan_opt.check_ref_access_part2(key, start_key, records, tmp);
 
       } /* not ft_key */
-      if (tmp < best_time - records/(double) TIME_FOR_COMPARE ||
+      if (tmp < best_time - records * ROW_EVALUATE_COST ||
           (quick_matches_more_parts && 
            quick_records < best_quick_records))
       {
         best_quick_records = quick_records;
-        best_time= tmp + records/(double) TIME_FOR_COMPARE;
+        best_time= tmp + records * ROW_EVALUATE_COST;
         best= tmp;
         best_records= records;
         best_key= start_key;
@@ -7542,7 +7538,7 @@ best_access_path(JOIN      *join,
       */
       tmp= record_count *
         (s->quick->read_time +
-         (s->found_records - rnd_records)/(double) TIME_FOR_COMPARE);
+         (s->found_records - rnd_records) * ROW_EVALUATE_COST);
 
       loose_scan_opt.check_range_access(join, idx, s->quick);
     }
@@ -7562,8 +7558,7 @@ best_access_path(JOIN      *join,
           - skip rows which does not satisfy join condition
         */
         tmp= record_count *
-          (tmp +
-           (s->records - rnd_records)/(double) TIME_FOR_COMPARE);
+             (tmp + (s->records - rnd_records) * ROW_EVALUATE_COST);
       }
       else
       {
@@ -7582,18 +7577,18 @@ best_access_path(JOIN      *join,
            we read the table (see flush_cached_records for details). Here we
            take into account cost to read and skip these records.
         */
-        tmp+= (s->records - rnd_records)/(double) TIME_FOR_COMPARE;
+        tmp+= (s->records - rnd_records) * ROW_EVALUATE_COST;
       }
     }
 
     /*
       We estimate the cost of evaluating WHERE clause for found records
-      as record_count * rnd_records / TIME_FOR_COMPARE. This cost plus
+      as record_count * rnd_records * ROW_EVALUATE_COST. This cost plus
       tmp give us total cost of using TABLE SCAN
     */
     if (best == DBL_MAX ||
-        (tmp  + record_count/(double) TIME_FOR_COMPARE*rnd_records <
-         best + record_count/(double) TIME_FOR_COMPARE*records))
+        (tmp  + (record_count * ROW_EVALUATE_COST * rnd_records) <
+         best + (record_count * ROW_EVALUATE_COST * records)))
     {
       /*
         If the table has a range (s->quick is set) make_join_select()
@@ -7914,7 +7909,7 @@ void Optimize_table_order::optimize_stra
     /* compute the cost of the new plan extended with 's' */
     record_count*= join->positions[idx].records_read;
     read_time+=    join->positions[idx].read_time
-                   + record_count / (double) TIME_FOR_COMPARE;
+                   + record_count * ROW_EVALUATE_COST;
     advance_sj_state(join_tables, s, idx, &record_count, &read_time,
                      &loose_scan_pos);
 
@@ -8168,7 +8163,7 @@ bool Optimize_table_order::greedy_search
     /* compute the cost of the new plan extended with 'best_table' */
     record_count*= join->positions[idx].records_read;
     read_time+=    join->positions[idx].read_time
-                   + record_count / (double) TIME_FOR_COMPARE;
+                   + record_count * ROW_EVALUATE_COST;
 
     remaining_tables&= ~(best_table->table->map);
     --size_remain;
@@ -8214,7 +8209,7 @@ void get_partial_join_cost(JOIN *join, u
     {
       record_count *= join->best_positions[i].records_read;
       read_time += join->best_positions[i].read_time
-                   + record_count / (double) TIME_FOR_COMPARE;
+                   + record_count * ROW_EVALUATE_COST;
     }
   }
   *read_time_arg= read_time;
@@ -8393,7 +8388,7 @@ bool Optimize_table_order::best_extensio
       current_record_count= record_count * position->records_read;
       current_read_time=    read_time
                             + position->read_time
-                            + current_record_count / (double) TIME_FOR_COMPARE;
+                            + current_record_count * ROW_EVALUATE_COST;
 
       if (has_sj)
       {
@@ -10662,19 +10657,17 @@ void revise_cache_usage(JOIN_TAB *join_t
 }
 
 
-/* 
+/**
   Check whether a join buffer can be used to join the specified table   
 
-  SYNOPSIS
-    check_join_cache_usage()
-      tab                 joined table to check join buffer usage for
-      join                join for which the check is performed
-      options             options of the join
-      no_jbuf_after       don't use join buffering after table with this number
-      icp_other_tables_ok OUT TRUE if condition pushdown supports
-                          other tables presence
+  @param tab             joined table to check join buffer usage for
+  @param join            join for which the check is performed
+  @param options         options of the join
+  @param no_jbuf_after   don't use join buffering after table with this number
+  @param icp_other_tables_ok[out] TRUE if condition pushdown supports
+                                  other tables presence
 
-  DESCRIPTION
+  @details
     The function finds out whether the table 'tab' can be joined using a join
     buffer. This check is performed after the best execution plan for 'join'
     has been chosen. If the function decides that a join buffer can be employed
@@ -10710,7 +10703,7 @@ void revise_cache_usage(JOIN_TAB *join_t
     failure to do this results in an invocation of the function that destructs
     the created object.
  
-  NOTES
+  @note
     An inner table of a nested outer join or a nested semi-join can be currently
     joined only when a linked cache object is employed. In these cases setting
     join cache level to an odd number results in denial of usage of any join
@@ -10722,7 +10715,7 @@ void revise_cache_usage(JOIN_TAB *join_t
     an index. For these engines setting the value of join_cache_level to 5 or 6
     results in that no join buffer is used to join the table. 
    
-  TODO
+  @todo
     Support BKA inside SJ-Materialization nests. When doing this, we'll need
     to only store sj-inner tables in the join buffer.
 #if 0
@@ -10746,7 +10739,7 @@ void revise_cache_usage(JOIN_TAB *join_t
         }
 #endif
 
-  RETURN
+  @return
     Bitmap describing the chosen cache's properties:
     1) the algorithm (JOIN_CACHE::ALG_NONE, JOIN_CACHE::ALG_BNL,
     JOIN_CACHE::ALG_BKA, JOIN_CACHE::ALG_BKA_UNIQUE)
@@ -11246,33 +11239,28 @@ bool setup_sj_materialization(JOIN_TAB *
 }
 
 
-/*
+/**
   Plan refinement stage: do various setup things for the executor
 
-  SYNOPSIS
-    make_join_readinfo()
-      join           Join being processed
-      options        Join's options (checking for SELECT_DESCRIBE, 
-                     SELECT_NO_JOIN_CACHE)
-      no_jbuf_after  Don't use join buffering after table with this number.
+  @param join          Join being processed
+  @param options       Join's options (checking for SELECT_DESCRIBE, 
+                       SELECT_NO_JOIN_CACHE)
+  @param no_jbuf_after Don't use join buffering after table with this number.
 
-  DESCRIPTION
+  @return false if successful, true if error (Out of memory)
+
+  @details
     Plan refinement stage: do various set ups for the executioner
       - setup join buffering use
       - push index conditions
       - increment relevant counters
       - etc
-
-  RETURN 
-    FALSE - OK
-    TRUE  - Out of memory
 */
 
 static bool
 make_join_readinfo(JOIN *join, ulonglong options, uint no_jbuf_after)
 {
-  uint i, jcl;
-  bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
+  const bool statistics= test(!(join->select_options & SELECT_DESCRIBE));
   uint first_sjm_table= MAX_TABLES;
   uint last_sjm_table= MAX_TABLES;
 
@@ -11284,11 +11272,12 @@ make_join_readinfo(JOIN *join, ulonglong
   if (setup_semijoin_dups_elimination(join, options, no_jbuf_after))
     DBUG_RETURN(TRUE); /* purecov: inspected */
 
-  for (i=join->const_tables ; i < join->tables ; i++)
+  for (uint i= join->const_tables; i < join->tables; i++)
   {
-    JOIN_TAB *tab=join->join_tab+i;
-    TABLE *table=tab->table;
+    JOIN_TAB *const tab= join->join_tab+i;
+    TABLE    *const table= tab->table;
     bool icp_other_tables_ok;
+    uint jcl;
     tab->read_record.table= table;
     tab->read_record.file=table->file;
     tab->read_record.unlock_row= rr_unlock_row;
@@ -11439,12 +11428,12 @@ make_join_readinfo(JOIN *join, ulonglong
     If a join buffer is used to join a table the ordering by an index
     for the first non-constant table cannot be employed anymore.
   */
-  for (i=join->const_tables ; i < join->tables ; i++)
+  for (uint i= join->const_tables; i < join->tables; i++)
   {
-    JOIN_TAB *tab=join->join_tab+i;
+    JOIN_TAB *const tab=join->join_tab + i;
     if (tab->use_join_cache)
     {
-      JOIN_TAB *sort_by_tab= join->get_sort_by_join_tab();
+      JOIN_TAB *const sort_by_tab= join->get_sort_by_join_tab();
       if (sort_by_tab)
       {
         join->need_tmp= 1;

=== modified file 'sql/sql_select.h'
--- a/sql/sql_select.h	revid:mikael.ronstrom@stripped
+++ b/sql/sql_select.h	revid:mikael.ronstrom@stripped
@@ -30,6 +30,7 @@
 #include "records.h"                          /* READ_RECORD */
 #include "opt_range.h"                /* SQL_SELECT, QUICK_SELECT_I */
 
+#include "mem_root_array.h"
 
 /* Values in optimize */
 #define KEY_OPTIMIZE_EXISTS		1
@@ -37,12 +38,24 @@
 
 /**
   Information about usage of an index to satisfy an equality condition.
-
-  @note such objects are stored in DYNAMIC_ARRAY which uses sizeof(), so keep
-  this class as POD as possible.
 */
 class Key_use {
 public:
+  // We need the default constructor for unit testing.
+  Key_use()
+    : table(NULL),
+      val(NULL),
+      used_tables(0),
+      key(0),
+      keypart(0),
+      optimize(0),
+      keypart_map(0),
+      ref_table_rows(0),
+      null_rejecting(false),
+      cond_guard(NULL),
+      sj_pred_no(UINT_MAX)
+  {}
+
   Key_use(TABLE *table_arg, Item *val_arg, table_map used_tables_arg,
           uint key_arg, uint keypart_arg, uint optimize_arg,
           key_part_map keypart_map_arg, ha_rows ref_table_rows_arg,
@@ -85,7 +98,7 @@ public:
   bool *cond_guard;
   /**
      0..64    <=> This was created from semi-join IN-equality # sj_pred_no.
-     MAX_UINT  Otherwise
+     UINT_MAX  Otherwise
 
      Not used if the index is fulltext (such index cannot be used for
      semijoin).
@@ -93,6 +106,10 @@ public:
   uint         sj_pred_no;
 };
 
+
+// Key_use has a trivial destructor, no need to run it from Mem_root_array.
+typedef Mem_root_array<Key_use, true> Key_use_array;
+
 class store_key;
 
 typedef struct st_table_ref : public Sql_alloc
@@ -1816,7 +1833,9 @@ public:
   bool          skip_sort_order;
 
   bool need_tmp, hidden_group_fields;
-  DYNAMIC_ARRAY keyuse;
+
+  Key_use_array keyuse;
+
   List<Item> all_fields; ///< to store all fields that used in query
   ///Above list changed to use temporary table
   List<Item> tmp_all_fields1, tmp_all_fields2, tmp_all_fields3;
@@ -1892,7 +1911,9 @@ public:
 
   JOIN(THD *thd_arg, List<Item> &fields_arg, ulonglong select_options_arg,
        select_result *result_arg)
-    :fields_list(fields_arg), sj_subselects(thd_arg->mem_root, 4)
+    : keyuse(thd_arg->mem_root),
+      fields_list(fields_arg),
+      sj_subselects(thd_arg->mem_root, 4)
   {
     init(thd_arg, fields_arg, select_options_arg, result_arg);
   }
@@ -1946,7 +1967,7 @@ public:
     all_fields= fields_arg;
     if (&fields_list != &fields_arg)      /* Avoid valgrind-warning */
       fields_list= fields_arg;
-    bzero((char*) &keyuse,sizeof(keyuse));
+    keyuse.clear();
     tmp_table_param.init();
     tmp_table_param.end_write_records= HA_POS_ERROR;
     rollup.state= ROLLUP::STATE_NONE;

=== modified file 'sql/sql_test.cc'
--- a/sql/sql_test.cc	revid:mikael.ronstrom@stripped
+++ b/sql/sql_test.cc	revid:mikael.ronstrom@stripped
@@ -239,7 +239,7 @@ TEST_join(JOIN *join)
 
 #define FT_KEYPART   (MAX_REF_PARTS+10)
 
-void print_keyuse(Key_use *keyuse)
+void print_keyuse(const Key_use *keyuse)
 {
   char buff[256];
   char buf2[64]; 
@@ -266,14 +266,14 @@ void print_keyuse(Key_use *keyuse)
 
 
 /* purecov: begin inspected */
-void print_keyuse_array(DYNAMIC_ARRAY *keyuse_array)
+void print_keyuse_array(const Key_use_array *keyuse_array)
 {
   DBUG_LOCK_FILE;
-  fprintf(DBUG_FILE, "Key_use array (%d elements)\n", keyuse_array->elements);
+  fprintf(DBUG_FILE, "Key_use array (%d elements)\n",
+          (int) keyuse_array->size());
   DBUG_UNLOCK_FILE;
-  for(uint i=0; i < keyuse_array->elements; i++)
-    print_keyuse(reinterpret_cast<Key_use *>
-                 (dynamic_array_ptr(keyuse_array, i)));
+  for(uint i=0; i < keyuse_array->size(); i++)
+    print_keyuse(&keyuse_array->at(i));
 }
 
 

=== modified file 'sql/sql_test.h'
--- a/sql/sql_test.h	revid:mikael.ronstrom@stripped
+++ b/sql/sql_test.h	revid:mikael.ronstrom@stripped
@@ -17,6 +17,7 @@
 #define SQL_TEST_INCLUDED
 
 #include "mysqld.h"
+#include "sql_select.h"
 
 class JOIN;
 struct TABLE_LIST;
@@ -31,7 +32,7 @@ void print_plan(JOIN* join,uint idx, dou
                 double current_read_time, const char *info);
 void dump_TABLE_LIST_graph(SELECT_LEX *select_lex, TABLE_LIST* tl);
 void print_sjm(TABLE_LIST *emb_sj_nest);
-void print_keyuse_array(DYNAMIC_ARRAY *keyuse_array);
+void print_keyuse_array(const Key_use_array *keyuse_array);
 #endif
 void mysql_print_status();
 

=== modified file 'sql/transaction.cc'
--- a/sql/transaction.cc	revid:mikael.ronstrom@stripped
+++ b/sql/transaction.cc	revid:mikael.ronstrom@stripped
@@ -175,14 +175,14 @@ bool trans_commit(THD *thd)
 
   thd->server_status&= ~SERVER_STATUS_IN_TRANS;
   res= ha_commit_trans(thd, TRUE);
+  /*
+    if res is non-zero, then ha_commit_trans has rolled back the
+    transaction, so the hooks for rollback will be called.
+  */
   if (res)
-    /*
-      if res is non-zero, then ha_commit_trans has rolled back the
-      transaction, so the hooks for rollback will be called.
-    */
-    RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+    (void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
   else
-    RUN_HOOK(transaction, after_commit, (thd, FALSE));
+    (void) RUN_HOOK(transaction, after_commit, (thd, FALSE));
   thd->variables.option_bits&= ~OPTION_BEGIN;
   thd->transaction.all.reset_unsafe_rollback_flags();
   thd->lex->start_transaction_opt= 0;
@@ -254,7 +254,7 @@ bool trans_rollback(THD *thd)
 
   thd->server_status&= ~SERVER_STATUS_IN_TRANS;
   res= ha_rollback_trans(thd, TRUE);
-  RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+  (void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
   thd->variables.option_bits&= ~OPTION_BEGIN;
   thd->transaction.all.reset_unsafe_rollback_flags();
   thd->lex->start_transaction_opt= 0;
@@ -299,14 +299,14 @@ bool trans_commit_stmt(THD *thd)
       thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
   }
 
+  /*
+    if res is non-zero, then ha_commit_trans has rolled back the
+    transaction, so the hooks for rollback will be called.
+  */
   if (res)
-    /*
-      if res is non-zero, then ha_commit_trans has rolled back the
-      transaction, so the hooks for rollback will be called.
-    */
-    RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+    (void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
   else
-    RUN_HOOK(transaction, after_commit, (thd, FALSE));
+    (void) RUN_HOOK(transaction, after_commit, (thd, FALSE));
 
   thd->transaction.stmt.reset();
 
@@ -345,7 +345,7 @@ bool trans_rollback_stmt(THD *thd)
       thd->tx_isolation= (enum_tx_isolation) thd->variables.tx_isolation;
   }
 
-  RUN_HOOK(transaction, after_rollback, (thd, FALSE));
+  (void) RUN_HOOK(transaction, after_rollback, (thd, FALSE));
 
   thd->transaction.stmt.reset();
 

=== modified file 'sql/uniques.cc'
--- a/sql/uniques.cc	revid:mikael.ronstrom@stripped
+++ b/sql/uniques.cc	revid:mikael.ronstrom@stripped
@@ -122,7 +122,7 @@ inline double log2_n_fact(double x)
     the same length, so each of total_buf_size elements will be added to a sort
     heap with (n_buffers-1) elements. This gives the comparison cost:
 
-      total_buf_elems* log2(n_buffers) / TIME_FOR_COMPARE_ROWID;
+      total_buf_elems * log2(n_buffers) * ROWID_COMPARE_COST;
 */
 
 static double get_merge_buffers_cost(uint *buff_elems, uint elem_size,
@@ -137,7 +137,7 @@ static double get_merge_buffers_cost(uin
 
   /* Using log2(n)=log(n)/log(2) formula */
   return 2*((double)total_buf_elems*elem_size) / IO_SIZE +
-     total_buf_elems*log((double) n_buffers) / (TIME_FOR_COMPARE_ROWID * M_LN2);
+     total_buf_elems*log((double) n_buffers) * ROWID_COMPARE_COST / M_LN2;
 }
 
 
@@ -267,7 +267,6 @@ double Unique::get_use_cost(uint *buffer
   ulong max_elements_in_tree;
   ulong last_tree_elems;
   int   n_full_trees; /* number of trees in unique - 1 */
-  double result;
 
   max_elements_in_tree= ((ulong) max_in_memory_size /
                          ALIGN_SIZE(sizeof(TREE_ELEMENT)+key_size));
@@ -276,10 +275,10 @@ double Unique::get_use_cost(uint *buffer
   last_tree_elems= nkeys % max_elements_in_tree;
 
   /* Calculate cost of creating trees */
-  result= 2*log2_n_fact(last_tree_elems + 1.0);
+  double result= 2 * log2_n_fact(last_tree_elems + 1.0);
   if (n_full_trees)
     result+= n_full_trees * log2_n_fact(max_elements_in_tree + 1.0);
-  result /= TIME_FOR_COMPARE_ROWID;
+  result*= ROWID_COMPARE_COST;
 
   DBUG_PRINT("info",("unique trees sizes: %u=%u*%lu + %lu", nkeys,
                      n_full_trees, n_full_trees?max_elements_in_tree:0,

=== modified file 'storage/innobase/handler/i_s.cc'
--- a/storage/innobase/handler/i_s.cc	revid:mikael.ronstrom@stripped
+++ b/storage/innobase/handler/i_s.cc	revid:mikael.ronstrom@stripped
@@ -151,7 +151,8 @@ do {									\
 	}								\
 } while (0)
 
-#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER
+#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 &&	\
+	!defined __INTEL_COMPILER && !defined __clang__
 #define STRUCT_FLD(name, value)	name: value
 #else
 #define STRUCT_FLD(name, value)	value

=== modified file 'storage/perfschema/pfs.cc'
--- a/storage/perfschema/pfs.cc	revid:mikael.ronstrom@stripped
+++ b/storage/perfschema/pfs.cc	revid:mikael.ronstrom@stripped
@@ -1402,9 +1402,6 @@ static void destroy_cond_v1(PSI_cond* co
 static PSI_table_share*
 get_table_share_v1(my_bool temporary, TABLE_SHARE *share)
 {
-  /* Do not instrument this table is all table instruments are disabled. */
-  if (! global_table_io_class.m_enabled && ! global_table_lock_class.m_enabled)
-    return NULL;
   /* An instrumented thread is required, for LF_PINS. */
   PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
   if (unlikely(pfs_thread == NULL))
@@ -1454,6 +1451,16 @@ open_table_v1(PSI_table_share *share, co
   PFS_thread *thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
   if (unlikely(thread == NULL))
     return NULL;
+
+  if (unlikely(setup_objects_version != pfs_table_share->m_setup_objects_version))
+  {
+    pfs_table_share->refresh_setup_object_flags(thread);
+  }
+
+  /* Do not instrument this table is all table instruments are disabled. */
+  if (! pfs_table_share->m_io_enabled && ! pfs_table_share->m_lock_enabled)
+    return NULL;
+
   PFS_table *pfs_table= create_table(pfs_table_share, thread, identity);
   return reinterpret_cast<PSI_table *> (pfs_table);
 }
@@ -2212,27 +2219,8 @@ get_thread_table_io_locker_v1(PSI_table_
   if (! flag_global_instrumentation)
     return NULL;
 
-  if (! global_table_io_class.m_enabled)
-    return NULL;
-
   PFS_table_share *share= pfs_table->m_share;
-  if (unlikely(setup_objects_version != share->m_setup_objects_version))
-  {
-    PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
-    if (unlikely(pfs_thread == NULL))
-      return NULL;
-    /* Refresh the enabled and timed flags from SETUP_OBJECTS */
-    share->m_setup_objects_version= setup_objects_version;
-    lookup_setup_object(pfs_thread,
-                        OBJECT_TYPE_TABLE, /* even for temporary tables */
-                        share->m_schema_name,
-                        share->m_schema_name_length,
-                        share->m_table_name,
-                        share->m_table_name_length,
-                        & share->m_enabled,
-                        & share->m_timed);
-  }
-  if (! share->m_enabled)
+  if (! share->m_io_enabled)
     return NULL;
 
   PFS_instr_class *klass;
@@ -2250,7 +2238,7 @@ get_thread_table_io_locker_v1(PSI_table_
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed && share->m_timed)
+    if (share->m_io_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2284,7 +2272,7 @@ get_thread_table_io_locker_v1(PSI_table_
   }
   else
   {
-    if (klass->m_timed && share->m_timed)
+    if (share->m_io_timed)
     {
       flags= STATE_FLAG_TIMED;
     }
@@ -2320,27 +2308,8 @@ get_thread_table_lock_locker_v1(PSI_tabl
   if (! flag_global_instrumentation)
     return NULL;
 
-  if (! global_table_lock_class.m_enabled)
-    return NULL;
-
   PFS_table_share *share= pfs_table->m_share;
-  if (unlikely(setup_objects_version != share->m_setup_objects_version))
-  {
-    PFS_thread *pfs_thread= my_pthread_getspecific_ptr(PFS_thread*, THR_PFS);
-    if (unlikely(pfs_thread == NULL))
-      return NULL;
-    /* Refresh the enabled and timed flags from SETUP_OBJECTS */
-    share->m_setup_objects_version= setup_objects_version;
-    lookup_setup_object(pfs_thread,
-                        OBJECT_TYPE_TABLE, /* even for temporary tables */
-                        share->m_schema_name,
-                        share->m_schema_name_length,
-                        share->m_table_name,
-                        share->m_table_name_length,
-                        & share->m_enabled,
-                        & share->m_timed);
-  }
-  if (! share->m_enabled)
+  if (! share->m_lock_enabled)
     return NULL;
 
   PFS_instr_class *klass;
@@ -2380,7 +2349,7 @@ get_thread_table_lock_locker_v1(PSI_tabl
     state->m_thread= reinterpret_cast<PSI_thread *> (pfs_thread);
     flags= STATE_FLAG_THREAD;
 
-    if (klass->m_timed && share->m_timed)
+    if (share->m_lock_timed)
       flags|= STATE_FLAG_TIMED;
 
     if (flag_events_waits_current)
@@ -2414,7 +2383,7 @@ get_thread_table_lock_locker_v1(PSI_tabl
   }
   else
   {
-    if (klass->m_timed && share->m_timed)
+    if (share->m_lock_timed)
     {
       flags= STATE_FLAG_TIMED;
     }

=== modified file 'storage/perfschema/pfs_instr_class.cc'
--- a/storage/perfschema/pfs_instr_class.cc	revid:mikael.ronstrom@stripped
+++ b/storage/perfschema/pfs_instr_class.cc	revid:mikael.ronstrom@stripped
@@ -118,6 +118,36 @@ PFS_table_share *table_share_array= NULL
 PFS_instr_class global_table_io_class;
 PFS_instr_class global_table_lock_class;
 
+void PFS_instr_class::set_enabled(PFS_instr_class *pfs, bool enabled)
+{
+  pfs->m_enabled= enabled;
+
+  /*
+    When the table instruments are changed,
+    the cache on top of SETUP_OBJECTS is invalidated.
+  */
+  if ((pfs == & global_table_io_class) ||
+      (pfs == & global_table_lock_class))
+  {
+    setup_objects_version++;
+  }
+}
+
+void PFS_instr_class::set_timed(PFS_instr_class *pfs, bool timed)
+{
+  pfs->m_timed= timed;
+
+  /*
+    When the table instruments are changed,
+    the cache on top of SETUP_OBJECTS is invalidated.
+  */
+  if ((pfs == & global_table_io_class) ||
+      (pfs == & global_table_lock_class))
+  {
+    setup_objects_version++;
+  }
+}
+
 /**
   Hash index for instrumented table shares.
   This index is searched by table fully qualified name (@c PFS_table_share_key),
@@ -409,6 +439,24 @@ static void set_table_share_key(PFS_tabl
   }
 }
 
+void PFS_table_share::refresh_setup_object_flags(PFS_thread *thread)
+{
+  bool enabled;
+  bool timed;
+  m_setup_objects_version= setup_objects_version;
+  lookup_setup_object(thread,
+                      OBJECT_TYPE_TABLE,
+                      m_schema_name, m_schema_name_length,
+                      m_table_name, m_table_name_length,
+                      &enabled, &timed);
+
+  m_io_enabled= enabled && global_table_io_class.m_enabled;
+  m_io_timed= timed && global_table_io_class.m_timed;
+
+  m_lock_enabled= enabled && global_table_lock_class.m_enabled;
+  m_lock_timed= timed && global_table_lock_class.m_timed;
+}
+
 /**
   Initialize the file class buffer.
   @param file_class_sizing            max number of file class
@@ -1041,8 +1089,10 @@ PFS_table_share* find_or_create_table_sh
   uint retry_count= 0;
   uint version= 0;
   const uint retry_max= 3;
-  bool enabled= true;
-  bool timed= true;
+  bool io_enabled= true;
+  bool lock_enabled= true;
+  bool io_timed= true;
+  bool lock_timed= true;
 
 search:
   entry= reinterpret_cast<PFS_table_share**>
@@ -1065,6 +1115,8 @@ search:
 
   if (retry_count == 0)
   {
+    bool enabled;
+    bool timed;
     version= setup_objects_version;
     lookup_setup_object(thread,
                         OBJECT_TYPE_TABLE,
@@ -1072,6 +1124,12 @@ search:
                         table_name, table_name_length,
                         &enabled, &timed);
 
+    io_enabled= enabled && global_table_io_class.m_enabled;
+    io_timed= timed && global_table_io_class.m_timed;
+
+    lock_enabled= enabled && global_table_lock_class.m_enabled;
+    lock_timed= timed && global_table_lock_class.m_timed;
+
     /*
       Even when enabled is false, a record is added in the dictionary:
       - It makes enabling a table already in the table cache possible,
@@ -1101,8 +1159,10 @@ search:
           pfs->m_schema_name_length= schema_name_length;
           pfs->m_table_name= &pfs->m_key.m_hash_key[schema_name_length + 2];
           pfs->m_table_name_length= table_name_length;
-          pfs->m_enabled= enabled;
-          pfs->m_timed= timed;
+          pfs->m_io_enabled= io_enabled;
+          pfs->m_lock_enabled= lock_enabled;
+          pfs->m_io_timed= io_timed;
+          pfs->m_lock_timed= lock_timed;
           pfs->init_refcount();
           pfs->m_table_stat.reset();
           set_keys(pfs, share);

=== modified file 'storage/perfschema/pfs_instr_class.h'
--- a/storage/perfschema/pfs_instr_class.h	revid:mikael.ronstrom@stripped
+++ b/storage/perfschema/pfs_instr_class.h	revid:mikael.ronstrom@stripped
@@ -99,6 +99,9 @@ struct PFS_instr_class
   {
     return m_flags & PSI_FLAG_GLOBAL;
   }
+
+  static void set_enabled(PFS_instr_class *pfs, bool enabled);
+  static void set_timed(PFS_instr_class *pfs, bool timed);
 };
 
 struct PFS_mutex;
@@ -231,7 +234,17 @@ public:
     PFS_atomic::add_32(& m_refcount, -1);
   }
 
-  /** Setup object refresh version. */
+  void refresh_setup_object_flags(PFS_thread *thread);
+
+  /**
+    Setup object refresh version.
+    Cache version used when computing the enabled / timed flags.
+    @sa setup_objects_version
+    @sa m_io_enabled
+    @sa m_lock_enabled
+    @sa m_io_timed
+    @sa m_lock_timed
+  */
   uint m_setup_objects_version;
   /** Internal lock. */
   pfs_lock m_lock;
@@ -245,11 +258,14 @@ public:
   const char *m_table_name;
   /** Length in bytes of @c m_table_name. */
   uint m_table_name_length;
-  /** True if this table instrument is enabled. */
-  bool m_enabled;
-  /** True if this table instrument is timed. */
-  bool m_timed;
-  bool m_purge;
+  /** True if table io instrumentation is enabled. */
+  bool m_io_enabled;
+  /** True if table lock instrumentation is enabled. */
+  bool m_lock_enabled;
+  /** True if table io instrumentation is timed. */
+  bool m_io_timed;
+  /** True if table lock instrumentation is timed. */
+  bool m_lock_timed;
   /** Table statistics. */
   PFS_table_stat m_table_stat;
   /** Number of indexes. */

=== modified file 'storage/perfschema/pfs_setup_object.h'
--- a/storage/perfschema/pfs_setup_object.h	revid:mikael.ronstrom@stripped
+++ b/storage/perfschema/pfs_setup_object.h	revid:mikael.ronstrom@stripped
@@ -70,6 +70,20 @@ struct PFS_setup_object
   bool m_timed;
 };
 
+/**
+  Version number of the SETUP_OBJECTS cache.
+  The content of the SETUP_OBJECTS table,
+  and the content of SETUP_INSTRUMENTS table for instruments that apply to objects :
+  - wait/io/table/sql/handler
+  - wait/lock/table/sql/handler
+  is cached once for each object,
+  to avoid evaluating the object ENABLED and TIMED flags too frequently.
+  Incrementing @c setup_objects_version invalidates the cache.
+  @sa global_table_io_class
+  @sa global_table_lock_class
+  @sa PFS_table_share::refresh_setup_objects_flags
+  @sa PFS_table_share::m_setup_objects_version
+*/
 extern uint setup_objects_version;
 
 int init_setup_object(const PFS_global_param *param);

=== modified file 'storage/perfschema/table_setup_instruments.cc'
--- a/storage/perfschema/table_setup_instruments.cc	revid:mikael.ronstrom@stripped
+++ b/storage/perfschema/table_setup_instruments.cc	revid:mikael.ronstrom@stripped
@@ -1,4 +1,4 @@
-/* Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2008, 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
@@ -25,6 +25,7 @@
 #include "pfs_column_values.h"
 #include "table_setup_instruments.h"
 #include "pfs_global.h"
+#include "pfs_setup_object.h"
 
 THR_LOCK table_setup_instruments::m_table_lock;
 
@@ -173,10 +174,7 @@ int table_setup_instruments::rnd_pos(con
 
 void table_setup_instruments::make_row(PFS_instr_class *klass)
 {
-  m_row.m_name= &klass->m_name[0];
-  m_row.m_name_length= klass->m_name_length;
-  m_row.m_enabled_ptr= &klass->m_enabled;
-  m_row.m_timed_ptr= &klass->m_timed;
+  m_row.m_instr_class= klass;
 }
 
 int table_setup_instruments::read_row_values(TABLE *table,
@@ -200,16 +198,13 @@ int table_setup_instruments::read_row_va
       switch(f->field_index)
       {
       case 0: /* NAME */
-        set_field_varchar_utf8(f, m_row.m_name, m_row.m_name_length);
+        set_field_varchar_utf8(f, m_row.m_instr_class->m_name, m_row.m_instr_class->m_name_length);
         break;
       case 1: /* ENABLED */
-        set_field_enum(f, (*m_row.m_enabled_ptr) ? ENUM_YES : ENUM_NO);
+        set_field_enum(f, m_row.m_instr_class->m_enabled ? ENUM_YES : ENUM_NO);
         break;
       case 2: /* TIMED */
-        if (m_row.m_timed_ptr)
-          set_field_enum(f, (*m_row.m_timed_ptr) ? ENUM_YES : ENUM_NO);
-        else
-          set_field_enum(f, ENUM_NO);
+        set_field_enum(f, m_row.m_instr_class->m_timed ? ENUM_YES : ENUM_NO);
         break;
       default:
         DBUG_ASSERT(false);
@@ -238,14 +233,11 @@ int table_setup_instruments::update_row_
         return HA_ERR_WRONG_COMMAND;
       case 1: /* ENABLED */
         value= (enum_yes_no) get_field_enum(f);
-        *m_row.m_enabled_ptr= (value == ENUM_YES) ? true : false;
+        PFS_instr_class::set_enabled(m_row.m_instr_class, (value == ENUM_YES) ? true : false);
         break;
       case 2: /* TIMED */
-        if (m_row.m_timed_ptr)
-        {
-          value= (enum_yes_no) get_field_enum(f);
-          *m_row.m_timed_ptr= (value == ENUM_YES) ? true : false;
-        }
+        value= (enum_yes_no) get_field_enum(f);
+        PFS_instr_class::set_timed(m_row.m_instr_class, (value == ENUM_YES) ? true : false);
         break;
       default:
         DBUG_ASSERT(false);

=== modified file 'storage/perfschema/table_setup_instruments.h'
--- a/storage/perfschema/table_setup_instruments.h	revid:mikael.ronstrom@stripped
+++ b/storage/perfschema/table_setup_instruments.h	revid:mikael.ronstrom@stripped
@@ -32,14 +32,8 @@
 /** A row of PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS. */
 struct row_setup_instruments
 {
-  /** Column NAME. */
-  const char *m_name;
-  /** Length in bytes of @c m_name. */
-  uint m_name_length;
-  /** Column ENABLED. */
-  bool *m_enabled_ptr;
-  /** Column TIMED. */
-  bool *m_timed_ptr;
+  /** Columns NAME, ENABLED, TIMED. */
+  PFS_instr_class *m_instr_class;
 };
 
 /** Position of a cursor on PERFORMANCE_SCHEMA.SETUP_INSTRUMENTS. */

=== modified file 'strings/decimal.c'
--- a/strings/decimal.c	revid:mikael.ronstrom@stripped
+++ b/strings/decimal.c	revid:mikael.ronstrom@stripped
@@ -678,7 +678,7 @@ int decimal_shift(decimal_t *dec, int sh
     if (do_left)
     {
       do_mini_left_shift(dec, l_mini_shift, beg, end);
-      mini_shift=- l_mini_shift;
+      mini_shift= -l_mini_shift;
     }
     else
     {

=== modified file 'unittest/gunit/CMakeLists.txt'
--- a/unittest/gunit/CMakeLists.txt	revid:mikael.ronstrom@stripped
+++ b/unittest/gunit/CMakeLists.txt	revid:mikael.ronstrom@stripped
@@ -206,6 +206,7 @@ ENDIF()
 SET(TESTS
   bounded_queue
   dbug
+  dynarray
   mdl
   mdl_mytap
   my_bitmap

=== added file 'unittest/gunit/dynarray-t.cc'
--- a/unittest/gunit/dynarray-t.cc	1970-01-01 00:00:00 +0000
+++ b/unittest/gunit/dynarray-t.cc	revid:mikael.ronstrom@stripped
@@ -0,0 +1,408 @@
+/* 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, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
+
+// First include (the generated) my_config.h, to get correct platform defines,
+// then gtest.h (before any other MySQL headers), to avoid min() macros etc ...
+#include "my_config.h"
+#include <gtest/gtest.h>
+
+#include <algorithm>
+#include <functional>
+#include <vector>
+
+#include "sql_select.h"
+#include "mem_root_array.h"
+
+/**
+   WL#5774 Decrease number of malloc's for normal DML queries.
+   One of the malloc's was due to DYNAMIC_ARRAY keyuse;
+   We replace the DYNAMIC_ARRAY with a std::vector-like class Mem_root_array.
+
+   Below are unit tests for comparing performance, and for testing
+   functionality of Mem_root_array.
+*/
+
+pthread_key(MEM_ROOT**, THR_MALLOC);
+pthread_key(THD*, THR_THD);
+
+extern "C" void sql_alloc_error_handler(void)
+{
+  ADD_FAILURE();
+}
+
+
+/*
+  Rewrite of sort_keyuse() to comparison operator for use by std::less<>
+  It is a template argument, so static rather than in unnamed namespace.
+*/
+static inline bool operator<(const Key_use &a, const Key_use &b)
+{
+  if (a.table->tablenr != b.table->tablenr)
+    return a.table->tablenr < b.table->tablenr;
+  if (a.key != b.key)
+    return a.key < b.key;
+  if (a.keypart != b.keypart)
+    return a.keypart < b.keypart;
+  const bool atab = test((a.used_tables & ~OUTER_REF_TABLE_BIT));
+  const bool btab = test((b.used_tables & ~OUTER_REF_TABLE_BIT));
+  if (atab != btab)
+    return atab < btab;
+  return
+    ((a.optimize & KEY_OPTIMIZE_REF_OR_NULL) <
+     (b.optimize & KEY_OPTIMIZE_REF_OR_NULL));
+}
+
+
+/*
+  Compare for equality.
+  It is a template argument, so static rather than in unnamed namespace.
+*/
+static inline bool operator==(const Key_use &lhs, const Key_use &rhs)
+{
+  return
+    lhs.table->tablenr == rhs.table->tablenr &&
+    lhs.key            == rhs.key            &&
+    lhs.keypart        == rhs.keypart        &&
+    test((lhs.used_tables & ~OUTER_REF_TABLE_BIT))
+    ==
+    test((rhs.used_tables & ~OUTER_REF_TABLE_BIT)) &&
+    (lhs.optimize & KEY_OPTIMIZE_REF_OR_NULL)
+    ==
+    (rhs.optimize & KEY_OPTIMIZE_REF_OR_NULL);
+}
+
+
+namespace {
+
+/*
+  Cut'n paste this function from sql_select.cc,
+  to avoid linking in the entire server for this unit test.
+*/
+inline int sort_keyuse(Key_use *a, Key_use *b)
+{
+  int res;
+  if (a->table->tablenr != b->table->tablenr)
+    return (int) (a->table->tablenr - b->table->tablenr);
+  if (a->key != b->key)
+    return (int) (a->key - b->key);
+  if (a->keypart != b->keypart)
+    return (int) (a->keypart - b->keypart);
+  // Place const values before other ones
+  if ((res= test((a->used_tables & ~OUTER_REF_TABLE_BIT)) -
+       test((b->used_tables & ~OUTER_REF_TABLE_BIT))))
+    return res;
+  /* Place rows that are not 'OPTIMIZE_REF_OR_NULL' first */
+  return (int) ((a->optimize & KEY_OPTIMIZE_REF_OR_NULL) -
+		(b->optimize & KEY_OPTIMIZE_REF_OR_NULL));
+}
+
+
+std::ostream &operator<<(std::ostream &s, const Key_use &v)
+{
+  return s << "{"
+           << v.table->tablenr << ", "
+           << v.key            << ", "
+           << v.keypart        << ", "
+           << v.used_tables    << ", "
+           << v.optimize
+           << "}"
+    ;
+}
+
+
+// We generate some random data at startup, for testing of sorting.
+void generate_test_data(Key_use *keys, TABLE *tables, int n)
+{
+  int ix;
+  for (ix= 0; ix < n; ++ix)
+  {
+    tables[ix].tablenr= ix % 3;
+    keys[ix]=
+      Key_use(&tables[ix],
+              NULL,                           // Item      *val
+              0,                              // table_map  used_tables
+              ix % 4,                         // uint       key
+              ix % 2,                         // uint       keypart
+              0,                              // uint       optimize
+              0,                              //            keypart_map
+              0,                              // ha_rows    ref_table_rows
+              true,                           // bool       null_rejecting
+              NULL,                           // bool      *cond_guard
+              0                               // uint       sj_pred_no
+              );
+  }
+  std::random_shuffle(&keys[0], &keys[n]);
+}
+
+
+// Play around with these constants to see std::sort speedup vs. my_qsort.
+const int num_elements= 200;
+const int num_iterations= 10;
+
+/*
+  This class is used for comparing performance of
+    std::vector<> and std::sort()
+  vs
+    DYNAMIC_ARRAY and my_qsort()
+ */
+class DynArrayTest : public ::testing::Test
+{
+public:
+  DynArrayTest() {}
+
+  static void SetUpTestCase()
+  {
+    generate_test_data(test_data, table_list, num_elements);
+  }
+
+  virtual void SetUp()
+  {
+    my_init_dynamic_array(&m_keyuse_dyn, sizeof(Key_use), num_elements, 64);
+    m_keyuse_vec.reserve(num_elements);
+  }
+
+  void insert_and_sort_dynamic()
+  {
+    reset_dynamic(&m_keyuse_dyn);
+    for (int ix= 0; ix < num_elements; ++ix)
+    {
+      insert_dynamic(&m_keyuse_dyn, &test_data[ix]);
+    }
+    my_qsort(m_keyuse_dyn.buffer, m_keyuse_dyn.elements, sizeof(Key_use),
+             reinterpret_cast<qsort_cmp>(sort_keyuse));
+  }
+
+  void insert_and_sort_vector()
+  {
+    m_keyuse_vec.clear();
+    for (int ix= 0; ix < num_elements; ++ix)
+    {
+      m_keyuse_vec.push_back(test_data[ix]);
+    }
+    std::sort(m_keyuse_vec.begin(), m_keyuse_vec.end(), std::less<Key_use>());
+  }
+
+  DYNAMIC_ARRAY           m_keyuse_dyn;
+  std::vector<Key_use>    m_keyuse_vec;
+private:
+  static Key_use test_data[num_elements];
+  static TABLE   table_list[num_elements];
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(DynArrayTest);
+};
+
+Key_use DynArrayTest::test_data[num_elements];
+TABLE   DynArrayTest::table_list[num_elements];
+
+
+// Test insert_dynamic() and my_qsort().
+TEST_F(DynArrayTest, DynArray)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+    insert_and_sort_dynamic();
+}
+
+
+// Test vector::push_back() and std::sort()
+TEST_F(DynArrayTest, Vector)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+    insert_and_sort_vector();
+}
+
+
+/*
+  This class is for unit testing of Mem_root_array.
+ */
+class MemRootTest : public ::testing::Test
+{
+protected:
+  MemRootTest()
+    : m_mem_root_p(&m_mem_root),
+      m_array_mysys(m_mem_root_p),
+      m_array_std(m_mem_root_p)
+  {}
+
+  virtual void SetUp()
+  {
+    init_sql_alloc(&m_mem_root, 1024, 0);
+    ASSERT_EQ(0, my_pthread_setspecific_ptr(THR_MALLOC, &m_mem_root_p));
+    MEM_ROOT *root= *my_pthread_getspecific_ptr(MEM_ROOT**, THR_MALLOC);
+    ASSERT_EQ(root, m_mem_root_p);
+
+    m_array_mysys.reserve(num_elements);
+    m_array_std.reserve(num_elements);
+  }
+
+  virtual void TearDown()
+  {
+    free_root(&m_mem_root, MYF(0));
+  }
+
+  static void SetUpTestCase()
+  {
+    generate_test_data(test_data, table_list, num_elements);
+    ASSERT_EQ(0, pthread_key_create(&THR_THD, NULL));
+    ASSERT_EQ(0, pthread_key_create(&THR_MALLOC, NULL));
+  }
+
+  static void TearDownTestCase()
+  {
+    pthread_key_delete(THR_THD);
+    pthread_key_delete(THR_MALLOC);
+  }
+
+  void insert_and_sort_mysys()
+  {
+    m_array_mysys.clear();
+    for (int ix= 0; ix < num_elements; ++ix)
+    {
+      m_array_mysys.push_back(test_data[ix]);
+    }
+    my_qsort(m_array_mysys.begin(), m_array_mysys.size(),
+             m_array_mysys.element_size(),
+             reinterpret_cast<qsort_cmp>(sort_keyuse));
+  }
+
+  void insert_and_sort_std()
+  {
+    m_array_std.clear();
+    for (int ix= 0; ix < num_elements; ++ix)
+    {
+      m_array_std.push_back(test_data[ix]);
+    }
+    std::sort(m_array_std.begin(), m_array_std.end(), std::less<Key_use>());
+  }
+
+  MEM_ROOT m_mem_root;
+  MEM_ROOT *m_mem_root_p;
+  Key_use_array m_array_mysys;
+  Key_use_array m_array_std;
+private:
+  static Key_use test_data[num_elements];
+  static TABLE   table_list[num_elements];
+
+  GTEST_DISALLOW_COPY_AND_ASSIGN_(MemRootTest);
+};
+
+Key_use MemRootTest::test_data[num_elements];
+TABLE   MemRootTest::table_list[num_elements];
+
+
+// Test Mem_root_array::push_back() and my_qsort()
+TEST_F(MemRootTest, KeyUseMysys)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+    insert_and_sort_mysys();
+}
+
+
+// Test Mem_root_array::push_back() and std::sort()
+TEST_F(MemRootTest, KeyUseStd)
+{
+  for (int ix= 0; ix < num_iterations; ++ix)
+    insert_and_sort_std();
+}
+
+
+// Test that my_qsort() and std::sort() generate same order.
+TEST_F(MemRootTest, KeyUseCompare)
+{
+  insert_and_sort_mysys();
+  insert_and_sort_std();
+  for (int ix= 0; ix < num_elements; ++ix)
+  {
+    Key_use k1= m_array_mysys.at(ix);
+    Key_use k2= m_array_std.at(ix);
+    EXPECT_EQ(k1, k2);
+  }
+}
+
+
+// Test that Mem_root_array re-expanding works.
+TEST_F(MemRootTest, Reserve)
+{
+  Mem_root_array<uint, true> intarr(m_mem_root_p);
+  intarr.reserve(2);
+  const uint num_pushes= 20;
+  for (uint ix=0; ix < num_pushes; ++ix)
+  {
+    EXPECT_EQ(ix, intarr.size());
+    EXPECT_FALSE(intarr.push_back(ix));
+    EXPECT_EQ(ix, intarr.at(ix));
+  }
+  for (uint ix=0; ix < num_pushes; ++ix)
+  {
+    EXPECT_EQ(ix, intarr.at(ix));
+  }
+  EXPECT_EQ(sizeof(uint), intarr.element_size());
+  EXPECT_EQ(num_pushes, intarr.size());
+  EXPECT_LE(num_pushes, intarr.capacity());
+}
+
+
+class DestroyCounter
+{
+public:
+  DestroyCounter(const DestroyCounter &rhs) : p_counter(rhs.p_counter) {}
+  DestroyCounter(size_t *p) : p_counter(p) {}
+  ~DestroyCounter() { (*p_counter)+= 1; }
+private:
+  size_t *p_counter;
+};
+
+
+// Test chop() and clear() and that destructors are executed.
+TEST_F(MemRootTest, ChopAndClear)
+{
+  Mem_root_array<DestroyCounter, false> array(m_mem_root_p);
+  const size_t nn= 4;
+  array.reserve(nn);
+  size_t counter= 0;
+  DestroyCounter foo(&counter);
+  for (size_t ix= 0; ix < array.capacity(); ++ix)
+    array.push_back(foo);
+
+  EXPECT_EQ(0U, counter);
+  array.chop(nn / 2);
+  EXPECT_EQ(nn / 2, counter);
+  EXPECT_EQ(nn / 2, array.size());
+
+  array.clear();
+  EXPECT_EQ(nn, counter);
+}
+
+
+// Test that elements are destroyed if push_back() needs to call reserve().
+TEST_F(MemRootTest, ReserveDestroy)
+{
+  Mem_root_array<DestroyCounter, false> array(m_mem_root_p);
+  const size_t nn= 4;
+  array.reserve(nn / 2);
+  size_t counter= 0;
+  DestroyCounter foo(&counter);
+  for (size_t ix= 0; ix < nn; ++ix)
+    array.push_back(foo);
+  
+  EXPECT_EQ(nn / 2, counter);
+  EXPECT_EQ(nn, array.size());
+
+  counter= 0;
+  array.clear();
+  EXPECT_EQ(nn, counter);
+}
+
+
+}

=== modified file 'unittest/mysys/lf-t.c'
--- a/unittest/mysys/lf-t.c	revid:mikael.ronstrom@stripped
+++ b/unittest/mysys/lf-t.c	revid:mikael.ronstrom@stripped
@@ -27,6 +27,8 @@ int32 inserts= 0, N;
 LF_ALLOCATOR lf_allocator;
 LF_HASH lf_hash;
 
+int with_my_thread_init=0;
+
 /*
   pin allocator - alloc and release an element in a loop
 */
@@ -36,7 +38,8 @@ pthread_handler_t test_lf_pinbox(void *a
   int32 x= 0;
   LF_PINS *pins;
 
-  my_thread_init();
+  if (with_my_thread_init)
+    my_thread_init();
 
   pins= lf_pinbox_get_pins(&lf_allocator.pinbox);
 
@@ -49,7 +52,10 @@ pthread_handler_t test_lf_pinbox(void *a
   pthread_mutex_lock(&mutex);
   if (!--running_threads) pthread_cond_signal(&cond);
   pthread_mutex_unlock(&mutex);
-  my_thread_end();
+
+  if (with_my_thread_init)
+    my_thread_end();
+
   return 0;
 }
 
@@ -68,7 +74,8 @@ pthread_handler_t test_lf_alloc(void *ar
   int32 x,y= 0;
   LF_PINS *pins;
 
-  my_thread_init();
+  if (with_my_thread_init)
+    my_thread_init();
 
   pins= lf_alloc_get_pins(&lf_allocator);
 
@@ -101,7 +108,9 @@ pthread_handler_t test_lf_alloc(void *ar
   }
   if (!--running_threads) pthread_cond_signal(&cond);
   pthread_mutex_unlock(&mutex);
-  my_thread_end();
+
+  if (with_my_thread_init)
+    my_thread_end();
   return 0;
 }
 
@@ -112,7 +121,8 @@ pthread_handler_t test_lf_hash(void *arg
   int32 x,y,z,sum= 0, ins= 0;
   LF_PINS *pins;
 
-  my_thread_init();
+  if (with_my_thread_init)
+    my_thread_init();
 
   pins= lf_hash_get_pins(&lf_hash);
 
@@ -152,14 +162,15 @@ pthread_handler_t test_lf_hash(void *arg
   }
   if (!--running_threads) pthread_cond_signal(&cond);
   pthread_mutex_unlock(&mutex);
-  my_thread_end();
+  if (with_my_thread_init)
+    my_thread_end();
   return 0;
 }
 
 
 void do_tests()
 {
-  plan(4);
+  plan(7);
 
   lf_alloc_init(&lf_allocator, sizeof(TLA), offsetof(TLA, not_used));
   lf_hash_init(&lf_hash, sizeof(int), LF_HASH_UNIQUE, 0, sizeof(int), 0,
@@ -168,9 +179,15 @@ void do_tests()
   bad= my_atomic_initialize();
   ok(!bad, "my_atomic_initialize() returned %d", bad);
 
-  test_concurrently("lf_pinbox", test_lf_pinbox, N= THREADS, CYCLES);
-  test_concurrently("lf_alloc",  test_lf_alloc,  N= THREADS, CYCLES);
-  test_concurrently("lf_hash",   test_lf_hash,   N= THREADS, CYCLES/10);
+  with_my_thread_init= 1;
+  test_concurrently("lf_pinbox (with my_thread_init)", test_lf_pinbox, N= THREADS, CYCLES);
+  test_concurrently("lf_alloc (with my_thread_init)",  test_lf_alloc,  N= THREADS, CYCLES);
+  test_concurrently("lf_hash (with my_thread_init)",   test_lf_hash,   N= THREADS, CYCLES/10);
+
+  with_my_thread_init= 0;
+  test_concurrently("lf_pinbox (without my_thread_init)", test_lf_pinbox, N= THREADS, CYCLES);
+  test_concurrently("lf_alloc (without my_thread_init)",  test_lf_alloc,  N= THREADS, CYCLES);
+  test_concurrently("lf_hash (without my_thread_init)",   test_lf_hash,   N= THREADS, CYCLES/10);
 
   lf_hash_destroy(&lf_hash);
   lf_alloc_destroy(&lf_allocator);

No bundle (reason: revision is a merge (you can force generation of a bundle with env var BZR_FORCE_BUNDLE=1)).
Thread
bzr commit into mysql-trunk branch (mikael.ronstrom:3373) Mikael Ronstrom19 May