List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:January 29 2011 10:30pm
Subject:bzr commit into mysql-trunk-mtr branch (bjorn.munch:3020)
View as plain text  
#At file:///home/bm136801/my/mtr-tr/ based on revid:bjorn.munch@stripped

 3020 Bjorn Munch	2011-01-29 [merge]
      merge from trunk main

    added:
      mysql-test/include/have_dbi_dbd-mysql.inc
      mysql-test/std_data/checkDBI_DBD-mysql.pl
      mysql-test/suite/perfschema/r/debug_env.result
      mysql-test/suite/perfschema/t/debug_env.test
      unittest/gunit/test_mdl_context_owner.h
    modified:
      client/mysqltest.cc
      include/mysql/psi/psi.h
      include/mysql/psi/psi_abi_v1.h.pp
      include/mysql/psi/psi_abi_v2.h.pp
      mysql-test/collections/default.experimental
      mysql-test/collections/mysql-trunk.daily
      mysql-test/include/icp_tests.inc
      mysql-test/include/mysqlhotcopy.inc
      mysql-test/r/innodb_icp.result
      mysql-test/r/innodb_icp_all.result
      mysql-test/r/innodb_icp_none.result
      mysql-test/r/innodb_mysql_sync.result
      mysql-test/r/myisam_icp.result
      mysql-test/r/myisam_icp_all.result
      mysql-test/r/myisam_icp_none.result
      mysql-test/r/partition_error.result
      mysql-test/suite/parts/inc/partition_layout_check1.inc
      mysql-test/suite/parts/inc/partition_layout_check2.inc
      mysql-test/suite/parts/r/partition_recover_myisam.result
      mysql-test/suite/parts/t/partition_alter1_1_2_myisam.test
      mysql-test/suite/parts/t/partition_alter1_1_myisam.test
      mysql-test/suite/parts/t/partition_alter1_2_myisam.test
      mysql-test/suite/parts/t/partition_basic_myisam.test
      mysql-test/suite/parts/t/partition_engine_myisam.test
      mysql-test/suite/parts/t/partition_recover_myisam.test
      mysql-test/suite/parts/t/partition_syntax_myisam.test
      mysql-test/suite/perfschema/include/table_aggregate_load.inc
      mysql-test/suite/perfschema/r/ortho_iter.result
      mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_off.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result
      mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result
      mysql-test/suite/perfschema/t/disabled.def
      mysql-test/suite/perfschema/t/ortho_iter.test
      mysql-test/suite/rpl/t/disabled.def
      mysql-test/t/disabled.def
      mysql-test/t/innodb_mysql_sync.test
      mysql-test/t/partition_error.test
      sql/ha_partition.cc
      sql/ha_partition.h
      sql/handler.h
      sql/item.h
      sql/item_func.h
      sql/item_timefunc.h
      sql/mdl.cc
      sql/mdl.h
      sql/partition_info.h
      sql/sql_base.cc
      sql/sql_class.cc
      sql/sql_class.h
      sql/sql_insert.cc
      sql/sql_partition.cc
      sql/sql_select.cc
      sql/sql_table.cc
      sql/table.cc
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/handler0alter.cc
      storage/perfschema/ha_perfschema.cc
      storage/perfschema/pfs_column_types.h
      storage/perfschema/table_ews_by_thread_by_event_name.cc
      storage/perfschema/table_ews_by_thread_by_event_name.h
      storage/perfschema/table_ews_global_by_event_name.h
      storage/perfschema/table_setup_instruments.cc
      unittest/gunit/mdl-t.cc
      unittest/gunit/mdl_mytap-t.cc
