List:Commits« Previous MessageNext Message »
From:marko.makela Date:April 10 2012 8:09am
Subject:bzr push into mysql-trunk-wl5545 branch (marko.makela:3884 to 3885)
View as plain text  
 3885 Marko Mäkelä	2012-04-10 [merge]
      Merge mysql-trunk to mysql-trunk-wl5534.

    removed:
      mysql-test/suite/rpl/t/rpl_report_port-slave.opt
    added:
      mysql-test/r/partition_locking_4.result
      mysql-test/t/partition_locking_4.test
    modified:
      libmysqld/lib_sql.cc
      mysql-test/collections/default.push
      mysql-test/mysql-test-run.pl
      mysql-test/suite/perfschema/include/digest_cleanup.inc
      mysql-test/suite/perfschema/include/digest_execution.inc
      mysql-test/suite/perfschema/include/digest_setup.inc
      mysql-test/suite/perfschema/r/digest_table_full.result
      mysql-test/suite/perfschema/r/start_server_no_digests.result
      mysql-test/suite/perfschema/r/statement_digest.result
      mysql-test/suite/perfschema/r/statement_digest_charset.result
      mysql-test/suite/perfschema/r/statement_digest_consumers.result
      mysql-test/suite/perfschema/r/statement_digest_consumers2.result
      mysql-test/suite/perfschema/t/statement_digest_charset.test
      mysql-test/suite/rpl/r/rpl_corruption.result
      mysql-test/suite/rpl/r/rpl_master_pos_wait.result
      mysql-test/suite/rpl/r/rpl_report_port.result
      mysql-test/suite/rpl/t/rpl_corruption.test
      mysql-test/suite/rpl/t/rpl_master_pos_wait.test
      mysql-test/suite/rpl/t/rpl_report_port.test
      mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test
      mysql-test/t/disabled.def
      sql/opt_explain_json.cc
      sql/table.cc
      storage/innobase/dict/dict0boot.cc
      storage/innobase/dict/dict0crea.cc
      storage/innobase/dict/dict0load.cc
      storage/innobase/fts/fts0fts.cc
      storage/innobase/fts/fts0que.cc
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/ha_innodb.h
      storage/innobase/handler/handler0alter.cc
      storage/innobase/handler/i_s.cc
      storage/innobase/include/dict0boot.h
      storage/innobase/include/dict0crea.h
      storage/innobase/include/dict0load.h
      storage/innobase/include/fts0priv.h
      storage/innobase/include/ut0vec.ic
      storage/innobase/os/os0file.cc
      storage/perfschema/pfs_digest.cc
 3884 Marko MäkelCK=EXCLUSIVE is specified,
      do not allocate the modification log for online index creation.

    modified:
      mysql-test/suite/innodb/r/innodb-index-online.result
      mysql-test/suite/innodb/t/innodb-index-online.test
      storage/innobase/handler/handler0alter.cc
=== modified file 'libmysqld/lib_sql.cc'
--- a/libmysqld/lib_sql.cc	revid:marko.makela@strippedvkdms4
+++ b/libmysqld/lib_sql.cc	revid:marko.makela@oracle.com-20120410080813-a3ezlp38lna1gv37
@@ -349,6 +349,8 @@ static int emb_stmt_execute(MYSQL_STMT *
     set_stmt_errmsg(stmt, net);
     DBUG_RETURN(1);
   }
+  else if (stmt->mysql->status == MYSQL_STATUS_GET_RESULT)
+           stmt->mysql->status= MYSQL_STATUS_STATEMENT_GET_RESULT;
   DBUG_RETURN(0);
 }
 

=== modified file 'mysql-test/collections/default.push'
--- a/mysql-test/collections/default.push	revid:marko.makela@strippedaj6c6vqw7vkdms4
+++ b/mysql-test/collections/default.push	revid:marko.makela@stripped1gv37
@@ -2,4 +2,5 @@ perl mysql-test-run.pl --timer --force -
 perl mysql-test-run.pl --timer --force --parallel=auto --comment=main_ps_row --vardir=var-main-ps_row --suite=main --ps-protocol --mysqld=--binlog-format=row --experimental=collections/default.experimental --skip-ndb --skip-test-list=collections/disabled-per-push.list
 perl mysql-test-run.pl --timer --force --parallel=auto --comment=main_embedded --vardir=var-main_emebbed  --suite=main --embedded --experimental=collections/default.experimental --skip-ndb
 perl mysql-test-run.pl --timer --force --parallel=auto --comment=innodb_4k_size --vardir=var-innodb-4k --experimental=collections/default.experimental --skip-ndb --suite=innodb --mysqld=--innodb-page-size=4k
-perl mysql-test-run.pl --timer --force --comment=explain-json --vardir=var-explain-json  --suite=explain_json_validate 
+perl mysql-test-run.pl --timer --force --comment=explain-json --vardir=var-explain-json  --suite=explain_json_validate
+perl mysql-test-run.pl --force --timer --parallel=auto --experimental=collections/default.experimental --comment=partitions --vardir=var-parts      --suite=parts 