=== modified file 'client/mysqltest.cc'
--- a/client/mysqltest.cc	2011-01-18 11:09:49 +0000
+++ b/client/mysqltest.cc	2011-01-26 20:13:31 +0000
@@ -7563,8 +7563,12 @@ void run_query_stmt(MYSQL *mysql, struct
 
       mysql_free_result(res);     /* Free normal result set with meta data */
 
-      /* Clear prepare warnings */
-      dynstr_set(&ds_prepare_warnings, NULL);
+      /*
+        Clear prepare warnings if there are execute warnings,
+        since they are probably duplicated.
+      */
+      if (ds_execute_warnings.length || mysql->warning_count)
+        dynstr_set(&ds_prepare_warnings, NULL);
     }
     else
     {

=== modified file 'include/mysql/psi/psi.h'
--- a/include/mysql/psi/psi.h	2010-12-09 16:17:13 +0000
+++ b/include/mysql/psi/psi.h	2011-01-25 15:35:07 +0000
@@ -256,7 +256,7 @@ enum PSI_table_lock_operation
   /** Table lock, in the server layer. */
   PSI_TABLE_LOCK= 0,
   /** Table lock, in the storage engine layer. */
-  PSI_TABLE_EXTERNAL_LOCK= 1,
+  PSI_TABLE_EXTERNAL_LOCK= 1
 };
 
 /**

=== modified file 'include/mysql/psi/psi_abi_v1.h.pp'
--- a/include/mysql/psi/psi_abi_v1.h.pp	2010-12-09 16:17:13 +0000
+++ b/include/mysql/psi/psi_abi_v1.h.pp	2011-01-25 15:35:07 +0000
@@ -64,7 +64,7 @@ enum PSI_table_io_operation
 enum PSI_table_lock_operation
 {
   PSI_TABLE_LOCK= 0,
-  PSI_TABLE_EXTERNAL_LOCK= 1,
+  PSI_TABLE_EXTERNAL_LOCK= 1
 };
 typedef unsigned int PSI_mutex_key;
 typedef unsigned int PSI_rwlock_key;

=== modified file 'include/mysql/psi/psi_abi_v2.h.pp'
--- a/include/mysql/psi/psi_abi_v2.h.pp	2010-12-09 16:17:13 +0000
+++ b/include/mysql/psi/psi_abi_v2.h.pp	2011-01-25 15:35:07 +0000
@@ -64,7 +64,7 @@ enum PSI_table_io_operation
 enum PSI_table_lock_operation
 {
   PSI_TABLE_LOCK= 0,
-  PSI_TABLE_EXTERNAL_LOCK= 1,
+  PSI_TABLE_EXTERNAL_LOCK= 1
 };
 typedef unsigned int PSI_mutex_key;
 typedef unsigned int PSI_rwlock_key;

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2011-01-18 17:52:48 +0000
+++ b/mysql-test/collections/default.experimental	2011-01-28 12:46:03 +0000
@@ -40,3 +40,48 @@ rpl_bhs.*
 main.gis-rtree                           # svoj: due to BUG#38965
 main.type_float                          # svoj: due to BUG#38965
 main.type_newdecimal                     # svoj: due to BUG#38965
+
+# Not a test, utility to troubleshoot test failures
+# Flagged as experimental since output will vary
+perfschema.debug_env                         # Bug#59740 2011-02-26 Marc Alff, script needed to investigate the failure
+
+perfschema.ortho_iter                        # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.event_aggregate                   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_off               # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_global_2u_2t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_global_2u_3t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_global_4u_2t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_global_4u_3t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_hist_2u_2t        # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_hist_2u_3t        # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_hist_4u_2t        # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_hist_4u_3t        # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_thread_2u_2t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_thread_2u_3t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_thread_4u_2t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_aggregate_thread_4u_3t      # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_global_2u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_global_2u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_global_4u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_global_4u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_hist_2u_2t     # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_hist_2u_3t     # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_hist_4u_2t     # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_hist_4u_3t     # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_thread_2u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_thread_2u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_thread_4u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_io_aggregate_thread_4u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_global_2u_2t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_global_2u_3t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_global_4u_2t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_global_4u_3t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_hist_2u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_hist_2u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_hist_4u_2t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_hist_4u_3t   # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_thread_2u_2t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_thread_2u_3t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_thread_4u_2t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+perfschema.table_lock_aggregate_thread_4u_3t # BUG#59740 2011-02-26 Marc Alff Test fails on FreeBSD
+

=== modified file 'mysql-test/collections/mysql-trunk.daily'
--- a/mysql-test/collections/mysql-trunk.daily	2011-01-24 05:59:58 +0000
+++ b/mysql-test/collections/mysql-trunk.daily	2011-01-27 00:57:39 +0000
@@ -1,14 +1,15 @@
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal          --vardir=var-normal --report-features 
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=n_mix          --vardir=var-n_mix                  --mysqld=--binlog-format=mixed
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row --vardir=var-rpl_binlog_row --mysqld=--binlog-format=row --suite=rpl,binlog --skip-ndb
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=ps_row         --vardir=var-ps_row   --ps-protocol --mysqld=--binlog-format=row
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=embedded       --vardir=var-emebbed  --embedded
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=funcs_1        --vardir=var-funcs_1                                              --suite=funcs_1
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps_funcs1   --suite=funcs_1 --ps-protocol --vardir=var-ps_funcs_1 --suite=funcs_1
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs2         --vardir=var-funcs2  --suite=funcs_2 
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=partitions     --vardir=var-parts --suite=parts   
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental  --comment=stress        --vardir=var-stress --suite=stress  
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental  --comment=jp            --vardir=var-jp --suite=jp      
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental  --comment=nist          --vardir=var-nist --suite=nist 
-perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental  --comment=nist+ps       --vardir=var-ps_nist --suite=nist --ps-protocol 
-perl mysql-test-run.pl --timer --force --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_checksum  --vardir-var-rpl_binlog_checksum --mysqld=--binlog-checksum=CRC32  --vardir=var-rpl_binlog_checksum --suite=binlog,rpl
+
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=normal               --vardir=var-normal                                                                  --report-features
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=n_mix                --vardir=var-n_mix                                  --mysqld=--binlog-format=mixed
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_row       --vardir=var-rpl_binlog_row      --suite=rpl,binlog --mysqld=--binlog-format=row     --skip-ndb
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps_row               --vardir=var-ps_row                                 --mysqld=--binlog-format=row     --ps-protocol
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=embedded             --vardir=var-embedded                                                                --embedded
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs_1              --vardir=var-funcs_1             --suite=funcs_1
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=ps_funcs1            --vardir=var-ps_funcs_1          --suite=funcs_1                                     --ps-protocol
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=funcs2               --vardir=var-funcs2              --suite=funcs_2
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=partitions           --vardir=var-parts               --suite=parts
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=stress               --vardir=var-stress              --suite=stress
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=jp                   --vardir=var-jp                  --suite=jp
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist                 --vardir=var-nist                --suite=nist
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=nist+ps              --vardir=var-ps_nist             --suite=nist                                        --ps-protocol
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=rpl_binlog_checksum  --vardir=var-rpl_binlog_checksum --suite=rpl,binlog --mysqld=--binlog-checksum=CRC32

=== added file 'mysql-test/include/have_dbi_dbd-mysql.inc'
--- a/mysql-test/include/have_dbi_dbd-mysql.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/include/have_dbi_dbd-mysql.inc	2011-01-29 11:38:36 +0000
@@ -0,0 +1,78 @@
+#
+# Originally created by John Embretsen, 2011-01-26.
+#
+# Checks for the existence of Perl modules DBI and DBD::mysql as seen from the
+# perl installation used by "external" executable perl scripts, i.e. scripts
+# that are executed as standalone scripts interpreted by the perl installation
+# specified by the "shebang" line in the top of these scripts.
+#
+# If either module is not found, the test will be skipped.
+#
+# For use in tests that call perl scripts that require these modules.
+#
+# This file is intended to work on Unix. Windows may need different treatment.
+# Reasoning:
+#   - "shebangs" are not relevant on Windows, but need to be handled here.
+#   - Perl scripts cannot be made executable on Windows, interpreter must be 
+#     specified.
+#
+# Note that if there are multiple perl installations and not all have the
+# required modules, this check may fail even if the perl in path does have
+# the modules available. This may happen if the perl specified by the script's 
+# shebang (e.g. #!/usr/bin/perl) does not have these modules, and script is 
+# called without specifying the perl interpreter. However, this will be 
+# a correct result in cases where a test calls a script with a similar shebang.
+#
+################################################################################
+
+--source include/not_windows.inc
+
+# We jump through some hoops since there is no direct way to check if an 
+# external command went OK or not from a mysql-test file:
+#
+#   - In theory, we could do as simple as "exec perl -MDBI -MDBD::mysql -e 1",
+#     however we cannot check the result (exit code) from within a test script. 
+#     Also, this may not yield the same result as other uses of perl due to the 
+#     shebang issue mentioned above.
+#   - Instead we use a separate helper perl script that checks for the modules.
+#   - If the modules are found, the perl script leaves a file which sets a
+#     variable that can be read by this file.
+#     If the modules are not found, the perl script does not set this variable,
+#     but leaves an empty file instead.
+#
+# This is done because there is apparently no direct way to transfer
+# information from perl to the test script itself.
+
+--disable_query_log
+--disable_result_log
+--disable_warnings
+
+# We do not use embedded perl in this script because that would not have yielded
+# correct results for a situation where an external Perl script is called like
+# "scriptname" instead of "perl scriptname" and the shebang in the script points
+# to a specific perl that may be different than the perl in PATH.
+#
+# Instead, we call a separate helper script which checks for the modules in its
+# own environment. We call it without "perl" in front.
+
+--let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl
+--let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt
+
+# Make the script executable and execute it.
+--chmod 0755 $perlChecker
+--exec $perlChecker
+
+# Source the resulting temporary file and look for a variable being set.
+--source $resultFile
+
+if (!$dbidbd) {
+    --skip Test needs Perl modules DBI and DBD::mysql
+} 
+
+# Clean up
+--remove_file $resultFile
+
+--enable_query_log
+--enable_result_log
+--enable_warnings
+

=== modified file 'mysql-test/include/icp_tests.inc'
--- a/mysql-test/include/icp_tests.inc	2011-01-20 14:57:03 +0000
+++ b/mysql-test/include/icp_tests.inc	2011-01-28 12:57:04 +0000
@@ -724,3 +724,55 @@ WHERE NOT EXISTS
 --echo
 
 DROP TABLE t1,t2;
+
+--echo #
+--echo # Bug#59186 Wrong results of join when ICP is enabled
+--echo #
+
+CREATE TABLE t1 (
+  pk INTEGER NOT NULL,
+  c1 VARCHAR(3) NOT NULL,
+  PRIMARY KEY (pk)
+);
+
+INSERT INTO t1 VALUES (1,'y'),(0,'or');
+
+CREATE TABLE t2 (
+  pk INTEGER NOT NULL,
+  c1 VARCHAR(3) NOT NULL,
+  c2 VARCHAR(6) NOT NULL,
+  PRIMARY KEY (pk)
+);
+
+INSERT INTO t2 VALUES (6,'y','RPOYT'),(10,'m','JINQE');
+
+let query=
+SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+      (t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+
+eval EXPLAIN $query;
+eval $query;
+
+DROP TABLE t1, t2;
+
+--echo #
+--echo # Bug#58838 "Wrong results with HAVING + LIMIT without GROUP BY when 
+--echo #            ICP is enabled"
+--echo # 
+
+CREATE TABLE t1 (
+  pk INT NOT NULL,
+  c1 INT,
+  PRIMARY KEY (pk),
+  KEY col_int_key (c1)
+);
+
+INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
+
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
+
+DROP TABLE t1;

=== modified file 'mysql-test/include/mysqlhotcopy.inc'
--- a/mysql-test/include/mysqlhotcopy.inc	2010-08-23 08:55:01 +0000
+++ b/mysql-test/include/mysqlhotcopy.inc	2011-01-29 12:15:56 +0000
@@ -4,12 +4,26 @@
 
 --source include/not_windows.inc
 --source include/not_embedded.inc
+--source include/have_dbi_dbd-mysql.inc
 
 if (!$MYSQLHOTCOPY)
 {
+  # Fail the test if the mysqlhotcopy script is missing.
+  # If the tool's location changes, mysql-test-run.pl must be updated to
+  # reflect this (look for "MYSQLHOTCOPY").
   die due to missing mysqlhotcopy tool;
 }
 
+# NOTE (johnemb, 2011-01-26):
+#       In this test mysqlhotcopy (a perl script) is executed as a standalone
+#       executable, i.e. not necessarily using the perl interpreter in PATH,
+#       because that is how the documentation demonstrates it.
+#
+#       We include have_dbi_dbd-mysql.inc above so that the test will
+#       be skipped if Perl modules required by the mysqlhotcopy tool are not
+#       found when the script is run this way.
+
+
 let $MYSQLD_DATADIR= `SELECT @@datadir`;
 --disable_warnings
 DROP DATABASE IF EXISTS hotcopy_test;

=== modified file 'mysql-test/r/innodb_icp.result'
--- a/mysql-test/r/innodb_icp.result	2011-01-20 14:57:03 +0000
+++ b/mysql-test/r/innodb_icp.result	2011-01-28 12:57:04 +0000
@@ -672,5 +672,55 @@ id	select_type	table	type	possible_keys
 3	DEPENDENT SUBQUERY	t2	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using where; Full scan on NULL key
 
 DROP TABLE t1,t2;
+#
+# Bug#59186 Wrong results of join when ICP is enabled
+#
+CREATE TABLE t1 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1,'y'),(0,'or');
+CREATE TABLE t2 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+c2 VARCHAR(6) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t2 VALUES (6,'y','RPOYT'),(10,'m','JINQE');
+EXPLAIN SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using index condition
+1	SIMPLE	t2	range	PRIMARY	PRIMARY	4	NULL	2	Using index condition; Using where; Using join buffer (BNL, incremental buffers)
+SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+c2
+DROP TABLE t1, t2;
+#
+# Bug#58838 "Wrong results with HAVING + LIMIT without GROUP BY when 
+#            ICP is enabled"
+# 
+CREATE TABLE t1 (
+pk INT NOT NULL,
+c1 INT,
+PRIMARY KEY (pk),
+KEY col_int_key (c1)
+);
+INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
+pk
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
+pk
+3
+DROP TABLE t1;
 set default_storage_engine= @save_storage_engine;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/innodb_icp_all.result'
--- a/mysql-test/r/innodb_icp_all.result	2011-01-13 15:37:54 +0000
+++ b/mysql-test/r/innodb_icp_all.result	2011-01-28 10:21:56 +0000
@@ -670,5 +670,28 @@ id	select_type	table	type	possible_keys
 3	DEPENDENT SUBQUERY	t2	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using where; Full scan on NULL key
 
 DROP TABLE t1,t2;
+#
+# Bug#58838 "Wrong results with HAVING + LIMIT without GROUP BY when 
+#            ICP is enabled"
+# 
+CREATE TABLE t1 (
+pk INT NOT NULL,
+c1 INT,
+PRIMARY KEY (pk),
+KEY col_int_key (c1)
+);
+INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
+pk
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
+pk
+3
+DROP TABLE t1;
 set default_storage_engine= @save_storage_engine;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/innodb_icp_none.result'
--- a/mysql-test/r/innodb_icp_none.result	2011-01-20 14:57:03 +0000
+++ b/mysql-test/r/innodb_icp_none.result	2011-01-28 12:57:04 +0000
@@ -671,5 +671,55 @@ id	select_type	table	type	possible_keys
 3	DEPENDENT SUBQUERY	t2	unique_subquery	PRIMARY	PRIMARY	4	func	1	Using where; Full scan on NULL key
 
 DROP TABLE t1,t2;
+#
+# Bug#59186 Wrong results of join when ICP is enabled
+#
+CREATE TABLE t1 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1,'y'),(0,'or');
+CREATE TABLE t2 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+c2 VARCHAR(6) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t2 VALUES (6,'y','RPOYT'),(10,'m','JINQE');
+EXPLAIN SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	1	Using where
+1	SIMPLE	t2	range	PRIMARY	PRIMARY	4	NULL	2	Using where; Using join buffer (BNL, incremental buffers)
+SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+c2
+DROP TABLE t1, t2;
+#
+# Bug#58838 "Wrong results with HAVING + LIMIT without GROUP BY when 
+#            ICP is enabled"
+# 
+CREATE TABLE t1 (
+pk INT NOT NULL,
+c1 INT,
+PRIMARY KEY (pk),
+KEY col_int_key (c1)
+);
+INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
+pk
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
+pk
+3
+DROP TABLE t1;
 set default_storage_engine= @save_storage_engine;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/innodb_mysql_sync.result'
--- a/mysql-test/r/innodb_mysql_sync.result	2011-01-10 13:12:23 +0000
+++ b/mysql-test/r/innodb_mysql_sync.result	2011-01-26 13:23:29 +0000
@@ -90,3 +90,68 @@ test.t1	optimize	status	Operation failed
 # Connection default
 DROP TABLE t1;
 SET DEBUG_SYNC= 'RESET';
+#
+# Bug#42230 during add index, cannot do queries on storage engines
+#           that implement add_index
+#
+DROP DATABASE IF EXISTS db1;
+DROP TABLE IF EXISTS t1;
+# Test 1: Secondary index, should not block reads (original test case).
+# Connection default
+CREATE DATABASE db1;
+CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb;
+INSERT INTO db1.t1(value) VALUES (1), (2);
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+# Sending:
+ALTER TABLE db1.t1 ADD INDEX(value);
+# Connection con1
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+USE db1;
+SELECT * FROM t1;
+id	value
+1	1
+2	2
+SET DEBUG_SYNC= "now SIGNAL query";
+# Connection default
+# Reaping: ALTER TABLE db1.t1 ADD INDEX(value)
+DROP DATABASE db1;
+# Test 2: Primary index (implicit), should block reads.
+CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+# Sending:
+ALTER TABLE t1 ADD UNIQUE INDEX(a);
+# Connection con1
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+USE test;
+# Sending:
+SELECT * FROM t1;
+# Connection con2
+# Waiting for SELECT to be blocked by the metadata lock on t1
+SET DEBUG_SYNC= "now SIGNAL query";
+# Connection default
+# Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a)
+# Connection con1
+# Reaping: SELECT * FROM t1
+a	b
+# Test 3: Primary index (explicit), should block reads.
+# Connection default
+ALTER TABLE t1 DROP INDEX a;
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+# Sending:
+ALTER TABLE t1 ADD PRIMARY KEY (a);
+# Connection con1
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+# Sending:
+SELECT * FROM t1;
+# Connection con2
+# Waiting for SELECT to be blocked by the metadata lock on t1
+SET DEBUG_SYNC= "now SIGNAL query";
+# Connection default
+# Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a)
+# Connection con1
+# Reaping: SELECT * FROM t1
+a	b
+# Test 4: Secondary unique index, should not block reads.
+# Connection default
+SET DEBUG_SYNC= "RESET";
+DROP TABLE t1;

=== modified file 'mysql-test/r/myisam_icp.result'
--- a/mysql-test/r/myisam_icp.result	2011-01-20 14:57:03 +0000
+++ b/mysql-test/r/myisam_icp.result	2011-01-28 12:57:04 +0000
@@ -670,4 +670,54 @@ id	select_type	table	type	possible_keys
 3	DEPENDENT SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
 
 DROP TABLE t1,t2;
+#
+# Bug#59186 Wrong results of join when ICP is enabled
+#
+CREATE TABLE t1 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1,'y'),(0,'or');
+CREATE TABLE t2 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+c2 VARCHAR(6) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t2 VALUES (6,'y','RPOYT'),(10,'m','JINQE');
+EXPLAIN SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	2	Using index condition
+1	SIMPLE	t2	range	PRIMARY	PRIMARY	4	NULL	2	Using index condition; Using where; Using join buffer (BNL, incremental buffers)
+SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+c2
+DROP TABLE t1, t2;
+#
+# Bug#58838 "Wrong results with HAVING + LIMIT without GROUP BY when 
+#            ICP is enabled"
+# 
+CREATE TABLE t1 (
+pk INT NOT NULL,
+c1 INT,
+PRIMARY KEY (pk),
+KEY col_int_key (c1)
+);
+INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
+pk
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
+pk
+3
+DROP TABLE t1;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/myisam_icp_all.result'
--- a/mysql-test/r/myisam_icp_all.result	2011-01-13 15:37:54 +0000
+++ b/mysql-test/r/myisam_icp_all.result	2011-01-28 10:21:56 +0000
@@ -668,4 +668,27 @@ id	select_type	table	type	possible_keys
 3	DEPENDENT SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
 
 DROP TABLE t1,t2;
+#
+# Bug#58838 "Wrong results with HAVING + LIMIT without GROUP BY when 
+#            ICP is enabled"
+# 
+CREATE TABLE t1 (
+pk INT NOT NULL,
+c1 INT,
+PRIMARY KEY (pk),
+KEY col_int_key (c1)
+);
+INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
+pk
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
+pk
+3
+DROP TABLE t1;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/myisam_icp_none.result'
--- a/mysql-test/r/myisam_icp_none.result	2011-01-20 14:57:03 +0000
+++ b/mysql-test/r/myisam_icp_none.result	2011-01-28 12:57:04 +0000
@@ -669,4 +669,54 @@ id	select_type	table	type	possible_keys
 3	DEPENDENT SUBQUERY	NULL	NULL	NULL	NULL	NULL	NULL	NULL	Impossible WHERE
 
 DROP TABLE t1,t2;
+#
+# Bug#59186 Wrong results of join when ICP is enabled
+#
+CREATE TABLE t1 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t1 VALUES (1,'y'),(0,'or');
+CREATE TABLE t2 (
+pk INTEGER NOT NULL,
+c1 VARCHAR(3) NOT NULL,
+c2 VARCHAR(6) NOT NULL,
+PRIMARY KEY (pk)
+);
+INSERT INTO t2 VALUES (6,'y','RPOYT'),(10,'m','JINQE');
+EXPLAIN SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+id	select_type	table	type	possible_keys	key	key_len	ref	rows	Extra
+1	SIMPLE	t1	range	PRIMARY	PRIMARY	4	NULL	2	Using where
+1	SIMPLE	t2	range	PRIMARY	PRIMARY	4	NULL	2	Using where; Using join buffer (BNL, incremental buffers)
+SELECT c2 FROM t1 JOIN t2 ON t1.c1 = t2.c1
+WHERE (t2.pk <= 4 AND t1.pk IN (2,1)) OR
+(t1.pk > 1 AND t2.pk BETWEEN 6 AND 6);
+c2
+DROP TABLE t1, t2;
+#
+# Bug#58838 "Wrong results with HAVING + LIMIT without GROUP BY when 
+#            ICP is enabled"
+# 
+CREATE TABLE t1 (
+pk INT NOT NULL,
+c1 INT,
+PRIMARY KEY (pk),
+KEY col_int_key (c1)
+);
+INSERT INTO t1 VALUES (1,37),(2,8),(3,-25),(4,NULL),(5,55);
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 0;
+pk
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 1;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 2;
+pk
+3
+SELECT pk FROM t1 WHERE c1 <> 1 HAVING pk = 3 ORDER BY pk LIMIT 5;
+pk
+3
+DROP TABLE t1;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/partition_error.result'
--- a/mysql-test/r/partition_error.result	2011-01-10 16:37:47 +0000
+++ b/mysql-test/r/partition_error.result	2011-01-26 20:13:31 +0000
@@ -1,5 +1,18 @@
 drop table if exists t1, t2;
 #
+# Bug#57924: crash when creating partitioned table with
+#            multiple columns in the partition key
+#
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
+PARTITION BY KEY(a, b, a);
+ERROR HY000: Duplicate partition field name 'a'
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
+PARTITION BY KEY(A, b);
+DROP TABLE t1;
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
+PARTITION BY KEY(a, b, A);
+ERROR HY000: Duplicate partition field name 'a'
+#
 # Bug#54483: valgrind errors when making warnings for multiline inserts
 #            into partition
 #

=== added file 'mysql-test/std_data/checkDBI_DBD-mysql.pl'
--- a/mysql-test/std_data/checkDBI_DBD-mysql.pl	1970-01-01 00:00:00 +0000
+++ b/mysql-test/std_data/checkDBI_DBD-mysql.pl	2011-01-29 11:38:36 +0000
@@ -0,0 +1,97 @@
+#!/usr/bin/perl
+
+# 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 Library 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
+# Library 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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+################################################################################
+#
+# This perl script checks for availability of the Perl modules DBI and
+# DBD::mysql using the "current" perl interpreter.
+#
+# Useful for test environment checking before testing executable perl scripts
+# in the MySQL Server distribution.
+#
+# NOTE: The "shebang" on the first line of this script should always point to
+#       /usr/bin/perl, so that we can use this script to check whether or not we
+#       support running perl scripts with such a shebang without specifying the
+#       perl interpreter on the command line. Such a script is mysqlhotcopy.
+#
+#       When run as "checkDBI_DBD-mysql.pl" the shebang line will be evaluated
+#       and used. When run as "perl checkDBI_DBD-mysql.pl" the shebang line is
+#       not used.
+#
+# NOTE: This script will create a temporary file in MTR's tmp dir.
+#       If modules are found, a mysql-test statement which sets a special
+#       variable is written to this file. If one of the modules is not found
+#       (or cannot be loaded), the file will remain empty.
+#       A test (or include file) which sources that file can then easily do
+#       an if-check on the special variable to determine success or failure.
+#
+#       Example:
+#
+#         --let $perlChecker= $MYSQLTEST_VARDIR/std_data/checkDBI_DBD-mysql.pl
+#         --let $resultFile= $MYSQL_TMP_DIR/dbidbd-mysql.txt
+#         --chmod 0755 $perlChecker
+#         --exec $perlChecker
+#         --source $resultFile
+#         if (!$dbidbd) {
+#             --skip Test needs Perl modules DBI and DBD::mysql
+#         } 
+#
+#       The calling script is also responsible for cleaning up after use:
+#
+#         --remove_file $resultFile
+#
+# Windows notes: 
+#   - shebangs may work differently - call this script with "perl " in front.
+#
+# See mysql-test/include/have_dbi_dbd-mysql.inc for example use of this script.
+# This script should be executable for the user running MTR.
+#
+################################################################################
+
+BEGIN {
+    # By using eval inside BEGIN we can suppress warnings and continue after.
+    # We need to catch "Can't locate" as well as "Can't load" errors.
+    eval{
+        $FOUND_DBI=0;
+        $FOUND_DBD_MYSQL=0;
+
+        # Check for DBI module:
+        $FOUND_DBI=1 if require DBI;
+
+        # Check for DBD::mysql module
+        $FOUND_DBD_MYSQL=1 if require DBD::mysql;
+    };
+};
+
+# Open a file to be used for transfer of result back to mysql-test.
+# The file must be created whether we write to it or not, otherwise mysql-test 
+# will complain if trying to source it. 
+# An empty file indicates failure to load modules.
+open(FILE, ">", $ENV{'MYSQL_TMP_DIR'}.'/dbidbd-mysql.txt');
+
+if ($FOUND_DBI && $FOUND_DBD_MYSQL) {
+    # write a mysql-test command setting a variable to indicate success
+    print(FILE 'let $dbidbd= FOUND_DBI_DBD-MYSQL;'."\n");
+}
+
+# close the file.
+close(FILE);
+
+1;
+

=== modified file 'mysql-test/suite/parts/inc/partition_layout_check1.inc'
--- a/mysql-test/suite/parts/inc/partition_layout_check1.inc	2010-09-15 08:22:12 +0000
+++ b/mysql-test/suite/parts/inc/partition_layout_check1.inc	2011-01-28 12:28:15 +0000
@@ -29,14 +29,10 @@ DELETE FROM t0_definition;
 let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`;
 #echo MYSQLD_DATADIR: $MYSQLD_DATADIR;
 
-# Dump the current definition of the table t1 to tmp1
-# This complicated method - let another mysqltest collect the output - is used
-# because of two reasons
+# Save the current definition of the table t1
 # - SHOW CREATE TABLE t1 is at least currently most probably more reliable than
 #   the corresponding SELECT on the INFORMATION_SCHEMA
-# - SHOW CREATE TABLE .. cannot write its out put into a file like SELECT
-let $show_file= $MYSQLD_DATADIR/test/tmp1;
---exec echo "SHOW CREATE TABLE t1; exit; " | $MYSQL_TEST > $show_file 2>&1
+let $show_create= `SHOW CREATE TABLE t1`;
 if ($do_file_tests)
 {
   # List the files belonging to the table t1
@@ -57,12 +53,13 @@ if (!$do_file_tests)
 
 # Insert the current definition of the table t1 into t0_definition
 eval INSERT INTO t0_definition SET state = 'old',
-     create_command = load_file('$show_file'),
+     create_command = "$show_create",
      file_list      = @aux;
 
 # Print the create table statement into the protocol
+# Added the concat to avoid changing the result files
 --replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR '\r' ''
-SELECT create_command FROM t0_definition WHERE state = 'old';
+SELECT concat('SHOW CREATE TABLE t1;\nTable\tCreate Table\n',create_command,'\n') as `create_command` FROM t0_definition WHERE state = 'old';
 if ($do_file_tests)
 {
    # We stored the list of files, therefore printing the content makes sense

=== modified file 'mysql-test/suite/parts/inc/partition_layout_check2.inc'
--- a/mysql-test/suite/parts/inc/partition_layout_check2.inc	2010-09-15 08:22:12 +0000
+++ b/mysql-test/suite/parts/inc/partition_layout_check2.inc	2011-01-28 12:28:15 +0000
@@ -28,9 +28,8 @@ DELETE FROM t0_definition WHERE state =
 let $MYSQLD_DATADIR= `select LEFT(@@datadir, LENGTH(@@datadir)-1)`;
 #echo MYSQLD_DATADIR: $MYSQLD_DATADIR;
 
-# Dump the current definition of the table t1 to tmp1
-let $show_file= $MYSQLD_DATADIR/test/tmp1;
---exec echo "SHOW CREATE TABLE t1; exit; " | $MYSQL_TEST > $show_file 2>&1
+# Save the current definition of the table t1
+let $show_create= `SHOW CREATE TABLE t1`;
 
 if ($do_file_tests)
 {
@@ -52,7 +51,7 @@ if (!$do_file_tests)
 
 # Insert the current definition of the table t1 into t0_definition
 eval INSERT INTO t0_definition SET state = 'new',
-     create_command = load_file('$show_file'),
+     create_command = "$show_create",
      file_list      = @aux;
 
 # Print the old and new table layout, if they differ

=== modified file 'mysql-test/suite/parts/r/partition_recover_myisam.result'
--- a/mysql-test/suite/parts/r/partition_recover_myisam.result	2010-10-01 16:11:50 +0000
+++ b/mysql-test/suite/parts/r/partition_recover_myisam.result	2011-01-28 13:49:59 +0000
@@ -18,6 +18,13 @@ a
 9
 10
 11
+Warnings:
+Error	145	Table './test/t1_will_crash' is marked as crashed and should be repaired
+Error	1194	Table 't1_will_crash' is marked as crashed and should be repaired
+Error	1034	1 client is using or hasn't closed the table properly
+Error	1034	Size of indexfile is: 1024        Should be: 2048
+Error	1034	Size of datafile is: 77       Should be: 7
+Error	1034	Number of rows changed from 1 to 11
 DROP TABLE t1_will_crash;
 CREATE TABLE t1_will_crash (a INT, KEY (a))
 ENGINE=MyISAM
@@ -41,4 +48,11 @@ a
 9
 10
 11
+Warnings:
+Error	145	Table './test/t1_will_crash#P#p1' is marked as crashed and should be repaired
+Error	1194	Table 't1_will_crash' is marked as crashed and should be repaired
+Error	1034	1 client is using or hasn't closed the table properly
+Error	1034	Size of indexfile is: 1024        Should be: 2048
+Error	1034	Size of datafile is: 28       Should be: 7
+Error	1034	Number of rows changed from 1 to 4
 DROP TABLE t1_will_crash;

=== modified file 'mysql-test/suite/parts/t/partition_alter1_1_2_myisam.test'
--- a/mysql-test/suite/parts/t/partition_alter1_1_2_myisam.test	2010-06-17 17:17:17 +0000
+++ b/mysql-test/suite/parts/t/partition_alter1_1_2_myisam.test	2011-01-28 13:49:59 +0000
@@ -45,9 +45,6 @@ let $more_pk_ui_tests= 0;
 # The server must support partitioning.
 --source include/have_partition.inc
 
-# Does not work with --embedded
---source include/not_embedded.inc
-
 #------------------------------------------------------------------------------#
 # Engine specific settings and requirements
 

=== modified file 'mysql-test/suite/parts/t/partition_alter1_1_myisam.test'
--- a/mysql-test/suite/parts/t/partition_alter1_1_myisam.test	2010-06-17 17:17:17 +0000
+++ b/mysql-test/suite/parts/t/partition_alter1_1_myisam.test	2011-01-28 13:49:59 +0000
@@ -46,9 +46,6 @@ let $more_pk_ui_tests= 0;
 # The server must support partitioning.
 --source include/have_partition.inc
 
-# Does not work with --embedded
---source include/not_embedded.inc
-
 #------------------------------------------------------------------------------#
 # Engine specific settings and requirements
 

=== modified file 'mysql-test/suite/parts/t/partition_alter1_2_myisam.test'
--- a/mysql-test/suite/parts/t/partition_alter1_2_myisam.test	2010-06-17 17:17:17 +0000
+++ b/mysql-test/suite/parts/t/partition_alter1_2_myisam.test	2011-01-28 13:49:59 +0000
@@ -46,9 +46,6 @@ let $more_pk_ui_tests= 0;
 # The server must support partitioning.
 --source include/have_partition.inc
 
-# Does not work with --embedded
---source include/not_embedded.inc
-
 #------------------------------------------------------------------------------#
 # Engine specific settings and requirements
 

=== modified file 'mysql-test/suite/parts/t/partition_basic_myisam.test'
--- a/mysql-test/suite/parts/t/partition_basic_myisam.test	2010-06-17 17:17:17 +0000
+++ b/mysql-test/suite/parts/t/partition_basic_myisam.test	2011-01-28 13:49:59 +0000
@@ -43,9 +43,6 @@ let $more_pk_ui_tests= 0;
 # The server must support partitioning.
 --source include/have_partition.inc
 
-# Does not work with --embedded
---source include/not_embedded.inc
-
 #------------------------------------------------------------------------------#
 # Engine specific settings and requirements
 

=== modified file 'mysql-test/suite/parts/t/partition_engine_myisam.test'
--- a/mysql-test/suite/parts/t/partition_engine_myisam.test	2010-06-17 17:17:17 +0000
+++ b/mysql-test/suite/parts/t/partition_engine_myisam.test	2011-01-28 13:49:59 +0000
@@ -42,9 +42,6 @@ let $more_pk_ui_tests= 0;
 # The server must support partitioning.
 --source include/have_partition.inc
 
-# Does not work with --embedded
---source include/not_embedded.inc
-
 #------------------------------------------------------------------------------#
 # Engine specific settings and requirements
 

=== modified file 'mysql-test/suite/parts/t/partition_recover_myisam.test'
--- a/mysql-test/suite/parts/t/partition_recover_myisam.test	2010-10-01 16:11:50 +0000
+++ b/mysql-test/suite/parts/t/partition_recover_myisam.test	2011-01-28 13:49:59 +0000
@@ -20,7 +20,8 @@ FLUSH TABLES;
 let $MYSQLD_DATADIR= `select @@datadir`;
 --remove_file $MYSQLD_DATADIR/test/t1_will_crash.MYI
 --copy_file std_data/corrupt_t1.MYI $MYSQLD_DATADIR/test/t1_will_crash.MYI
---disable_warnings
+--replace_result \\ /
+--replace_regex /Table '.*data/Table './
 SELECT * FROM t1_will_crash;
 --enable_warnings
 DROP TABLE t1_will_crash;
@@ -35,7 +36,8 @@ FLUSH TABLES;
 --echo # head -c1024 t1#P#p1.MYI > corrupt_t1#P#p1.MYI 
 --remove_file $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI
 --copy_file std_data/corrupt_t1#P#p1.MYI $MYSQLD_DATADIR/test/t1_will_crash#P#p1.MYI
---disable_warnings
+--replace_result \\ /
+--replace_regex /Table '.*data/Table './
 SELECT * FROM t1_will_crash;
 --enable_warnings
 DROP TABLE t1_will_crash;

=== modified file 'mysql-test/suite/parts/t/partition_syntax_myisam.test'
--- a/mysql-test/suite/parts/t/partition_syntax_myisam.test	2010-06-17 17:17:17 +0000
+++ b/mysql-test/suite/parts/t/partition_syntax_myisam.test	2011-01-28 13:49:59 +0000
@@ -42,9 +42,6 @@ let $more_pk_ui_tests= 0;
 # The server must support partitioning.
 --source include/have_partition.inc
 
-# Does not work with --embedded
---source include/not_embedded.inc
-
 #------------------------------------------------------------------------------#
 # Engine specific settings and requirements
 

=== modified file 'mysql-test/suite/perfschema/include/table_aggregate_load.inc'
--- a/mysql-test/suite/perfschema/include/table_aggregate_load.inc	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/include/table_aggregate_load.inc	2011-01-26 09:34:10 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -40,6 +40,10 @@ truncate performance_schema.events_waits
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
 
+# Check the configuration is ok
+show variables like "performance_schema%";
+show status like "performance_schema%";
+
 echo "================== Step 1 ==================";
 execute dump_thread;
 execute dump_global;

=== added file 'mysql-test/suite/perfschema/r/debug_env.result'
--- a/mysql-test/suite/perfschema/r/debug_env.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/r/debug_env.result	2011-01-26 14:41:43 +0000
@@ -0,0 +1,152 @@
+"============================================================================"
+"This is not a test, it's a debug utility to troubleshoot test suite problems"
+"This script is flagged as experimental, as failures are expected"
+"============================================================================"
+show engines;
+Engine	Support	Comment	Transactions	XA	Savepoints
+FEDERATED	NO	Federated MySQL storage engine	NULL	NULL	NULL
+MRG_MYISAM	YES	Collection of identical MyISAM tables	NO	NO	NO
+MyISAM	DEFAULT	MyISAM storage engine	NO	NO	NO
+BLACKHOLE	YES	/dev/null storage engine (anything you write to it disappears)	NO	NO	NO
+CSV	YES	CSV storage engine	NO	NO	NO
+MEMORY	YES	Hash based, stored in memory, useful for temporary tables	NO	NO	NO
+ARCHIVE	YES	Archive storage engine	NO	NO	NO
+InnoDB	YES	Supports transactions, row-level locking, and foreign keys	YES	YES	YES
+PERFORMANCE_SCHEMA	YES	Performance Schema	NO	NO	NO
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show engine performance_schema status;
+Type	Name	Status
+performance_schema	events_waits_current.row_size	136
+performance_schema	events_waits_current.row_count	3000
+performance_schema	events_waits_history.row_size	136
+performance_schema	events_waits_history.row_count	10000
+performance_schema	events_waits_history.memory	1360000
+performance_schema	events_waits_history_long.row_size	136
+performance_schema	events_waits_history_long.row_count	10000
+performance_schema	events_waits_history_long.memory	1360000
+performance_schema	(pfs_mutex_class).row_size	192
+performance_schema	(pfs_mutex_class).row_count	200
+performance_schema	(pfs_mutex_class).memory	38400
+performance_schema	(pfs_rwlock_class).row_size	224
+performance_schema	(pfs_rwlock_class).row_count	30
+performance_schema	(pfs_rwlock_class).memory	6720
+performance_schema	(pfs_cond_class).row_size	176
+performance_schema	(pfs_cond_class).row_count	80
+performance_schema	(pfs_cond_class).memory	14080
+performance_schema	(pfs_thread_class).row_size	144
+performance_schema	(pfs_thread_class).row_count	50
+performance_schema	(pfs_thread_class).memory	7200
+performance_schema	(pfs_file_class).row_size	200
+performance_schema	(pfs_file_class).row_count	50
+performance_schema	(pfs_file_class).memory	10000
+performance_schema	mutex_instances.row_size	104
+performance_schema	mutex_instances.row_count	10000
+performance_schema	mutex_instances.memory	1040000
+performance_schema	rwlock_instances.row_size	152
+performance_schema	rwlock_instances.row_count	10000
+performance_schema	rwlock_instances.memory	1520000
+performance_schema	cond_instances.row_size	72
+performance_schema	cond_instances.row_count	1000
+performance_schema	cond_instances.memory	72000
+performance_schema	threads.row_size	888
+performance_schema	threads.row_count	1000
+performance_schema	threads.memory	888000
+performance_schema	file_instances.row_size	608
+performance_schema	file_instances.row_count	10000
+performance_schema	file_instances.memory	6080000
+performance_schema	(pfs_file_handle).row_size	8
+performance_schema	(pfs_file_handle).row_count	32768
+performance_schema	(pfs_file_handle).memory	262144
+performance_schema	events_waits_summary_by_thread_by_event_name.row_size	32
+performance_schema	events_waits_summary_by_thread_by_event_name.row_count	362000
+performance_schema	events_waits_summary_by_thread_by_event_name.memory	11584000
+performance_schema	(pfs_table_share).row_size	21664
+performance_schema	(pfs_table_share).row_count	500
+performance_schema	(pfs_table_share).memory	10832000
+performance_schema	(pfs_table).row_size	8704
+performance_schema	(pfs_table).row_count	1000
+performance_schema	(pfs_table).memory	8704000
+performance_schema	setup_actors.row_size	240
+performance_schema	setup_actors.row_count	100
+performance_schema	setup_actors.memory	24000
+performance_schema	setup_objects.row_size	432
+performance_schema	setup_objects.row_count	100
+performance_schema	setup_objects.memory	43200
+performance_schema	events_waits_summary_global_by_event_name.row_size	32
+performance_schema	events_waits_summary_global_by_event_name.row_count	362
+performance_schema	events_waits_summary_global_by_event_name.memory	11584
+performance_schema	performance_schema.memory	43857328
+use performance_schema;
+show tables;
+Tables_in_performance_schema
+cond_instances
+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
+select * from performance_timers;
+TIMER_NAME	TIMER_FREQUENCY	TIMER_RESOLUTION	TIMER_OVERHEAD
+select * from setup_timers;
+NAME	TIMER_NAME
+wait	CYCLE
+select * from threads;
+THREAD_ID	NAME	TYPE	PROCESSLIST_ID	PROCESSLIST_USER	PROCESSLIST_HOST	PROCESSLIST_DB	PROCESSLIST_COMMAND	PROCESSLIST_TIME	PROCESSLIST_STATE	PROCESSLIST_INFO	PARENT_THREAD_ID	ROLE	INSTRUMENTED
+select count(*) from setup_instruments;
+count(*)
+220
+select count(*) from events_waits_summary_by_thread_by_event_name;
+count(*)
+3080

=== modified file 'mysql-test/suite/perfschema/r/ortho_iter.result'
--- a/mysql-test/suite/perfschema/r/ortho_iter.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/ortho_iter.result	2011-01-28 13:40:57 +0000
@@ -91,6 +91,42 @@ close pfs_cursor;
 signal sqlstate '01000' set message_text='Done', mysql_errno=12000;
 end
 $
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 call check_instrument("wait/synch/mutex/");
 instr_name	is_wait	is_stage	is_statement
 wait/synch/mutex/	1	0	0
@@ -118,6 +154,15 @@ status
 Checking table events_waits_summary_global_by_event_name ...
 Warnings:
 Warning	12000	Done
+call check_instrument("wait/synch/");
+instr_name	is_wait	is_stage	is_statement
+wait/synch/	1	0	0
+status
+Checking table events_waits_summary_by_thread_by_event_name ...
+status
+Checking table events_waits_summary_global_by_event_name ...
+Warnings:
+Warning	12000	Done
 call check_instrument("wait/io/file/");
 instr_name	is_wait	is_stage	is_statement
 wait/io/file/	1	0	0
@@ -145,6 +190,15 @@ status
 Checking table events_waits_summary_global_by_event_name ...
 Warnings:
 Warning	12000	Done
+call check_instrument("wait/io/");
+instr_name	is_wait	is_stage	is_statement
+wait/io/	1	0	0
+status
+Checking table events_waits_summary_by_thread_by_event_name ...
+status
+Checking table events_waits_summary_global_by_event_name ...
+Warnings:
+Warning	12000	Done
 call check_instrument("wait/lock/table/");
 instr_name	is_wait	is_stage	is_statement
 wait/lock/table/	1	0	0
@@ -154,6 +208,24 @@ status
 Checking table events_waits_summary_global_by_event_name ...
 Warnings:
 Warning	12000	Done
+call check_instrument("wait/lock/");
+instr_name	is_wait	is_stage	is_statement
+wait/lock/	1	0	0
+status
+Checking table events_waits_summary_by_thread_by_event_name ...
+status
+Checking table events_waits_summary_global_by_event_name ...
+Warnings:
+Warning	12000	Done
+call check_instrument("wait/");
+instr_name	is_wait	is_stage	is_statement
+wait/	1	0	0
+status
+Checking table events_waits_summary_by_thread_by_event_name ...
+status
+Checking table events_waits_summary_global_by_event_name ...
+Warnings:
+Warning	12000	Done
 call check_instrument("stage/");
 instr_name	is_wait	is_stage	is_statement
 stage/	0	1	0
@@ -178,6 +250,15 @@ statement/sql/	0	0	1
 status
 Checking table events_waits_summary_by_thread_by_event_name ...
 status
+Checking table events_waits_summary_global_by_event_name ...
+Warnings:
+Warning	12000	Done
+call check_instrument("statement/");
+instr_name	is_wait	is_stage	is_statement
+statement/	0	0	1
+status
+Checking table events_waits_summary_by_thread_by_event_name ...
+status
 Checking table events_waits_summary_global_by_event_name ...
 Warnings:
 Warning	12000	Done

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_2t.result	2011-01-26 09:34:10 +0000
@@ -29,6 +29,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_2u_3t.result	2011-01-26 09:34:10 +0000
@@ -28,6 +28,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_2t.result	2011-01-26 09:34:10 +0000
@@ -29,6 +29,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_global_4u_3t.result	2011-01-26 09:34:10 +0000
@@ -28,6 +28,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_2t.result	2011-01-26 09:34:10 +0000
@@ -27,6 +27,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_2u_3t.result	2011-01-26 09:34:10 +0000
@@ -26,6 +26,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_2t.result	2011-01-26 09:34:10 +0000
@@ -27,6 +27,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_hist_4u_3t.result	2011-01-26 09:34:10 +0000
@@ -26,6 +26,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_off.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_off.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_off.result	2011-01-26 09:34:10 +0000
@@ -28,6 +28,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_2t.result	2011-01-26 09:34:10 +0000
@@ -29,6 +29,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_2u_3t.result	2011-01-26 09:34:10 +0000
@@ -28,6 +28,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_2t.result	2011-01-26 09:34:10 +0000
@@ -29,6 +29,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_aggregate_thread_4u_3t.result	2011-01-26 09:34:10 +0000
@@ -28,6 +28,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_2t.result	2011-01-26 09:34:10 +0000
@@ -31,6 +31,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_2u_3t.result	2011-01-26 09:34:10 +0000
@@ -30,6 +30,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_2t.result	2011-01-26 09:34:10 +0000
@@ -31,6 +31,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_global_4u_3t.result	2011-01-26 09:34:10 +0000
@@ -30,6 +30,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_2t.result	2011-01-26 09:34:10 +0000
@@ -29,6 +29,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_2u_3t.result	2011-01-26 09:34:10 +0000
@@ -28,6 +28,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_2t.result	2011-01-26 09:34:10 +0000
@@ -29,6 +29,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_hist_4u_3t.result	2011-01-26 09:34:10 +0000
@@ -28,6 +28,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_2t.result	2011-01-26 09:34:10 +0000
@@ -31,6 +31,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_2u_3t.result	2011-01-26 09:34:10 +0000
@@ -30,6 +30,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_2t.result	2011-01-26 09:34:10 +0000
@@ -31,6 +31,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_io_aggregate_thread_4u_3t.result	2011-01-26 09:34:10 +0000
@@ -30,6 +30,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_2t.result	2011-01-26 09:34:10 +0000
@@ -31,6 +31,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_2u_3t.result	2011-01-26 09:34:10 +0000
@@ -30,6 +30,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_2t.result	2011-01-26 09:34:10 +0000
@@ -31,6 +31,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_global_4u_3t.result	2011-01-26 09:34:10 +0000
@@ -30,6 +30,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_2t.result	2011-01-26 09:34:10 +0000
@@ -29,6 +29,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_2u_3t.result	2011-01-26 09:34:10 +0000
@@ -28,6 +28,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_2t.result	2011-01-26 09:34:10 +0000
@@ -29,6 +29,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_hist_4u_3t.result	2011-01-26 09:34:10 +0000
@@ -28,6 +28,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_2t.result	2011-01-26 09:34:10 +0000
@@ -31,6 +31,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_2u_3t.result	2011-01-26 09:34:10 +0000
@@ -30,6 +30,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_2t.result	2011-01-26 09:34:10 +0000
@@ -31,6 +31,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== modified file 'mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result'
--- a/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/r/table_lock_aggregate_thread_4u_3t.result	2011-01-26 09:34:10 +0000
@@ -30,6 +30,42 @@ truncate performance_schema.table_lock_w
 truncate performance_schema.events_waits_summary_by_thread_by_event_name;
 truncate performance_schema.events_waits_summary_global_by_event_name;
 truncate performance_schema.events_waits_history_long;
+show variables like "performance_schema%";
+Variable_name	Value
+performance_schema	ON
+performance_schema_events_waits_history_long_size	10000
+performance_schema_events_waits_history_size	10
+performance_schema_max_cond_classes	80
+performance_schema_max_cond_instances	1000
+performance_schema_max_file_classes	50
+performance_schema_max_file_handles	32768
+performance_schema_max_file_instances	10000
+performance_schema_max_mutex_classes	200
+performance_schema_max_mutex_instances	10000
+performance_schema_max_rwlock_classes	30
+performance_schema_max_rwlock_instances	10000
+performance_schema_max_table_handles	1000
+performance_schema_max_table_instances	500
+performance_schema_max_thread_classes	50
+performance_schema_max_thread_instances	1000
+performance_schema_setup_actors_size	100
+performance_schema_setup_objects_size	100
+show status like "performance_schema%";
+Variable_name	Value
+Performance_schema_cond_classes_lost	0
+Performance_schema_cond_instances_lost	0
+Performance_schema_file_classes_lost	0
+Performance_schema_file_handles_lost	0
+Performance_schema_file_instances_lost	0
+Performance_schema_locker_lost	0
+Performance_schema_mutex_classes_lost	0
+Performance_schema_mutex_instances_lost	0
+Performance_schema_rwlock_classes_lost	0
+Performance_schema_rwlock_instances_lost	0
+Performance_schema_table_handles_lost	0
+Performance_schema_table_instances_lost	0
+Performance_schema_thread_classes_lost	0
+Performance_schema_thread_instances_lost	0
 "================== Step 1 =================="
 execute dump_thread;
 event_name	count_star

=== added file 'mysql-test/suite/perfschema/t/debug_env.test'
--- a/mysql-test/suite/perfschema/t/debug_env.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/perfschema/t/debug_env.test	2011-01-28 18:55:45 +0000
@@ -0,0 +1,45 @@
+# Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software Foundation,
+# 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA
+
+# Tests for PERFORMANCE_SCHEMA
+
+--source include/not_embedded.inc
+--source include/have_perfschema.inc
+
+-- echo "============================================================================"
+-- echo "This is not a test, it's a debug utility to troubleshoot test suite problems"
+-- echo "This script is flagged as experimental, as failures are expected"
+-- echo "============================================================================"
+
+show engines;
+show status like "performance_schema%";
+show variables like "performance_schema%";
+show engine performance_schema status;
+
+use performance_schema;
+show tables;
+
+select * from performance_timers;
+select * from setup_timers;
+
+# Investigating bug#59740
+select * from threads;
+select count(*) from threads;
+select count(*) from setup_instruments;
+
+show status like "%handler%";
+select count(*) from events_waits_summary_by_thread_by_event_name;
+show status like "%handler%";
+

=== modified file 'mysql-test/suite/perfschema/t/disabled.def'
--- a/mysql-test/suite/perfschema/t/disabled.def	2010-11-12 13:10:44 +0000
+++ b/mysql-test/suite/perfschema/t/disabled.def	2011-01-28 12:46:03 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2009, 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

=== modified file 'mysql-test/suite/perfschema/t/ortho_iter.test'
--- a/mysql-test/suite/perfschema/t/ortho_iter.test	2010-12-09 16:39:45 +0000
+++ b/mysql-test/suite/perfschema/t/ortho_iter.test	2011-01-28 13:40:57 +0000
@@ -1,4 +1,4 @@
-# Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -135,16 +135,25 @@ end
 $
 delimiter ;$
 
+# Check the configuration is ok
+show variables like "performance_schema%";
+show status like "performance_schema%";
+
 call check_instrument("wait/synch/mutex/");
 call check_instrument("wait/synch/rwlock/");
 call check_instrument("wait/synch/cond/");
+call check_instrument("wait/synch/");
 call check_instrument("wait/io/file/");
 call check_instrument("wait/io/net/");
 call check_instrument("wait/io/table/");
+call check_instrument("wait/io/");
 call check_instrument("wait/lock/table/");
+call check_instrument("wait/lock/");
+call check_instrument("wait/");
 call check_instrument("stage/");
 call check_instrument("statement/com/");
 call check_instrument("statement/sql/");
+call check_instrument("statement/");
 
 drop procedure check_instrument;
 

=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def	2011-01-05 13:06:42 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def	2011-01-26 12:48:17 +0000
@@ -15,3 +15,5 @@ rpl_spec_variables        : BUG#47661 20
 rpl_row_event_max_size    : Bug#55675 2010-10-25 andrei mysql_binlog_send attempts to read events partly
 rpl_delayed_slave         : Bug#57514 2010-11-09 andrei rpl_delayed_slave fails sporadically in pb
 rpl_log_pos               : BUG#55675 2010-09-10 alfranio rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle
+rpl_row_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out
+rpl_stm_until : BUG#59543 Jan 26 2011 alfranio Replication test from eits suite rpl_row_until times out

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2010-12-21 07:27:09 +0000
+++ b/mysql-test/t/disabled.def	2011-01-29 12:15:56 +0000
@@ -10,11 +10,7 @@
 #
 ##############################################################################
 lowercase_table3         : Bug#54845 2010-06-30 alik main.lowercase_table3 on Mac OSX
-mysqlhotcopy_myisam      : Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
-mysqlhotcopy_archive     : Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
 query_cache_28249        : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
-main.mysqlhotcopy_myisam : Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
-main.mysqlhotcopy_archive: Bug#56817 2010-10-21 anitha mysqlhotcopy* fails
 log_tables-big           : Bug#48646 2010-11-15 mattiasj report already exists
 read_many_rows_innodb    : Bug#37635 2010-11-15 mattiasj report already exists
 sum_distinct-big         : Bug#56927 2010-11-15 mattiasj was not tested

=== modified file 'mysql-test/t/innodb_mysql_sync.test'
--- a/mysql-test/t/innodb_mysql_sync.test	2011-01-10 13:12:23 +0000
+++ b/mysql-test/t/innodb_mysql_sync.test	2011-01-26 13:23:29 +0000
@@ -147,6 +147,139 @@ SET DEBUG_SYNC= 'RESET';
 disconnect con1;
 
 
+--echo #
+--echo # Bug#42230 during add index, cannot do queries on storage engines
+--echo #           that implement add_index
+--echo #
+
+--disable_warnings
+DROP DATABASE IF EXISTS db1;
+DROP TABLE IF EXISTS t1;
+--enable_warnings
+
+connect(con1,localhost,root);
+connect(con2,localhost,root);
+
+--echo # Test 1: Secondary index, should not block reads (original test case).
+
+--echo # Connection default
+connection default;
+CREATE DATABASE db1;
+CREATE TABLE db1.t1(id INT NOT NULL AUTO_INCREMENT PRIMARY KEY, value INT) engine=innodb;
+INSERT INTO db1.t1(value) VALUES (1), (2);
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+--echo # Sending:
+--send ALTER TABLE db1.t1 ADD INDEX(value)
+
+--echo # Connection con1
+connection con1;
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+# Neither of these two statements should be blocked
+USE db1;
+SELECT * FROM t1;
+SET DEBUG_SYNC= "now SIGNAL query";
+
+--echo # Connection default
+connection default;
+--echo # Reaping: ALTER TABLE db1.t1 ADD INDEX(value)
+--reap
+DROP DATABASE db1;
+
+--echo # Test 2: Primary index (implicit), should block reads.
+
+CREATE TABLE t1(a INT NOT NULL, b INT NOT NULL) engine=innodb;
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+--echo # Sending:
+--send ALTER TABLE t1 ADD UNIQUE INDEX(a)
+
+--echo # Connection con1
+connection con1;
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+USE test;
+--echo # Sending:
+--send SELECT * FROM t1
+
+--echo # Connection con2
+connection con2;
+--echo # Waiting for SELECT to be blocked by the metadata lock on t1
+let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
+  WHERE state= 'Waiting for table metadata lock'
+  AND info='SELECT * FROM t1';
+--source include/wait_condition.inc
+SET DEBUG_SYNC= "now SIGNAL query";
+
+--echo # Connection default
+connection default;
+--echo # Reaping: ALTER TABLE t1 ADD UNIQUE INDEX(a)
+--reap
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: SELECT * FROM t1
+--reap
+
+--echo # Test 3: Primary index (explicit), should block reads.
+
+--echo # Connection default
+connection default;
+ALTER TABLE t1 DROP INDEX a;
+SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+--echo # Sending:
+--send ALTER TABLE t1 ADD PRIMARY KEY (a)
+
+--echo # Connection con1
+connection con1;
+SET DEBUG_SYNC= "now WAIT_FOR manage";
+--echo # Sending:
+--send SELECT * FROM t1
+
+--echo # Connection con2
+connection con2;
+--echo # Waiting for SELECT to be blocked by the metadata lock on t1
+let $wait_condition= SELECT COUNT(*)= 1 FROM information_schema.processlist
+  WHERE state= 'Waiting for table metadata lock'
+  AND info='SELECT * FROM t1';
+--source include/wait_condition.inc
+SET DEBUG_SYNC= "now SIGNAL query";
+
+--echo # Connection default
+connection default;
+--echo # Reaping: ALTER TABLE t1 ADD PRIMARY KEY (a)
+--reap
+
+--echo # Connection con1
+connection con1;
+--echo # Reaping: SELECT * FROM t1
+--reap
+
+--echo # Test 4: Secondary unique index, should not block reads.
+# This requires HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE to be supported
+# by InnoDB. Adding this flag currently introduces a regression so
+# this test is disabled until the regression has been fixed.
+
+--echo # Connection default
+connection default;
+#SET DEBUG_SYNC= "alter_table_manage_keys SIGNAL manage WAIT_FOR query";
+#--echo # Sending:
+#--send ALTER TABLE t1 ADD UNIQUE (b)
+
+#--echo # Connection con1
+#connection con1;
+#SET DEBUG_SYNC= "now WAIT_FOR manage";
+#SELECT * FROM t1;
+#SET DEBUG_SYNC= "now SIGNAL query";
+
+#--echo # Connection default
+#connection default;
+#--echo # Reaping: ALTER TABLE t1 ADD UNIQUE (b)
+#--reap
+
+disconnect con1;
+disconnect con2;
+SET DEBUG_SYNC= "RESET";
+DROP TABLE t1;
+
+
 # Check that all connections opened by test cases in this file are really
 # gone so execution of other tests won't be affected by their presence.
 --source include/wait_until_count_sessions.inc

=== modified file 'mysql-test/t/partition_error.test'
--- a/mysql-test/t/partition_error.test	2011-01-10 16:37:47 +0000
+++ b/mysql-test/t/partition_error.test	2011-01-26 20:13:31 +0000
@@ -11,6 +11,21 @@ drop table if exists t1, t2;
 let $MYSQLD_DATADIR= `SELECT @@datadir`;
 
 --echo #
+--echo # Bug#57924: crash when creating partitioned table with
+--echo #            multiple columns in the partition key
+--echo #
+--error ER_SAME_NAME_PARTITION_FIELD
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
+PARTITION BY KEY(a, b, a);
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
+PARTITION BY KEY(A, b);
+DROP TABLE t1;
+--error ER_SAME_NAME_PARTITION_FIELD
+CREATE TABLE t1 (a INT, b INT, PRIMARY KEY (a,b))
+PARTITION BY KEY(a, b, A);
+
+
+--echo #
 --echo # Bug#54483: valgrind errors when making warnings for multiline inserts
 --echo #            into partition
 --echo #
@@ -670,7 +685,6 @@ PARTITION BY HASH (TIME_TO_SEC(a));
 CREATE TABLE t1 (a INT)
 PARTITION BY HASH (TIME_TO_SEC(a));
 
-
 --echo #
 --echo # Bug#50036: Inconsistent errors when using TIMESTAMP
 --echo #            columns/expressions

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2011-01-03 15:45:43 +0000
+++ b/sql/ha_partition.cc	2011-01-26 21:12:56 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2005, 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
@@ -6348,6 +6348,31 @@ uint8 ha_partition::table_cache_type()
 }
 
 
+/**
+  Calculate hash value for KEY partitioning using an array of fields.
+
+  @param field_array   An array of the fields in KEY partitioning
+
+  @return hash_value calculated
+
+  @note Uses the hash function on the character set of the field.
+  Integer and floating point fields use the binary character set by default.
+*/
+
+uint32 ha_partition::calculate_key_hash_value(Field **field_array)
+{
+  ulong nr1= 1;
+  ulong nr2= 4;
+
+  do
+  {
+    Field *field= *field_array;
+    field->hash(&nr1, &nr2);
+  } while (*(++field_array));
+  return (uint32) nr1;
+}
+
+
 /****************************************************************************
                 MODULE print messages
 ****************************************************************************/
@@ -6433,28 +6458,28 @@ uint ha_partition::alter_table_flags(uin
     already altered, partitions. So both ADD and DROP can only be supported in
     pairs.
   */
-  flags_to_check= HA_ONLINE_ADD_INDEX_NO_WRITES;
-  flags_to_check|= HA_ONLINE_DROP_INDEX_NO_WRITES;
+  flags_to_check= HA_INPLACE_ADD_INDEX_NO_READ_WRITE;
+  flags_to_check|= HA_INPLACE_DROP_INDEX_NO_READ_WRITE;
   if ((flags_to_return & flags_to_check) != flags_to_check)
     flags_to_return&= ~flags_to_check;
-  flags_to_check= HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES;
-  flags_to_check|= HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES;
+  flags_to_check= HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE;
+  flags_to_check|= HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE;
   if ((flags_to_return & flags_to_check) != flags_to_check)
     flags_to_return&= ~flags_to_check;
-  flags_to_check= HA_ONLINE_ADD_PK_INDEX_NO_WRITES;
-  flags_to_check|= HA_ONLINE_DROP_PK_INDEX_NO_WRITES;
+  flags_to_check= HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE;
+  flags_to_check|= HA_INPLACE_DROP_PK_INDEX_NO_READ_WRITE;
   if ((flags_to_return & flags_to_check) != flags_to_check)
     flags_to_return&= ~flags_to_check;
-  flags_to_check= HA_ONLINE_ADD_INDEX;
-  flags_to_check|= HA_ONLINE_DROP_INDEX;
+  flags_to_check= HA_INPLACE_ADD_INDEX_NO_WRITE;
+  flags_to_check|= HA_INPLACE_DROP_INDEX_NO_WRITE;
   if ((flags_to_return & flags_to_check) != flags_to_check)
     flags_to_return&= ~flags_to_check;
-  flags_to_check= HA_ONLINE_ADD_UNIQUE_INDEX;
-  flags_to_check|= HA_ONLINE_DROP_UNIQUE_INDEX;
+  flags_to_check= HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE;
+  flags_to_check|= HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE;
   if ((flags_to_return & flags_to_check) != flags_to_check)
     flags_to_return&= ~flags_to_check;
-  flags_to_check= HA_ONLINE_ADD_PK_INDEX;
-  flags_to_check|= HA_ONLINE_DROP_PK_INDEX;
+  flags_to_check= HA_INPLACE_ADD_PK_INDEX_NO_WRITE;
+  flags_to_check|= HA_INPLACE_DROP_PK_INDEX_NO_WRITE;
   if ((flags_to_return & flags_to_check) != flags_to_check)
     flags_to_return&= ~flags_to_check;
   DBUG_RETURN(flags_to_return);

=== modified file 'sql/ha_partition.h'
--- a/sql/ha_partition.h	2010-12-03 10:05:56 +0000
+++ b/sql/ha_partition.h	2011-01-26 21:12:56 +0000
@@ -166,7 +166,7 @@ private:
   enum_monotonicity_info m_part_func_monotonicity_info;
 public:
   handler *clone(MEM_ROOT *mem_root);
-  virtual void set_part_info(partition_info *part_info)
+  virtual void set_part_info(partition_info *part_info, bool early)
   {
      m_part_info= part_info;
      m_is_sub_partitioned= part_info->is_sub_partitioned();
@@ -599,6 +599,9 @@ public:
   virtual uint8 table_cache_type();
   virtual ha_rows records();
 
+  /* Calculate hash value for PARTITION BY KEY tables. */
+  uint32 calculate_key_hash_value(Field **field_array);
+
   /*
     -------------------------------------------------------------------------
     MODULE print messages

=== modified file 'sql/handler.h'
--- a/sql/handler.h	2011-01-10 09:04:20 +0000
+++ b/sql/handler.h	2011-01-26 21:12:56 +0000
@@ -1,7 +1,7 @@
 #ifndef HANDLER_INCLUDED
 #define HANDLER_INCLUDED
 
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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
@@ -181,28 +181,31 @@
   bits in alter_table_flags:
 */
 /*
-  These bits are set if different kinds of indexes can be created
-  off-line without re-create of the table (but with a table lock).
+  These bits are set if different kinds of indexes can be created or dropped
+  in-place without re-creating the table using a temporary table.
+  NO_READ_WRITE indicates that the handler needs concurrent reads and writes
+  of table data to be blocked.
   Partitioning needs both ADD and DROP to be supported by its underlying
   handlers, due to error handling, see bug#57778.
 */
-#define HA_ONLINE_ADD_INDEX_NO_WRITES           (1L << 0) /*add index w/lock*/
-#define HA_ONLINE_DROP_INDEX_NO_WRITES          (1L << 1) /*drop index w/lock*/
-#define HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES    (1L << 2) /*add unique w/lock*/
-#define HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES   (1L << 3) /*drop uniq. w/lock*/
-#define HA_ONLINE_ADD_PK_INDEX_NO_WRITES        (1L << 4) /*add prim. w/lock*/
-#define HA_ONLINE_DROP_PK_INDEX_NO_WRITES       (1L << 5) /*drop prim. w/lock*/
-/*
-  These are set if different kinds of indexes can be created on-line
-  (without a table lock). If a handler is capable of one or more of
-  these, it should also set the corresponding *_NO_WRITES bit(s).
-*/
-#define HA_ONLINE_ADD_INDEX                     (1L << 6) /*add index online*/
-#define HA_ONLINE_DROP_INDEX                    (1L << 7) /*drop index online*/
-#define HA_ONLINE_ADD_UNIQUE_INDEX              (1L << 8) /*add unique online*/
-#define HA_ONLINE_DROP_UNIQUE_INDEX             (1L << 9) /*drop uniq. online*/
-#define HA_ONLINE_ADD_PK_INDEX                  (1L << 10)/*add prim. online*/
-#define HA_ONLINE_DROP_PK_INDEX                 (1L << 11)/*drop prim. online*/
+#define HA_INPLACE_ADD_INDEX_NO_READ_WRITE         (1L << 0)
+#define HA_INPLACE_DROP_INDEX_NO_READ_WRITE        (1L << 1)
+#define HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE  (1L << 2)
+#define HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE (1L << 3)
+#define HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE      (1L << 4)
+#define HA_INPLACE_DROP_PK_INDEX_NO_READ_WRITE     (1L << 5)
+/*
+  These are set if different kinds of indexes can be created or dropped
+  in-place while still allowing concurrent reads (but not writes) of table
+  data. If a handler is capable of one or more of these, it should also set
+  the corresponding *_NO_READ_WRITE bit(s).
+*/
+#define HA_INPLACE_ADD_INDEX_NO_WRITE              (1L << 6)
+#define HA_INPLACE_DROP_INDEX_NO_WRITE             (1L << 7)
+#define HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE       (1L << 8)
+#define HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE      (1L << 9)
+#define HA_INPLACE_ADD_PK_INDEX_NO_WRITE           (1L << 10)
+#define HA_INPLACE_DROP_PK_INDEX_NO_WRITE          (1L << 11)
 /*
   HA_PARTITION_FUNCTION_SUPPORTED indicates that the function is
   supported at all.
@@ -1884,6 +1887,8 @@ public:
   virtual int info(uint)=0; // see my_base.h for full description
   virtual void get_dynamic_partition_info(PARTITION_STATS *stat_info,
                                           uint part_id);
+  virtual uint32 calculate_key_hash_value(Field **field_array)
+  { DBUG_ASSERT(0); return 0; }
   virtual int extra(enum ha_extra_function operation)
   { return 0; }
   virtual int extra_opt(enum ha_extra_function operation, ulong cache_size)
@@ -2021,7 +2026,7 @@ public:
     *no_parts= 0;
     return 0;
   }
-  virtual void set_part_info(partition_info *part_info) {return;}
+  virtual void set_part_info(partition_info *part_info, bool early) {return;}
 
   virtual ulong index_flags(uint idx, uint part, bool all_parts) const =0;
 

=== modified file 'sql/item.h'
--- a/sql/item.h	2011-01-10 16:37:47 +0000
+++ b/sql/item.h	2011-01-28 13:49:59 +0000
@@ -1,7 +1,7 @@
 #ifndef ITEM_INCLUDED
 #define ITEM_INCLUDED
 
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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

=== modified file 'sql/item_func.h'
--- a/sql/item_func.h	2011-01-10 16:37:47 +0000
+++ b/sql/item_func.h	2011-01-28 13:49:59 +0000
@@ -1,7 +1,7 @@
 #ifndef ITEM_FUNC_INCLUDED
 #define ITEM_FUNC_INCLUDED
 
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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

=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h	2011-01-10 16:37:47 +0000
+++ b/sql/item_timefunc.h	2011-01-28 13:49:59 +0000
@@ -1,7 +1,7 @@
 #ifndef ITEM_TIMEFUNC_INCLUDED
 #define ITEM_TIMEFUNC_INCLUDED
 
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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

=== modified file 'sql/mdl.cc'
--- a/sql/mdl.cc	2010-11-19 12:34:44 +0000
+++ b/sql/mdl.cc	2011-01-27 15:31:18 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2007, 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
@@ -731,7 +731,8 @@ void MDL_map::remove(MDL_lock *lock)
 */
 
 MDL_context::MDL_context()
-  : m_thd(NULL),
+  :
+  m_owner(NULL),
   m_needs_thr_lock_abort(FALSE),
   m_waiting_for(NULL)
 {
@@ -950,6 +951,7 @@ void MDL_wait::reset_status()
 /**
   Wait for the status to be assigned to this wait slot.
 
+  @param owner           MDL context owner.
   @param abs_timeout     Absolute time after which waiting should stop.
   @param set_status_on_timeout TRUE  - If in case of timeout waiting
                                        context should close the wait slot by
@@ -961,7 +963,7 @@ void MDL_wait::reset_status()
 */
 
 MDL_wait::enum_wait_status
-MDL_wait::timed_wait(THD *thd, struct timespec *abs_timeout,
+MDL_wait::timed_wait(MDL_context_owner *owner, struct timespec *abs_timeout,
                      bool set_status_on_timeout, const char *wait_state_name)
 {
   const char *old_msg;
@@ -970,10 +972,9 @@ MDL_wait::timed_wait(THD *thd, struct ti
 
   mysql_mutex_lock(&m_LOCK_wait_status);
 
-  old_msg= thd_enter_cond(thd, &m_COND_wait_status, &m_LOCK_wait_status,
-                          wait_state_name);
-
-  while (!m_wait_status && !thd_killed(thd) &&
+  old_msg= owner->enter_cond(&m_COND_wait_status, &m_LOCK_wait_status,
+                             wait_state_name);
+  while (!m_wait_status && !owner->is_killed() &&
          wait_result != ETIMEDOUT && wait_result != ETIME)
     wait_result= mysql_cond_timedwait(&m_COND_wait_status, &m_LOCK_wait_status,
                                       abs_timeout);
@@ -992,14 +993,14 @@ MDL_wait::timed_wait(THD *thd, struct ti
       false, which means that the caller intends to restart the
       wait.
     */
-    if (thd_killed(thd))
+    if (owner->is_killed())
       m_wait_status= KILLED;
     else if (set_status_on_timeout)
       m_wait_status= TIMEOUT;
   }
   result= m_wait_status;
 
-  thd_exit_cond(thd, old_msg);
+  owner->exit_cond(old_msg);
 
   return result;
 }
@@ -1696,9 +1697,9 @@ void MDL_object_lock::notify_conflicting
         lock or some other non-MDL resource we might need to wake it up
         by calling code outside of MDL.
       */
-      mysql_notify_thread_having_shared_lock(ctx->get_thd(),
-                                 conflicting_ctx->get_thd(),
-                                 conflicting_ctx->get_needs_thr_lock_abort());
+      ctx->get_owner()->
+        notify_shared_lock(conflicting_ctx->get_owner(),
+                           conflicting_ctx->get_needs_thr_lock_abort());
     }
   }
 }
@@ -1728,9 +1729,9 @@ void MDL_scoped_lock::notify_conflicting
         insert delayed. We need to kill such threads in order to get
         global shared lock. We do this my calling code outside of MDL.
       */
-      mysql_notify_thread_having_shared_lock(ctx->get_thd(),
-                                 conflicting_ctx->get_thd(),
-                                 conflicting_ctx->get_needs_thr_lock_abort());
+      ctx->get_owner()->
+        notify_shared_lock(conflicting_ctx->get_owner(),
+                           conflicting_ctx->get_needs_thr_lock_abort());
     }
   }
 }