=== modified file 'mysql-test/mysql-test-run.pl'
--- a/mysql-test/mysql-test-run.pl	revid:marko.makela@stripped120407140247-yaj6c6vqw7vkdms4
+++ b/mysql-test/mysql-test-run.pl	revid:marko.makela@strippedlp38lna1gv37
@@ -3901,6 +3901,8 @@ sub resfile_report_test ($) {
 sub run_testcase ($) {
   my $tinfo=  shift;
 
+  my $print_freq=20;
+
   mtr_verbose("Running test:", $tinfo->{name});
   resfile_report_test($tinfo) if $opt_resfile;
 
@@ -4059,6 +4061,7 @@ sub run_testcase ($) {
   my $test= start_mysqltest($tinfo);
   # Set only when we have to keep waiting after expectedly died server
   my $keep_waiting_proc = 0;
+  my $print_timeout= start_timer($print_freq * 60);
 
   while (1)
   {
@@ -4083,7 +4086,22 @@ sub run_testcase ($) {
     }
     if (! $keep_waiting_proc)
     {
-      $proc= My::SafeProcess->wait_any_timeout($test_timeout);
+      if($test_timeout > $print_timeout)
+      {
+         $proc= My::SafeProcess->wait_any_timeout($print_timeout);
+         if ( $proc->{timeout} )
+         {
+            #print out that the test is still on
+            mtr_print("Test still running: $tinfo->{name}");
+            #reset the timer
+            $print_timeout= start_timer($print_freq * 60);
+            next;
+         }
+      }
+      else
+      {
+         $proc= My::SafeProcess->wait_any_timeout($test_timeout);
+      }
     }
 
     # Will be restored if we need to keep waiting

=== added file 'mysql-test/r/partition_locking_4.result'
--- a/mysql-test/r/partition_locking_4.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/r/partition_locking_4.result	revid:marko.makela@stripped10080813-a3ezlp38lna1gv37
@@ -0,0 +1,183 @@
+# Original tests for WL#4443
+# Must have InnoDB as engine to get the same statistics results.
+# embedded uses MyISAM as default. CREATE SELECT uses the default engine.
+SET @old_default_storage_engine = @@global.default_storage_engine;
+SET @@global.default_storage_engine = 'InnoDB';
+SET @old_autocommit = @@global.autocommit;
+SET @@global.autocommit = 0;
+SET @old_lock_wait_timeout= @@global.lock_wait_timeout;
+SET @@global.lock_wait_timeout = 1;
+SET @old_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout = 1;
+SET @old_wait_timeout= @@global.wait_timeout;
+SET @@global.wait_timeout= 1;
+USE test;
+CREATE USER 'mysqltest1'@'localhost';
+CREATE USER 'mysqltest2'@'localhost';
+GRANT ALL PRIVILEGES ON test.* TO 'mysqltest1'@'localhost';
+GRANT ALL PRIVILEGES ON test.* TO 'mysqltest2'@'localhost';
+CREATE TABLE t1 (a int PRIMARY KEY, b varchar(128), KEY (b))
+ENGINE = InnoDB
+PARTITION BY HASH (a) PARTITIONS 13;
+CREATE TABLE t2 (a int PRIMARY KEY AUTO_INCREMENT, b varchar(128))
+ENGINE = InnoDB
+PARTITION BY HASH (a) PARTITIONS 13;
+INSERT INTO t1 VALUES (0, 'First row, p0');
+INSERT INTO t1 VALUES (1, 'First row, p1');
+INSERT INTO t1 VALUES (2, 'First row, p2');
+INSERT INTO t1 VALUES (3, 'First row, p3');
+INSERT INTO t1 VALUES (4, 'First row, p4');
+INSERT INTO t1 VALUES (5, 'First row, p5');
+INSERT INTO t1 VALUES (6, 'First row, p6');
+INSERT INTO t1 VALUES (7, 'First row, p7');
+INSERT INTO t1 VALUES (8, 'First row, p8');
+INSERT INTO t1 VALUES (9, 'First row, p9');
+INSERT INTO t1 VALUES (10, 'First row, p10');
+INSERT INTO t1 VALUES (11, 'First row, p11');
+INSERT INTO t1 VALUES (12, 'First row, p12');
+connect  test1,localhost,mysqltest1,,test;
+connect  test2,localhost,mysqltest2,,test;
+#
+#
+# Test insert
+#
+connection default;
+FLUSH STATUS;
+connection test1;
+INSERT INTO t1 PARTITION (p12) VALUES (26+12, 'third row, p12');
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
+WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
+VARIABLE_NAME	VARIABLE_VALUE
+HANDLER_COMMIT	1
+HANDLER_EXTERNAL_LOCK	4
+HANDLER_WRITE	18
+SELECT * FROM t1 ORDER BY a;
+a	b
+0	First row, p0
+1	First row, p1
+2	First row, p2
+3	First row, p3
+4	First row, p4
+5	First row, p5
+6	First row, p6
+7	First row, p7
+8	First row, p8
+9	First row, p9
+10	First row, p10
+11	First row, p11
+12	First row, p12
+38	third row, p12
+connection default;
+FLUSH STATUS;
+connection test2;
+INSERT INTO t1 VALUES (13+0, 'Second row, p0');
+INSERT INTO t1 VALUES (13+1, 'Second row, p1');
+INSERT INTO t1 VALUES (13+2, 'Second row, p2');
+INSERT INTO t1 VALUES (13+3, 'Second row, p3');
+INSERT INTO t1 VALUES (13+4, 'Second row, p4');
+INSERT INTO t1 VALUES (13+5, 'Second row, p5');
+INSERT INTO t1 VALUES (13+6, 'Second row, p6');
+INSERT INTO t1 VALUES (13+7, 'Second row, p7');
+INSERT INTO t1 VALUES (13+8, 'Second row, p8');
+INSERT INTO t1 VALUES (13+9, 'Second row, p9');
+INSERT INTO t1 VALUES (13+10, 'Second row, p10');
+INSERT INTO t1 VALUES (13+11, 'Second row, p11');
+INSERT INTO t1 VALUES (13+12, 'Second row, p12');
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
+WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
+VARIABLE_NAME	VARIABLE_VALUE
+HANDLER_COMMIT	13
+HANDLER_EXTERNAL_LOCK	52
+HANDLER_WRITE	30
+SELECT * FROM t1 ORDER BY a;
+a	b
+0	First row, p0
+1	First row, p1
+2	First row, p2
+3	First row, p3
+4	First row, p4
+5	First row, p5
+6	First row, p6
+7	First row, p7
+8	First row, p8
+9	First row, p9
+10	First row, p10
+11	First row, p11
+12	First row, p12
+13	Second row, p0
+14	Second row, p1
+15	Second row, p2
+16	Second row, p3
+17	Second row, p4
+18	Second row, p5
+19	Second row, p6
+20	Second row, p7
+21	Second row, p8
+22	Second row, p9
+23	Second row, p10
+24	Second row, p11
+25	Second row, p12
+connection default;
+FLUSH STATUS;
+connection test1;
+SELECT * FROM INFORMATION_SCHEMA.SESSION_STATUS
+WHERE VARIABLE_NAME LIKE 'HANDLER_%' AND VARIABLE_VALUE > 0;
+VARIABLE_NAME	VARIABLE_VALUE
+HANDLER_COMMIT	2
+HANDLER_EXTERNAL_LOCK	32
+HANDLER_READ_FIRST	13
+HANDLER_READ_KEY	13
+HANDLER_READ_NEXT	14
+HANDLER_READ_RND_NEXT	19
+HANDLER_WRITE	36
+connection default;
+SELECT * FROM t1 PARTITION (p0) ORDER BY a;
+a	b
+0	First row, p0
+SELECT * FROM t1 PARTITION (p1) ORDER BY a;
+a	b
+1	First row, p1
+SELECT * FROM t1 PARTITION (p2) ORDER BY a;
+a	b
+2	First row, p2
+SELECT * FROM t1 PARTITION (p3) ORDER BY a;
+a	b
+3	First row, p3
+SELECT * FROM t1 PARTITION (p4) ORDER BY a;
+a	b
+4	First row, p4
+SELECT * FROM t1 PARTITION (p5) ORDER BY a;
+a	b
+5	First row, p5
+SELECT * FROM t1 PARTITION (p6) ORDER BY a;
+a	b
+6	First row, p6
+SELECT * FROM t1 PARTITION (p7) ORDER BY a;
+a	b
+7	First row, p7
+SELECT * FROM t1 PARTITION (p8) ORDER BY a;
+a	b
+8	First row, p8
+SELECT * FROM t1 PARTITION (p9) ORDER BY a;
+a	b
+9	First row, p9
+SELECT * FROM t1 PARTITION (p10) ORDER BY a;
+a	b
+10	First row, p10
+SELECT * FROM t1 PARTITION (p11) ORDER BY a;
+a	b
+11	First row, p11
+SELECT * FROM t1 PARTITION (p12) ORDER BY a;
+a	b
+12	First row, p12
+FLUSH STATUS;
+connection test1;
+connection default;
+DROP TABLE t1, t2;
+DROP USER 'mysqltest1'@'localhost';
+DROP USER 'mysqltest2'@'localhost';
+SET @@global.default_storage_engine= @old_default_storage_engine;
+SET @@global.autocommit = @old_autocommit;
+SET @@global.lock_wait_timeout= @old_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout= @old_innodb_lock_wait_timeout;
+SET @@global.wait_timeout= @old_wait_timeout;

=== modified file 'mysql-test/suite/perfschema/include/digest_cleanup.inc'
--- a/mysql-test/suite/perfschema/include/digest_cleanup.inc	revid:marko.makela@stripped
+++ b/mysql-test/suite/perfschema/include/digest_cleanup.inc	revid:marko.makela@stripped7
@@ -7,5 +7,6 @@ DROP TABLE IF EXISTS t2;
 DROP TABLE IF EXISTS t3;
 DROP TABLE IF EXISTS t4;
 DROP TABLE IF EXISTS t5;
+DROP TABLE IF EXISTS t6;
 DROP DATABASE IF EXISTS statements_digest;
 --enable_warnings

=== modified file 'mysql-test/suite/perfschema/include/digest_execution.inc'
--- a/mysql-test/suite/perfschema/include/digest_execution.inc	revid:marko.makela@stripped6c6vqw7vkdms4
+++ b/mysql-test/suite/perfschema/include/digest_execution.inc	revid:marko.makela@stripped0080813-a3ezlp38lna1gv37
@@ -34,6 +34,19 @@ INSERT INTO t3 VALUES (1, 2), (3, 4), (5
 INSERT INTO t5 VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9);
 
 # -----------------------------------------------------------------------
+# Test case to handle NULL. If alone, not normalized otherwise normalized. 
+# -----------------------------------------------------------------------
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t3 VALUES (NULL,NULL);
+INSERT INTO t3 VALUES (1,NULL);
+INSERT INTO t3 VALUES (NULL,1);
+INSERT INTO t6 VALUES (NULL, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (1, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (NULL, 2, NULL, NULL);
+INSERT INTO t6 VALUES (1, 2, 3, NULL);
+INSERT INTO t6 VALUES (1, 2, NULL, 4);
+
+# -----------------------------------------------------------------------
 # Test case for handling spaces in statement.
 # -----------------------------------------------------------------------
 
@@ -59,7 +72,6 @@ SELECT 1 /* This is an inline comment */
  */
  1;
 
-
 # -----------------------------------------------------------------------
 # Tests to show how the digest behaves with tokens that can have multiple
 # names (such as DATABASE = "DATABASE" or "SCHEMA", SUBSTRING, STD_SYM,
@@ -84,3 +96,5 @@ create table t11 (c char(4));
 --ERROR ER_TABLE_EXISTS_ERROR
 create table t11 (c char(4));
 insert into t11 values("MySQL");
+
+

=== modified file 'mysql-test/suite/perfschema/include/digest_setup.inc'
--- a/mysql-test/suite/perfschema/include/digest_setup.inc	revid:marko.makela@stripped7140247-yaj6c6vqw7vkdms4
+++ b/mysql-test/suite/perfschema/include/digest_setup.inc	revid:marko.makela@stripped20120410080813-a3ezlp38lna1gv37
@@ -17,5 +17,6 @@ CREATE TABLE t2(a int);
 CREATE TABLE t3(a int, b int);
 CREATE TABLE t4(a int, b int);
 CREATE TABLE t5(a int, b int, c int);
+CREATE TABLE t6(a int, b int, c int, d int);
 --enable_warnings
 

=== modified file 'mysql-test/suite/perfschema/r/digest_table_full.result'
--- a/mysql-test/suite/perfschema/r/digest_table_full.result	revid:marko.makela@oracle.com-20120407140247-yaj6c6vqw7vkdms4
+++ b/mysql-test/suite/perfschema/r/digest_table_full.result	revid:marko.makela@stripped
@@ -8,6 +8,7 @@ CREATE TABLE t2(a int);
 CREATE TABLE t3(a int, b int);
 CREATE TABLE t4(a int, b int);
 CREATE TABLE t5(a int, b int, c int);
+CREATE TABLE t6(a int, b int, c int, d int);
 TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
 ####################################
 # EXECUTION
@@ -35,6 +36,15 @@ INSERT INTO t1 VALUES (1), (2), (3);
 INSERT INTO t1 VALUES (1), (2), (3), (4);
 INSERT INTO t3 VALUES (1, 2), (3, 4), (5, 6);
 INSERT INTO t5 VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t3 VALUES (NULL,NULL);
+INSERT INTO t3 VALUES (1,NULL);
+INSERT INTO t3 VALUES (NULL,1);
+INSERT INTO t6 VALUES (NULL, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (1, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (NULL, 2, NULL, NULL);
+INSERT INTO t6 VALUES (1, 2, 3, NULL);
+INSERT INTO t6 VALUES (1, 2, NULL, 4);
 SELECT                                          1           +        1;
 1           +        1
 2
@@ -75,7 +85,7 @@ Warning	1265	Data truncated for column '
 SELECT DIGEST, DIGEST_TEXT, COUNT_STAR, SUM_ROWS_AFFECTED, SUM_WARNINGS,
 SUM_ERRORS FROM performance_schema.events_statements_summary_by_digest;
 DIGEST	DIGEST_TEXT	COUNT_STAR	SUM_ROWS_AFFECTED	SUM_WARNINGS	SUM_ERRORS
-NULL	NULL	29	21	1	2
+NULL	NULL	38	30	1	2
 dee8f4f04e57a5e456c31892855e6835	TRUNCATE TABLE performance_schema . events_statements_summary_by_digest  	1	0	0	0
 SHOW VARIABLES LIKE "performance_schema_digests_size";
 Variable_name	Value
@@ -91,4 +101,5 @@ DROP TABLE IF EXISTS t2;
 DROP TABLE IF EXISTS t3;
 DROP TABLE IF EXISTS t4;
 DROP TABLE IF EXISTS t5;
+DROP TABLE IF EXISTS t6;
 DROP DATABASE IF EXISTS statements_digest;

=== modified file 'mysql-test/suite/perfschema/r/start_server_no_digests.result'
--- a/mysql-test/suite/perfschema/r/start_server_no_digests.result	revid:marko.makela@stripped
+++ b/mysql-test/suite/perfschema/r/start_server_no_digests.result	revid:marko.makela@strippedezlp38lna1gv37
@@ -8,6 +8,7 @@ CREATE TABLE t2(a int);
 CREATE TABLE t3(a int, b int);
 CREATE TABLE t4(a int, b int);
 CREATE TABLE t5(a int, b int, c int);
+CREATE TABLE t6(a int, b int, c int, d int);
 TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
 ####################################
 # EXECUTION
@@ -35,6 +36,15 @@ INSERT INTO t1 VALUES (1), (2), (3);
 INSERT INTO t1 VALUES (1), (2), (3), (4);
 INSERT INTO t3 VALUES (1, 2), (3, 4), (5, 6);
 INSERT INTO t5 VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t3 VALUES (NULL,NULL);
+INSERT INTO t3 VALUES (1,NULL);
+INSERT INTO t3 VALUES (NULL,1);
+INSERT INTO t6 VALUES (NULL, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (1, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (NULL, 2, NULL, NULL);
+INSERT INTO t6 VALUES (1, 2, 3, NULL);
+INSERT INTO t6 VALUES (1, 2, NULL, 4);
 SELECT                                          1           +        1;
 1           +        1
 2
@@ -89,4 +99,5 @@ DROP TABLE IF EXISTS t2;
 DROP TABLE IF EXISTS t3;
 DROP TABLE IF EXISTS t4;
 DROP TABLE IF EXISTS t5;
+DROP TABLE IF EXISTS t6;
 DROP DATABASE IF EXISTS statements_digest;

=== modified file 'mysql-test/suite/perfschema/r/statement_digest.result'
--- a/mysql-test/suite/perfschema/r/statement_digest.result	revid:marko.makela@strippeds4
+++ b/mysql-test/suite/perfschema/r/statement_digest.result	revid:marko.makela@stripped38lna1gv37
@@ -8,6 +8,7 @@ CREATE TABLE t2(a int);
 CREATE TABLE t3(a int, b int);
 CREATE TABLE t4(a int, b int);
 CREATE TABLE t5(a int, b int, c int);
+CREATE TABLE t6(a int, b int, c int, d int);
 TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
 ####################################
 # EXECUTION
@@ -35,6 +36,15 @@ INSERT INTO t1 VALUES (1), (2), (3);
 INSERT INTO t1 VALUES (1), (2), (3), (4);
 INSERT INTO t3 VALUES (1, 2), (3, 4), (5, 6);
 INSERT INTO t5 VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t3 VALUES (NULL,NULL);
+INSERT INTO t3 VALUES (1,NULL);
+INSERT INTO t3 VALUES (NULL,1);
+INSERT INTO t6 VALUES (NULL, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (1, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (NULL, 2, NULL, NULL);
+INSERT INTO t6 VALUES (1, 2, 3, NULL);
+INSERT INTO t6 VALUES (1, 2, NULL, 4);
 SELECT                                          1           +        1;
 1           +        1
 2
@@ -83,12 +93,14 @@ e7f8dc15f1156f57978116e457cc7488	SELECT
 3b8d5477aa795a19c9e9183e4ad04e6b	SELECT ?, ... FROM t2  	2	0	0	0
 5737343d989b1c42464fd3632614d25e	INSERT INTO t1 VALUES (?)  	1	1	0	0
 1e7fe109d5dd49394ee079690a029452	INSERT INTO t2 VALUES (?)  	1	1	0	0
-d63092ea2fa59316f398af6283bf80a5	INSERT INTO t3 VALUES (...)  	1	1	0	0
+d63092ea2fa59316f398af6283bf80a5	INSERT INTO t3 VALUES (...)  	4	4	0	0
 7383272b3a17c661872524713abae82f	INSERT INTO t4 VALUES (...)  	1	1	0	0
 42e8c9d8a502b06ac931886d3ff1ed1e	INSERT INTO t5 VALUES (...)  	1	1	0	0
 db545539039d269501474510fbc2da56	INSERT INTO t1 VALUES (?) /* , ... */  	2	7	0	0
 446dead39135f87b4fc4168f00dff254	INSERT INTO t3 VALUES (...) /* , ... */  	1	3	0	0
 3ec23fcc5b568c4ad359703ff996e0bd	INSERT INTO t5 VALUES (...) /* , ... */  	1	3	0	0
+d6eac9eb14e3e67fcd647c754f06e87f	INSERT INTO t1 VALUES ( NULL )  	1	1	0	0
+6a1b3810f32f521701aecb1cc695048d	INSERT INTO t6 VALUES (...)  	5	5	0	0
 6b473a776aa59140774b6ee689e68c9e	SELECT ? + ?  	3	0	0	0
 b608da273ea6dffe2120354f751cc8ba	SELECT ?  	1	0	0	0
 30046d97cfdc44c95bdaa7f3987d0a20	CREATE SCHEMA statements_digest_temp  	2	2	0	0
@@ -105,4 +117,5 @@ DROP TABLE IF EXISTS t2;
 DROP TABLE IF EXISTS t3;
 DROP TABLE IF EXISTS t4;
 DROP TABLE IF EXISTS t5;
+DROP TABLE IF EXISTS t6;
 DROP DATABASE IF EXISTS statements_digest;

=== modified file 'mysql-test/suite/perfschema/r/statement_digest_charset.result'
--- a/mysql-test/suite/perfschema/r/statement_digest_charset.result	revid:marko.makela@stripped7-yaj6c6vqw7vkdms4
+++ b/mysql-test/suite/perfschema/r/statement_digest_charset.result	revid:marko.makela@strippedom-20120410080813-a3ezlp38lna1gv37
@@ -5,20 +5,10 @@ SET NAMES cp1251;
 TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
 CREATE TABLE ���������_��������_1251b (s1 INT, s2 INT);
-SHOW TABLES;
-Tables_in_pfs_charset_test
-�����_��������_1251b
-�����_��������_1251a
 SET NAMES utf8;
 CREATE TABLE ДОЛЕН_регистър_утф8 (s1 INT);
 SET NAMES latin1;
-SELECT digest, digest_text FROM performance_schema.events_statements_summary_by_digest;
-digest	digest_text
-dee8f4f04e57a5e456c31892855e6835	TRUNCATE TABLE performance_schema . events_statements_summary_by_digest  
-cabc7ac4e258034ced3df98f1c66bb5c	CREATE TABLE `?????_????????_1251a` ( s1 INTEGER )  
-4801c71a0daae0cc6498f10160a11d83	CREATE TABLE `?????_????????_1251b` ( s1 INTEGER , s2 INTEGER )  
-8df5d894abe8f15b8cc3296cff7ac54f	SHOW TABLES  
-e8d4b0aa80e636e7844de8e2415c829a	SET NAMES utf8  
-300bd614d676b57ce98eb26b3fb1a9ac	CREATE TABLE `?????_????????_???8` ( `s1` INTEGER )  
-7e60a7e578a7b0048e04aa615a1420f3	SET NAMES `latin1`  
+SELECT * FROM performance_schema.events_statements_summary_by_digest
+WHERE digest_text LIKE 'XXXYYY%' LIMIT 1;
+DIGEST	DIGEST_TEXT	COUNT_STAR	SUM_TIMER_WAIT	MIN_TIMER_WAIT	AVG_TIMER_WAIT	MAX_TIMER_WAIT	SUM_LOCK_TIME	SUM_ERRORS	SUM_WARNINGS	SUM_ROWS_AFFECTED	SUM_ROWS_SENT	SUM_ROWS_EXAMINED	SUM_CREATED_TMP_DISK_TABLES	SUM_CREATED_TMP_TABLES	SUM_SELECT_FULL_JOIN	SUM_SELECT_FULL_RANGE_JOIN	SUM_SELECT_RANGE	SUM_SELECT_RANGE_CHECK	SUM_SELECT_SCAN	SUM_SORT_MERGE_PASSES	SUM_SORT_RANGE	SUM_SORT_ROWS	SUM_SORT_SCAN	SUM_NO_INDEX_USED	SUM_NO_GOOD_INDEX_USED	FIRST_SEEN	LAST_SEEN
 DROP DATABASE pfs_charset_test;

=== modified file 'mysql-test/suite/perfschema/r/statement_digest_consumers.result'
--- a/mysql-test/suite/perfschema/r/statement_digest_consumers.result	revid:marko.makela@stripped4
+++ b/mysql-test/suite/perfschema/r/statement_digest_consumers.result	revid:marko.makela@stripped13-a3ezlp38lna1gv37
@@ -8,6 +8,7 @@ CREATE TABLE t2(a int);
 CREATE TABLE t3(a int, b int);
 CREATE TABLE t4(a int, b int);
 CREATE TABLE t5(a int, b int, c int);
+CREATE TABLE t6(a int, b int, c int, d int);
 SELECT * FROM performance_schema.setup_consumers;
 NAME	ENABLED
 events_stages_current	YES
@@ -49,6 +50,15 @@ INSERT INTO t1 VALUES (1), (2), (3);
 INSERT INTO t1 VALUES (1), (2), (3), (4);
 INSERT INTO t3 VALUES (1, 2), (3, 4), (5, 6);
 INSERT INTO t5 VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t3 VALUES (NULL,NULL);
+INSERT INTO t3 VALUES (1,NULL);
+INSERT INTO t3 VALUES (NULL,1);
+INSERT INTO t6 VALUES (NULL, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (1, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (NULL, 2, NULL, NULL);
+INSERT INTO t6 VALUES (1, 2, 3, NULL);
+INSERT INTO t6 VALUES (1, 2, NULL, 4);
 SELECT                                          1           +        1;
 1           +        1
 2
@@ -96,12 +106,14 @@ e7f8dc15f1156f57978116e457cc7488	SELECT
 3b8d5477aa795a19c9e9183e4ad04e6b	SELECT ?, ... FROM t2  	2
 5737343d989b1c42464fd3632614d25e	INSERT INTO t1 VALUES (?)  	1
 1e7fe109d5dd49394ee079690a029452	INSERT INTO t2 VALUES (?)  	1
-d63092ea2fa59316f398af6283bf80a5	INSERT INTO t3 VALUES (...)  	1
+d63092ea2fa59316f398af6283bf80a5	INSERT INTO t3 VALUES (...)  	4
 7383272b3a17c661872524713abae82f	INSERT INTO t4 VALUES (...)  	1
 42e8c9d8a502b06ac931886d3ff1ed1e	INSERT INTO t5 VALUES (...)  	1
 db545539039d269501474510fbc2da56	INSERT INTO t1 VALUES (?) /* , ... */  	2
 446dead39135f87b4fc4168f00dff254	INSERT INTO t3 VALUES (...) /* , ... */  	1
 3ec23fcc5b568c4ad359703ff996e0bd	INSERT INTO t5 VALUES (...) /* , ... */  	1
+d6eac9eb14e3e67fcd647c754f06e87f	INSERT INTO t1 VALUES ( NULL )  	1
+6a1b3810f32f521701aecb1cc695048d	INSERT INTO t6 VALUES (...)  	5
 6b473a776aa59140774b6ee689e68c9e	SELECT ? + ?  	3
 b608da273ea6dffe2120354f751cc8ba	SELECT ?  	1
 30046d97cfdc44c95bdaa7f3987d0a20	CREATE SCHEMA statements_digest_temp  	2
@@ -120,4 +132,5 @@ DROP TABLE IF EXISTS t2;
 DROP TABLE IF EXISTS t3;
 DROP TABLE IF EXISTS t4;
 DROP TABLE IF EXISTS t5;
+DROP TABLE IF EXISTS t6;
 DROP DATABASE IF EXISTS statements_digest;

=== modified file 'mysql-test/suite/perfschema/r/statement_digest_consumers2.result'
--- a/mysql-test/suite/perfschema/r/statement_digest_consumers2.result	revid:marko.makela@stripped0407140247-yaj6c6vqw7vkdms4
+++ b/mysql-test/suite/perfschema/r/statement_digest_consumers2.result	revid:marko.makela@stripped
@@ -8,6 +8,7 @@ CREATE TABLE t2(a int);
 CREATE TABLE t3(a int, b int);
 CREATE TABLE t4(a int, b int);
 CREATE TABLE t5(a int, b int, c int);
+CREATE TABLE t6(a int, b int, c int, d int);
 SELECT * FROM performance_schema.setup_consumers;
 NAME	ENABLED
 events_stages_current	YES
@@ -49,6 +50,15 @@ INSERT INTO t1 VALUES (1), (2), (3);
 INSERT INTO t1 VALUES (1), (2), (3), (4);
 INSERT INTO t3 VALUES (1, 2), (3, 4), (5, 6);
 INSERT INTO t5 VALUES (1, 2, 3), (4, 5, 6), (7, 8, 9);
+INSERT INTO t1 VALUES (NULL);
+INSERT INTO t3 VALUES (NULL,NULL);
+INSERT INTO t3 VALUES (1,NULL);
+INSERT INTO t3 VALUES (NULL,1);
+INSERT INTO t6 VALUES (NULL, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (1, NULL, NULL, NULL);
+INSERT INTO t6 VALUES (NULL, 2, NULL, NULL);
+INSERT INTO t6 VALUES (1, 2, 3, NULL);
+INSERT INTO t6 VALUES (1, 2, NULL, 4);
 SELECT                                          1           +        1;
 1           +        1
 2
@@ -99,4 +109,5 @@ DROP TABLE IF EXISTS t2;
 DROP TABLE IF EXISTS t3;
 DROP TABLE IF EXISTS t4;
 DROP TABLE IF EXISTS t5;
+DROP TABLE IF EXISTS t6;
 DROP DATABASE IF EXISTS statements_digest;

=== modified file 'mysql-test/suite/perfschema/t/statement_digest_charset.test'
--- a/mysql-test/suite/perfschema/t/statement_digest_charset.test	revid:marko.makela@strippedyaj6c6vqw7vkdms4
+++ b/mysql-test/suite/perfschema/t/statement_digest_charset.test	revid:marko.makela@stripped0120410080813-a3ezlp38lna1gv37
@@ -19,7 +19,6 @@ SET NAMES cp1251;
 TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
 CREATE TABLE �����_T);
-SHOW TABLES;
 
 #
 # UTF8 - 8 bits, max multibyte length = 4
@@ -31,6 +30,7 @@ CREATE TABLE ДОЛЕН_регистър
 # Incorrectly converted statement identifiers will result in a warning.
 #
 SET NAMES latin1;
-SELECT digest, digest_text FROM performance_schema.events_statements_summary_by_digest;
+SELECT * FROM performance_schema.events_statements_summary_by_digest
+  WHERE digest_text LIKE 'XXXYYY%' LIMIT 1;
 
 DROP DATABASE pfs_charset_test;

=== modified file 'mysql-test/suite/rpl/r/rpl_corruption.result'
--- a/mysql-test/suite/rpl/r/rpl_corruption.result	revid:marko.makela@strippedvqw7vkdms4
+++ b/mysql-test/suite/rpl/r/rpl_corruption.result	revid:marko.makela@stripped8lna1gv37
@@ -26,13 +26,13 @@ include/wait_for_slave_io_error.inc [err
 SET GLOBAL master_verify_checksum=0;
 SET GLOBAL debug="d,corrupt_read_log_event";
 START SLAVE IO_THREAD;
-include/wait_for_slave_io_error.inc [errno=1595,1721]
+include/wait_for_slave_io_error.inc [errno=1595,1741]
 SET GLOBAL debug="";
 SET GLOBAL master_verify_checksum=1;
 # 5. Slave. Corruption in network
 SET GLOBAL debug="d,corrupt_queue_event";
 START SLAVE IO_THREAD;
-include/wait_for_slave_io_error.inc [errno=1595,1721]
+include/wait_for_slave_io_error.inc [errno=1595,1741]
 # 6. Slave. Corruption in relay log
 SET GLOBAL debug="d,corrupt_read_log_event_char";
 START SLAVE SQL_THREAD;

=== modified file 'mysql-test/suite/rpl/r/rpl_master_pos_wait.result'
--- a/mysql-test/suite/rpl/r/rpl_master_pos_wait.result	revid:marko.makela@stripped7vkdms4
+++ b/mysql-test/suite/rpl/r/rpl_master_pos_wait.result	revid:marko.makela@strippedp38lna1gv37
@@ -35,8 +35,8 @@ SQL_THREAD_WAIT_AFTER_GTIDS('', 2)
 0
 SELECT SQL_THREAD_WAIT_AFTER_GTIDS('error-gtid', 2);
 ERROR HY000: Malformed GTID set specification 'error-gtid'.
-SELECT SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 2);
+SELECT SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 0);
 STOP SLAVE SQL_THREAD;
-SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 2)
+SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 0)
 NULL
 include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/r/rpl_report_port.result'
--- a/mysql-test/suite/rpl/r/rpl_report_port.result	revid:marko.makela@oracle.com-20120407140247-yaj6c6vqw7vkdms4
+++ b/mysql-test/suite/rpl/r/rpl_report_port.result	revid:marko.makela@oracle.com-20120410080813-a3ezlp38lna1gv37
@@ -3,9 +3,12 @@ Warnings:
 Note	####	Sending passwords in plain text without SSL/TLS is extremely insecure.
 Note	####	Storing MySQL user name or password information in the master.info repository is not secure and is therefore not recommended. Please see the MySQL Manual for more about this issue and possible alternatives.
 [connection master]
-include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.]
 include/rpl_restart_server.inc [server_number=2 parameters: --report-port=9000]
 include/start_slave.inc
 [Slave restarted with the report-port set to some value]
 include/assert.inc [The value shown for the slave's port number is 9000 which is the value set for report-port.]
+include/rpl_restart_server.inc [server_number=2 parameters: --report-port=]
+include/start_slave.inc
+[Slave restarted with the report-port set to the value of slave's port number]
+include/assert.inc [The default value shown for the slave's port number is the actual port number of the slave.]
 include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_corruption.test'
--- a/mysql-test/suite/rpl/t/rpl_corruption.test	revid:marko.makela@stripped247-yaj6c6vqw7vkdms4
+++ b/mysql-test/suite/rpl/t/rpl_corruption.test	revid:marko.makela@stripped-a3ezlp38lna1gv37
@@ -80,7 +80,7 @@ reap;
 SET GLOBAL debug="d,corrupt_read_log_event";
 --connection slave
 START SLAVE IO_THREAD;
-let $slave_io_errno= 1236;
+let $slave_io_errno= 1236; # ER_MASTER_FATAL_ERROR_READING_BINLOG
 --source include/wait_for_slave_io_error.inc
 --connection master
 
@@ -91,7 +91,7 @@ SET GLOBAL master_verify_checksum=0;
 SET GLOBAL debug="d,corrupt_read_log_event";
 --connection slave
 START SLAVE IO_THREAD;
-let $slave_io_errno= 1595,1721;
+let $slave_io_errno= 1595,1741; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
 --source include/wait_for_slave_io_error.inc
 --connection master
 SET GLOBAL debug="";
@@ -102,14 +102,14 @@ SET GLOBAL master_verify_checksum=1;
 --connection slave
 SET GLOBAL debug="d,corrupt_queue_event";
 START SLAVE IO_THREAD;
-let $slave_io_errno= 1595,1721;
+let $slave_io_errno= 1595,1741; # ER_SLAVE_RELAY_LOG_WRITE_FAILURE, ER_NETWORK_READ_EVENT_CHECKSUM_FAILURE
 --source include/wait_for_slave_io_error.inc
 
 # Emulate corruption in relay log
 --echo # 6. Slave. Corruption in relay log
 SET GLOBAL debug="d,corrupt_read_log_event_char";
 START SLAVE SQL_THREAD;
-let $slave_sql_errno= 1593;
+let $slave_sql_errno= 1593; # ER_SLAVE_FATAL_ERROR
 --source include/wait_for_slave_sql_error.inc
 
 # Start normal replication and compare same table on master

=== modified file 'mysql-test/suite/rpl/t/rpl_master_pos_wait.test'
--- a/mysql-test/suite/rpl/t/rpl_master_pos_wait.test	revid:marko.makela@stripped
+++ b/mysql-test/suite/rpl/t/rpl_master_pos_wait.test	revid:marko.makela@stripped
@@ -53,7 +53,7 @@ SELECT SQL_THREAD_WAIT_AFTER_GTIDS('erro
 # SQL_THREAD_WAIT_AFTER_GTIDS: Check if it hangs when slave is 
 # idle and STOP SLAVE is issued.
 #
-send SELECT SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 2);
+send SELECT SQL_THREAD_WAIT_AFTER_GTIDS('7805be8e-51ab-11e1-bacc-6706c20ad7ba:1', 0);
 --connection slave1
 STOP SLAVE SQL_THREAD;
 --connection slave

=== removed file 'mysql-test/suite/rpl/t/rpl_report_port-slave.opt'
--- a/mysql-test/suite/rpl/t/rpl_report_port-slave.opt	revid:marko.makela@strippedaj6c6vqw7vkdms4
+++ b/mysql-test/suite/rpl/t/rpl_report_port-slave.opt	1970-01-01 00:00:00 +0000
@@ -1 +0,0 @@
---report-port=

=== modified file 'mysql-test/suite/rpl/t/rpl_report_port.test'
--- a/mysql-test/suite/rpl/t/rpl_report_port.test	revid:marko.makela@stripped7-yaj6c6vqw7vkdms4
+++ b/mysql-test/suite/rpl/t/rpl_report_port.test	revid:marko.makela@strippeda3ezlp38lna1gv37
@@ -10,22 +10,18 @@
 #
 #====Method====
 #
-# Start replication with report port not set.This will give the actual port 
-# number of the slave (ie. SLAVE_PORT) for the on doing SHOW SLAVE HOSTS on 
-# the master.
-# Restart the slave server with report port set to 9000 and start the slave.
+# Start replication  with report port set to 9000 and restart the slave.
 # In this case on doing SHOW SLAVE HOSTS on the master, we get the port number
 # of the slave to be 9000.
+# In the second case restart the slave server with report port not set. In this
+# case on doing SHOW SLAVE HOSTS on the master, we get the actual port number
+# of the slave (ie. SLAVE_PORT).
 
 source include/master-slave.inc;
+source include/have_binlog_format_mixed.inc;
 
 connection master;
 
---let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1)
---let assert_text= The default value shown for the slave's port number is the actual port number of the slave.
---let assert_cond= $report_port = "$SLAVE_MYPORT"
---source include/assert.inc
-
 # Start the server with some value being passed to the report_port= <option>
 # this will be used incase we have to mask the value of the slave's port
 # number in certain situations.
@@ -46,4 +42,25 @@ connection master;
 --let assert_cond= $report_port = "9000"
 --source include/assert.inc
 
+
+# Start the server with the report-port being passed with no value. So on SHOW SLAVE HOSTS
+# on the master the value of slave's port should be the actual value of the slave port.
+
+--let $rpl_server_number= 2
+--let $rpl_server_parameters= --report-port=
+--source include/rpl_restart_server.inc
+
+connection slave;
+--source include/start_slave.inc
+
+--echo [Slave restarted with the report-port set to the value of slave's port number]
+
+connection master;
+
+# The value reported is the actual value of the slave's port.
+--let $report_port= query_get_value(SHOW SLAVE HOSTS, Port, 1)
+--let assert_text= The default value shown for the slave's port number is the actual port number of the slave.
+--let assert_cond= $report_port = "$SLAVE_MYPORT"
+--source include/assert.inc
+
 --source include/rpl_end.inc

=== modified file 'mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test	revid:marko.makela@stripped
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test	revid:marko.makela@strippedezlp38lna1gv37
@@ -3,6 +3,10 @@
 #
 
 -- source include/have_innodb.inc
+# --force-restart from
+# mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic-master.opt
+# does not seem to work on Windows (test being executed without a restart)
+-- source include/not_windows.inc
 
 # Check the default value and save for later restoration
 SET @orig = @@global.innodb_buffer_pool_filename;

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	revid:marko.makela@stripped0247-yaj6c6vqw7vkdms4
+++ b/mysql-test/t/disabled.def	revid:marko.makela@stripped7
@@ -15,3 +15,4 @@ sum_distinct-big         : Bug#11764126
 archive-big              : Bug#11817185 2011-03-10 Anitha Disabled since this leads to timeout on Solaris Sparc
 log_tables-big           : Bug#11756699 2010-11-15 mattiasj report already exists
 ds_mrr-big @solaris      : Hemant disabled since this leads to timeout on Solaris on slow sparc servers
+partition_locking_4	 : Bug#13924750 2012-04-04 lost connection.

=== added file 'mysql-test/t/partition_locking_4.test'
--- a/mysql-test/t/partition_locking_4.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/t/partition_locking_4.test	revid:marko.makela@stripped0120410080813-a3ezlp38lna1gv37
@@ -0,0 +1,65 @@
+--source include/have_innodb.inc
+--source include/have_partition.inc
+
+--echo # Must have InnoDB as engine to get the same statistics results.
+--echo # embedded uses MyISAM as default. CREATE SELECT uses the default engine.
+SET @old_default_storage_engine = @@global.default_storage_engine;
+SET @@global.default_storage_engine = 'InnoDB';
+SET @old_autocommit = @@global.autocommit;
+SET @@global.autocommit = 0;
+SET @old_lock_wait_timeout= @@global.lock_wait_timeout;
+SET @@global.lock_wait_timeout = 1;
+SET @old_innodb_lock_wait_timeout= @@global.innodb_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout = 1;
+SET @old_wait_timeout= @@global.wait_timeout;
+SET @@global.wait_timeout= 1;
+
+USE test;
+
+CREATE USER 'mysqltest1'@'localhost';
+CREATE USER 'mysqltest2'@'localhost';
+GRANT ALL PRIVILEGES ON test.* TO 'mysqltest1'@'localhost';
+GRANT ALL PRIVILEGES ON test.* TO 'mysqltest2'@'localhost';
+
+CREATE TABLE t1 (a int PRIMARY KEY, b varchar(128), KEY (b))
+ENGINE = InnoDB
+PARTITION BY HASH (a) PARTITIONS 13;
+
+CREATE TABLE t2 (a int PRIMARY KEY AUTO_INCREMENT, b varchar(128))
+ENGINE = InnoDB
+PARTITION BY HASH (a) PARTITIONS 13;
+
+INSERT INTO t1 VALUES (11, 'First row, p11');
+INSERT INTO t1 VALUES (12, 'First row, p12');
+
+--enable_connect_log
+connect (test1,localhost,mysqltest1,,test);
+connect (test2,localhost,mysqltest2,,test);
+
+connection test1;
+INSERT INTO t1 VALUES (13+11, 'Second row, p11');
+#--error ER_LOCK_WAIT_TIMEOUT
+INSERT INTO t1 VALUES (13+12, 'Second row, p12');
+SELECT * FROM t1 ORDER BY a;
+
+connection test2;
+INSERT INTO t1 VALUES (13+11, 'Second row, p11');
+#--error ER_LOCK_WAIT_TIMEOUT
+#INSERT INTO t1 VALUES (13+12, 'Second row, p12');
+SELECT * FROM t1 ORDER BY a;
+#COMMIT;
+
+connection test1;
+SELECT * FROM t1 ORDER BY a;
+#COMMIT;
+
+connection default;
+DROP TABLE t1, t2;
+DROP USER 'mysqltest1'@'localhost';
+DROP USER 'mysqltest2'@'localhost';
+SET @@global.default_storage_engine= @old_default_storage_engine;
+SET @@global.autocommit = @old_autocommit;
+SET @@global.lock_wait_timeout= @old_lock_wait_timeout;
+SET @@global.innodb_lock_wait_timeout= @old_innodb_lock_wait_timeout;
+SET @@global.wait_timeout= @old_wait_timeout;
+

=== modified file 'sql/opt_explain_json.cc'
--- a/sql/opt_explain_json.cc	revid:marko.makela@strippedvqw7vkdms4
+++ b/sql/opt_explain_json.cc	revid:marko.makela@stripped
@@ -368,11 +368,11 @@ private:
         Opt_trace_object tmp_table(json, K_TABLE);
 
         if (!col_join_type.is_empty())
-          obj->add_alnum(K_ACCESS_TYPE, col_join_type.str);
+          tmp_table.add_alnum(K_ACCESS_TYPE, col_join_type.str);
         if (!col_key.is_empty())
-          obj->add_utf8(K_KEY, col_key.str);
+          tmp_table.add_utf8(K_KEY, col_key.str);
         if (!col_rows.is_empty())
-          obj->add(K_ROWS, col_rows.value);
+          tmp_table.add(K_ROWS, col_rows.value);
       }
 
       if (subquery->is_query_block())

=== modified file 'sql/table.cc'
--- a/sql/table.cc	revid:marko.makela@oracle.com-20120407140247-yaj6c6vqw7vkdms4
+++ b/sql/table.cc	revid:marko.makela@strippeda1gv37
@@ -5364,6 +5364,23 @@ void TABLE_LIST::reinit_before_use(THD *
     were closed in the end of previous prepare or execute call.
   */
   table= 0;
+
+ /*
+   Reset table_name and table_name_length,if it is a anonymous derived table
+   or schema table. They are not valid as TABLEs were closed in the end of
+   previous prepare or execute call.
+ */
+  if (derived)
+  {
+    table_name= NULL;
+    table_name_length= 0;
+  }
+  else if (schema_table_name)
+  {
+    table_name= schema_table_name;
+    table_name_length= strlen(schema_table_name);
+  }
+
   /* Reset is_schema_table_processed value(needed for I_S tables */
   schema_table_state= NOT_PROCESSED;
 

=== modified file 'storage/innobase/dict/dict0boot.cc'
--- a/storage/innobase/dict/dict0boot.cc	revid:marko.makela@strippedom-20120407140247-yaj6c6vqw7vkdms4
+++ b/storage/innobase/dict/dict0boot.cc	revid:marko.makela@stripped080813-a3ezlp38lna1gv37
@@ -476,7 +476,7 @@ dict_insert_initial_data(void)
 }
 
 /*****************************************************************//**
-Creates and initializes the data dictionary at the database creation. */
+Creates and initializes the data dictionary at the server bootstrap. */
 UNIV_INTERN
 void
 dict_create(void)

=== modified file 'storage/innobase/dict/dict0crea.cc'
--- a/storage/innobase/dict/dict0crea.cc	revid:marko.makela@oracle.com-20120407140247-yaj6c6vqw7vkdms4
+++ b/storage/innobase/dict/dict0crea.cc	revid:marko.makela@stripped20410080813-a3ezlp38lna1gv37
@@ -1272,7 +1272,7 @@ dict_create_or_check_foreign_constraint_
 	trx_t*		trx;
 	ulint		error;
 	ibool		success;
-	ibool		srv_file_per_table_backup;
+	my_bool		srv_file_per_table_backup;
 
 	ut_a(srv_get_active_thread_type() == SRV_NONE);
 
@@ -1318,7 +1318,7 @@ dict_create_or_check_foreign_constraint_
 	VARBINARY, like in other InnoDB system tables, to get a clean
 	design. */
 
-	srv_file_per_table_backup = (ibool) srv_file_per_table;
+	srv_file_per_table_backup = srv_file_per_table;
 
 	/* We always want SYSTEM tables to be created inside the system
 	tablespace. */
@@ -1382,7 +1382,7 @@ dict_create_or_check_foreign_constraint_
 	success = dict_check_sys_foreign_tables_exist();
 	ut_a(success);
 
-	srv_file_per_table = (my_bool) srv_file_per_table_backup;
+	srv_file_per_table = srv_file_per_table_backup;
 
 	return(error);
 }

=== modified file 'storage/innobase/dict/dict0load.cc'
--- a/storage/innobase/dict/dict0load.cc	revid:marko.makela@stripped4
+++ b/storage/innobase/dict/dict0load.cc	revid:marko.makela@stripped
@@ -46,7 +46,8 @@ Created 4/24/1996 Heikki Tuuri
 #include "fts0priv.h"
 
 
-/** Following are six InnoDB system tables */
+/** Following are the InnoDB system tables.  The positions in
+this array are referenced by enum dict_system_table_id. */
 static const char* SYSTEM_TABLE_NAME[] = {
 	"SYS_TABLES",
 	"SYS_INDEXES",

=== modified file 'storage/innobase/fts/fts0fts.cc'
--- a/storage/innobase/fts/fts0fts.cc	revid:marko.makela@strippedvqw7vkdms4
+++ b/storage/innobase/fts/fts0fts.cc	revid:marko.makela@stripped
@@ -2381,14 +2381,14 @@ fts_get_max_cache_size(
 Get the total number of documents in the FTS.
 @return estimated number of rows in the table */
 UNIV_INTERN
-ulint
+ib_int64_t
 fts_get_total_document_count(
 /*=========================*/
 	dict_table_t*   table)		/*!< in: table instance */
 {
 	ut_ad(table->stat_initialized);
 
-	return((ulint) table->stat_n_rows);
+	return(table->stat_n_rows);
 }
 
 /*********************************************************************//**

=== modified file 'storage/innobase/fts/fts0que.cc'
--- a/storage/innobase/fts/fts0que.cc	revid:marko.makela@strippeds4
+++ b/storage/innobase/fts/fts0que.cc	revid:marko.makela@stripped
@@ -126,7 +126,7 @@ struct fts_query_struct {
 					position info for each matched word
 					in the word list */
 
-	ulint		total_docs;	/*!< The total number of documents */
+	ib_int64_t	total_docs;	/*!< The total number of documents */
 
 	ulint		total_words;	/*!< The total number of words */
 
@@ -2907,7 +2907,7 @@ fts_query_calculate_idf(
 			}
 		}
 
-		fprintf(stderr,"'%s' -> %lu/%lu %6.5lf\n",
+		fprintf(stderr,"'%s' -> " INT64PF "/%lu %6.5lf\n",
 		       word_freq->word,
 		       query->total_docs, word_freq->doc_count,
 		       word_freq->idf);
@@ -3248,7 +3248,7 @@ fts_query(
 	}
 
 #ifdef	FTS_INTERNAL_DIAG_PRINT
-	fprintf(stderr, "Total docs: %lu Total words: %lu\n",
+	fprintf(stderr, "Total docs: " INT64PF " Total words: %lu\n",
 		query.total_docs, query.total_words);
 #endif
 

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	revid:marko.makela@stripped
+++ b/storage/innobase/handler/ha_innodb.cc	revid:marko.makela@oracle.com-20120410080813-a3ezlp38lna1gv37
@@ -2343,7 +2343,7 @@ innobase_invalidate_query_cache(
 
 	/* Argument TRUE below means we are using transactions */
 #ifdef HAVE_QUERY_CACHE
-	mysql_query_cache_invalidate4((THD*) trx->mysql_thd,
+	mysql_query_cache_invalidate4(static_cast<THD*>(trx->mysql_thd),
 				      full_name,
 				      (uint32) full_name_len,
 				      TRUE);
@@ -2527,7 +2527,8 @@ trx_is_interrupted(
 /*===============*/
 	trx_t*	trx)	/*!< in: transaction */
 {
-	return(trx && trx->mysql_thd && thd_killed((THD*) trx->mysql_thd));
+	return(trx && trx->mysql_thd
+	       && thd_killed(static_cast<THD*>(trx->mysql_thd)));
 }
 
 /**********************************************************************//**
@@ -2540,7 +2541,7 @@ trx_is_strict(
 	trx_t*	trx)	/*!< in: transaction */
 {
 	return(trx && trx->mysql_thd
-	       && THDVAR((THD*) trx->mysql_thd, strict_mode));
+	       && THDVAR(static_cast<THD*>(trx->mysql_thd), strict_mode));
 }
 
 /**************************************************************//**
@@ -3825,32 +3826,35 @@ ha_innobase::primary_key_is_clustered()
 
 /** Always normalize table name to lower case on Windows */
 #ifdef __WIN__
-#define normalize_table_name(norm_name, name)		\
-	normalize_table_name_low(norm_name, name, TRUE)
+#define normalize_table_name(name)		\
+	normalize_table_name_low(name, TRUE)
 #else
-#define normalize_table_name(norm_name, name)           \
-	normalize_table_name_low(norm_name, name, FALSE)
+#define normalize_table_name(name)           \
+	normalize_table_name_low(name, FALSE)
 #endif /* __WIN__ */
 
 /*****************************************************************//**
 Normalizes a table name string. A normalized name consists of the
-database name catenated to '/' and table name. An example:
-test/mytable. On Windows normalization puts both the database name and the
-table name always to lower case if "set_lower_case" is set to TRUE. */
+database name catenated to '/' and table name. An example: test/mytable.
+On Windows normalization puts both the database name and the
+table name always to lower case if "set_lower_case" is set to TRUE.
+Memory for norm_name is allocated here and must be freed by the caller.
+@return	normalized name as a null-terminated string*/
 static
-void
+char*
 normalize_table_name_low(
 /*=====================*/
-	char*		norm_name,	/*!< out: normalized name as a
-					null-terminated string */
 	const char*	name,		/*!< in: table name string */
 	ibool		set_lower_case)	/*!< in: TRUE if we want to set name
 					to lower case */
 {
+	char*	norm_name;
 	char*	name_ptr;
+	ulint	name_len;
 	char*	db_ptr;
 	ulint	db_len;
 	char*	ptr;
+	ulint	norm_len;
 
 	/* Scan name from the end */
 
@@ -3862,6 +3866,7 @@ normalize_table_name_low(
 	}
 
 	name_ptr = ptr + 1;
+	name_len = strlen(name_ptr);
 
 	/* skip any number of path separators */
 	while (ptr >= name && (*ptr == '\\' || *ptr == '/')) {
@@ -3880,15 +3885,21 @@ normalize_table_name_low(
 
 	db_ptr = ptr + 1;
 
+	norm_len = db_len + name_len + sizeof "/";
+	norm_name = static_cast<char*>(mem_alloc(norm_len));
+
 	memcpy(norm_name, db_ptr, db_len);
 
 	norm_name[db_len] = '/';
 
-	memcpy(norm_name + db_len + 1, name_ptr, strlen(name_ptr) + 1);
+	/* Copy the name and null-byte. */
+	memcpy(norm_name + db_len + 1, name_ptr, name_len + 1);
 
 	if (set_lower_case) {
 		innobase_casedn_str(norm_name);
 	}
+
+	return(norm_name);
 }
 
 #if !defined(DBUG_OFF)
@@ -3899,7 +3910,7 @@ void
 test_normalize_table_name_low()
 /*===========================*/
 {
-	char		norm_name[128];
+	char*		norm_name;
 	const char*	test_data[][2] = {
 		/* input, expected result */
 		{"./mysqltest/t1", "mysqltest/t1"},
@@ -3945,7 +3956,7 @@ test_normalize_table_name_low()
 		       "testing \"%s\", expected \"%s\"... ",
 		       test_data[i][0], test_data[i][1]);
 
-		normalize_table_name_low(norm_name, test_data[i][0], FALSE);
+		norm_name = normalize_table_name_low(test_data[i][0], FALSE);
 
 		if (strcmp(norm_name, test_data[i][1]) == 0) {
 			printf("ok\n");
@@ -3953,6 +3964,8 @@ test_normalize_table_name_low()
 			printf("got \"%s\"\n", norm_name);
 			ut_error;
 		}
+
+		mem_free(norm_name);
 	}
 }
 #endif /* !DBUG_OFF */
@@ -4354,12 +4367,11 @@ ha_innobase::open(
 	uint		test_if_locked)	/*!< in: not used */
 {
 	dict_table_t*	ib_table;
-	char		norm_name[1000];
+	char*		norm_name;
 	THD*		thd;
 	ulint		retries = 0;
 	char*		is_part = NULL;
-	ibool		par_case_name_set = FALSE;
-	char		par_case_name[MAX_FULL_NAME_LEN + 1];
+	char*		par_case_name = NULL;
 
 	DBUG_ENTER("ha_innobase::open");
 
@@ -4375,8 +4387,6 @@ ha_innobase::open(
 		innobase_release_temporary_latches(ht, thd);
 	}
 
-	normalize_table_name(norm_name, name);
-
 	user_thd = NULL;
 
 	if (!(share=get_share())) {
@@ -4384,6 +4394,8 @@ ha_innobase::open(
 		DBUG_RETURN(1);
 	}
 
+	norm_name = normalize_table_name(name);
+
 	/* Will be allocated if it is needed in ::update_row() */
 	upd_buf = NULL;
 	upd_buf_size = 0;
@@ -4424,24 +4436,22 @@ retry:
 			case them in the system table. */
 			if (innobase_get_lower_case_table_names() == 1) {
 
-				if (!par_case_name_set) {
+				if (par_case_name == NULL) {
 #ifndef __WIN__
 					/* Check for the table using lower
 					case name, including the partition
 					separator "P" */
-					memcpy(par_case_name, norm_name,
-					       strlen(norm_name));
-					par_case_name[strlen(norm_name)] = 0;
+					par_case_name = mem_strdup(norm_name);
 					innobase_casedn_str(par_case_name);
 #else
 					/* On Windows platfrom, check
 					whether there exists table name in
 					system table whose name is
 					not being normalized to lower case */
-					normalize_table_name_low(
-						par_case_name, name, FALSE);
+					par_case_name =
+						normalize_table_name_low(
+							name, FALSE);
 #endif
-					par_case_name_set = TRUE;
 				}
 
 				ib_table = dict_table_open_on_name(
@@ -4499,12 +4509,20 @@ retry:
 				"how you can resolve the problem.\n",
 				norm_name);
 		my_errno = ENOENT;
+		mem_free(norm_name);
+		if (par_case_name) {
+			mem_free(par_case_name);
+		}
 
 		DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
 	}
 
 table_opened:
 
+	if (par_case_name) {
+		mem_free(par_case_name);
+	}
+
 	MONITOR_INC(MONITOR_TABLE_OPEN);
 
 	if (ib_table->ibd_file_missing && !thd_tablespace_op(thd)) {
@@ -4519,6 +4537,8 @@ table_opened:
 		my_errno = ENOENT;
 
 		dict_table_close(ib_table, FALSE, FALSE);
+		mem_free(norm_name);
+
 		DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
 	}
 
@@ -4683,6 +4703,8 @@ table_opened:
 
 	info(HA_STATUS_NO_LOCK | HA_STATUS_VARIABLE | HA_STATUS_CONST);
 
+	mem_free(norm_name);
+
 	DBUG_RETURN(0);
 }
 
@@ -7954,7 +7976,7 @@ create_table_check_doc_id_col(
 				*doc_id_col = i;
 			} else {
 				push_warning_printf(
-					(THD*) trx->mysql_thd,
+					static_cast<THD*>(trx->mysql_thd),
 					Sql_condition::WARN_LEVEL_WARN,
 					ER_ILLEGAL_HA_CREATE_OPTION,
 					"InnoDB: FTS_DOC_ID column must be "
@@ -7982,17 +8004,18 @@ create_table_def(
 	const TABLE*	form,		/*!< in: information on table
 					columns and indexes */
 	const char*	table_name,	/*!< in: table name */
-	const char*	path_of_temp_table,
-					/*!< in: if this is a table explicitly
+	const char*	temp_path,	/*!< in: if this is a table explicitly
 					created by the user with the
 					TEMPORARY keyword, then this
 					parameter is the dir path where the
 					table should be placed if we create
 					an .ibd file for it (no .ibd extension
-					in the path, though) */
+					in the path, though). Otherwise this
+					is NULL */
 	ulint		flags,		/*!< in: table flags */
 	ulint		flags2)		/*!< in: table flags2 */
 {
+	THD*		thd = static_cast<THD*>(trx->mysql_thd);
 	dict_table_t*	table;
 	ulint		n_cols;
 	int		error;
@@ -8011,13 +8034,13 @@ create_table_def(
 	DBUG_ENTER("create_table_def");
 	DBUG_PRINT("enter", ("table_name: %s", table_name));
 
-	DBUG_ASSERT(trx->mysql_thd != NULL);
+	DBUG_ASSERT(thd != NULL);
 
 	/* MySQL does the name length check. But we do additional check
 	on the name length here */
 	if (strlen(table_name) > MAX_FULL_NAME_LEN) {
 		push_warning_printf(
-			(THD*) trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN,
+			thd, Sql_condition::WARN_LEVEL_WARN,
 			ER_TABLE_NAME,
 			"InnoDB: Table Name or Database Name is too long");
 
@@ -8029,7 +8052,7 @@ create_table_def(
 	if (strcmp(strchr(table_name, '/') + 1,
 		   "innodb_table_monitor") == 0) {
 		push_warning(
-			(THD*) trx->mysql_thd, Sql_condition::WARN_LEVEL_WARN,
+			thd, Sql_condition::WARN_LEVEL_WARN,
 			HA_ERR_WRONG_COMMAND,
 			DEPRECATED_MSG_INNODB_TABLE_MONITOR);
 	}
@@ -8071,9 +8094,9 @@ create_table_def(
 					      flags, flags2);
 	}
 
-	if (flags2 & DICT_TF2_TEMPORARY) {
+	if (temp_path) {
 		table->dir_path_of_temp_table =
-			mem_heap_strdup(table->heap, path_of_temp_table);
+			mem_heap_strdup(table->heap, temp_path);
 	}
 
 	heap = mem_heap_create(1000);
@@ -8086,8 +8109,7 @@ create_table_def(
 
 		if (!col_type) {
 			push_warning_printf(
-				(THD*) trx->mysql_thd,
-				Sql_condition::WARN_LEVEL_WARN,
+				thd, Sql_condition::WARN_LEVEL_WARN,
 				ER_CANT_CREATE_TABLE,
 				"Error creating table '%s' with "
 				"column '%s'. Please check its "
@@ -8111,8 +8133,7 @@ create_table_def(
 				/* in data0type.h we assume that the
 				number fits in one byte in prtype */
 				push_warning_printf(
-					(THD*) trx->mysql_thd,
-					Sql_condition::WARN_LEVEL_WARN,
+					thd, Sql_condition::WARN_LEVEL_WARN,
 					ER_CANT_CREATE_TABLE,
 					"In InnoDB, charset-collation codes"
 					" must be below 256."
@@ -8181,14 +8202,14 @@ err_col:
 		char buf[100];
 		char* buf_end = innobase_convert_identifier(
 			buf, sizeof buf - 1, table_name, strlen(table_name),
-			trx->mysql_thd, TRUE);
+			thd, TRUE);
 
 		*buf_end = '\0';
 		my_error(ER_TABLE_EXISTS_ERROR, MYF(0), buf);
 	}
 
 error_ret:
-	error = convert_error_code_to_mysql(error, flags, NULL);
+	error = convert_error_code_to_mysql(error, flags, thd);
 
 	DBUG_RETURN(error);
 }
@@ -8578,6 +8599,60 @@ innobase_fts_load_stopword(
 }
 
 /*****************************************************************//**
+Parses the table name into normal name and temp path if needed.
+The memory for these output strings is allocated here and the
+caller is responsible to free it.
+@return	0 if successful, otherwise, error number */
+UNIV_INTERN
+int
+ha_innobase::parse_table_name(
+/*==========================*/
+	const char*	name,		/*!< in/out: table name provided*/
+	HA_CREATE_INFO*	create_info,	/*!< in: more information of the
+					created table, contains also the
+					create statement string */
+	bool		use_tablespace,	/*!< in: srv_file_per_table */
+	char**		norm_name,	/*!< out: normalized table name */
+	char**		temp_path)	/*!< out: absolute path of table */
+{
+	DBUG_ENTER("ha_innobase::parse_table_name");
+
+#ifdef __WIN__
+	/* Names passed in from server are in two formats:
+	1. <database_name>/<table_name>: for normal table creation
+	2. full path: for temp table creation, or DATA DIRECTORY.
+
+	When srv_file_per_table is on and mysqld_embedded is off,
+	check for full path pattern, i.e.
+	X:\dir\...,		X is a driver letter, or
+	\\dir1\dir2\...,	UNC path
+	returns error if it is in full path format, but not creating a temp.
+	table. Currently InnoDB does not support symbolic link on Windows. */
+
+	if (use_tablespace
+	    && !mysqld_embedded
+	    && (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
+
+		if ((name[1] == ':')
+		    || (name[0] == '\\' && name[1] == '\\')) {
+			sql_print_error("Cannot create table %s\n", name);
+			DBUG_RETURN(HA_ERR_GENERIC);
+		}
+	}
+#endif
+
+	*norm_name = normalize_table_name(name);
+	*temp_path = NULL;
+
+	/* A full path is used for TEMPORARY TABLE. */
+	if (create_info->options & HA_LEX_CREATE_TMP_TABLE) {
+		*temp_path = mem_strdup(name);
+	}
+
+	DBUG_RETURN(0);
+}
+
+/*****************************************************************//**
 Determines InnoDB table flags.
 @retval true if successful, false if error */
 UNIV_INTERN
@@ -8812,8 +8887,8 @@ ha_innobase::create(
 	trx_t*		trx;
 	int		primary_key_no;
 	uint		i;
-	char		name2[FN_REFLEN];
-	char		norm_name[FN_REFLEN];
+	char*		temp_path = NULL;	/* absolute path of temp frm */
+	char*		norm_name = NULL;	/* {database}/{tablename} */
 	THD*		thd = ha_thd();
 	ib_int64_t	auto_inc_value;
 
@@ -8838,30 +8913,6 @@ ha_innobase::create(
 	DBUG_ASSERT(thd != NULL);
 	DBUG_ASSERT(create_info != NULL);
 
-#ifdef __WIN__
-	/* Names passed in from server are in two formats:
-	1. <database_name>/<table_name>: for normal table creation
-	2. full path: for temp table creation, or sym link
-
-	When srv_file_per_table is on and mysqld_embedded is off,
-	check for full path pattern, i.e.
-	X:\dir\...,		X is a driver letter, or
-	\\dir1\dir2\...,	UNC path
-	returns error if it is in full path format, but not creating a temp.
-	table. Currently InnoDB does not support symbolic link on Windows. */
-
-	if (use_tablespace
-	    && !mysqld_embedded
-	    && (!create_info->options & HA_LEX_CREATE_TMP_TABLE)) {
-
-		if ((name[1] == ':')
-		    || (name[0] == '\\' && name[1] == '\\')) {
-			sql_print_error("Cannot create table %s\n", name);
-			DBUG_RETURN(HA_ERR_GENERIC);
-		}
-	}
-#endif
-
 	if (form->s->fields > 1000) {
 		/* The limit probably should be REC_MAX_N_FIELDS - 3 = 1020,
 		but we play safe here */
@@ -8869,10 +8920,6 @@ ha_innobase::create(
 		DBUG_RETURN(HA_ERR_TO_BIG_ROW);
 	}
 
-	strcpy(name2, name);
-
-	normalize_table_name(norm_name, name2);
-
 	/* Create the table definition in InnoDB */
 
 	/* Validate create options if innodb_strict_mode is set. */
@@ -8887,6 +8934,12 @@ ha_innobase::create(
 		DBUG_RETURN(-1);
 	}
 
+	error = parse_table_name(name, create_info, use_tablespace,
+				 &norm_name, &temp_path);
+	if (error) {
+		DBUG_RETURN(error);
+	}
+
 	/* Look for a primary key */
 	primary_key_no = (form->s->primary_key != MAX_KEY ?
 			  (int) form->s->primary_key :
@@ -8900,11 +8953,13 @@ ha_innobase::create(
 	any user indices to be created. */
 	if (innobase_index_name_is_reserved(thd, form->key_info,
 					    form->s->keys)) {
-		DBUG_RETURN(-1);
+		error = -1;
+		goto cleanup3;
 	}
 
 	if (IS_MAGIC_TABLE_AND_USER_DENIED_ACCESS(norm_name, thd)) {
-		DBUG_RETURN(HA_ERR_GENERIC);
+		error = HA_ERR_GENERIC;
+		goto cleanup3;
 	}
 
 	/* Get the transaction associated with the current thd, or create one
@@ -8925,7 +8980,8 @@ ha_innobase::create(
 
 	row_mysql_lock_data_dictionary(trx);
 
-	error = create_table_def(trx, form, norm_name, name2, flags, flags2);
+	error = create_table_def(trx, form, norm_name, temp_path,
+				 flags, flags2);
 
 	if (error) {
 		goto cleanup;
@@ -9096,8 +9152,8 @@ ha_innobase::create(
 		if (!innobase_fts_load_stopword(innobase_table, NULL, thd)) {
 			dict_table_close(innobase_table, FALSE, FALSE);
 			srv_active_wake_master_thread();
-			trx_free_for_mysql(trx);
-			DBUG_RETURN(-1);
+			error = -1;
+			goto cleanup2;
 		}
 	}
 
@@ -9138,17 +9194,23 @@ ha_innobase::create(
 
 	srv_active_wake_master_thread();
 
-	trx_free_for_mysql(trx);
-
-	DBUG_RETURN(0);
+	error = 0;
+	goto cleanup2;
 
 cleanup:
 	innobase_commit_low(trx);
 
 	row_mysql_unlock_data_dictionary(trx);
 
+cleanup2:
 	trx_free_for_mysql(trx);
 
+cleanup3:
+	if (temp_path) {
+		mem_free(temp_path);
+	}
+	mem_free(norm_name);
+
 	DBUG_RETURN(error);
 }
 
@@ -9233,7 +9295,7 @@ ha_innobase::delete_table(
 	trx_t*	parent_trx;
 	trx_t*	trx;
 	THD	*thd = ha_thd();
-	char	norm_name[1000];
+	char*	norm_name = NULL;
 	char	errstr[1024];
 
 	DBUG_ENTER("ha_innobase::delete_table");
@@ -9245,9 +9307,10 @@ ha_innobase::delete_table(
 
 	/* Strangely, MySQL passes the table name without the '.frm'
 	extension, in contrast to ::create */
-	normalize_table_name(norm_name, name);
+	norm_name = normalize_table_name(name);
 
 	if (IS_MAGIC_TABLE_AND_USER_DENIED_ACCESS(norm_name, thd)) {
+		mem_free(norm_name);
 		DBUG_RETURN(HA_ERR_GENERIC);
 	}
 
@@ -9302,25 +9365,26 @@ ha_innobase::delete_table(
 #endif /* __WIN__ */
 
 		if (is_part) {
-			char	par_case_name[MAX_FULL_NAME_LEN + 1];
+			char*	par_case_name;
 
 #ifndef __WIN__
 			/* Check for the table using lower
 			case name, including the partition
 			separator "P" */
-			memcpy(par_case_name, norm_name, strlen(norm_name));
-			par_case_name[strlen(norm_name)] = 0;
+			par_case_name = mem_strdup(norm_name);
 			innobase_casedn_str(par_case_name);
 #else
 			/* On Windows platfrom, check
 			whether there exists table name in
 			system table whose name is
 			not being normalized to lower case */
-			normalize_table_name_low(par_case_name, name, FALSE);
+			par_case_name = normalize_table_name_low(
+				name, FALSE);
 #endif
-			error = row_drop_table_for_mysql(par_case_name, trx,
-							 thd_sql_command(thd)
-							 == SQLCOM_DROP_DB);
+			error = row_drop_table_for_mysql(
+				par_case_name, trx,
+				thd_sql_command(thd) == SQLCOM_DROP_DB);
+			mem_free(par_case_name);
 		}
 	}
 
@@ -9341,6 +9405,7 @@ ha_innobase::delete_table(
 
 	error = convert_error_code_to_mysql(error, 0, NULL);
 
+	mem_free(norm_name);
 	DBUG_RETURN(error);
 }
 
@@ -9440,12 +9505,8 @@ innobase_rename_table(
 	DBUG_ENTER("innobase_rename_table");
 	DBUG_ASSERT(trx_get_dict_operation(trx) == TRX_DICT_OP_INDEX);
 
-	// Magic number 64 arbitrary
-	norm_to = (char*) my_malloc(strlen(to) + 64, MYF(0));
-	norm_from = (char*) my_malloc(strlen(from) + 64, MYF(0));
-
-	normalize_table_name(norm_to, to);
-	normalize_table_name(norm_from, from);
+	norm_to = normalize_table_name(to);
+	norm_from = normalize_table_name(from);
 
 	/* Serialize data dictionary operations with dictionary mutex:
 	no deadlocks can occur then in these operations */
@@ -9471,27 +9532,26 @@ innobase_rename_table(
 #endif /* __WIN__ */
 
 			if (is_part) {
-				char	par_case_name[MAX_FULL_NAME_LEN + 1];
+				char*	par_case_name;
 
 #ifndef __WIN__
 				/* Check for the table using lower
 				case name, including the partition
 				separator "P" */
-				memcpy(par_case_name, norm_from,
-				       strlen(norm_from));
-				par_case_name[strlen(norm_from)] = 0;
+				par_case_name = mem_strdup(norm_from);
 				innobase_casedn_str(par_case_name);
 #else
 				/* On Windows platfrom, check
 				whether there exists table name in
 				system table whose name is
 				not being normalized to lower case */
-				normalize_table_name_low(par_case_name,
-							 from, FALSE);
+				par_case_name = normalize_table_name_low(
+					from, FALSE);
 #endif
 				error = (db_err) row_rename_table_for_mysql(
 					par_case_name, norm_to, trx, TRUE);
 
+				mem_free(par_case_name);
 			}
 		}
 
@@ -9531,8 +9591,8 @@ innobase_rename_table(
 
 	log_buffer_flush_to_disk();
 
-	my_free(norm_to);
-	my_free(norm_from);
+	mem_free(norm_to);
+	mem_free(norm_from);
 
 	DBUG_RETURN(error);
 }
@@ -10160,8 +10220,8 @@ ha_innobase::info_low(
 					"space for table %s but its "
 					"tablespace has been discarded or "
 					"the .ibd file is missing. Setting "
-                                        "the free space to zero. "
-                                        "(errno: %d - %s)",
+					"the free space to zero. "
+					"(errno: %d - %s)",
 					ib_table->name, errno,
 					my_strerror(errbuf, sizeof(errbuf),
 						    errno));

=== modified file 'storage/innobase/handler/ha_innodb.h'
--- a/storage/innobase/handler/ha_innodb.h	revid:marko.makela@stripped40247-yaj6c6vqw7vkdms4
+++ b/storage/innobase/handler/ha_innodb.h	revid:marko.makela@strippedzlp38lna1gv37
@@ -191,6 +191,11 @@ class ha_innobase: public handler
 	ha_rows estimate_rows_upper_bound();
 
 	void update_create_info(HA_CREATE_INFO* create_info);
+	int parse_table_name(const char*name,
+			     HA_CREATE_INFO*create_info,
+			     bool use_tablespace,
+			     char** norm_name,
+			     char** temp_path);
 	int create(const char *name, register TABLE *form,
 					HA_CREATE_INFO *create_info);
 	int truncate();

=== modified file 'storage/innobase/handler/handler0alter.cc'
--- a/storage/innobase/handler/handler0alter.cc	revid:marko.makela@oracle.com-20120407140247-yaj6c6vqw7vkdms4
+++ b/storage/innobase/handler/handler0alter.cc	revid:marko.makela@strippedm-20120410080813-a3ezlp38lna1gv37
@@ -869,7 +869,7 @@ innobase_fts_check_doc_id_index_in_def(
 		}
 
 		return(FTS_EXIST_DOC_ID_INDEX);
-        }
+	}
 
 	return(FTS_NOT_EXIST_DOC_ID_INDEX);
 }

=== modified file 'storage/innobase/handler/i_s.cc'
--- a/storage/innobase/handler/i_s.cc	revid:marko.makela@strippeddms4
+++ b/storage/innobase/handler/i_s.cc	revid:marko.makela@stripped
@@ -5511,10 +5511,11 @@ i_s_common_deinit(
 	DBUG_RETURN(0);
 }
 
+/**  SYS_TABLES  ***************************************************/
 /* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLES */
 static ST_FIELD_INFO	innodb_sys_tables_fields_info[] =
 {
-#define SYS_TABLE_ID		0
+#define SYS_TABLES_ID			0
 	{STRUCT_FLD(field_name,		"TABLE_ID"),
 	 STRUCT_FLD(field_length,	MY_INT64_NUM_DECIMAL_DIGITS),
 	 STRUCT_FLD(field_type,		MYSQL_TYPE_LONGLONG),
@@ -5523,7 +5524,7 @@ static ST_FIELD_INFO	innodb_sys_tables_f
 	 STRUCT_FLD(old_name,		""),
 	 STRUCT_FLD(open_method,	SKIP_OPEN_TABLE)},
 
-#define SYS_TABLE_NAME		1
+#define SYS_TABLES_NAME			1
 	{STRUCT_FLD(field_name,		"NAME"),
 	 STRUCT_FLD(field_length,	MAX_FULL_NAME_LEN + 1),
 	 STRUCT_FLD(field_type,		MYSQL_TYPE_STRING),
@@ -5532,7 +5533,7 @@ static ST_FIELD_INFO	innodb_sys_tables_f
 	 STRUCT_FLD(old_name,		""),
 	 STRUCT_FLD(open_method,	SKIP_OPEN_TABLE)},
 
-#define SYS_TABLE_FLAG		2
+#define SYS_TABLES_FLAG			2
 	{STRUCT_FLD(field_name,		"FLAG"),
 	 STRUCT_FLD(field_length,	MY_INT32_NUM_DECIMAL_DIGITS),
 	 STRUCT_FLD(field_type,		MYSQL_TYPE_LONG),
@@ -5541,7 +5542,7 @@ static ST_FIELD_INFO	innodb_sys_tables_f
 	 STRUCT_FLD(old_name,		""),
 	 STRUCT_FLD(open_method,	SKIP_OPEN_TABLE)},
 
-#define SYS_TABLE_NUM_COLUMN	3
+#define SYS_TABLES_NUM_COLUMN		3
 	{STRUCT_FLD(field_name,		"N_COLS"),
 	 STRUCT_FLD(field_length,	MY_INT32_NUM_DECIMAL_DIGITS),
 	 STRUCT_FLD(field_type,		MYSQL_TYPE_LONG),
@@ -5550,7 +5551,7 @@ static ST_FIELD_INFO	innodb_sys_tables_f
 	 STRUCT_FLD(old_name,		""),
 	 STRUCT_FLD(open_method,	SKIP_OPEN_TABLE)},
 
-#define SYS_TABLE_SPACE		4
+#define SYS_TABLES_SPACE		4
 	{STRUCT_FLD(field_name,		"SPACE"),
 	 STRUCT_FLD(field_length,	MY_INT32_NUM_DECIMAL_DIGITS),
 	 STRUCT_FLD(field_type,		MYSQL_TYPE_LONG),
@@ -5580,15 +5581,15 @@ i_s_dict_fill_sys_tables(
 
 	fields = table_to_fill->field;
 
-	OK(fields[SYS_TABLE_ID]->store(longlong(table->id), TRUE));
+	OK(fields[SYS_TABLES_ID]->store(longlong(table->id), TRUE));
 
-	OK(field_store_string(fields[SYS_TABLE_NAME], table->name));
+	OK(field_store_string(fields[SYS_TABLES_NAME], table->name));
 
-	OK(fields[SYS_TABLE_FLAG]->store(table->flags));
+	OK(fields[SYS_TABLES_FLAG]->store(table->flags));
 
-	OK(fields[SYS_TABLE_NUM_COLUMN]->store(table->n_cols));
+	OK(fields[SYS_TABLES_NUM_COLUMN]->store(table->n_cols));
 
-	OK(fields[SYS_TABLE_SPACE]->store(table->space));
+	OK(fields[SYS_TABLES_SPACE]->store(table->space));
 
 	OK(schema_table_store_record(thd, table_to_fill));
 
@@ -5741,6 +5742,7 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 	STRUCT_FLD(flags, 0UL),
 };
 
+/**  SYS_TABLESTATS  ***********************************************/
 /* Fields of the dynamic table INFORMATION_SCHEMA.SYS_TABLESTATS */
 static ST_FIELD_INFO	innodb_sys_tablestats_fields_info[] =
 {
@@ -6020,6 +6022,7 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 	STRUCT_FLD(flags, 0UL),
 };
 
+/**  SYS_INDEXES  **************************************************/
 /* Fields of the dynamic table INFORMATION_SCHEMA.SYS_INDEXES */
 static ST_FIELD_INFO	innodb_sysindex_fields_info[] =
 {
@@ -6279,7 +6282,8 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 	STRUCT_FLD(flags, 0UL),
 };
 
-/* Fields of the dynamic table INFORMATION_SCHEMA.SYS_COLUMNS */
+/**  SYS_COLUMNS  **************************************************/
+/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_COLUMNS */
 static ST_FIELD_INFO	innodb_sys_columns_fields_info[] =
 {
 #define SYS_COLUMN_TABLE_ID		0
@@ -6517,7 +6521,9 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 	/* unsigned long */
 	STRUCT_FLD(flags, 0UL),
 };
-/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_fields */
+
+/**  SYS_FIELDS  ***************************************************/
+/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_FIELDS */
 static ST_FIELD_INFO	innodb_sys_fields_fields_info[] =
 {
 #define SYS_FIELD_INDEX_ID	0
@@ -6729,7 +6735,8 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 	STRUCT_FLD(flags, 0UL),
 };
 
-/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign */
+/**  SYS_FOREIGN        ********************************************/
+/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_FOREIGN */
 static ST_FIELD_INFO	innodb_sys_foreign_fields_info[] =
 {
 #define SYS_FOREIGN_ID		0
@@ -6814,6 +6821,7 @@ i_s_dict_fill_sys_foreign(
 
 	DBUG_RETURN(0);
 }
+
 /*******************************************************************//**
 Function to populate INFORMATION_SCHEMA.innodb_sys_foreign table. Loop
 through each record in SYS_FOREIGN, and extract the foreign key
@@ -6880,6 +6888,7 @@ i_s_sys_foreign_fill_table(
 
 	DBUG_RETURN(0);
 }
+
 /*******************************************************************//**
 Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign
 @return 0 on success */
@@ -6953,7 +6962,9 @@ UNIV_INTERN struct st_mysql_plugin	i_s_i
 	/* unsigned long */
 	STRUCT_FLD(flags, 0UL),
 };
-/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign_cols */
+
+/**  SYS_FOREIGN_COLS   ********************************************/
+/* Fields of the dynamic table INFORMATION_SCHEMA.INNODB_SYS_FOREIGN_COLS */
 static ST_FIELD_INFO	innodb_sys_foreign_cols_fields_info[] =
 {
 #define SYS_FOREIGN_COL_ID		0

=== modified file 'storage/innobase/include/dict0boot.h'
--- a/storage/innobase/include/dict0boot.h	revid:marko.makela@stripped
+++ b/storage/innobase/include/dict0boot.h	revid:marko.makela@oracle.com-20120410080813-a3ezlp38lna1gv37
@@ -88,7 +88,7 @@ void
 dict_boot(void);
 /*===========*/
 /*****************************************************************//**
-Creates and initializes the data dictionary at the database creation. */
+Creates and initializes the data dictionary at the server bootstrap. */
 UNIV_INTERN
 void
 dict_create(void);

=== modified file 'storage/innobase/include/dict0crea.h'
--- a/storage/innobase/include/dict0crea.h	revid:marko.makela@strippedms4
+++ b/storage/innobase/include/dict0crea.h	revid:marko.makela@stripped
@@ -99,7 +99,7 @@ dict_drop_index_tree(
 	mtr_t*	mtr);	/*!< in: mtr having the latch on the record page */
 /****************************************************************//**
 Creates the foreign key constraints system tables inside InnoDB
-at database creation or database start if they are not found or are
+at server bootstrap or server start if they are not found or are
 not of the right form.
 @return	DB_SUCCESS or error code */
 UNIV_INTERN

=== modified file 'storage/innobase/include/dict0load.h'
--- a/storage/innobase/include/dict0load.h	revid:marko.makela@oracle.com-20120407140247-yaj6c6vqw7vkdms4
+++ b/storage/innobase/include/dict0load.h	revid:marko.makela@stripped0120410080813-a3ezlp38lna1gv37
@@ -33,7 +33,7 @@ Created 4/24/1996 Heikki Tuuri
 #include "mem0mem.h"
 #include "btr0types.h"
 
-/** enum that defines all 6 system table IDs */
+/** enum that defines all system table IDs. @see SYSTEM_TABLE_NAME[] */
 enum dict_system_table_id {
 	SYS_TABLES = 0,
 	SYS_INDEXES,

=== modified file 'storage/innobase/include/fts0priv.h'
--- a/storage/innobase/include/fts0priv.h	revid:marko.makela@strippedyaj6c6vqw7vkdms4
+++ b/storage/innobase/include/fts0priv.h	revid:marko.makela@strippeda1gv37
@@ -506,7 +506,7 @@ fts_wait_for_background_thread_to_start(
 Get the total number of documents in the FTS.
 @return estimated number of rows in the table */
 UNIV_INTERN
-ulint
+ib_int64_t
 fts_get_total_document_count(
 /*=========================*/
 	dict_table_t*	table);		/*!< in: table instance */

=== modified file 'storage/innobase/include/ut0vec.ic'
--- a/storage/innobase/include/ut0vec.ic	revid:marko.makela@stripped6c6vqw7vkdms4
+++ b/storage/innobase/include/ut0vec.ic	revid:marko.makela@stripped37
@@ -346,7 +346,7 @@ ib_vector_remove(
 	ib_vector_t*	vec,	/*!< in: vector */
 	const void*	elem)	/*!< in: value to remove */
 {
-	void*		current;
+	void*		current = NULL;
 	void*		next;
 	ulint		i;
 

=== modified file 'storage/innobase/os/os0file.cc'
--- a/storage/innobase/os/os0file.cc	revid:marko.makela@stripped6vqw7vkdms4
+++ b/storage/innobase/os/os0file.cc	revid:marko.makela@stripped
@@ -645,7 +645,8 @@ os_file_handle_error_cond_exit(
 
 			ut_print_timestamp(stderr);
 			fprintf(stderr, "  InnoDB: File operation call: "
-				"'%s'.\n", operation);
+				"'%s' returned OS error " ULINTPF ".\n",
+				operation, err);
 		}
 
 		if (should_exit) {

=== modified file 'storage/perfschema/pfs_digest.cc'
--- a/storage/perfschema/pfs_digest.cc	revid:marko.makela@stripped-yaj6c6vqw7vkdms4
+++ b/storage/perfschema/pfs_digest.cc	revid:marko.makela@strippedgv37
@@ -578,19 +578,23 @@ PSI_digest_locker* pfs_digest_add_token_
         TOK_PFS_GENERIC_VALUE := BIN_NUM | DECIMAL_NUM | ... | ULONGLONG_NUM
       */
       token= TOK_PFS_GENERIC_VALUE;
-
+    }
+    /* fall through */
+    case NULL_SYM:
+    {
       if ((last_token2 == TOK_PFS_GENERIC_VALUE ||
-           last_token2 == TOK_PFS_GENERIC_VALUE_LIST) &&
+           last_token2 == TOK_PFS_GENERIC_VALUE_LIST ||
+           last_token2 == NULL_SYM) &&
           (last_token == ','))
       {
         /*
           REDUCE:
           TOK_PFS_GENERIC_VALUE_LIST :=
-            TOK_PFS_GENERIC_VALUE ',' TOK_PFS_GENERIC_VALUE
+            (TOK_PFS_GENERIC_VALUE|NULL_SYM) ',' (TOK_PFS_GENERIC_VALUE|NULL_SYM)
           
           REDUCE:
           TOK_PFS_GENERIC_VALUE_LIST :=
-            TOK_PFS_GENERIC_VALUE_LIST ',' TOK_PFS_GENERIC_VALUE
+            TOK_PFS_GENERIC_VALUE_LIST ',' (TOK_PFS_GENERIC_VALUE|NULL_SYM)
         */
         digest_storage->m_byte_count-= 2*PFS_SIZE_OF_A_TOKEN;
         token= TOK_PFS_GENERIC_VALUE_LIST;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-wl5545 branch (marko.makela:3884 to 3885) marko.makela10 Apr