@@ -1797,7 +1798,7 @@ MDL_context::acquire_lock(MDL_request *m
   will_wait_for(ticket);
 
   /* There is a shared or exclusive lock on the object. */
-  DEBUG_SYNC(m_thd, "mdl_acquire_lock_wait");
+  DEBUG_SYNC(get_thd(), "mdl_acquire_lock_wait");
 
   find_deadlock();
 
@@ -1810,7 +1811,7 @@ MDL_context::acquire_lock(MDL_request *m
     while (cmp_timespec(abs_shortwait, abs_timeout) <= 0)
     {
       /* abs_timeout is far away. Wait a short while and notify locks. */
-      wait_status= m_wait.timed_wait(m_thd, &abs_shortwait, FALSE,
+      wait_status= m_wait.timed_wait(m_owner, &abs_shortwait, FALSE,
                                      mdl_request->key.get_wait_state_name());
 
       if (wait_status != MDL_wait::EMPTY)
@@ -1822,11 +1823,11 @@ MDL_context::acquire_lock(MDL_request *m
       set_timespec(abs_shortwait, 1);
     }
     if (wait_status == MDL_wait::EMPTY)
-      wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE,
+      wait_status= m_wait.timed_wait(m_owner, &abs_timeout, TRUE,
                                      mdl_request->key.get_wait_state_name());
   }
   else
-    wait_status= m_wait.timed_wait(m_thd, &abs_timeout, TRUE,
+    wait_status= m_wait.timed_wait(m_owner, &abs_timeout, TRUE,
                                    mdl_request->key.get_wait_state_name());
 
   done_waiting_for();

=== modified file 'sql/mdl.h'
--- a/sql/mdl.h	2010-11-22 11:20:49 +0000
+++ b/sql/mdl.h	2011-01-27 15:31:18 +0000
@@ -1,6 +1,6 @@
 #ifndef MDL_H
 #define MDL_H
-/* Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2007, 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
@@ -35,6 +35,41 @@ class MDL_context;
 class MDL_lock;
 class MDL_ticket;
 
+
+/**
+   An interface to separate the MDL module from the THD, and the rest of the
+   server code.
+ */
+
+class MDL_context_owner
+{
+public:
+  virtual ~MDL_context_owner() {}
+
+  /**
+     @see THD::enter_cond() and THD::exit_cond()
+   */
+  virtual const char* enter_cond(mysql_cond_t *cond, mysql_mutex_t* mutex,
+                                 const char* msg) = 0;
+  virtual void exit_cond(const char* old_msg) = 0;
+  /**
+     Has the owner thread been killed?
+   */
+  virtual int  is_killed() = 0;
+
+  /**
+     This one is only used for DEBUG_SYNC.
+     (Do not use it to peek/poke into other parts of THD.)
+   */
+  virtual THD* get_thd() = 0;
+
+  /**
+     @see THD::notify_shared_lock()
+   */
+  virtual bool notify_shared_lock(MDL_context_owner *in_use,
+                                  bool needs_thr_lock_abort) = 0;
+};
+
 /**
   Type of metadata lock request.
 
@@ -593,7 +628,8 @@ public:
   bool set_status(enum_wait_status result_arg);
   enum_wait_status get_status();
   void reset_status();
-  enum_wait_status timed_wait(THD *thd, struct timespec *abs_timeout,
+  enum_wait_status timed_wait(MDL_context_owner *owner,
+                              struct timespec *abs_timeout,
                               bool signal_timeout, const char *wait_state_name);
 private:
   /**
@@ -672,7 +708,7 @@ public:
   void release_transactional_locks();
   void rollback_to_savepoint(const MDL_savepoint &mdl_savepoint);
 
-  inline THD *get_thd() const { return m_thd; }
+  MDL_context_owner *get_owner() { return m_owner; }
 
   /** @pre Only valid if we started waiting for lock. */
   inline uint get_deadlock_weight() const
@@ -685,7 +721,7 @@ public:
                     already has received some signal or closed
                     signal slot.
   */
-  void init(THD *thd_arg) { m_thd= thd_arg; }
+  void init(MDL_context_owner *arg) { m_owner= arg; }
 
   void set_needs_thr_lock_abort(bool needs_thr_lock_abort)
   {
@@ -765,7 +801,7 @@ private:
       involved schemas and global intention exclusive lock.
   */
   Ticket_list m_tickets[MDL_DURATION_END];
-  THD *m_thd;
+  MDL_context_owner *m_owner;
   /**
     TRUE -  if for this context we will break protocol and try to
             acquire table-level locks while having only S lock on
@@ -794,6 +830,7 @@ private:
    */
   MDL_wait_for_subgraph *m_waiting_for;
 private:
+  THD *get_thd() const { return m_owner->get_thd(); }
   MDL_ticket *find_ticket(MDL_request *mdl_req,
                           enum_mdl_duration *duration);
   void release_locks_stored_before(enum_mdl_duration duration, MDL_ticket *sentinel);
@@ -839,16 +876,6 @@ void mdl_init();
 void mdl_destroy();
 
 
-/*
-  Functions in the server's kernel used by metadata locking subsystem.
-*/
-
-extern bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
-                                                   bool needs_thr_lock_abort);
-extern "C" const char* thd_enter_cond(MYSQL_THD thd, mysql_cond_t *cond,
-                                      mysql_mutex_t *mutex, const char *msg);
-extern "C" void thd_exit_cond(MYSQL_THD thd, const char *old_msg);
-
 #ifndef DBUG_OFF
 extern mysql_mutex_t LOCK_open;
 #endif

=== modified file 'sql/partition_info.h'
--- a/sql/partition_info.h	2010-10-21 09:49:16 +0000
+++ b/sql/partition_info.h	2011-01-26 21:12:56 +0000
@@ -157,6 +157,7 @@ public:
   uint curr_list_object;
   uint num_columns;
 
+  TABLE *table;
   /*
     These key_map's are used for Partitioning to enable quick decisions
     on whether we can derive more information about which partition to

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2011-01-11 11:45:02 +0000
+++ b/sql/sql_base.cc	2011-01-27 15:31:18 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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
@@ -8666,72 +8666,6 @@ void tdc_flush_unused_tables()
 }
 
 
-/**
-   A callback to the server internals that is used to address
-   special cases of the locking protocol.
-   Invoked when acquiring an exclusive lock, for each thread that
-   has a conflicting shared metadata lock.
-
-   This function:
-     - aborts waiting of the thread on a data lock, to make it notice
-       the pending exclusive lock and back off.
-     - if the thread is an INSERT DELAYED thread, sends it a KILL
-       signal to terminate it.
-
-   @note This function does not wait for the thread to give away its
-         locks. Waiting is done outside for all threads at once.
-
-   @param thd    Current thread context
-   @param in_use The thread to wake up
-   @param needs_thr_lock_abort Indicates that to wake up thread
-                               this call needs to abort its waiting
-                               on table-level lock.
-
-   @retval  TRUE  if the thread was woken up
-   @retval  FALSE otherwise.
-
-   @note It is one of two places where border between MDL and the
-         rest of the server is broken.
-*/
-
-bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
-                                            bool needs_thr_lock_abort)
-{
-  bool signalled= FALSE;
-  if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) &&
-      !in_use->killed)
-  {
-    in_use->killed= THD::KILL_CONNECTION;
-    mysql_mutex_lock(&in_use->mysys_var->mutex);
-    if (in_use->mysys_var->current_cond)
-      mysql_cond_broadcast(in_use->mysys_var->current_cond);
-    mysql_mutex_unlock(&in_use->mysys_var->mutex);
-    signalled= TRUE;
-  }
-
-  if (needs_thr_lock_abort)
-  {
-    mysql_mutex_lock(&in_use->LOCK_thd_data);
-    for (TABLE *thd_table= in_use->open_tables;
-         thd_table ;
-         thd_table= thd_table->next)
-    {
-      /*
-        Check for TABLE::needs_reopen() is needed since in some places we call
-        handler::close() for table instance (and set TABLE::db_stat to 0)
-        and do not remove such instances from the THD::open_tables
-        for some time, during which other thread can see those instances
-        (e.g. see partitioning code).
-      */
-      if (!thd_table->needs_reopen())
-        signalled|= mysql_lock_abort_for_thread(thd, thd_table);
-    }
-    mysql_mutex_unlock(&in_use->LOCK_thd_data);
-  }
-  return signalled;
-}
-
-
 /**
    Remove all or some (depending on parameter) instances of TABLE and
    TABLE_SHARE from the table definition cache.

=== modified file 'sql/sql_class.cc'
--- a/sql/sql_class.cc	2010-12-17 16:14:15 +0000
+++ b/sql/sql_class.cc	2011-01-27 15:31:18 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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
@@ -58,6 +58,7 @@
 #include "debug_sync.h"
 #include "sql_parse.h"                          // is_update_query
 #include "sql_callback.h"
+#include "lock.h"
 
 /*
   The following is used to initialise Table_ident with a internal
@@ -272,10 +273,11 @@ const char *set_thd_proc_info(void *thd_
     thd= current_thd;
 
   const char *old_info= thd->proc_info;
-  DBUG_PRINT("proc_info", ("%s:%d  %s", calling_file, calling_line,
-                           (info != NULL) ? info : "(null)"));
+  const char *basename= calling_file ? base_name(calling_file) : NULL;
+  DBUG_PRINT("proc_info", ("%s:%d  %s", basename, calling_line, info));
+
 #if defined(ENABLED_PROFILING)
-  thd->profiling.status_change(info, calling_function, calling_file, calling_line);
+  thd->profiling.status_change(info, calling_function, basename, calling_line);
 #endif
   thd->proc_info= info;
 #ifdef HAVE_PSI_INTERFACE
@@ -1321,6 +1323,45 @@ void THD::disconnect()
 }
 
 
+bool THD::notify_shared_lock(MDL_context_owner *ctx_in_use,
+                             bool needs_thr_lock_abort)
+{
+  THD *in_use= ctx_in_use->get_thd();
+  bool signalled= FALSE;
+  if ((in_use->system_thread & SYSTEM_THREAD_DELAYED_INSERT) &&
+      !in_use->killed)
+  {
+    in_use->killed= THD::KILL_CONNECTION;
+    mysql_mutex_lock(&in_use->mysys_var->mutex);
+    if (in_use->mysys_var->current_cond)
+      mysql_cond_broadcast(in_use->mysys_var->current_cond);
+    mysql_mutex_unlock(&in_use->mysys_var->mutex);
+    signalled= TRUE;
+  }
+
+  if (needs_thr_lock_abort)
+  {
+    mysql_mutex_lock(&in_use->LOCK_thd_data);
+    for (TABLE *thd_table= in_use->open_tables;
+         thd_table ;
+         thd_table= thd_table->next)
+    {
+      /*
+        Check for TABLE::needs_reopen() is needed since in some places we call
+        handler::close() for table instance (and set TABLE::db_stat to 0)
+        and do not remove such instances from the THD::open_tables
+        for some time, during which other thread can see those instances
+        (e.g. see partitioning code).
+      */
+      if (!thd_table->needs_reopen())
+        signalled|= mysql_lock_abort_for_thread(this, thd_table);
+    }
+    mysql_mutex_unlock(&in_use->LOCK_thd_data);
+  }
+  return signalled;
+}
+
+
 /*
   Remember the location of thread info, the structure needed for
   sql_alloc() and the structure for the net buffer

=== modified file 'sql/sql_class.h'
--- a/sql/sql_class.h	2010-12-29 00:38:59 +0000
+++ b/sql/sql_class.h	2011-01-27 15:31:18 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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
@@ -1475,7 +1475,8 @@ extern "C" void my_message_sql(uint erro
 */
 
 class THD :public Statement,
-           public Open_tables_state
+           public Open_tables_state,
+           public MDL_context_owner
 {
 public:
   MDL_context mdl_context;
@@ -2287,6 +2288,8 @@ public:
                    int errcode);
 #endif
 
+  // Begin implementation of MDL_context_owner interface.
+
   /*
     For enter_cond() / exit_cond() to work the mutex must be got before
     enter_cond(); this mutex is then released by exit_cond().
@@ -2318,6 +2321,39 @@ public:
     mysql_mutex_unlock(&mysys_var->mutex);
     return;
   }
+
+  virtual int is_killed() { return killed; }
+  virtual THD* get_thd() { return this; }
+
+  /**
+    A callback to the server internals that is used to address
+    special cases of the locking protocol.
+    Invoked when acquiring an exclusive lock, for each thread that
+    has a conflicting shared metadata lock.
+
+    This function:
+    - aborts waiting of the thread on a data lock, to make it notice
+      the pending exclusive lock and back off.
+    - if the thread is an INSERT DELAYED thread, sends it a KILL
+      signal to terminate it.
+
+    @note This function does not wait for the thread to give away its
+          locks. Waiting is done outside for all threads at once.
+
+    @param ctx_in_use           The MDL context owner (thread) to wake up.
+    @param needs_thr_lock_abort Indicates that to wake up thread
+                                this call needs to abort its waiting
+                                on table-level lock.
+
+    @retval  TRUE  if the thread was woken up
+    @retval  FALSE otherwise.
+   */
+  virtual bool notify_shared_lock(MDL_context_owner *ctx_in_use,
+                                  bool needs_thr_lock_abort);
+
+  // End implementation of MDL_context_owner interface.
+
+
   inline time_t query_start() { query_start_used=1; return start_time; }
   inline void set_time()
   {

=== modified file 'sql/sql_insert.cc'
--- a/sql/sql_insert.cc	2011-01-21 11:30:47 +0000
+++ b/sql/sql_insert.cc	2011-01-27 15:31:18 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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
@@ -2242,7 +2242,7 @@ TABLE *Delayed_insert::get_local_table(T
         The thread could be killed with an error message if
         di->handle_inserts() or di->open_and_lock_table() fails.
         The thread could be killed without an error message if
-        killed using mysql_notify_thread_having_shared_lock() or
+        killed using THD::notify_shared_lock() or
         kill_delayed_threads_for_table().
       */
       if (!thd.is_error() || thd.stmt_da->sql_errno() == ER_SERVER_SHUTDOWN)

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2011-01-10 16:37:47 +0000
+++ b/sql/sql_partition.cc	2011-01-28 13:49:59 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2005, 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
@@ -1889,6 +1889,7 @@ bool fix_partition_func(THD *thd, TABLE
   set_up_partition_key_maps(table, part_info);
   set_up_partition_func_pointers(part_info);
   set_up_range_analysis_info(part_info);
+  table->file->set_part_info(part_info, FALSE);
   result= FALSE;
 end:
   thd->mark_used_columns= save_mark_used_columns;
@@ -2719,42 +2720,13 @@ static inline int part_val_int(Item *ite
 
   We have a set of support functions for these 14 variants. There are 4
   variants of hash functions and there is a function for each. The KEY
-  partitioning uses the function calculate_key_value to calculate the hash
+  partitioning uses the function calculate_key_hash_value to calculate the hash
   value based on an array of fields. The linear hash variants uses the
   method get_part_id_from_linear_hash to get the partition id using the
   hash value and some parameters calculated from the number of partitions.
 */
 
 /*
-  Calculate hash value for KEY partitioning using an array of fields.
-
-  SYNOPSIS
-    calculate_key_value()
-    field_array             An array of the fields in KEY partitioning
-
-  RETURN VALUE
-    hash_value calculated
-
-  DESCRIPTION
-    Uses the hash function on the character set of the field. Integer and
-    floating point fields use the binary character set by default.
-*/
-
-static uint32 calculate_key_value(Field **field_array)
-{
-  ulong nr1= 1;
-  ulong nr2= 4;
-
-  do
-  {
-    Field *field= *field_array;
-    field->hash(&nr1, &nr2);
-  } while (*(++field_array));
-  return (uint32) nr1;
-}
-
-
-/*
   A simple support function to calculate part_id given local part and
   sub part.
 
@@ -2841,25 +2813,25 @@ static int get_part_id_linear_hash(parti
 }
 
 
-/*
+/**
   Calculate part_id for (SUB)PARTITION BY KEY
 
-  SYNOPSIS
-    get_part_id_key()
-    field_array         Array of fields for PARTTION KEY
-    num_parts           Number of KEY partitions
+  @param file                Handler to storage engine
+  @param field_array         Array of fields for PARTTION KEY
+  @param num_parts           Number of KEY partitions
+  @param func_value[out]     Returns calculated hash value
 
-  RETURN VALUE
-    Calculated partition id
+  @return Calculated partition id
 */
 
 inline
-static uint32 get_part_id_key(Field **field_array,
+static uint32 get_part_id_key(handler *file,
+                              Field **field_array,
                               uint num_parts,
                               longlong *func_value)
 {
   DBUG_ENTER("get_part_id_key");
-  *func_value= calculate_key_value(field_array);
+  *func_value= file->calculate_key_hash_value(field_array);
   DBUG_RETURN((uint32) (*func_value % num_parts));
 }
 
@@ -2886,7 +2858,7 @@ static uint32 get_part_id_linear_key(par
 {
   DBUG_ENTER("get_part_id_linear_key");
 
-  *func_value= calculate_key_value(field_array);
+  *func_value= part_info->table->file->calculate_key_hash_value(field_array);
   DBUG_RETURN(get_part_id_from_linear_hash(*func_value,
                                            part_info->linear_hash_mask,
                                            num_parts));
@@ -3574,7 +3546,8 @@ int get_partition_id_key_nosub(partition
                                 uint32 *part_id,
                                 longlong *func_value)
 {
-  *part_id= get_part_id_key(part_info->part_field_array,
+  *part_id= get_part_id_key(part_info->table->file,
+                            part_info->part_field_array,
                             part_info->num_parts, func_value);
   return 0;
 }
@@ -3664,7 +3637,8 @@ int get_partition_id_key_sub(partition_i
                              uint32 *part_id)
 {
   longlong func_value;
-  *part_id= get_part_id_key(part_info->subpart_field_array,
+  *part_id= get_part_id_key(part_info->table->file,
+                            part_info->subpart_field_array,
                             part_info->num_subparts, &func_value);
   return FALSE;
 }
@@ -4366,7 +4340,8 @@ bool mysql_unpack_partition(THD *thd,
     *work_part_info_used= true;
   }
   table->part_info= part_info;
-  table->file->set_part_info(part_info);
+  part_info->table= table;
+  table->file->set_part_info(part_info, TRUE);
   if (!part_info->default_engine_type)
     part_info->default_engine_type= default_db_type;
   DBUG_ASSERT(part_info->default_engine_type == default_db_type);

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-01-24 09:02:03 +0000
+++ b/sql/sql_select.cc	2011-01-28 12:57:04 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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
@@ -3223,6 +3223,32 @@ JOIN::exec()
 	DBUG_EXECUTE("where",print_where(curr_table->select->cond,
 					 "select and having",
                                          QT_ORDINARY););
+
+        /*
+          If we have pushed parts of the condition down to the handler
+          then we need to add this to the original pre-ICP select
+          condition since the original select condition may be used in
+          test_if_skip_sort_order(). 
+          Note: here we call make_cond_for_table() a second time in order
+          to get sort_table_cond. An alternative could be to use
+          Item::copy_andor_structure() to make a copy of sort_table_cond.
+        */
+        if (curr_table->pre_idx_push_select_cond)
+        {
+          sort_table_cond= make_cond_for_table(curr_join->tmp_having,
+                                               used_tables, used_tables, 0);
+          if (!sort_table_cond)
+            DBUG_VOID_RETURN;
+          Item* new_pre_idx_push_select_cond= 
+            new Item_cond_and(curr_table->pre_idx_push_select_cond, 
+                              sort_table_cond);
+          if (!new_pre_idx_push_select_cond)
+            DBUG_VOID_RETURN;
+          if (new_pre_idx_push_select_cond->fix_fields(thd, 0))
+            DBUG_VOID_RETURN;
+          curr_table->pre_idx_push_select_cond= new_pre_idx_push_select_cond;
+	}
+
 	curr_join->tmp_having= make_cond_for_table(curr_join->tmp_having,
 						   ~ (table_map) 0,
 						   ~used_tables, 0);
@@ -10010,8 +10036,8 @@ static bool uses_index_fields_only(Item
 Item *make_cond_for_index(Item *cond, TABLE *table, uint keyno,
                           bool other_tbls_ok)
 {
-  if (!cond)
-    return NULL;
+  DBUG_ASSERT(cond != NULL);
+
   if (cond->type() == Item::COND_ITEM)
   {
     uint n_marked= 0;
@@ -10020,7 +10046,7 @@ Item *make_cond_for_index(Item *cond, TA
       table_map used_tables= 0;
       Item_cond_and *new_cond=new Item_cond_and;
       if (!new_cond)
-	return (Item*) 0;
+	return NULL;
       List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
       Item *item;
       while ((item=li++))
@@ -10037,7 +10063,7 @@ Item *make_cond_for_index(Item *cond, TA
         cond->marker= ICP_COND_USES_INDEX_ONLY;
       switch (new_cond->argument_list()->elements) {
       case 0:
-	return (Item*) 0;
+	return NULL;
       case 1:
         new_cond->used_tables_cache= used_tables;
 	return new_cond->argument_list()->head();
@@ -10051,14 +10077,14 @@ Item *make_cond_for_index(Item *cond, TA
     {
       Item_cond_or *new_cond=new Item_cond_or;
       if (!new_cond)
-	return (Item*) 0;
+	return NULL;
       List_iterator<Item> li(*((Item_cond*) cond)->argument_list());
       Item *item;
       while ((item=li++))
       {
 	Item *fix= make_cond_for_index(item, table, keyno, other_tbls_ok);
 	if (!fix)
-	  return (Item*) 0;
+	  return NULL;
 	new_cond->argument_list()->push_back(fix);
         n_marked += test(item->marker == ICP_COND_USES_INDEX_ONLY);
       }
@@ -10072,7 +10098,15 @@ Item *make_cond_for_index(Item *cond, TA
   }
 
   if (!uses_index_fields_only(cond, table, keyno, other_tbls_ok))
-    return (Item*) 0;
+  {
+    /* 
+      Reset marker since it might have the value
+      ICP_COND_USES_INDEX_ONLY if this condition is part of the select
+      condition for multiple tables.
+    */
+    cond->marker= 0;
+    return NULL;
+  }
   cond->marker= ICP_COND_USES_INDEX_ONLY;
   return cond;
 }
@@ -10156,11 +10190,11 @@ Item *make_cond_remainder(Item *cond, bo
 static void push_index_cond(JOIN_TAB *tab, uint keyno, bool other_tbls_ok)
 {
   DBUG_ENTER("push_index_cond");
-  Item *idx_cond;
 
   /*
     We will only attempt to push down an index condition when the
     following criteria are true:
+    0. The table has a select condition
     1. The storage engine supports ICP.
     2. The system variable for enabling ICP is ON.
     3. The query is not a multi-table update or delete statement. The reason
@@ -10170,7 +10204,8 @@ static void push_index_cond(JOIN_TAB *ta
        when doing the update part and result in either not finding
        the record to update or updating the wrong record.
   */
-  if (tab->table->file->index_flags(keyno, 0, 1) &
+  if (tab->select_cond &&
+      tab->table->file->index_flags(keyno, 0, 1) &
       HA_DO_INDEX_COND_PUSHDOWN &&
       tab->join->thd->optimizer_switch_flag(OPTIMIZER_SWITCH_INDEX_CONDITION_PUSHDOWN) &&
       tab->join->thd->lex->sql_command != SQLCOM_UPDATE_MULTI &&
@@ -10178,8 +10213,8 @@ static void push_index_cond(JOIN_TAB *ta
   {
     DBUG_EXECUTE("where", print_where(tab->select_cond, "full cond",
                  QT_ORDINARY););
-    idx_cond= make_cond_for_index(tab->select_cond, tab->table, keyno,
-                                  other_tbls_ok);
+    Item *idx_cond= make_cond_for_index(tab->select_cond, tab->table, keyno,
+                                        other_tbls_ok);
     DBUG_EXECUTE("where", print_where(idx_cond, "idx cond", QT_ORDINARY););
     if (idx_cond)
     {

=== modified file 'sql/sql_table.cc'
--- a/sql/sql_table.cc	2010-12-17 18:43:38 +0000
+++ b/sql/sql_table.cc	2011-01-26 13:57:04 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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
@@ -4933,7 +4933,7 @@ err:
  
   @details Checks if any index is being modified (present as both DROP INDEX 
     and ADD INDEX) in the current ALTER TABLE statement. Needed for disabling 
-    online ALTER TABLE.
+    in-place ALTER TABLE.
   
   @param table       The table being altered
   @param alter_info  The ALTER TABLE structure
@@ -5050,7 +5050,7 @@ mysql_compare_tables(TABLE *table,
     like to keep mysql_compare_tables() idempotent (not altering any
     of the arguments) we create a copy of alter_info here and
     pass it to mysql_prepare_create_table, then use the result
-    to evaluate possibility of fast ALTER TABLE, and then
+    to evaluate possibility of in-place ALTER TABLE, and then
     destroy the copy.
   */
   Alter_info tmp_alter_info(*alter_info, thd->mem_root);
@@ -5091,9 +5091,9 @@ mysql_compare_tables(TABLE *table,
 
     There was a bug prior to mysql-4.0.25. Number of null fields was
     calculated incorrectly. As a result frm and data files gets out of
-    sync after fast alter table. There is no way to determine by which
+    sync after in-place alter table. There is no way to determine by which
     mysql version (in 4.0 and 4.1 branches) table was created, thus we
-    disable fast alter table for all tables created by mysql versions
+    disable in-place alter table for all tables created by mysql versions
     prior to 5.0 branch.
     See BUG#6236.
   */
@@ -5116,7 +5116,7 @@ mysql_compare_tables(TABLE *table,
   }
 
   /*
-    Use transformed info to evaluate possibility of fast ALTER TABLE
+    Use transformed info to evaluate possibility of in-place ALTER TABLE
     but use the preserved field to persist modifications.
   */
   new_field_it.init(alter_info->create_list);
@@ -5408,7 +5408,7 @@ blob_length_by_type(enum_field_types typ
   semantic checks.
 
   This function is invoked when we know that we're going to
-  perform ALTER TABLE via a temporary table -- i.e. fast ALTER TABLE
+  perform ALTER TABLE via a temporary table -- i.e. in-place ALTER TABLE
   is not possible, perhaps because the ALTER statement contains
   instructions that require change in table data, not only in
   table definition or indexes.
@@ -6305,7 +6305,7 @@ bool mysql_alter_table(THD *thd,char *ne
   }
 
   /*
-    If there are index changes only, try to do them online. "Index
+    If there are index changes only, try to do them in-place. "Index
     changes only" means also that the handler for the table does not
     change. The table is open and locked. The handler can be accessed.
   */
@@ -6313,8 +6313,8 @@ bool mysql_alter_table(THD *thd,char *ne
   {
     int   pk_changed= 0;
     ulong alter_flags= 0;
-    ulong needed_online_flags= 0;
-    ulong needed_fast_flags= 0;
+    ulong needed_inplace_with_read_flags= 0;
+    ulong needed_inplace_flags= 0;
     KEY   *key;
     uint  *idx_p;
     uint  *idx_end_p;
@@ -6338,8 +6338,8 @@ bool mysql_alter_table(THD *thd,char *ne
         {
           DBUG_PRINT("info", ("Dropping primary key"));
           /* Primary key. */
-          needed_online_flags|=  HA_ONLINE_DROP_PK_INDEX;
-          needed_fast_flags|= HA_ONLINE_DROP_PK_INDEX_NO_WRITES;
+          needed_inplace_with_read_flags|= HA_INPLACE_DROP_PK_INDEX_NO_WRITE;
+          needed_inplace_flags|= HA_INPLACE_DROP_PK_INDEX_NO_READ_WRITE;
           pk_changed++;
           candidate_key_count--;
         }
@@ -6349,8 +6349,9 @@ bool mysql_alter_table(THD *thd,char *ne
           bool is_candidate_key= true;
 
           /* Non-primary unique key. */
-          needed_online_flags|=  HA_ONLINE_DROP_UNIQUE_INDEX;
-          needed_fast_flags|= HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES;
+          needed_inplace_with_read_flags|=
+            HA_INPLACE_DROP_UNIQUE_INDEX_NO_WRITE;
+          needed_inplace_flags|= HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE;
 
           /*
             Check if all fields in key are declared
@@ -6369,12 +6370,13 @@ bool mysql_alter_table(THD *thd,char *ne
       else
       {
         /* Non-unique key. */
-        needed_online_flags|=  HA_ONLINE_DROP_INDEX;
-        needed_fast_flags|= HA_ONLINE_DROP_INDEX_NO_WRITES;
+        needed_inplace_with_read_flags|= HA_INPLACE_DROP_INDEX_NO_WRITE;
+        needed_inplace_flags|= HA_INPLACE_DROP_INDEX_NO_READ_WRITE;
       }
     }
     no_pk= ((table->s->primary_key == MAX_KEY) ||
-            (needed_online_flags & HA_ONLINE_DROP_PK_INDEX));
+            (needed_inplace_with_read_flags &
+             HA_INPLACE_DROP_PK_INDEX_NO_WRITE));
     /* Check added indexes. */
     for (idx_p= index_add_buffer, idx_end_p= idx_p + index_add_count;
          idx_p < idx_end_p;
@@ -6412,57 +6414,59 @@ bool mysql_alter_table(THD *thd,char *ne
         {
           DBUG_PRINT("info", ("Adding primary key"));
           /* Primary key. */
-          needed_online_flags|=  HA_ONLINE_ADD_PK_INDEX;
-          needed_fast_flags|= HA_ONLINE_ADD_PK_INDEX_NO_WRITES;
+          needed_inplace_with_read_flags|= HA_INPLACE_ADD_PK_INDEX_NO_WRITE;
+          needed_inplace_flags|= HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE;
           pk_changed++;
           no_pk= false;
         }
         else
         {
           /* Non-primary unique key. */
-          needed_online_flags|=  HA_ONLINE_ADD_UNIQUE_INDEX;
-          needed_fast_flags|= HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES;
+          needed_inplace_with_read_flags|= HA_INPLACE_ADD_UNIQUE_INDEX_NO_WRITE;
+          needed_inplace_flags|= HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE;
         }
       }
       else
       {
         /* Non-unique key. */
-        needed_online_flags|=  HA_ONLINE_ADD_INDEX;
-        needed_fast_flags|= HA_ONLINE_ADD_INDEX_NO_WRITES;
+        needed_inplace_with_read_flags|= HA_INPLACE_ADD_INDEX_NO_WRITE;
+        needed_inplace_flags|= HA_INPLACE_ADD_INDEX_NO_READ_WRITE;
       }
     }
 
-    if ((candidate_key_count > 0) && 
-        (needed_online_flags & HA_ONLINE_DROP_PK_INDEX))
+    if ((candidate_key_count > 0) &&
+        (needed_inplace_with_read_flags & HA_INPLACE_DROP_PK_INDEX_NO_WRITE))
     {
       /*
         Dropped primary key when there is some other unique 
         not null key that should be converted to primary key
       */
-      needed_online_flags|=  HA_ONLINE_ADD_PK_INDEX;
-      needed_fast_flags|= HA_ONLINE_ADD_PK_INDEX_NO_WRITES;
+      needed_inplace_with_read_flags|= HA_INPLACE_ADD_PK_INDEX_NO_WRITE;
+      needed_inplace_flags|= HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE;
       pk_changed= 2;
     }
 
-    DBUG_PRINT("info", ("needed_online_flags: 0x%lx, needed_fast_flags: 0x%lx",
-                        needed_online_flags, needed_fast_flags));
+    DBUG_PRINT("info",
+          ("needed_inplace_with_read_flags: 0x%lx, needed_inplace_flags: 0x%lx",
+           needed_inplace_with_read_flags, needed_inplace_flags));
     /*
-      Online or fast add/drop index is possible only if
+      In-place add/drop index is possible only if
       the primary key is not added and dropped in the same statement.
       Otherwise we have to recreate the table.
       need_copy_table is no-zero at this place.
     */
     if ( pk_changed < 2 )
     {
-      if ((alter_flags & needed_online_flags) == needed_online_flags)
+      if ((alter_flags & needed_inplace_with_read_flags) ==
+          needed_inplace_with_read_flags)
       {
-        /* All required online flags are present. */
+        /* All required in-place flags to allow concurrent reads are present. */
         need_copy_table= ALTER_TABLE_METADATA_ONLY;
         need_lock_for_indexes= FALSE;
       }
-      else if ((alter_flags & needed_fast_flags) == needed_fast_flags)
+      else if ((alter_flags & needed_inplace_flags) == needed_inplace_flags)
       {
-        /* All required fast flags are present. */
+        /* All required in-place flags are present. */
         need_copy_table= ALTER_TABLE_METADATA_ONLY;
       }
     }
@@ -6616,10 +6620,18 @@ bool mysql_alter_table(THD *thd,char *ne
   }
   else
   {
-    if (!table->s->tmp_table &&
+    /*
+      Ensure that we will upgrade the metadata lock if
+      handler::enable/disable_indexes() will be called.
+    */
+    if (alter_info->keys_onoff != LEAVE_AS_IS ||
+        table->file->indexes_are_disabled())
+      need_lock_for_indexes= true;
+    if (!table->s->tmp_table && need_lock_for_indexes &&
         wait_while_table_is_used(thd, table, HA_EXTRA_FORCE_REOPEN))
       goto err_new_table_cleanup;
     thd_proc_info(thd, "manage keys");
+    DEBUG_SYNC(thd, "alter_table_manage_keys");
     alter_table_manage_keys(table, table->file->indexes_are_disabled(),
                             alter_info->keys_onoff);
     error= trans_commit_stmt(thd);

=== modified file 'sql/table.cc'
--- a/sql/table.cc	2011-01-18 10:32:38 +0000
+++ b/sql/table.cc	2011-01-28 13:49:59 +0000
@@ -1,4 +1,4 @@
-/* Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
+/* 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

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2011-01-13 07:33:03 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2011-01-26 13:57:04 +0000
@@ -2790,11 +2790,12 @@ innobase_alter_table_flags(
 /*=======================*/
 	uint	flags)
 {
-	return(HA_ONLINE_ADD_INDEX_NO_WRITES
-		| HA_ONLINE_DROP_INDEX_NO_WRITES
-		| HA_ONLINE_ADD_UNIQUE_INDEX_NO_WRITES
-		| HA_ONLINE_DROP_UNIQUE_INDEX_NO_WRITES
-		| HA_ONLINE_ADD_PK_INDEX_NO_WRITES);
+	return(HA_INPLACE_ADD_INDEX_NO_READ_WRITE
+		| HA_INPLACE_ADD_INDEX_NO_WRITE
+		| HA_INPLACE_DROP_INDEX_NO_READ_WRITE
+		| HA_INPLACE_ADD_UNIQUE_INDEX_NO_READ_WRITE
+		| HA_INPLACE_DROP_UNIQUE_INDEX_NO_READ_WRITE
+		| HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE);
 }
 
 /*****************************************************************//**

=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc	2010-11-11 06:08:37 +0000
+++ b/storage/innobase/handler/handler0alter.cc	2011-01-26 13:57:04 +0000
@@ -1009,7 +1009,7 @@ convert_error:
 						    user_thd);
 	}
 
-	ut_a(innodb_table->n_ref_count == 1);
+	ut_a(!new_primary || innodb_table->n_ref_count == 1);
 
 	mem_heap_free(heap);
 	trx_commit_for_mysql(trx);

=== modified file 'storage/perfschema/ha_perfschema.cc'
--- a/storage/perfschema/ha_perfschema.cc	2010-12-01 18:46:51 +0000
+++ b/storage/perfschema/ha_perfschema.cc	2011-01-28 18:40:59 +0000
@@ -242,6 +242,7 @@ int ha_perfschema::update_row(const ucha
   DBUG_ENTER("ha_perfschema::update_row");
 
   DBUG_ASSERT(m_table);
+  ha_statistic_increment(&SSV::ha_update_count);
   int result= m_table->update_row(table, old_data, new_data, table->field);
   DBUG_RETURN(result);
 }
@@ -251,6 +252,7 @@ int ha_perfschema::delete_row(const ucha
   DBUG_ENTER("ha_perfschema::delete_row");
 
   DBUG_ASSERT(m_table);
+  ha_statistic_increment(&SSV::ha_delete_count);
   int result= m_table->delete_row(table, buf, table->field);
   DBUG_RETURN(result);
 }
@@ -287,6 +289,8 @@ int ha_perfschema::rnd_next(uchar *buf)
   DBUG_ENTER("ha_perfschema::rnd_next");
 
   DBUG_ASSERT(m_table);
+  ha_statistic_increment(&SSV::ha_read_rnd_next_count);
+
   int result= m_table->rnd_next();
   if (result == 0)
   {
@@ -311,6 +315,7 @@ int ha_perfschema::rnd_pos(uchar *buf, u
   DBUG_ENTER("ha_perfschema::rnd_pos");
 
   DBUG_ASSERT(m_table);
+  ha_statistic_increment(&SSV::ha_read_rnd_count);
   int result= m_table->rnd_pos(pos);
   if (result == 0)
     result= m_table->read_row(table, buf, table->field);

=== modified file 'storage/perfschema/pfs_column_types.h'
--- a/storage/perfschema/pfs_column_types.h	2010-12-09 16:17:13 +0000
+++ b/storage/perfschema/pfs_column_types.h	2011-01-28 12:49:11 +0000
@@ -135,7 +135,7 @@ enum enum_operation_type
   OPERATION_TYPE_TL_WRITE_LOW_PRIORITY= 37,
   OPERATION_TYPE_TL_WRITE_NORMAL= 38,
   OPERATION_TYPE_TL_READ_EXTERNAL= 39,
-  OPERATION_TYPE_TL_WRITE_EXTERNAL= 40,
+  OPERATION_TYPE_TL_WRITE_EXTERNAL= 40
 };
 #define FIRST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_LOCK))
 #define LAST_OPERATION_TYPE (static_cast<int> (OPERATION_TYPE_TL_WRITE_EXTERNAL))

=== modified file 'storage/perfschema/table_ews_by_thread_by_event_name.cc'
--- a/storage/perfschema/table_ews_by_thread_by_event_name.cc	2011-01-07 16:20:19 +0000
+++ b/storage/perfschema/table_ews_by_thread_by_event_name.cc	2011-01-28 13:40:57 +0000
@@ -115,120 +115,54 @@ void table_ews_by_thread_by_event_name::
 int table_ews_by_thread_by_event_name::rnd_next(void)
 {
   PFS_thread *thread;
-  PFS_mutex_class *mutex_class;
-  PFS_rwlock_class *rwlock_class;
-  PFS_cond_class *cond_class;
-  PFS_file_class *file_class;
-  PFS_instr_class *table_class;
+  PFS_instr_class *instr_class;
 
   for (m_pos.set_at(&m_next_pos);
-       m_pos.has_more_view();
-       m_pos.next_view())
+       m_pos.has_more_thread();
+       m_pos.next_thread())
   {
-    switch (m_pos.m_index_1)
-    {
-    case pos_ews_by_thread_by_event_name::VIEW_MUTEX:
-      do
-      {
-        mutex_class= find_mutex_class(m_pos.m_index_2);
-        if (mutex_class)
-        {
-          for ( ; m_pos.has_more_thread(); m_pos.next_thread())
-          {
-            thread= &thread_array[m_pos.m_index_3];
-            if (thread->m_lock.is_populated())
-            {
-              make_row(thread, mutex_class);
-              m_next_pos.set_after(&m_pos);
-              return 0;
-            }
-          }
-          m_pos.next_instrument();
-        }
-      } while (mutex_class != NULL);
-      break;
-    case pos_ews_by_thread_by_event_name::VIEW_RWLOCK:
-      do
-      {
-        rwlock_class= find_rwlock_class(m_pos.m_index_2);
-        if (rwlock_class)
-        {
-          for ( ; m_pos.has_more_thread(); m_pos.next_thread())
-          {
-            thread= &thread_array[m_pos.m_index_3];
-            if (thread->m_lock.is_populated())
-            {
-              make_row(thread, rwlock_class);
-              m_next_pos.set_after(&m_pos);
-              return 0;
-            }
-          }
-          m_pos.next_instrument();
-        }
-      } while (rwlock_class != NULL);
-      break;
-    case pos_ews_by_thread_by_event_name::VIEW_COND:
-      do
-      {
-        cond_class= find_cond_class(m_pos.m_index_2);
-        if (cond_class)
-        {
-          for ( ; m_pos.has_more_thread(); m_pos.next_thread())
-          {
-            thread= &thread_array[m_pos.m_index_3];
-            if (thread->m_lock.is_populated())
-            {
-              make_row(thread, cond_class);
-              m_next_pos.set_after(&m_pos);
-              return 0;
-            }
-          }
-          m_pos.next_instrument();
-        }
-      } while (cond_class != NULL);
-      break;
-    case pos_ews_by_thread_by_event_name::VIEW_FILE:
-      do
+    thread= &thread_array[m_pos.m_index_1];
+
+    /*
+      Important note: the thread scan is the outer loop (index 1),
+      to minimize the number of calls to atomic operations.
+    */
+    if (thread->m_lock.is_populated())
+    {
+      for ( ;
+           m_pos.has_more_view();
+           m_pos.next_view())
       {
-        file_class= find_file_class(m_pos.m_index_2);
-        if (file_class)
+        switch (m_pos.m_index_2)
         {
-          for ( ; m_pos.has_more_thread(); m_pos.next_thread())
-          {
-            thread= &thread_array[m_pos.m_index_3];
-            if (thread->m_lock.is_populated())
-            {
-              make_row(thread, file_class);
-              m_next_pos.set_after(&m_pos);
-              return 0;
-            }
-          }
-          m_pos.next_instrument();
+        case pos_ews_by_thread_by_event_name::VIEW_MUTEX:
+          instr_class= find_mutex_class(m_pos.m_index_3);
+          break;
+        case pos_ews_by_thread_by_event_name::VIEW_RWLOCK:
+          instr_class= find_rwlock_class(m_pos.m_index_3);
+          break;
+        case pos_ews_by_thread_by_event_name::VIEW_COND:
+          instr_class= find_cond_class(m_pos.m_index_3);
+          break;
+        case pos_ews_by_thread_by_event_name::VIEW_FILE:
+          instr_class= find_file_class(m_pos.m_index_3);
+          break;
+        case pos_ews_by_thread_by_event_name::VIEW_TABLE:
+          instr_class= find_table_class(m_pos.m_index_3);
+          break;
+        default:
+          DBUG_ASSERT(false);
+          instr_class= NULL;
+          break;
         }
-      } while (file_class != NULL);
-      break;
-    case pos_ews_by_thread_by_event_name::VIEW_TABLE:
-      do
-      {
-        table_class= find_table_class(m_pos.m_index_2);
-        if (table_class)
+
+        if (instr_class != NULL)
         {
-          for ( ; m_pos.has_more_thread(); m_pos.next_thread())
-          {
-            thread= &thread_array[m_pos.m_index_3];
-            if (thread->m_lock.is_populated())
-            {
-              make_row(thread, table_class);
-              m_next_pos.set_after(&m_pos);
-              return 0;
-            }
-          }
-          m_pos.next_instrument();
+          make_row(thread, instr_class);
+          m_next_pos.set_after(&m_pos);
+          return 0;
         }
-      } while (table_class != NULL);
-      break;
-    default:
-      break;
+      }
     }
   }
 
@@ -239,63 +173,42 @@ int
 table_ews_by_thread_by_event_name::rnd_pos(const void *pos)
 {
   PFS_thread *thread;
-  PFS_mutex_class *mutex_class;
-  PFS_rwlock_class *rwlock_class;
-  PFS_cond_class *cond_class;
-  PFS_file_class *file_class;
-  PFS_instr_class *table_class;
+  PFS_instr_class *instr_class;
 
   set_position(pos);
-  DBUG_ASSERT(m_pos.m_index_3 < thread_max);
+  DBUG_ASSERT(m_pos.m_index_1 < thread_max);
 
-  thread= &thread_array[m_pos.m_index_3];
+  thread= &thread_array[m_pos.m_index_1];
   if (! thread->m_lock.is_populated())
     return HA_ERR_RECORD_DELETED;
 
-  switch (m_pos.m_index_1)
+  switch (m_pos.m_index_2)
   {
   case pos_ews_by_thread_by_event_name::VIEW_MUTEX:
-    mutex_class= find_mutex_class(m_pos.m_index_2);
-    if (mutex_class)
-    {
-      make_row(thread, mutex_class);
-      return 0;
-    }
+    instr_class= find_mutex_class(m_pos.m_index_3);
     break;
   case pos_ews_by_thread_by_event_name::VIEW_RWLOCK:
-    rwlock_class= find_rwlock_class(m_pos.m_index_2);
-    if (rwlock_class)
-    {
-      make_row(thread, rwlock_class);
-      return 0;
-    }
+    instr_class= find_rwlock_class(m_pos.m_index_3);
     break;
   case pos_ews_by_thread_by_event_name::VIEW_COND:
-    cond_class= find_cond_class(m_pos.m_index_2);
-    if (cond_class)
-    {
-      make_row(thread, cond_class);
-      return 0;
-    }
+    instr_class= find_cond_class(m_pos.m_index_3);
     break;
   case pos_ews_by_thread_by_event_name::VIEW_FILE:
-    file_class= find_file_class(m_pos.m_index_2);
-    if (file_class)
-    {
-      make_row(thread, file_class);
-      return 0;
-    }
+    instr_class= find_file_class(m_pos.m_index_3);
     break;
   case pos_ews_by_thread_by_event_name::VIEW_TABLE:
-    table_class= find_table_class(m_pos.m_index_2);
-    if (table_class)
-    {
-      make_row(thread, table_class);
-      return 0;
-    }
+    instr_class= find_table_class(m_pos.m_index_3);
     break;
+  default:
+    DBUG_ASSERT(false);
+    instr_class= NULL;
   }
 
+  if (instr_class)
+  {
+    make_row(thread, instr_class);
+    return 0;
+  }
   return HA_ERR_RECORD_DELETED;
 }
 

=== modified file 'storage/perfschema/table_ews_by_thread_by_event_name.h'
--- a/storage/perfschema/table_ews_by_thread_by_event_name.h	2011-01-07 16:20:19 +0000
+++ b/storage/perfschema/table_ews_by_thread_by_event_name.h	2011-01-28 13:40:57 +0000
@@ -49,46 +49,41 @@ struct row_ews_by_thread_by_event_name
 /**
   Position of a cursor on
   PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_BY_THREAD_BY_EVENT_NAME.
-  Index 1 on instrument view
-  Index 2 on instrument class (1 based)
-  Index 3 on thread (0 based)
+  Index 1 on thread (0 based)
+  Index 2 on instrument view
+  Index 3 on instrument class (1 based)
 */
 struct pos_ews_by_thread_by_event_name
 : public PFS_triple_index, public PFS_instrument_view_constants
 {
   pos_ews_by_thread_by_event_name()
-    : PFS_triple_index(FIRST_VIEW, 1, 0)
+    : PFS_triple_index(0, FIRST_VIEW, 1)
   {}
 
   inline void reset(void)
   {
-    m_index_1= FIRST_VIEW;
-    m_index_2= 1;
-    m_index_3= 0;
+    m_index_1= 0;
+    m_index_2= FIRST_VIEW;
+    m_index_3= 1;
   }
 
-  inline bool has_more_view(void)
-  { return (m_index_1 <= LAST_VIEW); }
-
   inline bool has_more_thread(void)
-  { return (m_index_3 < thread_max); }
+  { return (m_index_1 < thread_max); }
 
-  inline void next_view(void)
+  inline void next_thread(void)
   {
     m_index_1++;
-    m_index_2= 1;
-    m_index_3= 0;
+    m_index_2= FIRST_VIEW;
+    m_index_3= 1;
   }
 
-  inline void next_instrument(void)
-  {
-    m_index_2++;
-    m_index_3= 0;
-  }
+  inline bool has_more_view(void)
+  { return (m_index_2 <= LAST_VIEW); }
 
-  inline void next_thread(void)
+  inline void next_view(void)
   {
-    m_index_3++;
+    m_index_2++;
+    m_index_3= 1;
   }
 };
 

=== modified file 'storage/perfschema/table_ews_global_by_event_name.h'
--- a/storage/perfschema/table_ews_global_by_event_name.h	2011-01-07 16:20:19 +0000
+++ b/storage/perfschema/table_ews_global_by_event_name.h	2011-01-28 13:40:57 +0000
@@ -71,11 +71,6 @@ struct pos_ews_global_by_event_name
     m_index_1++;
     m_index_2= 1;
   }
-
-  inline void next_instrument(void)
-  {
-    m_index_2++;
-  }
 };
 
 /** Table PERFORMANCE_SCHEMA.EVENTS_WAITS_SUMMARY_GLOBAL_BY_EVENT_NAME. */

=== modified file 'storage/perfschema/table_setup_instruments.cc'
--- a/storage/perfschema/table_setup_instruments.cc	2010-12-09 16:17:13 +0000
+++ b/storage/perfschema/table_setup_instruments.cc	2011-01-26 09:34:10 +0000
@@ -85,7 +85,7 @@ void table_setup_instruments::reset_posi
 
 int table_setup_instruments::rnd_next(void)
 {
-  PFS_instr_class *instr_class;
+  PFS_instr_class *instr_class= NULL;
 
   for (m_pos.set_at(&m_next_pos);
        m_pos.has_more_view();
@@ -104,7 +104,6 @@ int table_setup_instruments::rnd_next(vo
       break;
     case pos_setup_instruments::VIEW_THREAD:
       /* Not used yet  */
-      instr_class= NULL;
       break;
     case pos_setup_instruments::VIEW_FILE:
       instr_class= find_file_class(m_pos.m_index_2);
@@ -126,7 +125,7 @@ int table_setup_instruments::rnd_next(vo
 
 int table_setup_instruments::rnd_pos(const void *pos)
 {
-  PFS_instr_class *instr_class;
+  PFS_instr_class *instr_class= NULL;
 
   set_position(pos);
 
@@ -143,7 +142,6 @@ int table_setup_instruments::rnd_pos(con
     break;
   case pos_setup_instruments::VIEW_THREAD:
     /* Not used yet */
-    instr_class= NULL;
     break;
   case pos_setup_instruments::VIEW_FILE:
     instr_class= find_file_class(m_pos.m_index_2);

=== modified file 'unittest/gunit/mdl-t.cc'
--- a/unittest/gunit/mdl-t.cc	2010-12-23 11:03:09 +0000
+++ b/unittest/gunit/mdl-t.cc	2011-01-27 15:31:18 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Sun Microsystems, Inc.
+/* Copyright (c) 2009, 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
@@ -15,9 +15,9 @@
 
 /**
    This is a unit test for the 'meta data locking' classes.
-   It is written to illustrate how we can use googletest for unit testing
+   It is written to illustrate how we can use Google Test for unit testing
    of MySQL code.
-   For documentation on googletest, see http://code.google.com/p/googletest/
+   For documentation on Google Test, see http://code.google.com/p/googletest/
    and the contained wiki pages GoogleTestPrimer and GoogleTestAdvancedGuide.
    The code below should hopefully be (mostly) self-explanatory.
  */
@@ -32,32 +32,13 @@
 
 #include "thr_malloc.h"
 #include "thread_utils.h"
+#include "test_mdl_context_owner.h"
 
 pthread_key(MEM_ROOT**,THR_MALLOC);
 pthread_key(THD*, THR_THD);
 mysql_mutex_t LOCK_open;
 uint    opt_debug_sync_timeout= 0;
 
-static mysql_mutex_t *current_mutex= NULL;
-extern "C"
-const char* thd_enter_cond(MYSQL_THD thd, mysql_cond_t *cond,
-                           mysql_mutex_t *mutex, const char *msg)
-{
-  current_mutex= mutex;
-  return NULL;
-}
-
-extern "C"
-void thd_exit_cond(MYSQL_THD thd, const char *old_msg)
-{
-  mysql_mutex_unlock(current_mutex);
-}
-
-extern "C" int thd_killed(const MYSQL_THD thd)
-{
-  return 0;
-}
-
 /*
   A mock error handler.
 */
@@ -76,50 +57,6 @@ extern "C" void sql_alloc_error_handler(
   ADD_FAILURE();
 }
 
-namespace {
-bool notify_thread(THD*);
-}
-
-/*
-  We need to mock away this global function, because the real version
-  pulls in a lot of dependencies.
-  (The @note for the real version of this function indicates that the
-  coupling between THD and MDL is too tight.)
-   @retval  TRUE  if the thread was woken up
-   @retval  FALSE otherwise.
-*/
-bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
-                                            bool needs_thr_lock_abort)
-{
-  if (in_use != NULL)
-    return notify_thread(in_use);
-  return FALSE;
-}
-
-/*
-  Mock away this function as well, with an empty function.
-  @todo didrik: Consider verifying that the MDL module actually calls
-  this with correct arguments.
-*/
-void mysql_ha_flush(THD *)
-{
-  DBUG_PRINT("mysql_ha_flush", ("mock version"));
-}
-
-/*
-  We need to mock away this global function, the real version pulls in
-  too many dependencies.
- */
-extern "C" const char *set_thd_proc_info(void *thd, const char *info,
-                                         const char *calling_function,
-                                         const char *calling_file,
-                                         const unsigned int calling_line)
-{
-  DBUG_PRINT("proc_info", ("%s:%d  %s", calling_file, calling_line,
-                           (info != NULL) ? info : "(null)"));
-  return info;
-}
-
 /*
   Mock away this global function.
   We don't need DEBUG_SYNC functionality in a unit test.
@@ -148,12 +85,11 @@ const ulong zero_timeout= 0;
 const ulong long_timeout= (ulong) 3600L*24L*365L;
 
 
-class MDLTest : public ::testing::Test
+class MDLTest : public ::testing::Test, public Test_MDL_context_owner
 {
 protected:
   MDLTest()
-  : m_thd(NULL),
-    m_null_ticket(NULL),
+  : m_null_ticket(NULL),
     m_null_request(NULL)
   {
   }
@@ -167,7 +103,7 @@ protected:
   {
     expected_error= 0;
     mdl_init();
-    m_mdl_context.init(m_thd);
+    m_mdl_context.init(this);
     EXPECT_FALSE(m_mdl_context.has_locks());
     m_global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
                           MDL_TRANSACTION);
@@ -179,10 +115,15 @@ protected:
     mdl_destroy();
   }
 
+  virtual bool notify_shared_lock(MDL_context_owner *in_use,
+                                  bool needs_thr_lock_abort)
+  {
+    return in_use->notify_shared_lock(NULL, needs_thr_lock_abort);
+  }
+
   // A utility member for testing single lock requests.
   void test_one_simple_shared_lock(enum_mdl_type lock_type);
 
-  THD               *m_thd;
   const MDL_ticket  *m_null_ticket;
   const MDL_request *m_null_request;
   MDL_context        m_mdl_context;
@@ -199,7 +140,7 @@ private:
   The two notifications are for synchronizing with the main thread.
   Does *not* take ownership of the notifications.
 */
-class MDL_thread : public Thread
+class MDL_thread : public Thread, public Test_MDL_context_owner
 {
 public:
   MDL_thread(const char   *table_name,
@@ -212,8 +153,7 @@ public:
     m_release_locks(release_locks),
     m_ignore_notify(false)
   {
-    m_thd= reinterpret_cast<THD*>(this);    // See notify_thread below.
-    m_mdl_context.init(m_thd);
+    m_mdl_context.init(this);
   }
 
   ~MDL_thread()
@@ -224,8 +164,12 @@ public:
   virtual void run();
   void ignore_notify() { m_ignore_notify= true; }
 
-  bool notify()
+  virtual bool notify_shared_lock(MDL_context_owner *in_use,
+                                  bool needs_thr_lock_abort)
   {
+    if (in_use)
+      return in_use->notify_shared_lock(NULL, needs_thr_lock_abort);
+
     if (m_ignore_notify)
       return false;
     m_release_locks->notify();
@@ -238,19 +182,10 @@ private:
   Notification  *m_lock_grabbed;
   Notification  *m_release_locks;
   bool           m_ignore_notify;
-  THD           *m_thd;
   MDL_context    m_mdl_context;
 };
 
 
-// Admittedly an ugly hack, to avoid pulling in the THD in this unit test.
-bool notify_thread(THD *thd)
-{
-  MDL_thread *thread = (MDL_thread*) thd;
-  return thread->notify();
-}
-
-
 void MDL_thread::run()
 {
   MDL_request request;
@@ -277,7 +212,7 @@ void MDL_thread::run()
   m_mdl_context.release_transactional_locks();
 }
 
-// googletest recommends DeathTest suffix for classes use in death tests.
+// Google Test recommends DeathTest suffix for classes use in death tests.
 typedef MDLTest MDLDeathTest;
 
 
@@ -438,9 +373,8 @@ TEST_F(MDLTest, TwoShared)
  */
 TEST_F(MDLTest, SharedLocksBetweenContexts)
 {
-  THD         *thd2= (THD*) this;
   MDL_context  mdl_context2;
-  mdl_context2.init(thd2);
+  mdl_context2.init(this);
   MDL_request request_2;
   m_request.init(MDL_key::TABLE, db_name, table_name1, MDL_SHARED,
                  MDL_TRANSACTION);

=== modified file 'unittest/gunit/mdl_mytap-t.cc'
--- a/unittest/gunit/mdl_mytap-t.cc	2010-12-23 11:03:09 +0000
+++ b/unittest/gunit/mdl_mytap-t.cc	2011-01-27 15:31:18 +0000
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009 Sun Microsystems, Inc.
+/* Copyright (c) 2009, 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
@@ -14,9 +14,9 @@
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA */
 
 /**
-   This is a port of the corresponding mdl_test.cc (written for googletest)
+   This is a port of the corresponding mdl_test.cc (written for Google Test)
    to mytap. Do a 'tkdiff mdl-t.cc mdl_mytap-t.cc' to see the differences.
-   In order to illustrate (some of) the features of googletest, I have
+   In order to illustrate (some of) the features of Google Test, I have
    added some extensions below, notably support for reporting of line
    numbers in case of failures.
  */
@@ -35,34 +35,14 @@
 
 #include "thr_malloc.h"
 #include "thread_utils.h"
+#include "test_mdl_context_owner.h"
 
 pthread_key(MEM_ROOT**,THR_MALLOC);
 pthread_key(THD*, THR_THD);
 mysql_mutex_t LOCK_open;
 uint    opt_debug_sync_timeout= 0;
 
-static mysql_mutex_t *current_mutex= NULL;
-extern "C"
-const char* thd_enter_cond(MYSQL_THD thd, mysql_cond_t *cond,
-                           mysql_mutex_t *mutex, const char *msg)
-{
-  current_mutex= mutex;
-  return NULL;
-}
-
-extern "C"
-void thd_exit_cond(MYSQL_THD thd, const char *old_msg)
-{
-  mysql_mutex_unlock(current_mutex);
-}
-
-extern "C" int thd_killed(const MYSQL_THD thd)
-{
-  return 0;
-}
-
-
-// Reimplemented some macros from googletest, so that the tests below
+// Reimplemented some macros from Google Test, so that the tests below
 // could be kept unchanged.  No support for streaming of user messages
 // in this simplified version.
 void print_message(const char* file, int line, const char* message)
@@ -132,50 +112,6 @@ extern "C" void sql_alloc_error_handler(
   FAIL();
 }
 
-namespace {
-bool notify_thread(THD*);
-}
-
-/*
-  We need to mock away this global function, because the real version
-  pulls in a lot of dependencies.
-  (The @note for the real version of this function indicates that the
-  coupling between THD and MDL is too tight.)
-   @retval  TRUE  if the thread was woken up
-   @retval  FALSE otherwise.
-*/
-bool mysql_notify_thread_having_shared_lock(THD *thd, THD *in_use,
-                                            bool needs_thr_lock_abort)
-{
-  if (in_use != NULL)
-    return notify_thread(in_use);
-  return FALSE;
-}
-
-/*
-  Mock away this function as well, with an empty function.
-  @todo didrik: Consider verifying that the MDL module actually calls
-  this with correct arguments.
-*/
-void mysql_ha_flush(THD *)
-{
-  DBUG_PRINT("mysql_ha_flush", ("mock version"));
-}
-
-/*
-  We need to mock away this global function, the real version pulls in
-  too many dependencies.
- */
-extern "C" const char *set_thd_proc_info(void *thd, const char *info,
-                                         const char *calling_function,
-                                         const char *calling_file,
-                                         const unsigned int calling_line)
-{
-  DBUG_PRINT("proc_info", ("%s:%d  %s", calling_file, calling_line,
-                           (info != NULL) ? info : "(null)"));
-  return info;
-}
-
 /*
   Mock away this global function.
   We don't need DEBUG_SYNC functionality in a unit test.
@@ -204,7 +140,7 @@ const ulong zero_timeout= 0;
 const ulong long_timeout= (ulong) 3600L*24L*365L;
 
 
-class MDLTest
+class MDLTest : public Test_MDL_context_owner
 {
 public:
   // Utility function to run one test case.
@@ -216,8 +152,7 @@ public:
 
 protected:
   MDLTest()
-  : m_thd(NULL),
-    m_null_ticket(NULL),
+  : m_null_ticket(NULL),
     m_null_request(NULL)
   {
   }
@@ -231,7 +166,7 @@ protected:
   {
     expected_error= 0;
     mdl_init();
-    m_mdl_context.init(m_thd);
+    m_mdl_context.init(this);
     EXPECT_FALSE(m_mdl_context.has_locks());
     m_global_request.init(MDL_key::GLOBAL, "", "", MDL_INTENTION_EXCLUSIVE,
                           MDL_TRANSACTION);
@@ -243,6 +178,12 @@ protected:
     mdl_destroy();
   }
 
+  virtual bool notify_shared_lock(MDL_context_owner *in_use,
+                                  bool needs_thr_lock_abort)
+  {
+    return in_use->notify_shared_lock(NULL, needs_thr_lock_abort);
+  }
+
   // A utility member for testing single lock requests.
   void test_one_simple_shared_lock(enum_mdl_type lock_type);
 
@@ -265,7 +206,6 @@ protected:
   void ConcurrentExclusiveShared();
   void ConcurrentUpgrade();
 
-  THD               *m_thd;
   const MDL_ticket  *m_null_ticket;
   const MDL_request *m_null_request;
   MDL_context        m_mdl_context;
@@ -282,7 +222,7 @@ private:
   The two notifications are for synchronizing with the main thread.
   Does *not* take ownership of the notifications.
 */
-class MDL_thread : public Thread
+class MDL_thread : public Thread, public Test_MDL_context_owner
 {
 public:
   MDL_thread(const char   *table_name,
@@ -295,8 +235,7 @@ public:
     m_release_locks(release_locks),
     m_ignore_notify(false)
   {
-    m_thd= reinterpret_cast<THD*>(this);    // See notify_thread below.
-    m_mdl_context.init(m_thd);
+    m_mdl_context.init(this);
   }
 
   ~MDL_thread()
@@ -307,8 +246,12 @@ public:
   virtual void run();
   void ignore_notify() { m_ignore_notify= true; }
 
-  bool notify()
+  virtual bool notify_shared_lock(MDL_context_owner *in_use,
+                                  bool needs_thr_lock_abort)
   {
+    if (in_use)
+      return in_use->notify_shared_lock(NULL, needs_thr_lock_abort);
+
     if (m_ignore_notify)
       return false;
     m_release_locks->notify();
@@ -321,19 +264,10 @@ private:
   Notification  *m_lock_grabbed;
   Notification  *m_release_locks;
   bool           m_ignore_notify;
-  THD           *m_thd;
   MDL_context    m_mdl_context;
 };
 
 
-// Admittedly an ugly hack, to avoid pulling in the THD in this unit test.
-bool notify_thread(THD *thd)
-{
-  MDL_thread *thread = (MDL_thread*) thd;
-  return thread->notify();
-}
-
-
 void MDL_thread::run()
 {
   MDL_request request;
@@ -360,7 +294,7 @@ void MDL_thread::run()
   m_mdl_context.release_transactional_locks();
 }
 
-// googletest recommends DeathTest suffix for classes use in death tests.
+// Google Test recommends DeathTest suffix for classes use in death tests.
 typedef MDLTest MDLDeathTest;
 
 // Our own (simplified) version of the TEST_F macro.
@@ -506,9 +440,8 @@ TEST_F(MDLTest, TwoShared)
  */
 TEST_F(MDLTest, SharedLocksBetweenContexts)
 {
-  THD         *thd2= (THD*) this;
   MDL_context  mdl_context2;
-  mdl_context2.init(thd2);
+  mdl_context2.init(this);
   MDL_request request_2;
   m_request.init(MDL_key::TABLE, db_name, table_name1, MDL_SHARED,
                  MDL_TRANSACTION);

=== added file 'unittest/gunit/test_mdl_context_owner.h'
--- a/unittest/gunit/test_mdl_context_owner.h	1970-01-01 00:00:00 +0000
+++ b/unittest/gunit/test_mdl_context_owner.h	2011-01-27 15:31:18 +0000
@@ -0,0 +1,48 @@
+/* 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 TEST_MDL_CONTEXT_OWNER_INCLUDED
+#define TEST_MDL_CONTEXT_OWNER_INCLUDED
+
+#include <mdl.h>
+#include <my_pthread.h>
+
+class Test_MDL_context_owner : public MDL_context_owner
+{
+public:
+  Test_MDL_context_owner()
+    : m_current_mutex(NULL)
+  {}
+  virtual const char* enter_cond(mysql_cond_t *cond,
+                                 mysql_mutex_t* mutex,
+                                 const char* msg)
+  {
+    m_current_mutex= mutex;
+    return NULL;
+  }
+
+  virtual void exit_cond(const char* old_msg)
+  {
+    mysql_mutex_unlock(m_current_mutex);
+  }
+
+  virtual int  is_killed() { return 0; }
+  virtual THD* get_thd()   { return NULL; }
+
+private:
+  mysql_mutex_t *m_current_mutex;
+};
+
+#endif  // TEST_MDL_CONTEXT_OWNER_INCLUDED

No bundle (reason: revision is a merge).
Thread
bzr commit into mysql-trunk-mtr branch (bjorn.munch:3020) Bjorn Munch29 Jan