List:Commits« Previous MessageNext Message »
From:Georgi Kodinov Date:June 1 2010 12:25pm
Subject:bzr push into mysql-5.1-bugteam branch (Georgi.Kodinov:3404 to 3408)
Bug#40928
View as plain text  
 3408 Georgi Kodinov	2010-06-01
      Bug#40928 : make main.func_str experimental on Solaris

    modified:
      mysql-test/collections/default.experimental
 3407 Georgi Kodinov	2010-06-01
      Bug #54138 : making main.sp and rpl.rpl_row_sp011 experimental on solaris

    modified:
      mysql-test/collections/default.experimental
 3406 Georgi Kodinov	2010-06-01 [merge]
      merged mysql-5.0-bugteam -> mysql-5.1-bugteam

 3405 Georgi Kodinov	2010-06-01 [merge]
      merge mysql-5.1 -> mysql-5.1-bugteam

    added:
      mysql-test/suite/innodb/r/innodb_bug48024.result
      mysql-test/suite/innodb/r/innodb_bug49164.result
      mysql-test/suite/innodb/r/innodb_multi_update.result
      mysql-test/suite/innodb/t/innodb_bug48024.test
      mysql-test/suite/innodb/t/innodb_bug49164.test
      mysql-test/suite/innodb/t/innodb_multi_update.test
      mysql-test/suite/innodb_plugin/r/innodb_bug48024.result
      mysql-test/suite/innodb_plugin/r/innodb_bug49164.result
      mysql-test/suite/innodb_plugin/r/innodb_bug53290.result
      mysql-test/suite/innodb_plugin/r/innodb_bug53591.result
      mysql-test/suite/innodb_plugin/r/innodb_bug53592.result
      mysql-test/suite/innodb_plugin/r/innodb_multi_update.result
      mysql-test/suite/innodb_plugin/t/disabled.def
      mysql-test/suite/innodb_plugin/t/innodb_bug48024.test
      mysql-test/suite/innodb_plugin/t/innodb_bug49164.test
      mysql-test/suite/innodb_plugin/t/innodb_bug53290.test
      mysql-test/suite/innodb_plugin/t/innodb_bug53591.test
      mysql-test/suite/innodb_plugin/t/innodb_bug53592.test
      mysql-test/suite/innodb_plugin/t/innodb_multi_update.test
    modified:
      BUILD/SETUP.sh
      BUILD/build_mccge.sh
      BUILD/compile-amd64-valgrind-max
      BUILD/compile-pentium-icc-valgrind-max
      BUILD/compile-pentium-valgrind-max
      BUILD/compile-pentium-valgrind-max-no-ndb
      BUILD/compile-pentium64-valgrind-max
      configure.in
      include/m_string.h
      include/my_sys.h
      mysql-test/suite/binlog/t/binlog_killed.test
      mysql-test/suite/innodb/r/innodb.result
      mysql-test/suite/innodb/t/disabled.def
      mysql-test/suite/innodb/t/innodb.test
      mysql-test/suite/innodb_plugin/r/innodb.result
      mysql-test/suite/innodb_plugin/t/innodb.test
      mysql-test/suite/sys_vars/r/tx_isolation_func.result
      mysql-test/suite/sys_vars/t/tx_isolation_func.test
      mysql-test/t/disabled.def
      mysql-test/t/ps_3innodb.test
      mysql-test/valgrind.supp
      mysys/safemalloc.c
      storage/innobase/buf/buf0flu.c
      storage/innobase/dict/dict0dict.c
      storage/innobase/fsp/fsp0fsp.c
      storage/innobase/handler/ha_innodb.cc
      storage/innobase/handler/ha_innodb.h
      storage/innobase/include/db0err.h
      storage/innobase/include/dict0dict.h
      storage/innobase/include/mach0data.ic
      storage/innobase/include/row0mysql.h
      storage/innobase/include/trx0trx.h
      storage/innobase/include/univ.i
      storage/innobase/row/row0mysql.c
      storage/innobase/row/row0sel.c
      storage/innobase/srv/srv0srv.c
      storage/innobase/srv/srv0start.c
      storage/innobase/trx/trx0trx.c
      storage/innodb_plugin/ChangeLog
      storage/innodb_plugin/btr/btr0btr.c
      storage/innodb_plugin/btr/btr0cur.c
      storage/innodb_plugin/buf/buf0buddy.c
      storage/innodb_plugin/buf/buf0buf.c
      storage/innodb_plugin/buf/buf0flu.c
      storage/innodb_plugin/buf/buf0lru.c
      storage/innodb_plugin/dict/dict0boot.c
      storage/innodb_plugin/dict/dict0crea.c
      storage/innodb_plugin/dict/dict0dict.c
      storage/innodb_plugin/fil/fil0fil.c
      storage/innodb_plugin/fsp/fsp0fsp.c
      storage/innodb_plugin/handler/ha_innodb.cc
      storage/innodb_plugin/handler/ha_innodb.h
      storage/innodb_plugin/handler/handler0alter.cc
      storage/innodb_plugin/include/buf0buf.ic
      storage/innodb_plugin/include/buf0lru.h
      storage/innodb_plugin/include/dict0boot.h
      storage/innodb_plugin/include/dict0dict.h
      storage/innodb_plugin/include/fil0fil.h
      storage/innodb_plugin/include/ha_prototypes.h
      storage/innodb_plugin/include/mach0data.ic
      storage/innodb_plugin/include/rem0cmp.h
      storage/innodb_plugin/include/row0mysql.h
      storage/innodb_plugin/include/trx0trx.h
      storage/innodb_plugin/include/univ.i
      storage/innodb_plugin/page/page0zip.c
      storage/innodb_plugin/rem/rem0cmp.c
      storage/innodb_plugin/row/row0merge.c
      storage/innodb_plugin/row/row0mysql.c
      storage/innodb_plugin/row/row0sel.c
      storage/innodb_plugin/setup.sh
      storage/innodb_plugin/srv/srv0srv.c
      storage/innodb_plugin/sync/sync0arr.c
      storage/innodb_plugin/trx/trx0i_s.c
      storage/innodb_plugin/trx/trx0trx.c
 3404 Sergey Glukhov	2010-06-01
      test case fix
     @ mysql-test/r/join_outer.result
        test case fix
     @ mysql-test/t/join_outer.test
        test case fix

    modified:
      mysql-test/r/join_outer.result
      mysql-test/t/join_outer.test
=== modified file 'BUILD/SETUP.sh'
--- a/BUILD/SETUP.sh	2008-11-05 15:40:23 +0000
+++ b/BUILD/SETUP.sh	2010-05-20 10:40:42 +0000
@@ -119,8 +119,12 @@ fi
 
 # Set flags for various build configurations.
 # Used in -valgrind builds
-valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
+# Override -DFORCE_INIT_OF_VARS from debug_cflags. It enables the macro
+# LINT_INIT(), which is only useful for silencing spurious warnings
+# of static analysis tools. We want LINT_INIT() to be a no-op in Valgrind.
+valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
 valgrind_flags="$valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
+valgrind_configs="--with-valgrind"
 #
 # Used in -debug builds
 debug_cflags="-DUNIV_MUST_NOT_INLINE -DEXTRA_DEBUG -DFORCE_INIT_OF_VARS "

=== modified file 'BUILD/build_mccge.sh'
--- a/BUILD/build_mccge.sh	2008-02-07 23:12:34 +0000
+++ b/BUILD/build_mccge.sh	2010-05-20 10:40:42 +0000
@@ -938,9 +938,10 @@ set_up_ccache()
 set_valgrind_flags()
 {
   if test "x$valgrind_flag" = "xyes" ; then
-    loc_valgrind_flags="-USAFEMALLOC -UFORCE_INIT_OF_VARS -DHAVE_purify "
+    loc_valgrind_flags="-UFORCE_INIT_OF_VARS -DHAVE_purify "
     loc_valgrind_flags="$loc_valgrind_flags -DMYSQL_SERVER_SUFFIX=-valgrind-max"
     compiler_flags="$compiler_flags $loc_valgrind_flags"
+    with_flags="$with_flags --with-valgrind"
   fi
 }
 

=== modified file 'BUILD/compile-amd64-valgrind-max'
--- a/BUILD/compile-amd64-valgrind-max	2007-01-23 13:09:14 +0000
+++ b/BUILD/compile-amd64-valgrind-max	2010-05-20 10:40:42 +0000
@@ -4,7 +4,7 @@ path=`dirname $0`
 . "$path/SETUP.sh"
 
 extra_flags="$amd64_cflags $debug_cflags $valgrind_flags"
-extra_configs="$amd64_configs $debug_configs $max_configs"
+extra_configs="$amd64_configs $debug_configs $valgrind_configs $max_configs"
 
 . "$path/FINISH.sh"
 

=== modified file 'BUILD/compile-pentium-icc-valgrind-max'
--- a/BUILD/compile-pentium-icc-valgrind-max	2006-04-05 12:50:12 +0000
+++ b/BUILD/compile-pentium-icc-valgrind-max	2010-05-20 10:40:42 +0000
@@ -29,6 +29,6 @@ extra_flags="$pentium_cflags $debug_cfla
 c_warnings="-Wall -Wcheck -wd161,444,279,810,981,1292,1469,1572"
 cxx_warnings="$c_warnings -wd869,874"
 base_cxxflags="-fno-exceptions -fno-rtti"
-extra_configs="$pentium_configs $debug_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs"
 
 . "$path/FINISH.sh"

=== modified file 'BUILD/compile-pentium-valgrind-max'
--- a/BUILD/compile-pentium-valgrind-max	2007-04-11 12:12:00 +0000
+++ b/BUILD/compile-pentium-valgrind-max	2010-05-20 10:40:42 +0000
@@ -4,7 +4,7 @@ path=`dirname $0`
 . "$path/SETUP.sh"
 
 extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
-extra_configs="$pentium_configs $debug_configs $max_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
 
 . "$path/FINISH.sh"
 

=== modified file 'BUILD/compile-pentium-valgrind-max-no-ndb'
--- a/BUILD/compile-pentium-valgrind-max-no-ndb	2008-05-27 15:35:35 +0000
+++ b/BUILD/compile-pentium-valgrind-max-no-ndb	2010-05-20 10:40:42 +0000
@@ -4,7 +4,7 @@ path=`dirname $0`
 . "$path/SETUP.sh"
 
 extra_flags="$pentium_cflags $debug_cflags $valgrind_flags"
-extra_configs="$pentium_configs $debug_configs $max_no_ndb_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_no_ndb_configs"
 
 . "$path/FINISH.sh"
 

=== modified file 'BUILD/compile-pentium64-valgrind-max'
--- a/BUILD/compile-pentium64-valgrind-max	2006-04-05 13:50:33 +0000
+++ b/BUILD/compile-pentium64-valgrind-max	2010-05-20 10:40:42 +0000
@@ -4,7 +4,7 @@ path=`dirname $0`
 . "$path/SETUP.sh"
 
 extra_flags="$pentium64_cflags $debug_cflags $valgrind_flags"
-extra_configs="$pentium_configs $debug_configs $max_configs"
+extra_configs="$pentium_configs $debug_configs $valgrind_configs $max_configs"
 
 . "$path/FINISH.sh"
 

=== modified file 'configure.in'
--- a/configure.in	2010-04-12 10:12:20 +0000
+++ b/configure.in	2010-05-20 10:40:42 +0000
@@ -12,7 +12,7 @@ dnl
 dnl When changing the major version number please also check the switch
 dnl statement in mysqlbinlog::check_master_version().  You may also need
 dnl to update version.c in ndb.
-AC_INIT([MySQL Server], [5.1.47], [], [mysql])
+AC_INIT([MySQL Server], [5.1.48], [], [mysql])
 
 AC_CONFIG_SRCDIR([sql/mysqld.cc])
 AC_CANONICAL_SYSTEM
@@ -1729,6 +1729,17 @@ else
   CXXFLAGS="$OPTIMIZE_CXXFLAGS $CXXFLAGS"
 fi
 
+AC_ARG_WITH([valgrind],
+  [AS_HELP_STRING([--with-valgrind],
+    [Valgrind instrumentation @<:@default=no@:>@])],
+    [], [with_valgrind=no])
+
+if test "$with_valgrind" != "no"
+then
+  AC_CHECK_HEADERS([valgrind/valgrind.h valgrind/memcheck.h],
+    [AC_DEFINE([HAVE_VALGRIND], [1], [Define for Valgrind support])])
+fi
+
 # Debug Sync Facility. NOTE: depends on 'with_debug'. Must be behind it.
 AC_MSG_CHECKING(if Debug Sync Facility should be enabled.)
 AC_ARG_ENABLE(debug_sync,

=== modified file 'include/m_string.h'
--- a/include/m_string.h	2009-12-24 09:00:04 +0000
+++ b/include/m_string.h	2010-05-20 10:40:42 +0000
@@ -127,9 +127,6 @@ extern	size_t bcmp(const uchar *s1,const
 extern	size_t my_bcmp(const uchar *s1,const uchar *s2,size_t len);
 #undef bcmp
 #define bcmp(A,B,C) my_bcmp((A),(B),(C))
-#define bzero_if_purify(A,B) bzero(A,B)
-#else
-#define bzero_if_purify(A,B)
 #endif /* HAVE_purify */
 
 #ifndef bmove512

=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2010-02-26 14:30:14 +0000
+++ b/include/my_sys.h	2010-05-20 10:40:42 +0000
@@ -25,6 +25,19 @@ typedef struct my_aio_result {
 } my_aio_result;
 #endif
 
+#ifdef HAVE_VALGRIND
+# include <valgrind/memcheck.h>
+# define MEM_UNDEFINED(a,len) VALGRIND_MAKE_MEM_UNDEFINED(a,len)
+# define MEM_NOACCESS(a,len) VALGRIND_MAKE_MEM_NOACCESS(a,len)
+# define MEM_CHECK_ADDRESSABLE(a,len) VALGRIND_CHECK_MEM_IS_ADDRESSABLE(a,len)
+# define MEM_CHECK_DEFINED(a,len) VALGRIND_CHECK_MEM_IS_DEFINED(a,len)
+#else /* HAVE_VALGRIND */
+# define MEM_UNDEFINED(a,len) ((void) 0)
+# define MEM_NOACCESS(a,len) ((void) 0)
+# define MEM_CHECK_ADDRESSABLE(a,len) ((void) 0)
+# define MEM_CHECK_DEFINED(a,len) ((void) 0)
+#endif /* HAVE_VALGRIND */
+
 #ifndef THREAD
 extern int NEAR my_errno;		/* Last error in mysys */
 #else
@@ -141,7 +154,7 @@ extern int NEAR my_errno;		/* Last error
 #define my_memdup(A,B,C) _my_memdup((A),(B), __FILE__,__LINE__,C)
 #define my_strdup(A,C) _my_strdup((A), __FILE__,__LINE__,C)
 #define my_strndup(A,B,C) _my_strndup((A),(B),__FILE__,__LINE__,C)
-#define TRASH(A,B) bfill(A, B, 0x8F)
+#define TRASH(A,B) do { bfill(A, B, 0x8F); MEM_UNDEFINED(A, B); } while (0)
 #define QUICK_SAFEMALLOC sf_malloc_quick=1
 #define NORMAL_SAFEMALLOC sf_malloc_quick=0
 extern uint sf_malloc_prehunc,sf_malloc_endhunc,sf_malloc_quick;
@@ -169,7 +182,7 @@ extern char *my_strndup(const char *from
 #define CALLER_INFO_PROTO   /* nothing */
 #define CALLER_INFO         /* nothing */
 #define ORIG_CALLER_INFO    /* nothing */
-#define TRASH(A,B) /* nothing */
+#define TRASH(A,B) do{MEM_CHECK_ADDRESSABLE(A,B);MEM_UNDEFINED(A,B);} while (0)
 #endif
 
 #if defined(ENABLED_DEBUG_SYNC)

=== modified file 'mysql-test/collections/default.experimental'
--- a/mysql-test/collections/default.experimental	2010-02-01 12:05:21 +0000
+++ b/mysql-test/collections/default.experimental	2010-06-01 12:16:35 +0000
@@ -13,12 +13,15 @@ funcs_1.ndb*                            
 funcs_2.ndb_charset                      # joro : NDB tests marked as experimental as agreed with bochklin
 
 main.ctype_gbk_binlog  @solaris          # Bug#46010: main.ctype_gbk_binlog fails sporadically : Table 't2' already exists
+main.func_str  @solaris                  # joro: Bug#40928
 main.plugin_load  @solaris               # Bug#42144
+main.sp @solaris                         # joro : Bug#54138
 main.outfile_loaddata @solaris           # joro : Bug #46895
 
 ndb.*                                    # joro : NDB tests marked as experimental as agreed with bochklin
 
 rpl.rpl_innodb_bug28430*  @solaris       # Bug#46029
+rpl.rpl_row_sp011         @solaris       # Joro : Bug #54138
 
 rpl_ndb.*                                # joro : NDB tests marked as experimental as agreed with bochklin
 rpl_ndb.rpl_ndb_log                      # Bug#38998

=== modified file 'mysql-test/suite/binlog/t/binlog_killed.test'
--- a/mysql-test/suite/binlog/t/binlog_killed.test	2010-04-08 16:55:55 +0000
+++ b/mysql-test/suite/binlog/t/binlog_killed.test	2010-05-20 07:39:02 +0000
@@ -202,7 +202,7 @@ eval kill query $ID;
 rollback;
 
 connection con2;
---error 0,ER_QUERY_INTERRUPTED,ER_LOCK_WAIT_TIMEOUT
+--error 0,ER_QUERY_INTERRUPTED
 reap;
 # todo 1,2 above
 rollback;

=== modified file 'mysql-test/suite/innodb/r/innodb.result'
--- a/mysql-test/suite/innodb/r/innodb.result	2010-04-27 06:09:08 +0000
+++ b/mysql-test/suite/innodb/r/innodb.result	2010-05-05 10:40:01 +0000
@@ -1179,82 +1179,6 @@ a	b
 8	8
 9	9
 drop table t1;
-CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
-CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
-INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
-INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-update t1,t2 set t1.a=t1.a+100;
-select * from t1;
-a	b
-101	1
-102	2
-103	3
-104	4
-105	5
-106	6
-107	7
-108	8
-109	9
-110	10
-111	11
-112	12
-update t1,t2 set t1.a=t1.a+100 where t1.a=101;
-select * from t1;
-a	b
-201	1
-102	2
-103	3
-104	4
-105	5
-106	6
-107	7
-108	8
-109	9
-110	10
-111	11
-112	12
-update t1,t2 set t1.b=t1.b+10 where t1.b=2;
-select * from t1;
-a	b
-201	1
-103	3
-104	4
-105	5
-106	6
-107	7
-108	8
-109	9
-110	10
-111	11
-102	12
-112	12
-update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
-select * from t1;
-a	b
-201	1
-103	5
-104	6
-106	6
-105	7
-107	7
-108	8
-109	9
-110	10
-111	11
-102	12
-112	12
-select * from t2;
-a	b
-1	1
-2	2
-6	6
-7	7
-8	8
-9	9
-3	13
-4	14
-5	15
-drop table t1,t2;
 CREATE TABLE t2 (   NEXT_T         BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
 CREATE TABLE t1 (  B_ID           INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
 SET AUTOCOMMIT=0;
@@ -1747,10 +1671,10 @@ variable_value - @innodb_rows_deleted_or
 71
 SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
 variable_value - @innodb_rows_inserted_orig
-1084
+1063
 SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
 variable_value - @innodb_rows_updated_orig
-885
+865
 SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
 variable_value - @innodb_row_lock_waits_orig
 0

=== added file 'mysql-test/suite/innodb/r/innodb_bug48024.result'
--- a/mysql-test/suite/innodb/r/innodb_bug48024.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_bug48024.result	2010-05-14 13:02:28 +0000
@@ -0,0 +1,10 @@
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
+DROP TABLE bug48024,bug48024_b;
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
+DROP TABLE bug48024,bug48024_b;

=== added file 'mysql-test/suite/innodb/r/innodb_bug49164.result'
--- a/mysql-test/suite/innodb/r/innodb_bug49164.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_bug49164.result	2010-05-10 11:37:52 +0000
@@ -0,0 +1,42 @@
+SET tx_isolation = 'READ-COMMITTED';
+CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
+ENGINE=InnoDB;
+insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
+begin;
+update bug49164 set c=7;
+select * from bug49164;
+a	b	c
+1	1	7
+2	2	7
+3	3	7
+rollback;
+select * from bug49164;
+a	b	c
+1	1	1
+2	2	2
+3	3	3
+begin;
+update bug49164 set c=7;
+SET tx_isolation = 'READ-COMMITTED';
+begin;
+select * from bug49164;
+a	b	c
+1	1	1
+2	2	2
+3	3	3
+commit;
+begin;
+update bug49164 set c=6 where a=1 and b=1;
+rollback;
+select * from bug49164;
+a	b	c
+1	1	1
+2	2	2
+3	3	3
+commit;
+select * from bug49164;
+a	b	c
+1	1	6
+2	2	2
+3	3	3
+drop table bug49164;

=== added file 'mysql-test/suite/innodb/r/innodb_multi_update.result'
--- a/mysql-test/suite/innodb/r/innodb_multi_update.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/r/innodb_multi_update.result	2010-05-05 10:40:01 +0000
@@ -0,0 +1,76 @@
+CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb;
+INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100;
+select * from bug38999_1;
+a	b
+101	1
+102	2
+103	3
+104	4
+105	5
+106	6
+107	7
+108	8
+109	9
+110	10
+111	11
+112	12
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101;
+select * from bug38999_1;
+a	b
+201	1
+102	2
+103	3
+104	4
+105	5
+106	6
+107	7
+108	8
+109	9
+110	10
+111	11
+112	12
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2;
+select * from bug38999_1;
+a	b
+201	1
+103	3
+104	4
+105	5
+106	6
+107	7
+108	8
+109	9
+110	10
+111	11
+102	12
+112	12
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100;
+select * from bug38999_1;
+a	b
+201	1
+103	5
+104	6
+106	6
+105	7
+107	7
+108	8
+109	9
+110	10
+111	11
+102	12
+112	12
+select * from bug38999_2;
+a	b
+1	1
+2	2
+6	6
+7	7
+8	8
+9	9
+3	13
+4	14
+5	15
+drop table bug38999_1,bug38999_2;

=== modified file 'mysql-test/suite/innodb/t/disabled.def'
--- a/mysql-test/suite/innodb/t/disabled.def	2010-04-30 10:02:36 +0000
+++ b/mysql-test/suite/innodb/t/disabled.def	2010-05-05 10:40:01 +0000
@@ -9,4 +9,4 @@
 #  Do not use any TAB characters for whitespace.
 #
 ##############################################################################
-innodb : Bug#53306 2010-04-30 VasilDimov valgrind warnings
+innodb_multi_update: Bug #38999 2010-05-05 mmakela Valgrind warnings

=== modified file 'mysql-test/suite/innodb/t/innodb.test'
--- a/mysql-test/suite/innodb/t/innodb.test	2010-04-27 06:09:08 +0000
+++ b/mysql-test/suite/innodb/t/innodb.test	2010-05-05 10:40:01 +0000
@@ -905,33 +905,6 @@ UPDATE t1 set a=a+100 where b between 2 
 SELECT * from t1;
 drop table t1;
 
-#
-# Test multi update with different join methods
-#
-
-CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
-CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
-INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
-INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-
-# Full join, without key
-update t1,t2 set t1.a=t1.a+100;
-select * from t1;
-
-# unique key
-update t1,t2 set t1.a=t1.a+100 where t1.a=101;
-select * from t1;
-
-# ref key
-update t1,t2 set t1.b=t1.b+10 where t1.b=2;
-select * from t1;
-
-# Range key (in t1)
-update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
-select * from t1;
-select * from t2;
-
-drop table t1,t2;
 CREATE TABLE t2 (   NEXT_T         BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
 CREATE TABLE t1 (  B_ID           INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
 SET AUTOCOMMIT=0;

=== added file 'mysql-test/suite/innodb/t/innodb_bug48024.test'
--- a/mysql-test/suite/innodb/t/innodb_bug48024.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug48024.test	2010-05-19 07:56:13 +0000
@@ -0,0 +1,22 @@
+# Bug #48024 Innodb doesn't work with multi-statements
+
+--source include/have_innodb.inc
+
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+# Bug #53644 InnoDB thinks that /*/ starts and ends a comment
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
+
+DROP TABLE bug48024,bug48024_b;
+
+# Work around Bug #53750 (failure in mysql-test-run --ps-protocol)
+-- disable_ps_protocol
+delimiter |;
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
+delimiter ;|
+
+DROP TABLE bug48024,bug48024_b;

=== added file 'mysql-test/suite/innodb/t/innodb_bug49164.test'
--- a/mysql-test/suite/innodb/t/innodb_bug49164.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug49164.test	2010-05-10 11:37:52 +0000
@@ -0,0 +1,47 @@
+-- source include/have_innodb.inc
+
+# Bug #49164 READ-COMMITTED reports "matched: 0" on compound PK
+# a duplicate of
+# Bug #52663 Lost update incrementing column value under READ COMMITTED
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+SET tx_isolation = 'READ-COMMITTED';
+
+CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
+ENGINE=InnoDB;
+
+insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
+
+begin;
+update bug49164 set c=7;
+select * from bug49164;
+rollback;
+select * from bug49164;
+begin;
+update bug49164 set c=7;
+
+connection con2;
+
+SET tx_isolation = 'READ-COMMITTED'; 
+begin;
+select * from bug49164;
+commit;
+begin;
+--send
+update bug49164 set c=6 where a=1 and b=1;
+
+connection con1;
+rollback;
+select * from bug49164;
+connection con2;
+reap;
+commit;
+connection con1;
+select * from bug49164;
+connection default;
+disconnect con1;
+disconnect con2;
+drop table bug49164;

=== added file 'mysql-test/suite/innodb/t/innodb_multi_update.test'
--- a/mysql-test/suite/innodb/t/innodb_multi_update.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb/t/innodb_multi_update.test	2010-05-05 10:40:01 +0000
@@ -0,0 +1,29 @@
+-- source include/have_innodb.inc
+
+#
+# Test multi update with different join methods
+#
+
+CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb;
+INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+
+# Full join, without key
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100;
+select * from bug38999_1;
+
+# unique key
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101;
+select * from bug38999_1;
+
+# ref key
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2;
+select * from bug38999_1;
+
+# Range key (in bug38999_1)
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100;
+select * from bug38999_1;
+select * from bug38999_2;
+
+drop table bug38999_1,bug38999_2;

=== modified file 'mysql-test/suite/innodb_plugin/r/innodb.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb.result	2010-04-09 13:07:41 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb.result	2010-05-05 10:44:25 +0000
@@ -1184,82 +1184,6 @@ a	b
 8	8
 9	9
 drop table t1;
-CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
-CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
-INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
-INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-update t1,t2 set t1.a=t1.a+100;
-select * from t1;
-a	b
-101	1
-102	2
-103	3
-104	4
-105	5
-106	6
-107	7
-108	8
-109	9
-110	10
-111	11
-112	12
-update t1,t2 set t1.a=t1.a+100 where t1.a=101;
-select * from t1;
-a	b
-201	1
-102	2
-103	3
-104	4
-105	5
-106	6
-107	7
-108	8
-109	9
-110	10
-111	11
-112	12
-update t1,t2 set t1.b=t1.b+10 where t1.b=2;
-select * from t1;
-a	b
-201	1
-103	3
-104	4
-105	5
-106	6
-107	7
-108	8
-109	9
-110	10
-111	11
-102	12
-112	12
-update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
-select * from t1;
-a	b
-201	1
-103	5
-104	6
-106	6
-105	7
-107	7
-108	8
-109	9
-110	10
-111	11
-102	12
-112	12
-select * from t2;
-a	b
-1	1
-2	2
-6	6
-7	7
-8	8
-9	9
-3	13
-4	14
-5	15
-drop table t1,t2;
 CREATE TABLE t2 (   NEXT_T         BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
 CREATE TABLE t1 (  B_ID           INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
 SET AUTOCOMMIT=0;
@@ -1752,10 +1676,10 @@ variable_value - @innodb_rows_deleted_or
 71
 SELECT variable_value - @innodb_rows_inserted_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_inserted';
 variable_value - @innodb_rows_inserted_orig
-1087
+1066
 SELECT variable_value - @innodb_rows_updated_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_rows_updated';
 variable_value - @innodb_rows_updated_orig
-885
+865
 SELECT variable_value - @innodb_row_lock_waits_orig FROM information_schema.global_status WHERE LOWER(variable_name) = 'innodb_row_lock_waits';
 variable_value - @innodb_row_lock_waits_orig
 0

=== added file 'mysql-test/suite/innodb_plugin/r/innodb_bug48024.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb_bug48024.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug48024.result	2010-05-14 13:08:15 +0000
@@ -0,0 +1,10 @@
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
+DROP TABLE bug48024,bug48024_b;
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
+DROP TABLE bug48024,bug48024_b;

=== added file 'mysql-test/suite/innodb_plugin/r/innodb_bug49164.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb_bug49164.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug49164.result	2010-05-10 11:38:25 +0000
@@ -0,0 +1,42 @@
+SET tx_isolation = 'READ-COMMITTED';
+CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
+ENGINE=InnoDB;
+insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
+begin;
+update bug49164 set c=7;
+select * from bug49164;
+a	b	c
+1	1	7
+2	2	7
+3	3	7
+rollback;
+select * from bug49164;
+a	b	c
+1	1	1
+2	2	2
+3	3	3
+begin;
+update bug49164 set c=7;
+SET tx_isolation = 'READ-COMMITTED';
+begin;
+select * from bug49164;
+a	b	c
+1	1	1
+2	2	2
+3	3	3
+commit;
+begin;
+update bug49164 set c=6 where a=1 and b=1;
+rollback;
+select * from bug49164;
+a	b	c
+1	1	1
+2	2	2
+3	3	3
+commit;
+select * from bug49164;
+a	b	c
+1	1	6
+2	2	2
+3	3	3
+drop table bug49164;

=== added file 'mysql-test/suite/innodb_plugin/r/innodb_bug53290.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb_bug53290.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug53290.result	2010-05-05 12:39:01 +0000
@@ -0,0 +1,17 @@
+create table bug53290 (x bigint) engine=innodb;
+insert into bug53290 () values (),(),(),(),(),(),(),(),(),(),(),();
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+alter table bug53290 add unique index `idx` (x);
+drop table bug53290;

=== added file 'mysql-test/suite/innodb_plugin/r/innodb_bug53591.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb_bug53591.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug53591.result	2010-05-12 10:42:12 +0000
@@ -0,0 +1,16 @@
+SET GLOBAL innodb_file_format='Barracuda';
+SET GLOBAL innodb_file_per_table=on;
+set old_alter_table=0;
+CREATE TABLE bug53591(a text charset utf8 not null)
+ENGINE=InnoDB KEY_BLOCK_SIZE=1;
+ALTER TABLE bug53591 ADD PRIMARY KEY(a(220));
+ERROR HY000: Too big row
+SHOW WARNINGS;
+Level	Code	Message
+Error	139	Too big row
+Error	1118	Row size too large. The maximum row size for the used table type, not counting BLOBs, is 8126. You have to change some columns to TEXT or BLOBs
+Error	1030	Got error 139 from storage engine
+DROP TABLE bug53591;
+SET GLOBAL innodb_file_format=Antelope;
+SET GLOBAL innodb_file_format_check=Antelope;
+SET GLOBAL innodb_file_per_table=0;

=== added file 'mysql-test/suite/innodb_plugin/r/innodb_bug53592.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb_bug53592.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb_bug53592.result	2010-05-26 05:31:27 +0000
@@ -0,0 +1,26 @@
+set old_alter_table=0;
+create table bug53592(a int) engine=innodb row_format=compact;
+alter table bug53592 add column b text charset utf8;
+alter table bug53592 add column c blob not null;
+create index bug53592_b on bug53592(b(81));
+create unique index bug53592_c on bug53592(c(1));
+replace into bug53592 values (),();
+Warnings:
+Warning	1364	Field 'c' doesn't have a default value
+check table bug53592;
+Table	Op	Msg_type	Msg_text
+test.bug53592	check	status	OK
+drop table bug53592;
+set old_alter_table=1;
+create table bug53592(a int) engine=innodb row_format=compact;
+alter table bug53592 add column b text charset utf8;
+alter table bug53592 add column c blob not null;
+create index bug53592_b on bug53592(b(81));
+create unique index bug53592_c on bug53592(c(1));
+replace into bug53592 values (),();
+Warnings:
+Warning	1364	Field 'c' doesn't have a default value
+check table bug53592;
+Table	Op	Msg_type	Msg_text
+test.bug53592	check	status	OK
+drop table bug53592;

=== added file 'mysql-test/suite/innodb_plugin/r/innodb_multi_update.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb_multi_update.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb_multi_update.result	2010-05-05 10:44:25 +0000
@@ -0,0 +1,76 @@
+CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb;
+INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100;
+select * from bug38999_1;
+a	b
+101	1
+102	2
+103	3
+104	4
+105	5
+106	6
+107	7
+108	8
+109	9
+110	10
+111	11
+112	12
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101;
+select * from bug38999_1;
+a	b
+201	1
+102	2
+103	3
+104	4
+105	5
+106	6
+107	7
+108	8
+109	9
+110	10
+111	11
+112	12
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2;
+select * from bug38999_1;
+a	b
+201	1
+103	3
+104	4
+105	5
+106	6
+107	7
+108	8
+109	9
+110	10
+111	11
+102	12
+112	12
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100;
+select * from bug38999_1;
+a	b
+201	1
+103	5
+104	6
+106	6
+105	7
+107	7
+108	8
+109	9
+110	10
+111	11
+102	12
+112	12
+select * from bug38999_2;
+a	b
+1	1
+2	2
+6	6
+7	7
+8	8
+9	9
+3	13
+4	14
+5	15
+drop table bug38999_1,bug38999_2;

=== added file 'mysql-test/suite/innodb_plugin/t/disabled.def'
--- a/mysql-test/suite/innodb_plugin/t/disabled.def	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/t/disabled.def	2010-05-05 10:44:25 +0000
@@ -0,0 +1,12 @@
+##############################################################################
+#
+#  List the test cases that are to be disabled temporarily.
+#
+#  Separate the test case name and the comment with ':'.
+#
+#    <testcasename> : BUG#<xxxx> <date disabled> <disabler> <comment>
+#
+#  Do not use any TAB characters for whitespace.
+#
+##############################################################################
+innodb_multi_update: Bug #38999 2010-05-05 mmakela Valgrind warnings

=== modified file 'mysql-test/suite/innodb_plugin/t/innodb.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb.test	2010-04-09 13:07:41 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb.test	2010-05-05 10:44:25 +0000
@@ -915,33 +915,6 @@ UPDATE t1 set a=a+100 where b between 2 
 SELECT * from t1;
 drop table t1;
 
-#
-# Test multi update with different join methods
-#
-
-CREATE TABLE t1 (a int not null primary key, b int not null, key (b)) engine=innodb;
-CREATE TABLE t2 (a int not null primary key, b int not null, key (b)) engine=innodb;
-INSERT INTO t1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
-INSERT INTO t2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
-
-# Full join, without key
-update t1,t2 set t1.a=t1.a+100;
-select * from t1;
-
-# unique key
-update t1,t2 set t1.a=t1.a+100 where t1.a=101;
-select * from t1;
-
-# ref key
-update t1,t2 set t1.b=t1.b+10 where t1.b=2;
-select * from t1;
-
-# Range key (in t1)
-update t1,t2 set t1.b=t1.b+2,t2.b=t1.b+10 where t1.b between 3 and 5 and t1.a=t2.a+100;
-select * from t1;
-select * from t2;
-
-drop table t1,t2;
 CREATE TABLE t2 (   NEXT_T         BIGINT NOT NULL PRIMARY KEY) ENGINE=MyISAM;
 CREATE TABLE t1 (  B_ID           INTEGER NOT NULL PRIMARY KEY) ENGINE=InnoDB;
 SET AUTOCOMMIT=0;

=== added file 'mysql-test/suite/innodb_plugin/t/innodb_bug48024.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug48024.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug48024.test	2010-05-18 13:06:58 +0000
@@ -0,0 +1,22 @@
+# Bug #48024 Innodb doesn't work with multi-statements
+
+--source include/have_innodb_plugin.inc
+
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+# Bug #53644 InnoDB thinks that /*/ starts and ends a comment
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b);
+
+DROP TABLE bug48024,bug48024_b;
+
+# Work around Bug #53750 (failure in mysql-test-run --ps-protocol)
+-- disable_ps_protocol
+delimiter |;
+CREATE TABLE bug48024(a int PRIMARY KEY,b int NOT NULL,KEY(b)) ENGINE=InnoDB;
+CREATE TABLE bug48024_b(b int PRIMARY KEY) ENGINE=InnoDB;
+ALTER TABLE bug48024 /*/ADD CONSTRAINT FOREIGN KEY(c) REFERENCES(a),/*/
+ADD CONSTRAINT FOREIGN KEY(b) REFERENCES bug48024_b(b)|
+delimiter ;|
+
+DROP TABLE bug48024,bug48024_b;

=== added file 'mysql-test/suite/innodb_plugin/t/innodb_bug49164.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug49164.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug49164.test	2010-05-10 11:38:25 +0000
@@ -0,0 +1,47 @@
+-- source include/have_innodb_plugin.inc
+
+# Bug #49164 READ-COMMITTED reports "matched: 0" on compound PK
+# a duplicate of
+# Bug #52663 Lost update incrementing column value under READ COMMITTED
+
+connect (con1,localhost,root,,);
+connect (con2,localhost,root,,);
+
+connection con1;
+SET tx_isolation = 'READ-COMMITTED';
+
+CREATE TABLE bug49164 (a INT, b BIGINT, c TINYINT, PRIMARY KEY (a, b))
+ENGINE=InnoDB;
+
+insert into bug49164 values (1,1,1), (2,2,2), (3,3,3);
+
+begin;
+update bug49164 set c=7;
+select * from bug49164;
+rollback;
+select * from bug49164;
+begin;
+update bug49164 set c=7;
+
+connection con2;
+
+SET tx_isolation = 'READ-COMMITTED'; 
+begin;
+select * from bug49164;
+commit;
+begin;
+--send
+update bug49164 set c=6 where a=1 and b=1;
+
+connection con1;
+rollback;
+select * from bug49164;
+connection con2;
+reap;
+commit;
+connection con1;
+select * from bug49164;
+connection default;
+disconnect con1;
+disconnect con2;
+drop table bug49164;

=== added file 'mysql-test/suite/innodb_plugin/t/innodb_bug53290.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug53290.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53290.test	2010-05-05 12:39:01 +0000
@@ -0,0 +1,22 @@
+-- source include/have_innodb_plugin.inc
+
+create table bug53290 (x bigint) engine=innodb;
+
+insert into bug53290 () values (),(),(),(),(),(),(),(),(),(),(),();
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+insert into bug53290 select * from bug53290;
+
+alter table bug53290 add unique index `idx` (x);
+
+drop table bug53290;

=== added file 'mysql-test/suite/innodb_plugin/t/innodb_bug53591.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug53591.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53591.test	2010-05-12 10:42:12 +0000
@@ -0,0 +1,22 @@
+-- source include/have_innodb_plugin.inc
+
+let $file_format=`select @@innodb_file_format`;
+let $file_format_check=`select @@innodb_file_format_check`;
+let $file_per_table=`select @@innodb_file_per_table`;
+
+SET GLOBAL innodb_file_format='Barracuda';
+SET GLOBAL innodb_file_per_table=on;
+
+set old_alter_table=0;
+
+CREATE TABLE bug53591(a text charset utf8 not null)
+ENGINE=InnoDB KEY_BLOCK_SIZE=1;
+-- error 139
+ALTER TABLE bug53591 ADD PRIMARY KEY(a(220));
+SHOW WARNINGS;
+
+DROP TABLE bug53591;
+
+EVAL SET GLOBAL innodb_file_format=$file_format;
+EVAL SET GLOBAL innodb_file_format_check=$file_format_check;
+EVAL SET GLOBAL innodb_file_per_table=$file_per_table;

=== added file 'mysql-test/suite/innodb_plugin/t/innodb_bug53592.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug53592.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug53592.test	2010-05-26 05:31:27 +0000
@@ -0,0 +1,59 @@
+# Testcase for Bug #53592 - "crash replacing duplicates into
+# table after fast alter table added unique key". The fix is to make
+# sure index number lookup should go through "index translation table".
+
+--source include/have_innodb.inc
+
+# Use FIC for index creation
+set old_alter_table=0;
+
+create table bug53592(a int) engine=innodb row_format=compact;
+
+alter table bug53592 add column b text charset utf8;
+
+alter table bug53592 add column c blob not null;
+
+# Create a non-unique nonclustered index
+create index bug53592_b on bug53592(b(81));
+
+# Create a unique index, this unique index should have smaller
+# index number than bug53592_b, since unique index ranks higher
+# than regular index does
+create unique index bug53592_c on bug53592(c(1));
+
+# This will trigger a dup key error and will require fetching
+# the index number through a index structure for the error reporting.
+# To get the correct index number, the code should go through index
+# translation table. Otherwise, it will get the wrong index
+# number and later trigger a server crash.
+replace into bug53592 values (),();
+
+check table bug53592;
+
+drop table bug53592;
+
+# Running the same set of test when "old_alter_table" is turned on
+set old_alter_table=1;
+
+create table bug53592(a int) engine=innodb row_format=compact;
+
+alter table bug53592 add column b text charset utf8;
+
+alter table bug53592 add column c blob not null;
+
+# Create a non-unique nonclustered index
+create index bug53592_b on bug53592(b(81));
+
+# Create a unique index
+create unique index bug53592_c on bug53592(c(1));
+
+# This will trigger a dup key error and will require fetching
+# the index number through a index structure for the error reporting.
+# To get the correct index number, the code should go through index
+# translation table. Otherwise, it will get the wrong index
+# number and later trigger a server crash.
+replace into bug53592 values (),();
+
+check table bug53592;
+
+drop table bug53592;

=== added file 'mysql-test/suite/innodb_plugin/t/innodb_multi_update.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb_multi_update.test	2010-05-05 10:44:25 +0000
@@ -0,0 +1,29 @@
+-- source include/have_innodb.inc
+
+#
+# Test multi update with different join methods
+#
+
+CREATE TABLE bug38999_1 (a int not null primary key, b int not null, key (b)) engine=innodb;
+CREATE TABLE bug38999_2 (a int not null primary key, b int not null, key (b)) engine=innodb;
+INSERT INTO bug38999_1 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9),(10,10),(11,11),(12,12);
+INSERT INTO bug38999_2 values (1,1),(2,2),(3,3),(4,4),(5,5),(6,6),(7,7),(8,8),(9,9);
+
+# Full join, without key
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100;
+select * from bug38999_1;
+
+# unique key
+update bug38999_1,bug38999_2 set bug38999_1.a=bug38999_1.a+100 where bug38999_1.a=101;
+select * from bug38999_1;
+
+# ref key
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+10 where bug38999_1.b=2;
+select * from bug38999_1;
+
+# Range key (in bug38999_1)
+update bug38999_1,bug38999_2 set bug38999_1.b=bug38999_1.b+2,bug38999_2.b=bug38999_1.b+10 where bug38999_1.b between 3 and 5 and bug38999_1.a=bug38999_2.a+100;
+select * from bug38999_1;
+select * from bug38999_2;
+
+drop table bug38999_1,bug38999_2;

=== modified file 'mysql-test/suite/sys_vars/r/tx_isolation_func.result'
--- a/mysql-test/suite/sys_vars/r/tx_isolation_func.result	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/r/tx_isolation_func.result	2010-05-11 16:58:45 +0000
@@ -95,10 +95,7 @@ a	b
 22	10
 24	10
 INSERT INTO t1 VALUES(23, 23);
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 INSERT INTO t1 VALUES(25, 25);
-ERROR HY000: Lock wait timeout exceeded; try restarting transaction
-Bug: Only even rows are being locked, error 1205 should'nt have occured
 SELECT * FROM t1;
 a	b
 2	10
@@ -109,7 +106,9 @@ a	b
 18	10
 20	10
 22	10
+23	23
 24	10
+25	25
 COMMIT;
 ** Connection con0 **
 COMMIT;
@@ -144,7 +143,9 @@ a	b
 18	10
 20	10
 22	10
+23	23
 24	10
+25	25
 INSERT INTO t1 VALUES(5, 5);
 INSERT INTO t1 VALUES(7, 7);
 SELECT * FROM t1;
@@ -159,7 +160,9 @@ a	b
 18	10
 20	10
 22	10
+23	23
 24	10
+25	25
 COMMIT;
 ** Connection con0 **
 COMMIT;
@@ -196,7 +199,9 @@ a	b
 18	11
 20	11
 22	11
+23	23
 24	11
+25	25
 INSERT INTO t1 VALUES(9, 9);
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 INSERT INTO t1 VALUES(13, 13);
@@ -214,7 +219,9 @@ a	b
 18	11
 20	11
 22	11
+23	23
 24	11
+25	25
 COMMIT;
 ** Connection con0 **
 COMMIT;
@@ -225,6 +232,8 @@ SELECT * FROM t1 WHERE a IN (2,4,6,8,10,
 a	b
 5	5
 7	7
+23	23
+25	25
 UPDATE t1 SET b = 13 WHERE a IN (2,4,6,8,10,12,14,16,18,20,22,24,26) = 0;
 ** Connection con1 **
 START TRANSACTION;
@@ -240,7 +249,9 @@ a	b
 18	12
 20	12
 22	12
+23	23
 24	12
+25	25
 INSERT INTO t1 VALUES(9, 9);
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 INSERT INTO t1 VALUES(13, 13);
@@ -258,7 +269,9 @@ a	b
 18	12
 20	12
 22	12
+23	23
 24	12
+25	25
 COMMIT;
 ** Connection con0 **
 COMMIT;
@@ -273,7 +286,9 @@ a	b
 18	12
 20	12
 22	12
+23	13
 24	12
+25	13
 UPDATE t1 SET b = 14 WHERE a IN (2,4,6,8) = 0;
 ** Connection con1 **
 START TRANSACTION;
@@ -289,7 +304,9 @@ a	b
 18	12
 20	12
 22	12
+23	13
 24	12
+25	13
 INSERT INTO t1 VALUES(9, 9);
 ERROR HY000: Lock wait timeout exceeded; try restarting transaction
 INSERT INTO t1 VALUES(13, 13);
@@ -307,7 +324,9 @@ a	b
 18	12
 20	12
 22	12
+23	13
 24	12
+25	13
 COMMIT;
 ** Connection con0 **
 COMMIT;

=== modified file 'mysql-test/suite/sys_vars/t/tx_isolation_func.test'
--- a/mysql-test/suite/sys_vars/t/tx_isolation_func.test	2008-12-19 15:12:15 +0000
+++ b/mysql-test/suite/sys_vars/t/tx_isolation_func.test	2010-05-11 16:58:45 +0000
@@ -134,12 +134,9 @@ START TRANSACTION;
 
 SELECT * FROM t1;
 
---error ER_LOCK_WAIT_TIMEOUT
 INSERT INTO t1 VALUES(23, 23);
 
---error ER_LOCK_WAIT_TIMEOUT
 INSERT INTO t1 VALUES(25, 25);
---echo Bug: Only even rows are being locked, error 1205 should'nt have occured
 
 SELECT * FROM t1;
 

=== modified file 'mysql-test/t/disabled.def'
--- a/mysql-test/t/disabled.def	2010-04-30 10:02:36 +0000
+++ b/mysql-test/t/disabled.def	2010-05-05 12:05:55 +0000
@@ -12,4 +12,3 @@
 kill                     : Bug#37780 2008-12-03 HHunger need some changes to be robust enough for pushbuild.
 query_cache_28249        : Bug#43861 2009-03-25 main.query_cache_28249 fails sporadically
 partition_innodb_plugin  : Bug#53307 2010-04-30 VasilDimov valgrind warnings
-ps_3innodb               : Bug#53309 2010-04-30 VasilDimov valgrind warnings

=== modified file 'mysql-test/t/ps_3innodb.test'
--- a/mysql-test/t/ps_3innodb.test	2005-07-28 00:22:47 +0000
+++ b/mysql-test/t/ps_3innodb.test	2010-05-20 13:27:35 +0000
@@ -8,6 +8,10 @@
 # NOTE: PLEASE SEE ps_1general.test (bottom) 
 #       BEFORE ADDING NEW TEST CASES HERE !!!
 
+# See Bug#38999 valgrind warnings for update statement in function
+# compare_record()
+-- source include/not_valgrind.inc
+
 use test;
 
 -- source include/have_innodb.inc

=== modified file 'mysql-test/valgrind.supp'
--- a/mysql-test/valgrind.supp	2009-09-25 11:52:41 +0000
+++ b/mysql-test/valgrind.supp	2010-05-25 12:37:48 +0000
@@ -722,3 +722,8 @@
    fun:pthread_create*
 }
 
+{
+   buf_buddy_relocate peeking (space,page) in potentially free blocks
+   Memcheck:Addr1
+   fun:buf_buddy_relocate
+}

=== modified file 'mysys/safemalloc.c'
--- a/mysys/safemalloc.c	2009-05-15 07:53:50 +0000
+++ b/mysys/safemalloc.c	2010-05-20 10:40:42 +0000
@@ -190,9 +190,12 @@ void *_mymalloc(size_t size, const char 
   sf_malloc_count++;
   pthread_mutex_unlock(&THR_LOCK_malloc);
 
+  MEM_CHECK_ADDRESSABLE(data, size);
   /* Set the memory to the aribtrary wierd value */
   if ((MyFlags & MY_ZEROFILL) || !sf_malloc_quick)
     bfill(data, size, (char) (MyFlags & MY_ZEROFILL ? 0 : ALLOC_VAL));
+  if (!(MyFlags & MY_ZEROFILL))
+    MEM_UNDEFINED(data, size);
   /* Return a pointer to the real data */
   DBUG_PRINT("exit",("ptr: %p", data));
   if (sf_min_adress > data)
@@ -309,7 +312,9 @@ void _myfree(void *ptr, const char *file
   if (!sf_malloc_quick)
     bfill(ptr, irem->datasize, (pchar) FREE_VAL);
 #endif
+  MEM_NOACCESS(ptr, irem->datasize);
   *((uint32*) ((char*) ptr- sizeof(uint32)))= ~MAGICKEY;
+  MEM_NOACCESS((char*) ptr - sizeof(uint32), sizeof(uint32));
   /* Actually free the memory */
   free((char*) irem);
   DBUG_VOID_RETURN;

=== modified file 'storage/innobase/buf/buf0flu.c'
--- a/storage/innobase/buf/buf0flu.c	2007-01-18 21:27:31 +0000
+++ b/storage/innobase/buf/buf0flu.c	2010-05-04 12:55:10 +0000
@@ -55,6 +55,7 @@ buf_flush_insert_into_flush_list(
 	      || (ut_dulint_cmp((UT_LIST_GET_FIRST(buf_pool->flush_list))
 				->oldest_modification,
 				block->oldest_modification) <= 0));
+	UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
 
 	UT_LIST_ADD_FIRST(flush_list, buf_pool->flush_list, block);
 
@@ -75,6 +76,7 @@ buf_flush_insert_sorted_into_flush_list(
 	buf_block_t*	b;
 
 	ut_ad(mutex_own(&(buf_pool->mutex)));
+	UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
 
 	prev_b = NULL;
 	b = UT_LIST_GET_FIRST(buf_pool->flush_list);
@@ -423,6 +425,7 @@ try_again:
 		goto try_again;
 	}
 
+	UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
 	ut_memcpy(trx_doublewrite->write_buf
 		  + UNIV_PAGE_SIZE * trx_doublewrite->first_free,
 		  block->frame, UNIV_PAGE_SIZE);

=== modified file 'storage/innobase/dict/dict0dict.c'
--- a/storage/innobase/dict/dict0dict.c	2009-09-10 20:43:05 +0000
+++ b/storage/innobase/dict/dict0dict.c	2010-05-14 13:02:28 +0000
@@ -2586,25 +2586,28 @@ dict_strip_comments(
 					/* out, own: SQL string stripped from
 					comments; the caller must free this
 					with mem_free()! */
-	const char*	sql_string)	/* in: SQL string */
+	const char*	sql_string,	/* in: SQL string */
+	size_t		sql_length)	/* in: length of sql_string */
 {
 	char*		str;
 	const char*	sptr;
+	const char*	eptr	= sql_string + sql_length;
 	char*		ptr;
 	/* unclosed quote character (0 if none) */
 	char		quote	= 0;
 
-	str = mem_alloc(strlen(sql_string) + 1);
+	str = mem_alloc(sql_length + 1);
 
 	sptr = sql_string;
 	ptr = str;
 
 	for (;;) {
 scan_more:
-		if (*sptr == '\0') {
+		if (sptr >= eptr || *sptr == '\0') {
+end_of_string:
 			*ptr = '\0';
 
-			ut_a(ptr <= str + strlen(sql_string));
+			ut_a(ptr <= str + sql_length);
 
 			return(str);
 		}
@@ -2623,30 +2626,35 @@ scan_more:
 			   || (sptr[0] == '-' && sptr[1] == '-'
 			       && sptr[2] == ' ')) {
 			for (;;) {
+				if (++sptr >= eptr) {
+					goto end_of_string;
+				}
+
 				/* In Unix a newline is 0x0A while in Windows
 				it is 0x0D followed by 0x0A */
 
-				if (*sptr == (char)0x0A
-				    || *sptr == (char)0x0D
-				    || *sptr == '\0') {
-
+				switch (*sptr) {
+				case (char) 0X0A:
+				case (char) 0x0D:
+				case '\0':
 					goto scan_more;
 				}
-
-				sptr++;
 			}
 		} else if (!quote && *sptr == '/' && *(sptr + 1) == '*') {
+			sptr += 2;
 			for (;;) {
-				if (*sptr == '*' && *(sptr + 1) == '/') {
-
-					sptr += 2;
-
-					goto scan_more;
+				if (sptr >= eptr) {
+					goto end_of_string;
 				}
 
-				if (*sptr == '\0') {
-
+				switch (*sptr) {
+				case '\0':
 					goto scan_more;
+				case '*':
+					if (sptr[1] == '/') {
+						sptr += 2;
+						goto scan_more;
+					}
 				}
 
 				sptr++;
@@ -3348,6 +3356,7 @@ dict_create_foreign_constraints(
 					name before it: test.table2; the
 					default database id the database of
 					parameter name */
+	size_t		sql_length,	/* in: length of sql_string */
 	const char*	name,		/* in: table full name in the
 					normalized form
 					database_name/table_name */
@@ -3362,7 +3371,7 @@ dict_create_foreign_constraints(
 	ut_a(trx);
 	ut_a(trx->mysql_thd);
 
-	str = dict_strip_comments(sql_string);
+	str = dict_strip_comments(sql_string, sql_length);
 	heap = mem_heap_create(10000);
 
 	err = dict_create_foreign_constraints_low(
@@ -3411,7 +3420,8 @@ dict_foreign_parse_drop_constraints(
 
 	*constraints_to_drop = mem_heap_alloc(heap, 1000 * sizeof(char*));
 
-	str = dict_strip_comments(*(trx->mysql_query_str));
+	str = dict_strip_comments(*trx->mysql_query_str,
+				  *trx->mysql_query_len);
 	ptr = str;
 
 	ut_ad(mutex_own(&(dict_sys->mutex)));

=== modified file 'storage/innobase/fsp/fsp0fsp.c'
--- a/storage/innobase/fsp/fsp0fsp.c	2007-06-26 13:08:11 +0000
+++ b/storage/innobase/fsp/fsp0fsp.c	2010-05-04 13:13:58 +0000
@@ -802,12 +802,7 @@ fsp_init_file_page_low(
 
 	buf_block_align(page)->check_index_page_at_flush = FALSE;
 
-#ifdef UNIV_BASIC_LOG_DEBUG
-	memset(page, 0xff, UNIV_PAGE_SIZE);
-#endif
-	mach_write_to_8(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM,
-			ut_dulint_zero);
-	mach_write_to_8(page + FIL_PAGE_LSN, ut_dulint_zero);
+	memset(page, 0, UNIV_PAGE_SIZE);
 }
 
 /***************************************************************

=== modified file 'storage/innobase/handler/ha_innodb.cc'
--- a/storage/innobase/handler/ha_innodb.cc	2010-04-29 13:29:45 +0000
+++ b/storage/innobase/handler/ha_innodb.cc	2010-05-20 07:39:02 +0000
@@ -759,6 +759,10 @@ convert_error_code_to_mysql(
 	} else if (error == DB_UNSUPPORTED) {
 
 		return(HA_ERR_UNSUPPORTED);
+	} else if (error == DB_INTERRUPTED) {
+
+		my_error(ER_QUERY_INTERRUPTED, MYF(0));
+		return(-1);
     	} else {
     		return(-1);			// Unknown error
     	}
@@ -1140,6 +1144,15 @@ innobase_next_autoinc(
 	return(next_value);
 }
 
+/** Copy the current SQL statement.
+* @param[in] thd	MySQL client connection
+* @param[in/out] trx	InnoDB transaction */
+#define INNOBASE_COPY_STMT(thd, trx) do {		\
+	LEX_STRING* stmt = thd_query_string(thd);	\
+	(trx)->mysql_query_str = &stmt->str;		\
+	(trx)->mysql_query_len = &stmt->length;		\
+} while (0)
+
 /*************************************************************************
 Gets the InnoDB transaction handle for a MySQL handler object, creates
 an InnoDB transaction struct if the corresponding MySQL thread struct still
@@ -1160,7 +1173,7 @@ check_trx_exists(
 		trx = trx_allocate_for_mysql();
 
 		trx->mysql_thd = thd;
-		trx->mysql_query_str = thd_query(thd);
+		INNOBASE_COPY_STMT(thd, trx);
 
 		/* Update the info whether we should skip XA steps that eat
 		CPU time */
@@ -5578,7 +5591,7 @@ ha_innobase::create(
 	trx = trx_allocate_for_mysql();
 
 	trx->mysql_thd = thd;
-	trx->mysql_query_str = thd_query(thd);
+	INNOBASE_COPY_STMT(thd, trx);
 
 	if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
 		trx->check_foreigns = FALSE;
@@ -5674,8 +5687,10 @@ ha_innobase::create(
 	}
 
 	if (*trx->mysql_query_str) {
-		error = row_table_add_foreign_constraints(trx,
-			*trx->mysql_query_str, norm_name,
+		error = row_table_add_foreign_constraints(
+			trx,
+			*trx->mysql_query_str, *trx->mysql_query_len,
+			norm_name,
 			create_info->options & HA_LEX_CREATE_TMP_TABLE);
 
 		error = convert_error_code_to_mysql(error, NULL);
@@ -5866,7 +5881,7 @@ ha_innobase::delete_table(
 	trx = trx_allocate_for_mysql();
 
 	trx->mysql_thd = thd;
-	trx->mysql_query_str = thd_query(thd);
+	INNOBASE_COPY_STMT(thd, trx);
 
 	if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
 		trx->check_foreigns = FALSE;
@@ -5955,7 +5970,7 @@ innobase_drop_database(
 #endif
 	trx = trx_allocate_for_mysql();
 	trx->mysql_thd = thd;
-	trx->mysql_query_str = thd_query(thd);
+	INNOBASE_COPY_STMT(thd, trx);
 
 	if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
 		trx->check_foreigns = FALSE;
@@ -6025,7 +6040,7 @@ ha_innobase::rename_table(
 
 	trx = trx_allocate_for_mysql();
 	trx->mysql_thd = thd;
-	trx->mysql_query_str = thd_query(thd);
+	INNOBASE_COPY_STMT(thd, trx);
 
 	if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
 		trx->check_foreigns = FALSE;

=== modified file 'storage/innobase/handler/ha_innodb.h'
--- a/storage/innobase/handler/ha_innodb.h	2010-01-12 10:22:19 +0000
+++ b/storage/innobase/handler/ha_innodb.h	2010-05-14 13:02:28 +0000
@@ -210,7 +210,7 @@ the definitions are bracketed with #ifde
 
 extern "C" {
 struct charset_info_st *thd_charset(MYSQL_THD thd);
-char **thd_query(MYSQL_THD thd);
+LEX_STRING *thd_query_string(MYSQL_THD thd);
 
 /** Get the file name of the MySQL binlog.
  * @return the name of the binlog file

=== modified file 'storage/innobase/include/db0err.h'
--- a/storage/innobase/include/db0err.h	2009-09-04 00:26:13 +0000
+++ b/storage/innobase/include/db0err.h	2010-05-20 07:39:02 +0000
@@ -69,6 +69,9 @@ Created 5/24/1996 Heikki Tuuri
 					a feature that it can't recoginize or
 					work with e.g., FT indexes created by
 					a later version of the engine. */
+#define DB_INTERRUPTED		49	/* the query has been interrupted with
+					"KILL QUERY N;" */
+
 /* The following are partial failure codes */
 #define DB_FAIL			1000
 #define DB_OVERFLOW		1001

=== modified file 'storage/innobase/include/dict0dict.h'
--- a/storage/innobase/include/dict0dict.h	2008-10-23 04:30:32 +0000
+++ b/storage/innobase/include/dict0dict.h	2010-05-14 13:02:28 +0000
@@ -309,6 +309,7 @@ dict_create_foreign_constraints(
 					name before it: test.table2; the
 					default database id the database of
 					parameter name */
+	size_t		sql_length,	/* in: length of sql_string */
 	const char*	name,		/* in: table full name in the
 					normalized form
 					database_name/table_name */

=== modified file 'storage/innobase/include/mach0data.ic'
--- a/storage/innobase/include/mach0data.ic	2009-11-25 08:28:35 +0000
+++ b/storage/innobase/include/mach0data.ic	2010-05-19 08:16:18 +0000
@@ -19,7 +19,7 @@ mach_write_to_1(
 	ulint	n)	/* in: ulint integer to be stored, >= 0, < 256 */
 {
 	ut_ad(b);
-	ut_ad(n <= 0xFFUL);
+	ut_ad((n | 0xFFUL) <= 0xFFUL);
 
 	b[0] = (byte)n;
 }
@@ -48,7 +48,7 @@ mach_write_to_2(
 	ulint	n)	/* in: ulint integer to be stored */
 {
 	ut_ad(b);
-	ut_ad(n <= 0xFFFFUL);
+	ut_ad((n | 0xFFFFUL) <= 0xFFFFUL);
 
 	b[0] = (byte)(n >> 8);
 	b[1] = (byte)(n);
@@ -64,10 +64,7 @@ mach_read_from_2(
 			/* out: ulint integer */
 	byte*	b)	/* in: pointer to 2 bytes */
 {
-	ut_ad(b);
-	return( ((ulint)(b[0]) << 8)
-		+ (ulint)(b[1])
-		);
+	return(((ulint)(b[0]) << 8) | (ulint)(b[1]));
 }
 
 /************************************************************
@@ -112,7 +109,7 @@ mach_write_to_3(
 	ulint	n)	/* in: ulint integer to be stored */
 {
 	ut_ad(b);
-	ut_ad(n <= 0xFFFFFFUL);
+	ut_ad((n | 0xFFFFFFUL) <= 0xFFFFFFUL);
 
 	b[0] = (byte)(n >> 16);
 	b[1] = (byte)(n >> 8);
@@ -131,8 +128,8 @@ mach_read_from_3(
 {
 	ut_ad(b);
 	return( ((ulint)(b[0]) << 16)
-		+ ((ulint)(b[1]) << 8)
-		+ (ulint)(b[2])
+		| ((ulint)(b[1]) << 8)
+		| (ulint)(b[2])
 		);
 }
 
@@ -166,9 +163,9 @@ mach_read_from_4(
 {
 	ut_ad(b);
 	return( ((ulint)(b[0]) << 24)
-		+ ((ulint)(b[1]) << 16)
-		+ ((ulint)(b[2]) << 8)
-		+ (ulint)(b[3])
+		| ((ulint)(b[1]) << 16)
+		| ((ulint)(b[2]) << 8)
+		| (ulint)(b[3])
 		);
 }
 
@@ -670,7 +667,7 @@ mach_read_from_2_little_endian(
 				/* out: unsigned long int */
 	byte*	buf)		/* in: from where to read */
 {
-	return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256);
+	return((ulint)(buf[0]) | ((ulint)(buf[1]) << 8));
 }
 
 /*************************************************************

=== modified file 'storage/innobase/include/row0mysql.h'
--- a/storage/innobase/include/row0mysql.h	2009-03-12 08:06:44 +0000
+++ b/storage/innobase/include/row0mysql.h	2010-05-14 13:02:28 +0000
@@ -366,6 +366,7 @@ row_table_add_foreign_constraints(
 				FOREIGN KEY (a, b) REFERENCES table2(c, d),
 					table2 can be written also with the
 					database name before it: test.table2 */
+	size_t		sql_length,	/* in: length of sql_string */
 	const char*	name,		/* in: table full name in the
 					normalized form
 					database_name/table_name */

=== modified file 'storage/innobase/include/trx0trx.h'
--- a/storage/innobase/include/trx0trx.h	2009-12-22 08:54:55 +0000
+++ b/storage/innobase/include/trx0trx.h	2010-05-14 13:02:28 +0000
@@ -444,6 +444,8 @@ struct trx_struct{
 	char**		mysql_query_str;/* pointer to the field in mysqld_thd
 					which contains the pointer to the
 					current SQL query string */
+	size_t*		mysql_query_len;/* pointer to the length of the
+					current SQL query string */
 	const char*	mysql_log_file_name;
 					/* if MySQL binlog is used, this field
 					contains a pointer to the latest file

=== modified file 'storage/innobase/include/univ.i'
--- a/storage/innobase/include/univ.i	2010-04-28 06:33:25 +0000
+++ b/storage/innobase/include/univ.i	2010-05-20 10:40:42 +0000
@@ -82,9 +82,9 @@ memory is read outside the allocated blo
 
 /* Make a non-inline debug version */
 
-#ifdef HAVE_purify
+#if defined HAVE_VALGRIND
 # define UNIV_DEBUG_VALGRIND
-#endif /* HAVE_purify */
+#endif /* HAVE_VALGRIND */
 #if 0
 #define UNIV_DEBUG_VALGRIND			/* Enable extra
 						Valgrind instrumentation */
@@ -126,11 +126,6 @@ by one. */
 			/* the above option prevents forcing of log to disk
 			at a buffer page write: it should be tested with this
 			option off; also some ibuf tests are suppressed */
-/*
-#define UNIV_BASIC_LOG_DEBUG
-*/
-			/* the above option enables basic recovery debugging:
-			new allocated file pages are reset */
 
 #if (!defined(UNIV_DEBUG) && !defined(INSIDE_HA_INNOBASE_CC) && !defined(UNIV_MUST_NOT_INLINE))
 /* Definition for inline version */

=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c	2010-04-29 13:29:45 +0000
+++ b/storage/innobase/row/row0mysql.c	2010-05-20 07:39:02 +0000
@@ -483,6 +483,7 @@ handle_new_error:
 	} else if (err == DB_ROW_IS_REFERENCED
 		   || err == DB_NO_REFERENCED_ROW
 		   || err == DB_CANNOT_ADD_CONSTRAINT
+		   || err == DB_INTERRUPTED
 		   || err == DB_TOO_MANY_CONCURRENT_TRXS) {
 		if (savept) {
 			/* Roll back the latest, possibly incomplete
@@ -2103,6 +2104,7 @@ row_table_add_foreign_constraints(
 				FOREIGN KEY (a, b) REFERENCES table2(c, d),
 					table2 can be written also with the
 					database name before it: test.table2 */
+	size_t		sql_length,	/* in: length of sql_string */
 	const char*	name,		/* in: table full name in the
 					normalized form
 					database_name/table_name */
@@ -2124,8 +2126,8 @@ row_table_add_foreign_constraints(
 
 	trx->dict_operation = TRUE;
 
-	err = dict_create_foreign_constraints(trx, sql_string, name,
-					      reject_fks);
+	err = dict_create_foreign_constraints(trx, sql_string, sql_length,
+					      name, reject_fks);
 
 	if (err == DB_SUCCESS) {
 		/* Check that also referencing constraints are ok */

=== modified file 'storage/innobase/row/row0sel.c'
--- a/storage/innobase/row/row0sel.c	2010-04-29 13:29:45 +0000
+++ b/storage/innobase/row/row0sel.c	2010-05-05 09:53:28 +0000
@@ -2452,6 +2452,7 @@ row_sel_field_store_in_mysql_format(
 	byte*	pad_ptr;
 
 	ut_ad(len != UNIV_SQL_NULL);
+	UNIV_MEM_ASSERT_RW(data, len);
 
 	if (templ->type == DATA_INT) {
 		/* Convert integer data from Innobase to a little-endian
@@ -2687,6 +2688,9 @@ row_sel_store_mysql_rec(
 			/* MySQL assumes that the field for an SQL
 			NULL value is set to the default value. */
 
+			UNIV_MEM_ASSERT_RW(prebuilt->default_rec
+					   + templ->mysql_col_offset,
+					   templ->mysql_col_len);
 			mysql_rec[templ->mysql_null_byte_offset]
 				|= (byte) templ->mysql_null_bit_mask;
 			memcpy(mysql_rec + templ->mysql_col_offset,
@@ -3007,6 +3011,11 @@ row_sel_pop_cached_row_for_mysql(
 
 		for (i = 0; i < prebuilt->n_template; i++) {
 			templ = prebuilt->mysql_template + i;
+#if 0 /* Some of the cached_rec may legitimately be uninitialized. */
+			UNIV_MEM_ASSERT_RW(cached_rec
+					   + templ->mysql_col_offset,
+					   templ->mysql_col_len);
+#endif
 			ut_memcpy(buf + templ->mysql_col_offset,
 				  cached_rec + templ->mysql_col_offset,
 				  templ->mysql_col_len);
@@ -3021,6 +3030,11 @@ row_sel_pop_cached_row_for_mysql(
 		}
 	}
 	else {
+#if 0 /* Some of the cached_rec may legitimately be uninitialized. */
+		UNIV_MEM_ASSERT_RW(prebuilt->fetch_cache
+				   [prebuilt->fetch_cache_first],
+				   prebuilt->mysql_prefix_len);
+#endif
 		ut_memcpy(buf,
 			  prebuilt->fetch_cache[prebuilt->fetch_cache_first],
 			  prebuilt->mysql_prefix_len);
@@ -3070,6 +3084,8 @@ row_sel_push_cache_row_for_mysql(
 	}
 
 	ut_ad(prebuilt->fetch_cache_first == 0);
+	UNIV_MEM_INVALID(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
+			 prebuilt->mysql_row_len);
 
 	if (UNIV_UNLIKELY(!row_sel_store_mysql_rec(
 				  prebuilt->fetch_cache[

=== modified file 'storage/innobase/srv/srv0srv.c'
--- a/storage/innobase/srv/srv0srv.c	2010-03-31 07:14:51 +0000
+++ b/storage/innobase/srv/srv0srv.c	2010-05-20 07:39:02 +0000
@@ -1554,12 +1554,16 @@ srv_suspend_mysql_thread(
 
 	mutex_exit(&kernel_mutex);
 
-	if (trx_is_interrupted(trx)
-	    || (srv_lock_wait_timeout < 100000000
-		&& wait_time > (double)srv_lock_wait_timeout)) {
+	if (srv_lock_wait_timeout < 100000000
+	    && wait_time > (double)srv_lock_wait_timeout) {
 
 		trx->error_state = DB_LOCK_WAIT_TIMEOUT;
 	}
+
+	if (trx_is_interrupted(trx)) {
+
+		trx->error_state = DB_INTERRUPTED;
+	}
 #else /* UNIV_HOTBACKUP */
 	/* This function depends on MySQL code that is not included in
 	InnoDB Hot Backup builds.  Besides, this function should never

=== modified file 'storage/innobase/srv/srv0start.c'
--- a/storage/innobase/srv/srv0start.c	2009-12-17 04:54:24 +0000
+++ b/storage/innobase/srv/srv0start.c	2010-05-14 10:51:26 +0000
@@ -102,20 +102,6 @@ static char*	srv_monitor_file_name;
 #define SRV_MAX_N_PENDING_SYNC_IOS	100
 
 
-/* Avoid warnings when using purify */
-
-#ifdef HAVE_purify
-static int inno_bcmp(register const char *s1, register const char *s2,
-	register uint len)
-{
-	while ((len-- != 0) && (*s1++ == *s2++))
-		;
-
-	return(len + 1);
-}
-#define memcmp(A,B,C) inno_bcmp((A),(B),(C))
-#endif
-
 static
 char*
 srv_parse_megabytes(

=== modified file 'storage/innobase/trx/trx0trx.c'
--- a/storage/innobase/trx/trx0trx.c	2009-12-22 08:54:55 +0000
+++ b/storage/innobase/trx/trx0trx.c	2010-05-14 13:02:28 +0000
@@ -131,6 +131,8 @@ trx_create(
 
 	trx->mysql_thd = NULL;
 	trx->mysql_query_str = NULL;
+	trx->mysql_query_len = NULL;
+
 	trx->active_trans = 0;
 	trx->duplicates = 0;
 
@@ -936,6 +938,7 @@ trx_commit_off_kernel(
 	trx->undo_no = ut_dulint_zero;
 	trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
 	trx->mysql_query_str = NULL;
+	trx->mysql_query_len = NULL;
 
 	ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
 	ut_ad(UT_LIST_GET_LEN(trx->trx_locks) == 0);

=== modified file 'storage/innodb_plugin/ChangeLog'
--- a/storage/innodb_plugin/ChangeLog	2010-04-29 13:37:50 +0000
+++ b/storage/innodb_plugin/ChangeLog	2010-05-26 05:38:14 +0000
@@ -1,3 +1,68 @@
+2010-05-25	The InnoDB Team
+
+	* handler/ha_innodb.cc, include/row0mysql.h, row/row0mysql.c:
+	Fix Bug#53592: crash replacing duplicates into table after fast
+	alter table added unique key 
+
+2010-05-24	The InnoDB Team
+
+	* dict/dict0boot.c, dict/dict0crea.c, fil/fil0fil.c,
+	include/dict0boot.h, include/fil0fil.h, row/row0mysql.c:
+	Fix Bug#53578: assert on invalid page access, in fil_io()
+
+2010-05-14	The InnoDB Team
+	* mysql-test/innodb_bug48024.test, mysql-test/innodb_bug48024.result,
+	dict/dict0dict.c, handler/ha_innodb.cc, handler/ha_innodb.h,
+	include/dict0dict.h, include/ha_prototypes.h, include/row0mysql.h,
+	include/trx0trx.h, row/row0mysql.c, trx/trx0i_s.c, trx/trx0trx.c:
+	Fix Bug#48024 Innodb doesn't work with multi-statements
+	Fix Bug#53644 InnoDB thinks that /*/ starts and ends a comment
+
+2010-05-12	The InnoDB Team
+
+	* handler/handler0alter.cc:
+	Fix Bug#53591 crash with fast alter table and text/blob prefix
+	primary key
+
+2010-05-12	The InnoDB Team
+
+	* row/row0merge.c:
+	Fix Bug#53471 row_merge_drop_temp_indexes() refers freed memory, SEGVs
+
+2010-05-11	The InnoDB Team
+
+	* mysql-test/innodb_bug53290.test, mysql-test/innodb_bug53290.result,
+	include/rem0cmp.h, rem/rem0cmp.c, row/row0merge.c:
+	Fix Bug#53290 wrong duplicate key error when adding a unique index
+	via fast alter table
+
+2010-05-11	The InnoDB Team
+	* buf/buf0lru.c, include/buf0buf.ic:
+	Fix Bug#53307 valgrind: warnings in main.partition_innodb_plugin
+
+2010-05-05	The InnoDB Team
+
+	* row/row0merge.c:
+	Fix Bug#53256 in a stress test, assert dict/dict0dict.c:815
+	table2 == NULL
+
+2010-05-05	The InnoDB Team
+
+	* handler/ha_innodb.cc:
+	Fix Bug#53165 Setting innodb_change_buffering=DEFAULT produces
+	incorrect result
+
+2010-05-04	The InnoDB Team
+
+	* fsp/fsp0fsp.c:
+	Fix Bug#53306 valgrind: warnings in innodb.innodb
+
+2010-05-03	The InnoDB Team
+
+	* buf0buf.c:
+	Fix Bug#53248 compressed tables page checksum mismatch after
+	re-enabling innodb_checksums
+
 2010-04-28	The InnoDB Team
 
 	* log/log0recv.h, log/log0recv.c:
@@ -42,12 +107,6 @@
 	Only check the record size at index creation time when
 	innodb_strict_mode is set or when ROW_FORMAT is DYNAMIC or COMPRESSED.
 
-2010-04-20	The InnoDB Team
-
-	* btr/btr0btr.c, include/univ.i:
-	Implement UNIV_BTR_AVOID_COPY, for avoiding writes when a B-tree
-	node is split at the first or last record.
-
 2010-04-15	The InnoDB Team
 
 	* trx/trx0rec.c:
@@ -66,6 +125,10 @@
 	* mysql-test/innodb_bug38231.test:
 	Remove non-determinism in the test case.
 
+2010-03-29	The InnoDB Team
+
+	InnoDB Plugin 1.0.7 released
+
 2010-03-18	The InnoDB Team
 
 	* CMakeLists.txt:

=== modified file 'storage/innodb_plugin/btr/btr0btr.c'
--- a/storage/innodb_plugin/btr/btr0btr.c	2010-04-26 07:39:49 +0000
+++ b/storage/innodb_plugin/btr/btr0btr.c	2010-05-11 10:49:10 +0000
@@ -1999,9 +1999,14 @@ func_start:
 			split_rec = NULL;
 			goto insert_empty;
 		}
+	} else if (UNIV_UNLIKELY(insert_left)) {
+		ut_a(n_iterations > 0);
+		first_rec = page_rec_get_next(page_get_infimum_rec(page));
+		move_limit = page_rec_get_next(btr_cur_get_rec(cursor));
 	} else {
 insert_empty:
 		ut_ad(!split_rec);
+		ut_ad(!insert_left);
 		buf = mem_alloc(rec_get_converted_size(cursor->index,
 						       tuple, n_ext));
 
@@ -2025,7 +2030,11 @@ insert_empty:
 			&& btr_page_insert_fits(cursor, split_rec,
 						offsets, tuple, n_ext, heap);
 	} else {
-		mem_free(buf);
+		if (!insert_left) {
+			mem_free(buf);
+			buf = NULL;
+		}
+
 		insert_will_fit = !new_page_zip
 			&& btr_page_insert_fits(cursor, NULL,
 						NULL, tuple, n_ext, heap);
@@ -2038,17 +2047,7 @@ insert_empty:
 	}
 
 	/* 5. Move then the records to the new page */
-	if (direction == FSP_DOWN
-#ifdef UNIV_BTR_AVOID_COPY
-	    && page_rec_is_supremum(move_limit)) {
-		/* Instead of moving all records, make the new page
-		the empty page. */
-
-		left_block = block;
-		right_block = new_block;
-	} else if (direction == FSP_DOWN
-#endif /* UNIV_BTR_AVOID_COPY */
-		   ) {
+	if (direction == FSP_DOWN) {
 		/*		fputs("Split left\n", stderr); */
 
 		if (0
@@ -2091,14 +2090,6 @@ insert_empty:
 		right_block = block;
 
 		lock_update_split_left(right_block, left_block);
-#ifdef UNIV_BTR_AVOID_COPY
-	} else if (!split_rec) {
-		/* Instead of moving all records, make the new page
-		the empty page. */
-
-		left_block = new_block;
-		right_block = block;
-#endif /* UNIV_BTR_AVOID_COPY */
 	} else {
 		/*		fputs("Split right\n", stderr); */
 

=== modified file 'storage/innodb_plugin/btr/btr0cur.c'
--- a/storage/innodb_plugin/btr/btr0cur.c	2010-04-28 08:46:27 +0000
+++ b/storage/innodb_plugin/btr/btr0cur.c	2010-05-19 07:58:43 +0000
@@ -3871,6 +3871,8 @@ btr_store_big_rec_extern_fields(
 			field_ref += local_len;
 		}
 		extern_len = big_rec_vec->fields[i].len;
+		UNIV_MEM_ASSERT_RW(big_rec_vec->fields[i].data,
+				   extern_len);
 
 		ut_a(extern_len > 0);
 
@@ -4507,6 +4509,7 @@ btr_copy_blob_prefix(
 		mtr_commit(&mtr);
 
 		if (page_no == FIL_NULL || copy_len != part_len) {
+			UNIV_MEM_ASSERT_RW(buf, copied_len);
 			return(copied_len);
 		}
 
@@ -4690,6 +4693,7 @@ btr_copy_externally_stored_field_prefix_
 				      space_id, page_no, offset);
 		inflateEnd(&d_stream);
 		mem_heap_free(heap);
+		UNIV_MEM_ASSERT_RW(buf, d_stream.total_out);
 		return(d_stream.total_out);
 	} else {
 		return(btr_copy_blob_prefix(buf, len, space_id,

=== modified file 'storage/innodb_plugin/buf/buf0buddy.c'
--- a/storage/innodb_plugin/buf/buf0buddy.c	2010-03-26 14:19:01 +0000
+++ b/storage/innodb_plugin/buf/buf0buddy.c	2010-05-25 12:37:48 +0000
@@ -442,11 +442,15 @@ buf_buddy_relocate(
 		pool), so there is nothing wrong about this.  The
 		mach_read_from_4() calls here will only trigger bogus
 		Valgrind memcheck warnings in UNIV_DEBUG_VALGRIND builds. */
-		bpage = buf_page_hash_get(
-			mach_read_from_4((const byte*) src
-					 + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID),
-			mach_read_from_4((const byte*) src
-					 + FIL_PAGE_OFFSET));
+		ulint		space	= mach_read_from_4(
+			(const byte*) src + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID);
+		ulint		page_no	= mach_read_from_4(
+			(const byte*) src + FIL_PAGE_OFFSET);
+		/* Suppress Valgrind warnings about conditional jump
+		on uninitialized value. */
+		UNIV_MEM_VALID(&space, sizeof space);
+		UNIV_MEM_VALID(&page_no, sizeof page_no);
+		bpage = buf_page_hash_get(space, page_no);
 
 		if (!bpage || bpage->zip.data != src) {
 			/* The block has probably been freshly
@@ -495,7 +499,12 @@ success:
 		mutex_exit(mutex);
 	} else if (i == buf_buddy_get_slot(sizeof(buf_page_t))) {
 		/* This must be a buf_page_t object. */
+#if UNIV_WORD_SIZE == 4
+		/* On 32-bit systems, there is no padding in
+		buf_page_t.  On other systems, Valgrind could complain
+		about uninitialized pad bytes. */
 		UNIV_MEM_ASSERT_RW(src, size);
+#endif
 		if (buf_buddy_relocate_block(src, dst)) {
 
 			goto success;

=== modified file 'storage/innodb_plugin/buf/buf0buf.c'
--- a/storage/innodb_plugin/buf/buf0buf.c	2010-03-23 16:20:36 +0000
+++ b/storage/innodb_plugin/buf/buf0buf.c	2010-05-19 08:01:52 +0000
@@ -1820,14 +1820,14 @@ buf_zip_decompress(
 	buf_block_t*	block,	/*!< in/out: block */
 	ibool		check)	/*!< in: TRUE=verify the page checksum */
 {
-	const byte* frame = block->page.zip.data;
+	const byte*	frame		= block->page.zip.data;
+	ulint		stamp_checksum	= mach_read_from_4(
+		frame + FIL_PAGE_SPACE_OR_CHKSUM);
 
 	ut_ad(buf_block_get_zip_size(block));
 	ut_a(buf_block_get_space(block) != 0);
 
-	if (UNIV_LIKELY(check)) {
-		ulint	stamp_checksum	= mach_read_from_4(
-			frame + FIL_PAGE_SPACE_OR_CHKSUM);
+	if (UNIV_LIKELY(check && stamp_checksum != BUF_NO_CHECKSUM_MAGIC)) {
 		ulint	calc_checksum	= page_zip_calc_checksum(
 			frame, page_zip_get_size(&block->page.zip));
 
@@ -2251,8 +2251,9 @@ wait_until_unfixed:
 		/* Decompress the page and apply buffered operations
 		while not holding buf_pool_mutex or block->mutex. */
 		success = buf_zip_decompress(block, srv_use_checksums);
+		ut_a(success);
 
-		if (UNIV_LIKELY(success && !recv_no_ibuf_operations)) {
+		if (UNIV_LIKELY(!recv_no_ibuf_operations)) {
 			ibuf_merge_or_delete_for_page(block, space, offset,
 						      zip_size, TRUE);
 		}
@@ -2265,13 +2266,6 @@ wait_until_unfixed:
 		mutex_exit(&block->mutex);
 		buf_pool->n_pend_unzip--;
 		rw_lock_x_unlock(&block->lock);
-
-		if (UNIV_UNLIKELY(!success)) {
-
-			buf_pool_mutex_exit();
-			return(NULL);
-		}
-
 		break;
 
 	case BUF_BLOCK_ZIP_FREE:
@@ -2286,7 +2280,12 @@ wait_until_unfixed:
 	ut_ad(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE);
 
 	mutex_enter(&block->mutex);
+#if UNIV_WORD_SIZE == 4
+	/* On 32-bit systems, there is no padding in buf_page_t.  On
+	other systems, Valgrind could complain about uninitialized pad
+	bytes. */
 	UNIV_MEM_ASSERT_RW(&block->page, sizeof block->page);
+#endif
 
 	buf_block_buf_fix_inc(block, file, line);
 

=== modified file 'storage/innodb_plugin/buf/buf0flu.c'
--- a/storage/innodb_plugin/buf/buf0flu.c	2010-04-07 06:21:26 +0000
+++ b/storage/innodb_plugin/buf/buf0flu.c	2010-05-04 12:47:44 +0000
@@ -249,6 +249,17 @@ buf_flush_insert_into_flush_list(
 	ut_d(block->page.in_flush_list = TRUE);
 	UT_LIST_ADD_FIRST(list, buf_pool->flush_list, &block->page);
 
+#ifdef UNIV_DEBUG_VALGRIND
+	{
+		ulint	zip_size = buf_block_get_zip_size(block);
+
+		if (UNIV_UNLIKELY(zip_size)) {
+			UNIV_MEM_ASSERT_RW(block->page.zip.data, zip_size);
+		} else {
+			UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
+		}
+	}
+#endif /* UNIV_DEBUG_VALGRIND */
 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
 	ut_a(buf_flush_validate_low());
 #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
@@ -276,6 +287,18 @@ buf_flush_insert_sorted_into_flush_list(
 	ut_ad(!block->page.in_flush_list);
 	ut_d(block->page.in_flush_list = TRUE);
 
+#ifdef UNIV_DEBUG_VALGRIND
+	{
+		ulint	zip_size = buf_block_get_zip_size(block);
+
+		if (UNIV_UNLIKELY(zip_size)) {
+			UNIV_MEM_ASSERT_RW(block->page.zip.data, zip_size);
+		} else {
+			UNIV_MEM_ASSERT_RW(block->frame, UNIV_PAGE_SIZE);
+		}
+	}
+#endif /* UNIV_DEBUG_VALGRIND */
+
 	prev_b = NULL;
 
 	/* For the most part when this function is called the flush_rbt
@@ -809,6 +832,7 @@ try_again:
 	zip_size = buf_page_get_zip_size(bpage);
 
 	if (UNIV_UNLIKELY(zip_size)) {
+		UNIV_MEM_ASSERT_RW(bpage->zip.data, zip_size);
 		/* Copy the compressed page and clear the rest. */
 		memcpy(trx_doublewrite->write_buf
 		       + UNIV_PAGE_SIZE * trx_doublewrite->first_free,
@@ -818,6 +842,8 @@ try_again:
 		       + zip_size, 0, UNIV_PAGE_SIZE - zip_size);
 	} else {
 		ut_a(buf_page_get_state(bpage) == BUF_BLOCK_FILE_PAGE);
+		UNIV_MEM_ASSERT_RW(((buf_block_t*) bpage)->frame,
+				   UNIV_PAGE_SIZE);
 
 		memcpy(trx_doublewrite->write_buf
 		       + UNIV_PAGE_SIZE * trx_doublewrite->first_free,

=== modified file 'storage/innodb_plugin/buf/buf0lru.c'
--- a/storage/innodb_plugin/buf/buf0lru.c	2010-03-23 16:20:36 +0000
+++ b/storage/innodb_plugin/buf/buf0lru.c	2010-05-20 13:07:34 +0000
@@ -1364,7 +1364,7 @@ buf_LRU_make_block_old(
 Try to free a block.  If bpage is a descriptor of a compressed-only
 page, the descriptor object will be freed as well.
 
-NOTE: If this function returns BUF_LRU_FREED, it will not temporarily
+NOTE: If this function returns BUF_LRU_FREED, it will temporarily
 release buf_pool_mutex.  Furthermore, the page frame will no longer be
 accessible via bpage.
 
@@ -1393,7 +1393,12 @@ buf_LRU_free_block(
 	ut_ad(buf_page_in_file(bpage));
 	ut_ad(bpage->in_LRU_list);
 	ut_ad(!bpage->in_flush_list == !bpage->oldest_modification);
+#if UNIV_WORD_SIZE == 4
+	/* On 32-bit systems, there is no padding in buf_page_t.  On
+	other systems, Valgrind could complain about uninitialized pad
+	bytes. */
 	UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
+#endif
 
 	if (!buf_page_can_relocate(bpage)) {
 
@@ -1489,8 +1494,13 @@ alloc:
 
 				ut_ad(prev_b->in_LRU_list);
 				ut_ad(buf_page_in_file(prev_b));
+#if UNIV_WORD_SIZE == 4
+				/* On 32-bit systems, there is no
+				padding in buf_page_t.  On other
+				systems, Valgrind could complain about
+				uninitialized pad bytes. */
 				UNIV_MEM_ASSERT_RW(prev_b, sizeof *prev_b);
-
+#endif
 				UT_LIST_INSERT_AFTER(LRU, buf_pool->LRU,
 						     prev_b, b);
 
@@ -1688,7 +1698,12 @@ buf_LRU_block_remove_hashed_page(
 	ut_a(buf_page_get_io_fix(bpage) == BUF_IO_NONE);
 	ut_a(bpage->buf_fix_count == 0);
 
+#if UNIV_WORD_SIZE == 4
+	/* On 32-bit systems, there is no padding in
+	buf_page_t.  On other systems, Valgrind could complain
+	about uninitialized pad bytes. */
 	UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
+#endif
 
 	buf_LRU_remove_block(bpage);
 

=== modified file 'storage/innodb_plugin/dict/dict0boot.c'
--- a/storage/innodb_plugin/dict/dict0boot.c	2010-04-22 09:33:42 +0000
+++ b/storage/innodb_plugin/dict/dict0boot.c	2010-05-24 11:04:39 +0000
@@ -62,32 +62,47 @@ dict_hdr_get(
 }
 
 /**********************************************************************//**
-Returns a new table, index, or tree id.
-@return	the new id */
+Returns a new table, index, or space id. */
 UNIV_INTERN
-dulint
+void
 dict_hdr_get_new_id(
 /*================*/
-	ulint	type)	/*!< in: DICT_HDR_ROW_ID, ... */
+	dulint*	table_id,	/*!< out: table id (not assigned if NULL) */
+	dulint*	index_id,	/*!< out: index id (not assigned if NULL) */
+	ulint*	space_id)	/*!< out: space id (not assigned if NULL) */
 {
 	dict_hdr_t*	dict_hdr;
 	dulint		id;
 	mtr_t		mtr;
 
-	ut_ad((type == DICT_HDR_TABLE_ID) || (type == DICT_HDR_INDEX_ID));
-
 	mtr_start(&mtr);
 
 	dict_hdr = dict_hdr_get(&mtr);
 
-	id = mtr_read_dulint(dict_hdr + type, &mtr);
-	id = ut_dulint_add(id, 1);
+	if (table_id) {
+		id = mtr_read_dulint(dict_hdr + DICT_HDR_TABLE_ID, &mtr);
+		id = ut_dulint_add(id, 1);
+		mlog_write_dulint(dict_hdr + DICT_HDR_TABLE_ID, id, &mtr);
+		*table_id = id;
+	}
 
-	mlog_write_dulint(dict_hdr + type, id, &mtr);
+	if (index_id) {
+		id = mtr_read_dulint(dict_hdr + DICT_HDR_INDEX_ID, &mtr);
+		id = ut_dulint_add(id, 1);
+		mlog_write_dulint(dict_hdr + DICT_HDR_INDEX_ID, id, &mtr);
+		*index_id = id;
+	}
 
-	mtr_commit(&mtr);
+	if (space_id) {
+		*space_id = mtr_read_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID,
+					   MLOG_4BYTES, &mtr);
+		if (fil_assign_new_space_id(space_id)) {
+			mlog_write_ulint(dict_hdr + DICT_HDR_MAX_SPACE_ID,
+					 *space_id, MLOG_4BYTES, &mtr);
+		}
+	}
 
-	return(id);
+	mtr_commit(&mtr);
 }
 
 /**********************************************************************//**
@@ -151,9 +166,12 @@ dict_hdr_create(
 	mlog_write_dulint(dict_header + DICT_HDR_INDEX_ID,
 			  ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
 
-	/* Obsolete, but we must initialize it to 0 anyway. */
-	mlog_write_dulint(dict_header + DICT_HDR_MIX_ID,
-			  ut_dulint_create(0, DICT_HDR_FIRST_ID), mtr);
+	mlog_write_ulint(dict_header + DICT_HDR_MAX_SPACE_ID,
+			 0, MLOG_4BYTES, mtr);
+
+	/* Obsolete, but we must initialize it anyway. */
+	mlog_write_ulint(dict_header + DICT_HDR_MIX_ID_LOW,
+			 DICT_HDR_FIRST_ID, MLOG_4BYTES, mtr);
 
 	/* Create the B-tree roots for the clustered indexes of the basic
 	system tables */

=== modified file 'storage/innodb_plugin/dict/dict0crea.c'
--- a/storage/innodb_plugin/dict/dict0crea.c	2010-04-21 10:27:23 +0000
+++ b/storage/innodb_plugin/dict/dict0crea.c	2010-05-24 11:04:39 +0000
@@ -239,16 +239,22 @@ dict_build_table_def_step(
 	const char*	path_or_name;
 	ibool		is_path;
 	mtr_t		mtr;
+	ulint		space = 0;
 
 	ut_ad(mutex_own(&(dict_sys->mutex)));
 
 	table = node->table;
 
-	table->id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
+	dict_hdr_get_new_id(&table->id, NULL,
+			    srv_file_per_table ? &space : NULL);
 
 	thr_get_trx(thr)->table_id = table->id;
 
 	if (srv_file_per_table) {
+		if (UNIV_UNLIKELY(space == ULINT_UNDEFINED)) {
+			return(DB_ERROR);
+		}
+
 		/* We create a new single-table tablespace for the table.
 		We initially let it be 4 pages:
 		- page 0 is the fsp header and an extent descriptor page,
@@ -257,8 +263,6 @@ dict_build_table_def_step(
 		- page 3 will contain the root of the clustered index of the
 		table we create here. */
 
-		ulint	space = 0;	/* reset to zero for the call below */
-
 		if (table->dir_path_of_temp_table) {
 			/* We place tables created with CREATE TEMPORARY
 			TABLE in the tmp dir of mysqld server */
@@ -276,7 +280,7 @@ dict_build_table_def_step(
 
 		flags = table->flags & ~(~0 << DICT_TF_BITS);
 		error = fil_create_new_single_table_tablespace(
-			&space, path_or_name, is_path,
+			space, path_or_name, is_path,
 			flags == DICT_TF_COMPACT ? 0 : flags,
 			FIL_IBD_FILE_INITIAL_SIZE);
 		table->space = (unsigned int) space;
@@ -561,7 +565,7 @@ dict_build_index_def_step(
 	ut_ad((UT_LIST_GET_LEN(table->indexes) > 0)
 	      || dict_index_is_clust(index));
 
-	index->id = dict_hdr_get_new_id(DICT_HDR_INDEX_ID);
+	dict_hdr_get_new_id(NULL, &index->id, NULL);
 
 	/* Inherit the space id from the table; we store all indexes of a
 	table in the same tablespace */

=== modified file 'storage/innodb_plugin/dict/dict0dict.c'
--- a/storage/innodb_plugin/dict/dict0dict.c	2010-04-28 10:34:52 +0000
+++ b/storage/innodb_plugin/dict/dict0dict.c	2010-05-14 13:08:15 +0000
@@ -82,7 +82,7 @@ static char	dict_ibfk[] = "_ibfk_";
 
 /** array of mutexes protecting dict_index_t::stat_n_diff_key_vals[] */
 #define DICT_INDEX_STAT_MUTEX_SIZE	32
-mutex_t	dict_index_stat_mutex[DICT_INDEX_STAT_MUTEX_SIZE];
+static mutex_t	dict_index_stat_mutex[DICT_INDEX_STAT_MUTEX_SIZE];
 
 /*******************************************************************//**
 Tries to find column names for the index and sets the col field of the
@@ -3008,25 +3008,28 @@ static
 char*
 dict_strip_comments(
 /*================*/
-	const char*	sql_string)	/*!< in: SQL string */
+	const char*	sql_string,	/*!< in: SQL string */
+	size_t		sql_length)	/*!< in: length of sql_string */
 {
 	char*		str;
 	const char*	sptr;
+	const char*	eptr	= sql_string + sql_length;
 	char*		ptr;
 	/* unclosed quote character (0 if none) */
 	char		quote	= 0;
 
-	str = mem_alloc(strlen(sql_string) + 1);
+	str = mem_alloc(sql_length + 1);
 
 	sptr = sql_string;
 	ptr = str;
 
 	for (;;) {
 scan_more:
-		if (*sptr == '\0') {
+		if (sptr >= eptr || *sptr == '\0') {
+end_of_string:
 			*ptr = '\0';
 
-			ut_a(ptr <= str + strlen(sql_string));
+			ut_a(ptr <= str + sql_length);
 
 			return(str);
 		}
@@ -3045,30 +3048,35 @@ scan_more:
 			   || (sptr[0] == '-' && sptr[1] == '-'
 			       && sptr[2] == ' ')) {
 			for (;;) {
+				if (++sptr >= eptr) {
+					goto end_of_string;
+				}
+
 				/* In Unix a newline is 0x0A while in Windows
 				it is 0x0D followed by 0x0A */
 
-				if (*sptr == (char)0x0A
-				    || *sptr == (char)0x0D
-				    || *sptr == '\0') {
-
+				switch (*sptr) {
+				case (char) 0X0A:
+				case (char) 0x0D:
+				case '\0':
 					goto scan_more;
 				}
-
-				sptr++;
 			}
 		} else if (!quote && *sptr == '/' && *(sptr + 1) == '*') {
+			sptr += 2;
 			for (;;) {
-				if (*sptr == '*' && *(sptr + 1) == '/') {
-
-					sptr += 2;
-
-					goto scan_more;
+				if (sptr >= eptr) {
+					goto end_of_string;
 				}
 
-				if (*sptr == '\0') {
-
+				switch (*sptr) {
+				case '\0':
 					goto scan_more;
+				case '*':
+					if (sptr[1] == '/') {
+						sptr += 2;
+						goto scan_more;
+					}
 				}
 
 				sptr++;
@@ -3749,6 +3757,7 @@ dict_create_foreign_constraints(
 					name before it: test.table2; the
 					default database id the database of
 					parameter name */
+	size_t		sql_length,	/*!< in: length of sql_string */
 	const char*	name,		/*!< in: table full name in the
 					normalized form
 					database_name/table_name */
@@ -3763,7 +3772,7 @@ dict_create_foreign_constraints(
 	ut_a(trx);
 	ut_a(trx->mysql_thd);
 
-	str = dict_strip_comments(sql_string);
+	str = dict_strip_comments(sql_string, sql_length);
 	heap = mem_heap_create(10000);
 
 	err = dict_create_foreign_constraints_low(
@@ -3796,6 +3805,7 @@ dict_foreign_parse_drop_constraints(
 	dict_foreign_t*		foreign;
 	ibool			success;
 	char*			str;
+	size_t			len;
 	const char*		ptr;
 	const char*		id;
 	FILE*			ef	= dict_foreign_err_file;
@@ -3810,7 +3820,10 @@ dict_foreign_parse_drop_constraints(
 
 	*constraints_to_drop = mem_heap_alloc(heap, 1000 * sizeof(char*));
 
-	str = dict_strip_comments(*(trx->mysql_query_str));
+	ptr = innobase_get_stmt(trx->mysql_thd, &len);
+
+	str = dict_strip_comments(ptr, len);
+
 	ptr = str;
 
 	ut_ad(mutex_own(&(dict_sys->mutex)));

=== modified file 'storage/innodb_plugin/fil/fil0fil.c'
--- a/storage/innodb_plugin/fil/fil0fil.c	2010-03-26 14:19:01 +0000
+++ b/storage/innodb_plugin/fil/fil0fil.c	2010-05-24 11:04:39 +0000
@@ -279,6 +279,10 @@ struct fil_system_struct {
 					request */
 	UT_LIST_BASE_NODE_T(fil_space_t) space_list;
 					/*!< list of all file spaces */
+	ibool		space_id_reuse_warned;
+					/* !< TRUE if fil_space_create()
+					has issued a warning about
+					potential space_id reuse */
 };
 
 /** The tablespace memory cache. This variable is NULL before the module is
@@ -1193,7 +1197,19 @@ try_again:
 	space->tablespace_version = fil_system->tablespace_version;
 	space->mark = FALSE;
 
-	if (purpose == FIL_TABLESPACE && id > fil_system->max_assigned_id) {
+	if (UNIV_LIKELY(purpose == FIL_TABLESPACE)
+	    && UNIV_UNLIKELY(id > fil_system->max_assigned_id)) {
+		if (!fil_system->space_id_reuse_warned) {
+			fil_system->space_id_reuse_warned = TRUE;
+
+			ut_print_timestamp(stderr);
+			fprintf(stderr,
+				"  InnoDB: Warning: allocated tablespace %lu,"
+				" old maximum was %lu\n",
+				(ulong) id,
+				(ulong) fil_system->max_assigned_id);
+		}
+
 		fil_system->max_assigned_id = id;
 	}
 
@@ -1231,19 +1247,25 @@ try_again:
 Assigns a new space id for a new single-table tablespace. This works simply by
 incrementing the global counter. If 4 billion id's is not enough, we may need
 to recycle id's.
-@return	new tablespace id; ULINT_UNDEFINED if could not assign an id */
-static
-ulint
-fil_assign_new_space_id(void)
-/*=========================*/
+@return	TRUE if assigned, FALSE if not */
+UNIV_INTERN
+ibool
+fil_assign_new_space_id(
+/*====================*/
+	ulint*	space_id)	/*!< in/out: space id */
 {
-	ulint		id;
+	ulint	id;
+	ibool	success;
 
 	mutex_enter(&fil_system->mutex);
 
-	fil_system->max_assigned_id++;
+	id = *space_id;
 
-	id = fil_system->max_assigned_id;
+	if (id < fil_system->max_assigned_id) {
+		id = fil_system->max_assigned_id;
+	}
+
+	id++;
 
 	if (id > (SRV_LOG_SPACE_FIRST_ID / 2) && (id % 1000000UL == 0)) {
 		ut_print_timestamp(stderr);
@@ -1259,7 +1281,11 @@ fil_assign_new_space_id(void)
 			(ulong) SRV_LOG_SPACE_FIRST_ID);
 	}
 
-	if (id >= SRV_LOG_SPACE_FIRST_ID) {
+	success = (id < SRV_LOG_SPACE_FIRST_ID);
+
+	if (success) {
+		*space_id = fil_system->max_assigned_id = id;
+	} else {
 		ut_print_timestamp(stderr);
 		fprintf(stderr,
 			"InnoDB: You have run out of single-table"
@@ -1269,14 +1295,12 @@ fil_assign_new_space_id(void)
 			" have to dump all your tables and\n"
 			"InnoDB: recreate the whole InnoDB installation.\n",
 			(ulong) id);
-		fil_system->max_assigned_id--;
-
-		id = ULINT_UNDEFINED;
+		*space_id = ULINT_UNDEFINED;
 	}
 
 	mutex_exit(&fil_system->mutex);
 
-	return(id);
+	return(success);
 }
 
 /*******************************************************************//**
@@ -1512,7 +1536,7 @@ fil_init(
 	ut_a(hash_size > 0);
 	ut_a(max_n_open > 0);
 
-	fil_system = mem_alloc(sizeof(fil_system_t));
+	fil_system = mem_zalloc(sizeof(fil_system_t));
 
 	mutex_create(&fil_system->mutex, SYNC_ANY_LATCH);
 
@@ -1521,16 +1545,7 @@ fil_init(
 
 	UT_LIST_INIT(fil_system->LRU);
 
-	fil_system->n_open = 0;
 	fil_system->max_n_open = max_n_open;
-
-	fil_system->modification_counter = 0;
-	fil_system->max_assigned_id = 0;
-
-	fil_system->tablespace_version = 0;
-
-	UT_LIST_INIT(fil_system->unflushed_spaces);
-	UT_LIST_INIT(fil_system->space_list);
 }
 
 /*******************************************************************//**
@@ -2115,7 +2130,7 @@ fil_op_log_parse_or_replay(
 			fil_create_directory_for_tablename(name);
 
 			if (fil_create_new_single_table_tablespace(
-				    &space_id, name, FALSE, flags,
+				    space_id, name, FALSE, flags,
 				    FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
 				ut_error;
 			}
@@ -2562,9 +2577,7 @@ UNIV_INTERN
 ulint
 fil_create_new_single_table_tablespace(
 /*===================================*/
-	ulint*		space_id,	/*!< in/out: space id; if this is != 0,
-					then this is an input parameter,
-					otherwise output */
+	ulint		space_id,	/*!< in: space id */
 	const char*	tablename,	/*!< in: the table name in the usual
 					databasename/tablename format
 					of InnoDB, or a dir path to a temp
@@ -2584,6 +2597,8 @@ fil_create_new_single_table_tablespace(
 	ibool		success;
 	char*		path;
 
+	ut_a(space_id > 0);
+	ut_a(space_id < SRV_LOG_SPACE_FIRST_ID);
 	ut_a(size >= FIL_IBD_FILE_INITIAL_SIZE);
 	/* The tablespace flags (FSP_SPACE_FLAGS) should be 0 for
 	ROW_FORMAT=COMPACT
@@ -2640,38 +2655,21 @@ fil_create_new_single_table_tablespace(
 		return(DB_ERROR);
 	}
 
-	buf2 = ut_malloc(3 * UNIV_PAGE_SIZE);
-	/* Align the memory for file i/o if we might have O_DIRECT set */
-	page = ut_align(buf2, UNIV_PAGE_SIZE);
-
 	ret = os_file_set_size(path, file, size * UNIV_PAGE_SIZE, 0);
 
 	if (!ret) {
-		ut_free(buf2);
-		os_file_close(file);
-		os_file_delete(path);
-
-		mem_free(path);
-		return(DB_OUT_OF_FILE_SPACE);
-	}
-
-	if (*space_id == 0) {
-		*space_id = fil_assign_new_space_id();
-	}
-
-	/* printf("Creating tablespace %s id %lu\n", path, *space_id); */
-
-	if (*space_id == ULINT_UNDEFINED) {
-		ut_free(buf2);
+		err = DB_OUT_OF_FILE_SPACE;
 error_exit:
 		os_file_close(file);
 error_exit2:
 		os_file_delete(path);
 
 		mem_free(path);
-		return(DB_ERROR);
+		return(err);
 	}
 
+	/* printf("Creating tablespace %s id %lu\n", path, space_id); */
+
 	/* We have to write the space id to the file immediately and flush the
 	file to disk. This is because in crash recovery we must be aware what
 	tablespaces exist and what are their space id's, so that we can apply
@@ -2681,10 +2679,14 @@ error_exit2:
 	with zeros from the call of os_file_set_size(), until a buffer pool
 	flush would write to it. */
 
+	buf2 = ut_malloc(3 * UNIV_PAGE_SIZE);
+	/* Align the memory for file i/o if we might have O_DIRECT set */
+	page = ut_align(buf2, UNIV_PAGE_SIZE);
+
 	memset(page, '\0', UNIV_PAGE_SIZE);
 
-	fsp_header_init_fields(page, *space_id, flags);
-	mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, *space_id);
+	fsp_header_init_fields(page, space_id, flags);
+	mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID, space_id);
 
 	if (!(flags & DICT_TF_ZSSIZE_MASK)) {
 		buf_flush_init_for_writing(page, NULL, 0);
@@ -2715,6 +2717,7 @@ error_exit2:
 		      " to tablespace ", stderr);
 		ut_print_filename(stderr, path);
 		putc('\n', stderr);
+		err = DB_ERROR;
 		goto error_exit;
 	}
 
@@ -2724,22 +2727,20 @@ error_exit2:
 		fputs("InnoDB: Error: file flush of tablespace ", stderr);
 		ut_print_filename(stderr, path);
 		fputs(" failed\n", stderr);
+		err = DB_ERROR;
 		goto error_exit;
 	}
 
 	os_file_close(file);
 
-	if (*space_id == ULINT_UNDEFINED) {
-		goto error_exit2;
-	}
-
-	success = fil_space_create(path, *space_id, flags, FIL_TABLESPACE);
+	success = fil_space_create(path, space_id, flags, FIL_TABLESPACE);
 
 	if (!success) {
+		err = DB_ERROR;
 		goto error_exit2;
 	}
 
-	fil_node_create(path, size, *space_id, FALSE);
+	fil_node_create(path, size, space_id, FALSE);
 
 #ifndef UNIV_HOTBACKUP
 	{
@@ -2750,7 +2751,7 @@ error_exit2:
 		fil_op_write_log(flags
 				 ? MLOG_FILE_CREATE2
 				 : MLOG_FILE_CREATE,
-				 *space_id,
+				 space_id,
 				 is_temp ? MLOG_FILE_FLAG_TEMP : 0,
 				 flags,
 				 tablename, NULL, &mtr);

=== modified file 'storage/innodb_plugin/fsp/fsp0fsp.c'
--- a/storage/innodb_plugin/fsp/fsp0fsp.c	2010-02-20 16:45:41 +0000
+++ b/storage/innodb_plugin/fsp/fsp0fsp.c	2010-05-04 13:09:17 +0000
@@ -869,12 +869,10 @@ fsp_init_file_page_low(
 		return;
 	}
 
-	UNIV_MEM_INVALID(page, UNIV_PAGE_SIZE);
+	memset(page, 0, UNIV_PAGE_SIZE);
 	mach_write_to_4(page + FIL_PAGE_OFFSET, buf_block_get_page_no(block));
-	memset(page + FIL_PAGE_LSN, 0, 8);
 	mach_write_to_4(page + FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
 			buf_block_get_space(block));
-	memset(page + UNIV_PAGE_SIZE - FIL_PAGE_END_LSN_OLD_CHKSUM, 0, 8);
 }
 
 #ifndef UNIV_HOTBACKUP

=== modified file 'storage/innodb_plugin/handler/ha_innodb.cc'
--- a/storage/innodb_plugin/handler/ha_innodb.cc	2010-04-29 13:27:43 +0000
+++ b/storage/innodb_plugin/handler/ha_innodb.cc	2010-05-28 13:17:37 +0000
@@ -1004,6 +1004,29 @@ innobase_get_charset(
 	return(thd_charset((THD*) mysql_thd));
 }
 
+/**********************************************************************//**
+Determines the current SQL statement.
+@return	SQL statement string */
+extern "C" UNIV_INTERN
+const char*
+innobase_get_stmt(
+/*==============*/
+	void*	mysql_thd,	/*!< in: MySQL thread handle */
+	size_t*	length)		/*!< out: length of the SQL statement */
+{
+#if MYSQL_VERSION_ID >= 50142
+	LEX_STRING* stmt;
+
+	stmt = thd_query_string((THD*) mysql_thd);
+	*length = stmt->length;
+	return(stmt->str);
+#else
+	const char*	stmt_str = thd_query((THD*) mysql_thd);
+	*length = strlen(stmt_str);
+	return(stmt_str);
+#endif
+}
+
 #if defined (__WIN__) && defined (MYSQL_DYNAMIC_PLUGIN)
 extern MYSQL_PLUGIN_IMPORT MY_TMPDIR mysql_tmpdir_list;
 /*******************************************************************//**
@@ -1314,7 +1337,6 @@ innobase_trx_allocate(
 	trx = trx_allocate_for_mysql();
 
 	trx->mysql_thd = thd;
-	trx->mysql_query_str = thd_query(thd);
 
 	innobase_trx_init(thd, trx);
 
@@ -6433,6 +6455,8 @@ ha_innobase::create(
 	/* Cache the value of innodb_file_format, in case it is
 	modified by another thread while the table is being created. */
 	const ulint	file_format = srv_file_format;
+	const char*	stmt;
+	size_t		stmt_len;
 
 	DBUG_ENTER("ha_innobase::create");
 
@@ -6649,7 +6673,7 @@ ha_innobase::create(
 			 (int) form->s->primary_key :
 			 -1);
 
-	/* Our function row_get_mysql_key_number_for_index assumes
+	/* Our function innobase_get_mysql_key_number_for_index assumes
 	the primary key is always number 0, if it exists */
 
 	ut_a(primary_key_no == -1 || primary_key_no == 0);
@@ -6709,9 +6733,11 @@ ha_innobase::create(
 		}
 	}
 
-	if (*trx->mysql_query_str) {
-		error = row_table_add_foreign_constraints(trx,
-			*trx->mysql_query_str, norm_name,
+	stmt = innobase_get_stmt(thd, &stmt_len);
+
+	if (stmt) {
+		error = row_table_add_foreign_constraints(
+			trx, stmt, stmt_len, norm_name,
 			create_info->options & HA_LEX_CREATE_TMP_TABLE);
 
 		error = convert_error_code_to_mysql(error, flags, NULL);
@@ -6996,7 +7022,6 @@ innobase_drop_database(
 	/* In the Windows plugin, thd = current_thd is always NULL */
 	trx = trx_allocate_for_mysql();
 	trx->mysql_thd = NULL;
-	trx->mysql_query_str = NULL;
 #else
 	trx = innobase_trx_allocate(thd);
 #endif
@@ -7365,6 +7390,87 @@ ha_innobase::read_time(
 }
 
 /*********************************************************************//**
+Calculates the key number used inside MySQL for an Innobase index. We will
+first check the "index translation table" for a match of the index to get
+the index number. If there does not exist an "index translation table",
+or not able to find the index in the translation table, then we will fall back
+to the traditional way of looping through dict_index_t list to find a
+match. In this case, we have to take into account if we generated a
+default clustered index for the table
+@return the key number used inside MySQL */
+static
+unsigned int
+innobase_get_mysql_key_number_for_index(
+/*====================================*/
+	INNOBASE_SHARE*		share,	/*!< in: share structure for index
+					translation table. */
+	const TABLE*		table,	/*!< in: table in MySQL data
+					dictionary */
+	dict_table_t*		ib_table,/*!< in: table in Innodb data
+					dictionary */
+        const dict_index_t*     index)	/*!< in: index */
+{
+	const dict_index_t*	ind;
+	unsigned int		i;
+
+	ut_ad(index);
+	ut_ad(ib_table);
+	ut_ad(table);
+	ut_ad(share);
+
+	/* If index does not belong to the table of share structure. Search
+	index->table instead */
+	if (index->table != ib_table
+	    && strcmp(index->table->name, share->table_name)) {
+		i = 0;
+		ind = dict_table_get_first_index(index->table);
+
+		while (index != ind) {
+			ind = dict_table_get_next_index(ind);
+			i++;
+		}
+
+		if (row_table_got_default_clust_index(index->table)) {
+			ut_a(i > 0);
+			i--;
+		}
+
+		return(i);
+	}
+
+	/* If index translation table exists, we will first check
+	the index through index translation table for a match. */
+        if (share->idx_trans_tbl.index_mapping) {
+		for (i = 0; i < share->idx_trans_tbl.index_count; i++) {
+			if (share->idx_trans_tbl.index_mapping[i] == index) {
+				return(i);
+			}
+		}
+
+		/* Print an error message if we cannot find the index
+		** in the "index translation table". */
+		sql_print_error("Cannot find index %s in InnoDB index "
+				"translation table.", index->name);
+	}
+
+	/* If we do not have an "index translation table", or not able
+	to find the index in the translation table, we'll directly find
+	matching index in the dict_index_t list */
+	for (i = 0; i < table->s->keys; i++) {
+		ind = dict_table_get_index_on_name(
+			ib_table, table->key_info[i].name);
+
+        	if (index == ind) {
+			return(i);
+		}
+        }
+
+	sql_print_error("Cannot find matching index number for index %s "
+			 "in InnoDB index list.", index->name);
+
+        return(0);
+}
+/*********************************************************************//**
 Returns statistics information of the table to the MySQL interpreter,
 in various fields of the handle object. */
 UNIV_INTERN
@@ -7633,8 +7739,8 @@ ha_innobase::info(
 		err_index = trx_get_error_info(prebuilt->trx);
 
 		if (err_index) {
-			errkey = (unsigned int)
-				row_get_mysql_key_number_for_index(err_index);
+			errkey = innobase_get_mysql_key_number_for_index(
+					share, table, ib_table, err_index);
 		} else {
 			errkey = (unsigned int) prebuilt->trx->error_key_num;
 		}
@@ -10346,7 +10452,35 @@ innodb_old_blocks_pct_update(
 }
 
 /*************************************************************//**
-Check if it is a valid value of innodb_change_buffering.  This function is
+Find the corresponding ibuf_use_t value that indexes into
+innobase_change_buffering_values[] array for the input
+change buffering option name.
+@return	corresponding IBUF_USE_* value for the input variable
+name, or IBUF_USE_COUNT if not able to find a match */
+static
+ibuf_use_t
+innodb_find_change_buffering_value(
+/*===============================*/
+	const char*	input_name)	/*!< in: input change buffering
+					option name */
+{
+	ulint	use;
+
+	for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
+	     use++) {
+		/* found a match */
+		if (!innobase_strcasecmp(
+			input_name, innobase_change_buffering_values[use])) {
+			return((ibuf_use_t)use);
+		}
+	}
+
+	/* Did not find any match */
+	return(IBUF_USE_COUNT);
+}
+
+/*************************************************************//**
+Check if it is a valid value of innodb_change_buffering. This function is
 registered as a callback with MySQL.
 @return	0 for valid innodb_change_buffering */
 static
@@ -10370,19 +10504,22 @@ innodb_change_buffering_validate(
 	change_buffering_input = value->val_str(value, buff, &len);
 
 	if (change_buffering_input != NULL) {
-		ulint	use;
+		ibuf_use_t	use;
 
-		for (use = 0; use < UT_ARR_SIZE(innobase_change_buffering_values);
-		     use++) {
-			if (!innobase_strcasecmp(
-				    change_buffering_input,
-				    innobase_change_buffering_values[use])) {
-				*(ibuf_use_t*) save = (ibuf_use_t) use;
-				return(0);
-			}
+		use = innodb_find_change_buffering_value(
+			change_buffering_input);
+
+		if (use != IBUF_USE_COUNT) {
+			/* Find a matching change_buffering option value. */
+			*static_cast<const char**>(save) =
+				innobase_change_buffering_values[use];
+
+			return(0);
 		}
 	}
 
+	/* No corresponding change buffering option for user supplied
+	"change_buffering_input" */
 	return(1);
 }
 
@@ -10393,21 +10530,27 @@ static
 void
 innodb_change_buffering_update(
 /*===========================*/
-	THD*				thd,		/*!< in: thread handle */
-	struct st_mysql_sys_var*	var,		/*!< in: pointer to
-							system variable */
-	void*				var_ptr,	/*!< out: where the
-							formal string goes */
-	const void*			save)		/*!< in: immediate result
-							from check function */
+	THD*				thd,	/*!< in: thread handle */
+	struct st_mysql_sys_var*	var,	/*!< in: pointer to
+						system variable */
+	void*				var_ptr,/*!< out: where the
+						formal string goes */
+	const void*			save)	/*!< in: immediate result
+						from check function */
 {
+	ibuf_use_t	use;
+
 	ut_a(var_ptr != NULL);
 	ut_a(save != NULL);
-	ut_a((*(ibuf_use_t*) save) < IBUF_USE_COUNT);
 
-	ibuf_use = *(const ibuf_use_t*) save;
+	use = innodb_find_change_buffering_value(
+		*static_cast<const char*const*>(save));
+
+	ut_a(use < IBUF_USE_COUNT);
 
-	*(const char**) var_ptr = innobase_change_buffering_values[ibuf_use];
+	ibuf_use = use;
+	*static_cast<const char**>(var_ptr) =
+		 *static_cast<const char*const*>(save);
 }
 
 static int show_innodb_vars(THD *thd, SHOW_VAR *var, char *buff)
@@ -10735,7 +10878,7 @@ static MYSQL_SYSVAR_STR(change_buffering
   "Buffer changes to reduce random access: "
   "OFF, ON, none, inserts.",
   innodb_change_buffering_validate,
-  innodb_change_buffering_update, NULL);
+  innodb_change_buffering_update, "inserts"); 
 
 static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold,
   PLUGIN_VAR_RQCMDARG,

=== modified file 'storage/innodb_plugin/handler/ha_innodb.h'
--- a/storage/innodb_plugin/handler/ha_innodb.h	2010-02-20 16:45:41 +0000
+++ b/storage/innodb_plugin/handler/ha_innodb.h	2010-05-14 13:08:15 +0000
@@ -231,7 +231,11 @@ the definitions are bracketed with #ifde
 
 extern "C" {
 struct charset_info_st *thd_charset(MYSQL_THD thd);
+#if MYSQL_VERSION_ID >= 50142
+LEX_STRING *thd_query_string(MYSQL_THD thd);
+#else
 char **thd_query(MYSQL_THD thd);
+#endif
 
 /** Get the file name of the MySQL binlog.
  * @return the name of the binlog file

=== modified file 'storage/innodb_plugin/handler/handler0alter.cc'
--- a/storage/innodb_plugin/handler/handler0alter.cc	2010-04-21 10:00:29 +0000
+++ b/storage/innodb_plugin/handler/handler0alter.cc	2010-05-12 10:42:12 +0000
@@ -894,6 +894,8 @@ error:
 		prebuilt->trx->error_info = NULL;
 		/* fall through */
 	default:
+		trx->error_state = DB_SUCCESS;
+
 		if (new_primary) {
 			if (indexed_table != innodb_table) {
 				row_merge_drop_table(trx, indexed_table);

=== modified file 'storage/innodb_plugin/include/buf0buf.ic'
--- a/storage/innodb_plugin/include/buf0buf.ic	2010-03-26 14:19:01 +0000
+++ b/storage/innodb_plugin/include/buf0buf.ic	2010-05-11 10:50:12 +0000
@@ -931,7 +931,12 @@ buf_page_hash_get(
 		ut_a(buf_page_in_file(bpage));
 		ut_ad(bpage->in_page_hash);
 		ut_ad(!bpage->in_zip_hash);
+#if UNIV_WORD_SIZE == 4
+		/* On 32-bit systems, there is no padding in
+		buf_page_t.  On other systems, Valgrind could complain
+		about uninitialized pad bytes. */
 		UNIV_MEM_ASSERT_RW(bpage, sizeof *bpage);
+#endif
 	}
 
 	return(bpage);

=== modified file 'storage/innodb_plugin/include/buf0lru.h'
--- a/storage/innodb_plugin/include/buf0lru.h	2009-08-27 06:25:00 +0000
+++ b/storage/innodb_plugin/include/buf0lru.h	2010-05-20 13:07:34 +0000
@@ -96,7 +96,7 @@ buf_LRU_insert_zip_clean(
 Try to free a block.  If bpage is a descriptor of a compressed-only
 page, the descriptor object will be freed as well.
 
-NOTE: If this function returns BUF_LRU_FREED, it will not temporarily
+NOTE: If this function returns BUF_LRU_FREED, it will temporarily
 release buf_pool_mutex.  Furthermore, the page frame will no longer be
 accessible via bpage.
 

=== modified file 'storage/innodb_plugin/include/dict0boot.h'
--- a/storage/innodb_plugin/include/dict0boot.h	2010-04-22 09:33:42 +0000
+++ b/storage/innodb_plugin/include/dict0boot.h	2010-05-24 11:04:39 +0000
@@ -46,13 +46,14 @@ dict_hdr_get(
 /*=========*/
 	mtr_t*	mtr);	/*!< in: mtr */
 /**********************************************************************//**
-Returns a new row, table, index, or tree id.
-@return	the new id */
+Returns a new table, index, or space id. */
 UNIV_INTERN
-dulint
+void
 dict_hdr_get_new_id(
 /*================*/
-	ulint	type);	/*!< in: DICT_HDR_ROW_ID, ... */
+	dulint*	table_id,	/*!< out: table id (not assigned if NULL) */
+	dulint*	index_id,	/*!< out: index id (not assigned if NULL) */
+	ulint*	space_id);	/*!< out: space id (not assigned if NULL) */
 /**********************************************************************//**
 Returns a new row id.
 @return	the new id */
@@ -119,7 +120,8 @@ dict_create(void);
 #define DICT_HDR_ROW_ID		0	/* The latest assigned row id */
 #define	DICT_HDR_TABLE_ID	8	/* The latest assigned table id */
 #define	DICT_HDR_INDEX_ID	16	/* The latest assigned index id */
-#define	DICT_HDR_MIX_ID		24	/* Obsolete, always 0. */
+#define DICT_HDR_MAX_SPACE_ID	24	/* The latest assigned space id, or 0*/
+#define	DICT_HDR_MIX_ID_LOW	28	/* Obsolete,always DICT_HDR_FIRST_ID */
 #define	DICT_HDR_TABLES		32	/* Root of the table index tree */
 #define	DICT_HDR_TABLE_IDS	36	/* Root of the table index tree */
 #define	DICT_HDR_COLUMNS	40	/* Root of the column index tree */

=== modified file 'storage/innodb_plugin/include/dict0dict.h'
--- a/storage/innodb_plugin/include/dict0dict.h	2010-04-28 08:46:27 +0000
+++ b/storage/innodb_plugin/include/dict0dict.h	2010-05-14 13:08:15 +0000
@@ -352,6 +352,7 @@ dict_create_foreign_constraints(
 					name before it: test.table2; the
 					default database id the database of
 					parameter name */
+	size_t		sql_length,	/*!< in: length of sql_string */
 	const char*	name,		/*!< in: table full name in the
 					normalized form
 					database_name/table_name */

=== modified file 'storage/innodb_plugin/include/fil0fil.h'
--- a/storage/innodb_plugin/include/fil0fil.h	2010-02-20 16:45:41 +0000
+++ b/storage/innodb_plugin/include/fil0fil.h	2010-05-24 11:04:39 +0000
@@ -225,6 +225,16 @@ fil_space_create(
 				0 for uncompressed tablespaces */
 	ulint		purpose);/*!< in: FIL_TABLESPACE, or FIL_LOG if log */
 /*******************************************************************//**
+Assigns a new space id for a new single-table tablespace. This works simply by
+incrementing the global counter. If 4 billion id's is not enough, we may need
+to recycle id's.
+@return	TRUE if assigned, FALSE if not */
+UNIV_INTERN
+ibool
+fil_assign_new_space_id(
+/*====================*/
+	ulint*	space_id);	/*!< in/out: space id */
+/*******************************************************************//**
 Returns the size of the space in pages. The tablespace must be cached in the
 memory cache.
 @return	space size, 0 if space not found */
@@ -427,9 +437,7 @@ UNIV_INTERN
 ulint
 fil_create_new_single_table_tablespace(
 /*===================================*/
-	ulint*		space_id,	/*!< in/out: space id; if this is != 0,
-					then this is an input parameter,
-					otherwise output */
+	ulint		space_id,	/*!< in: space id */
 	const char*	tablename,	/*!< in: the table name in the usual
 					databasename/tablename format
 					of InnoDB, or a dir path to a temp

=== modified file 'storage/innodb_plugin/include/ha_prototypes.h'
--- a/storage/innodb_plugin/include/ha_prototypes.h	2009-12-22 09:04:34 +0000
+++ b/storage/innodb_plugin/include/ha_prototypes.h	2010-05-14 13:08:15 +0000
@@ -215,11 +215,21 @@ innobase_casedn_str(
 /**********************************************************************//**
 Determines the connection character set.
 @return	connection character set */
+UNIV_INTERN
 struct charset_info_st*
 innobase_get_charset(
 /*=================*/
 	void*	mysql_thd);	/*!< in: MySQL thread handle */
-
+/**********************************************************************//**
+Determines the current SQL statement.
+@return	SQL statement string */
+UNIV_INTERN
+const char*
+innobase_get_stmt(
+/*==============*/
+	void*	mysql_thd,	/*!< in: MySQL thread handle */
+	size_t*	length)		/*!< out: length of the SQL statement */
+	__attribute__((nonnull));
 /******************************************************************//**
 This function is used to find the storage length in bytes of the first n
 characters for prefix indexes using a multibyte character set. The function

=== modified file 'storage/innodb_plugin/include/mach0data.ic'
--- a/storage/innodb_plugin/include/mach0data.ic	2009-05-25 09:52:29 +0000
+++ b/storage/innodb_plugin/include/mach0data.ic	2010-05-19 08:07:43 +0000
@@ -36,7 +36,7 @@ mach_write_to_1(
 	ulint	n)	/*!< in: ulint integer to be stored, >= 0, < 256 */
 {
 	ut_ad(b);
-	ut_ad(n <= 0xFFUL);
+	ut_ad((n | 0xFFUL) <= 0xFFUL);
 
 	b[0] = (byte)n;
 }
@@ -65,7 +65,7 @@ mach_write_to_2(
 	ulint	n)	/*!< in: ulint integer to be stored */
 {
 	ut_ad(b);
-	ut_ad(n <= 0xFFFFUL);
+	ut_ad((n | 0xFFFFUL) <= 0xFFFFUL);
 
 	b[0] = (byte)(n >> 8);
 	b[1] = (byte)(n);
@@ -81,10 +81,7 @@ mach_read_from_2(
 /*=============*/
 	const byte*	b)	/*!< in: pointer to 2 bytes */
 {
-	ut_ad(b);
-	return( ((ulint)(b[0]) << 8)
-		+ (ulint)(b[1])
-		);
+	return(((ulint)(b[0]) << 8) | (ulint)(b[1]));
 }
 
 /********************************************************//**
@@ -129,7 +126,7 @@ mach_write_to_3(
 	ulint	n)	/*!< in: ulint integer to be stored */
 {
 	ut_ad(b);
-	ut_ad(n <= 0xFFFFFFUL);
+	ut_ad((n | 0xFFFFFFUL) <= 0xFFFFFFUL);
 
 	b[0] = (byte)(n >> 16);
 	b[1] = (byte)(n >> 8);
@@ -148,8 +145,8 @@ mach_read_from_3(
 {
 	ut_ad(b);
 	return( ((ulint)(b[0]) << 16)
-		+ ((ulint)(b[1]) << 8)
-		+ (ulint)(b[2])
+		| ((ulint)(b[1]) << 8)
+		| (ulint)(b[2])
 		);
 }
 
@@ -183,9 +180,9 @@ mach_read_from_4(
 {
 	ut_ad(b);
 	return( ((ulint)(b[0]) << 24)
-		+ ((ulint)(b[1]) << 16)
-		+ ((ulint)(b[2]) << 8)
-		+ (ulint)(b[3])
+		| ((ulint)(b[1]) << 16)
+		| ((ulint)(b[2]) << 8)
+		| (ulint)(b[3])
 		);
 }
 
@@ -721,7 +718,7 @@ mach_read_from_2_little_endian(
 /*===========================*/
 	const byte*	buf)		/*!< in: from where to read */
 {
-	return((ulint)(*buf) + ((ulint)(*(buf + 1))) * 256);
+	return((ulint)(buf[0]) | ((ulint)(buf[1]) << 8));
 }
 
 /*********************************************************//**

=== modified file 'storage/innodb_plugin/include/rem0cmp.h'
--- a/storage/innodb_plugin/include/rem0cmp.h	2009-08-06 22:04:03 +0000
+++ b/storage/innodb_plugin/include/rem0cmp.h	2010-05-05 12:39:01 +0000
@@ -148,7 +148,9 @@ cmp_rec_rec_simple(
 	const rec_t*		rec2,	/*!< in: physical record */
 	const ulint*		offsets1,/*!< in: rec_get_offsets(rec1, ...) */
 	const ulint*		offsets2,/*!< in: rec_get_offsets(rec2, ...) */
-	const dict_index_t*	index);	/*!< in: data dictionary index */
+	const dict_index_t*	index,	/*!< in: data dictionary index */
+	ibool*			null_eq);/*!< out: set to TRUE if
+					found matching null values */
 /*************************************************************//**
 This function is used to compare two physical records. Only the common
 first fields are compared, and if an externally stored field is

=== modified file 'storage/innodb_plugin/include/row0mysql.h'
--- a/storage/innodb_plugin/include/row0mysql.h	2010-02-20 16:45:41 +0000
+++ b/storage/innodb_plugin/include/row0mysql.h	2010-05-26 05:31:27 +0000
@@ -253,15 +253,6 @@ row_table_got_default_clust_index(
 /*==============================*/
 	const dict_table_t*	table);	/*!< in: table */
 /*********************************************************************//**
-Calculates the key number used inside MySQL for an Innobase index. We have
-to take into account if we generated a default clustered index for the table
-@return	the key number used inside MySQL */
-UNIV_INTERN
-ulint
-row_get_mysql_key_number_for_index(
-/*===============================*/
-	const dict_index_t*	index);	/*!< in: index */
-/*********************************************************************//**
 Does an update or delete of a row for MySQL.
 @return	error code or DB_SUCCESS */
 UNIV_INTERN
@@ -403,6 +394,7 @@ row_table_add_foreign_constraints(
 				FOREIGN KEY (a, b) REFERENCES table2(c, d),
 					table2 can be written also with the
 					database name before it: test.table2 */
+	size_t		sql_length,	/*!< in: length of sql_string */
 	const char*	name,		/*!< in: table full name in the
 					normalized form
 					database_name/table_name */

=== modified file 'storage/innodb_plugin/include/trx0trx.h'
--- a/storage/innodb_plugin/include/trx0trx.h	2010-04-20 11:42:22 +0000
+++ b/storage/innodb_plugin/include/trx0trx.h	2010-05-14 13:08:15 +0000
@@ -560,9 +560,6 @@ struct trx_struct{
 	/*------------------------------*/
 	void*		mysql_thd;	/*!< MySQL thread handle corresponding
 					to this trx, or NULL */
-	char**		mysql_query_str;/* pointer to the field in mysqld_thd
-					which contains the pointer to the
-					current SQL query string */
 	const char*	mysql_log_file_name;
 					/* if MySQL binlog is used, this field
 					contains a pointer to the latest file

=== modified file 'storage/innodb_plugin/include/univ.i'
--- a/storage/innodb_plugin/include/univ.i	2010-04-26 08:35:57 +0000
+++ b/storage/innodb_plugin/include/univ.i	2010-05-20 10:40:42 +0000
@@ -46,7 +46,7 @@ Created 1/20/1994 Heikki Tuuri
 
 #define INNODB_VERSION_MAJOR	1
 #define INNODB_VERSION_MINOR	0
-#define INNODB_VERSION_BUGFIX	8
+#define INNODB_VERSION_BUGFIX	9
 
 /* The following is the InnoDB version as shown in
 SELECT plugin_version FROM information_schema.plugins;
@@ -165,9 +165,9 @@ command. Not tested on Windows. */
 #define UNIV_COMPILE_TEST_FUNCS
 */
 
-#ifdef HAVE_purify
+#if defined HAVE_VALGRIND
 # define UNIV_DEBUG_VALGRIND
-#endif /* HAVE_purify */
+#endif /* HAVE_VALGRIND */
 #if 0
 #define UNIV_DEBUG_VALGRIND			/* Enable extra
 						Valgrind instrumentation */
@@ -205,10 +205,6 @@ operations (very slow); also UNIV_DEBUG 
 						adaptive hash index */
 #define UNIV_SRV_PRINT_LATCH_WAITS		/* enable diagnostic output
 						in sync0sync.c */
-#define UNIV_BTR_AVOID_COPY			/* when splitting B-tree nodes,
-						do not move any records when
-						all the records would
-						be moved */
 #define UNIV_BTR_PRINT				/* enable functions for
 						printing B-trees */
 #define UNIV_ZIP_DEBUG				/* extensive consistency checks

=== modified file 'storage/innodb_plugin/page/page0zip.c'
--- a/storage/innodb_plugin/page/page0zip.c	2009-09-28 07:52:25 +0000
+++ b/storage/innodb_plugin/page/page0zip.c	2010-05-19 08:01:52 +0000
@@ -571,7 +571,7 @@ page_zip_dir_encode(
 	/* Traverse the list of stored records in the collation order,
 	starting from the first user record. */
 
-	rec = page + PAGE_NEW_INFIMUM, TRUE;
+	rec = page + PAGE_NEW_INFIMUM;
 
 	i = 0;
 
@@ -3117,8 +3117,13 @@ page_zip_validate_low(
 	temp_page_zip in a debugger when running valgrind --db-attach. */
 	VALGRIND_GET_VBITS(page, temp_page, UNIV_PAGE_SIZE);
 	UNIV_MEM_ASSERT_RW(page, UNIV_PAGE_SIZE);
+# if UNIV_WORD_SIZE == 4
 	VALGRIND_GET_VBITS(page_zip, &temp_page_zip, sizeof temp_page_zip);
+	/* On 32-bit systems, there is no padding in page_zip_des_t.
+	On other systems, Valgrind could complain about uninitialized
+	pad bytes. */
 	UNIV_MEM_ASSERT_RW(page_zip, sizeof *page_zip);
+# endif
 	VALGRIND_GET_VBITS(page_zip->data, temp_page,
 			   page_zip_get_size(page_zip));
 	UNIV_MEM_ASSERT_RW(page_zip->data, page_zip_get_size(page_zip));

=== modified file 'storage/innodb_plugin/rem/rem0cmp.c'
--- a/storage/innodb_plugin/rem/rem0cmp.c	2009-08-06 22:04:03 +0000
+++ b/storage/innodb_plugin/rem/rem0cmp.c	2010-05-05 12:39:01 +0000
@@ -706,7 +706,9 @@ cmp_rec_rec_simple(
 	const rec_t*		rec2,	/*!< in: physical record */
 	const ulint*		offsets1,/*!< in: rec_get_offsets(rec1, ...) */
 	const ulint*		offsets2,/*!< in: rec_get_offsets(rec2, ...) */
-	const dict_index_t*	index)	/*!< in: data dictionary index */
+	const dict_index_t*	index,	/*!< in: data dictionary index */
+	ibool*			null_eq)/*!< out: set to TRUE if
+					found matching null values */
 {
 	ulint		rec1_f_len;	/*!< length of current field in rec1 */
 	const byte*	rec1_b_ptr;	/*!< pointer to the current byte
@@ -753,6 +755,9 @@ cmp_rec_rec_simple(
 		    || rec2_f_len == UNIV_SQL_NULL) {
 
 			if (rec1_f_len == rec2_f_len) {
+				if (null_eq) {
+					*null_eq = TRUE;
+				}
 
 				goto next_field;
 

=== modified file 'storage/innodb_plugin/row/row0merge.c'
--- a/storage/innodb_plugin/row/row0merge.c	2010-04-27 13:47:38 +0000
+++ b/storage/innodb_plugin/row/row0merge.c	2010-05-25 08:01:03 +0000
@@ -717,14 +717,16 @@ row_merge_read(
 }
 
 /********************************************************************//**
-Read a merge block from the file system.
+Write a merge block to the file system.
 @return	TRUE if request was successful, FALSE if fail */
 static
 ibool
 row_merge_write(
 /*============*/
 	int		fd,	/*!< in: file descriptor */
-	ulint		offset,	/*!< in: offset where to write */
+	ulint		offset,	/*!< in: offset where to read
+				in number of row_merge_block_t
+				elements */
 	const void*	buf)	/*!< in: data */
 {
 	ib_uint64_t	ofs = ((ib_uint64_t) offset)
@@ -1075,11 +1077,14 @@ row_merge_cmp(
 						record to be compared */
 	const ulint*		offsets1,	/*!< in: first record offsets */
 	const ulint*		offsets2,	/*!< in: second record offsets */
-	const dict_index_t*	index)		/*!< in: index */
+	const dict_index_t*	index,		/*!< in: index */
+	ibool*			null_eq)	/*!< out: set to TRUE if
+						found matching null values */
 {
 	int	cmp;
 
-	cmp = cmp_rec_rec_simple(mrec1, mrec2, offsets1, offsets2, index);
+	cmp = cmp_rec_rec_simple(mrec1, mrec2, offsets1, offsets2, index,
+				 null_eq);
 
 #ifdef UNIV_DEBUG
 	if (row_merge_print_cmp) {
@@ -1445,11 +1450,13 @@ corrupt:
 	}
 
 	while (mrec0 && mrec1) {
+		ibool	null_eq = FALSE;
 		switch (row_merge_cmp(mrec0, mrec1,
-				      offsets0, offsets1, index)) {
+				      offsets0, offsets1, index,
+				      &null_eq)) {
 		case 0:
 			if (UNIV_UNLIKELY
-			    (dict_index_is_unique(index))) {
+			    (dict_index_is_unique(index) && !null_eq)) {
 				innobase_rec_to_mysql(table, mrec0,
 						      index, offsets0);
 				mem_heap_free(heap);
@@ -2087,13 +2094,16 @@ row_merge_drop_temp_indexes(void)
 		btr_pcur_store_position(&pcur, &mtr);
 		btr_pcur_commit_specify_mtr(&pcur, &mtr);
 
-		table = dict_load_table_on_id(table_id);
+		table = dict_table_get_on_id_low(table_id);
 
 		if (table) {
 			dict_index_t*	index;
+			dict_index_t*	next_index;
 
 			for (index = dict_table_get_first_index(table);
-			     index; index = dict_table_get_next_index(index)) {
+			     index; index = next_index) {
+
+				next_index = dict_table_get_next_index(index);
 
 				if (*index->name == TEMP_INDEX_PREFIX) {
 					row_merge_drop_index(index, table, trx);

=== modified file 'storage/innodb_plugin/row/row0mysql.c'
--- a/storage/innodb_plugin/row/row0mysql.c	2010-04-29 13:27:43 +0000
+++ b/storage/innodb_plugin/row/row0mysql.c	2010-05-26 05:31:27 +0000
@@ -522,6 +522,7 @@ handle_new_error:
 	case DB_CANNOT_ADD_CONSTRAINT:
 	case DB_TOO_MANY_CONCURRENT_TRXS:
 	case DB_OUT_OF_FILE_SPACE:
+	case DB_INTERRUPTED:
 		if (savept) {
 			/* Roll back the latest, possibly incomplete
 			insertion or update */
@@ -1645,37 +1646,6 @@ row_table_got_default_clust_index(
 }
 
 /*********************************************************************//**
-Calculates the key number used inside MySQL for an Innobase index. We have
-to take into account if we generated a default clustered index for the table
-@return	the key number used inside MySQL */
-UNIV_INTERN
-ulint
-row_get_mysql_key_number_for_index(
-/*===============================*/
-	const dict_index_t*	index)	/*!< in: index */
-{
-	const dict_index_t*	ind;
-	ulint			i;
-
-	ut_a(index);
-
-	i = 0;
-	ind = dict_table_get_first_index(index->table);
-
-	while (index != ind) {
-		ind = dict_table_get_next_index(ind);
-		i++;
-	}
-
-	if (row_table_got_default_clust_index(index->table)) {
-		ut_a(i > 0);
-		i--;
-	}
-
-	return(i);
-}
-
-/*********************************************************************//**
 Locks the data dictionary in shared mode from modifications, for performing
 foreign key check, rollback, or other operation invisible to MySQL. */
 UNIV_INTERN
@@ -2059,6 +2029,7 @@ row_table_add_foreign_constraints(
 				FOREIGN KEY (a, b) REFERENCES table2(c, d),
 					table2 can be written also with the
 					database name before it: test.table2 */
+	size_t		sql_length,	/*!< in: length of sql_string */
 	const char*	name,		/*!< in: table full name in the
 					normalized form
 					database_name/table_name */
@@ -2080,8 +2051,8 @@ row_table_add_foreign_constraints(
 
 	trx_set_dict_operation(trx, TRX_DICT_OP_TABLE);
 
-	err = dict_create_foreign_constraints(trx, sql_string, name,
-					      reject_fks);
+	err = dict_create_foreign_constraints(trx, sql_string, sql_length,
+					      name, reject_fks);
 	if (err == DB_SUCCESS) {
 		/* Check that also referencing constraints are ok */
 		err = dict_load_foreigns(name, TRUE);
@@ -2425,7 +2396,7 @@ row_discard_tablespace_for_mysql(
 		goto funct_exit;
 	}
 
-	new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
+	dict_hdr_get_new_id(&new_id, NULL, NULL);
 
 	/* Remove all locks except the table-level S and X locks. */
 	lock_remove_all_on_table(table, FALSE);
@@ -2787,10 +2758,11 @@ row_truncate_table_for_mysql(
 
 			dict_index_t*	index;
 
-			space = 0;
+			dict_hdr_get_new_id(NULL, NULL, &space);
 
-			if (fil_create_new_single_table_tablespace(
-				    &space, table->name, FALSE, flags,
+			if (space == ULINT_UNDEFINED
+			    || fil_create_new_single_table_tablespace(
+				    space, table->name, FALSE, flags,
 				    FIL_IBD_FILE_INITIAL_SIZE) != DB_SUCCESS) {
 				ut_print_timestamp(stderr);
 				fprintf(stderr,
@@ -2895,7 +2867,7 @@ next_rec:
 
 	mem_heap_free(heap);
 
-	new_id = dict_hdr_get_new_id(DICT_HDR_TABLE_ID);
+	dict_hdr_get_new_id(&new_id, NULL, NULL);
 
 	info = pars_info_create();
 

=== modified file 'storage/innodb_plugin/row/row0sel.c'
--- a/storage/innodb_plugin/row/row0sel.c	2010-04-29 13:27:43 +0000
+++ b/storage/innodb_plugin/row/row0sel.c	2010-05-25 12:53:52 +0000
@@ -2498,6 +2498,7 @@ row_sel_field_store_in_mysql_format(
 	byte*	pad_ptr;
 
 	ut_ad(len != UNIV_SQL_NULL);
+	UNIV_MEM_ASSERT_RW(data, len);
 
 	switch (templ->type) {
 	case DATA_INT:
@@ -2746,6 +2747,9 @@ row_sel_store_mysql_rec(
 			/* MySQL assumes that the field for an SQL
 			NULL value is set to the default value. */
 
+			UNIV_MEM_ASSERT_RW(prebuilt->default_rec
+					   + templ->mysql_col_offset,
+					   templ->mysql_col_len);
 			mysql_rec[templ->mysql_null_byte_offset]
 				|= (byte) templ->mysql_null_bit_mask;
 			memcpy(mysql_rec + templ->mysql_col_offset,
@@ -3070,6 +3074,11 @@ row_sel_pop_cached_row_for_mysql(
 
 		for (i = 0; i < prebuilt->n_template; i++) {
 			templ = prebuilt->mysql_template + i;
+#if 0 /* Some of the cached_rec may legitimately be uninitialized. */
+			UNIV_MEM_ASSERT_RW(cached_rec
+					   + templ->mysql_col_offset,
+					   templ->mysql_col_len);
+#endif
 			ut_memcpy(buf + templ->mysql_col_offset,
 				  cached_rec + templ->mysql_col_offset,
 				  templ->mysql_col_len);
@@ -3084,6 +3093,11 @@ row_sel_pop_cached_row_for_mysql(
 		}
 	}
 	else {
+#if 0 /* Some of the cached_rec may legitimately be uninitialized. */
+		UNIV_MEM_ASSERT_RW(prebuilt->fetch_cache
+				   [prebuilt->fetch_cache_first],
+				   prebuilt->mysql_prefix_len);
+#endif
 		ut_memcpy(buf,
 			  prebuilt->fetch_cache[prebuilt->fetch_cache_first],
 			  prebuilt->mysql_prefix_len);
@@ -3134,6 +3148,8 @@ row_sel_push_cache_row_for_mysql(
 	}
 
 	ut_ad(prebuilt->fetch_cache_first == 0);
+	UNIV_MEM_INVALID(prebuilt->fetch_cache[prebuilt->n_fetch_cached],
+			 prebuilt->mysql_row_len);
 
 	if (UNIV_UNLIKELY(!row_sel_store_mysql_rec(
 				  prebuilt->fetch_cache[
@@ -3595,6 +3611,13 @@ shortcut_fails_too_big_rec:
 		trx->has_search_latch = FALSE;
 	}
 
+	ut_ad(prebuilt->sql_stat_start || trx->conc_state == TRX_ACTIVE);
+	ut_ad(trx->conc_state == TRX_NOT_STARTED
+	      || trx->conc_state == TRX_ACTIVE);
+	ut_ad(prebuilt->sql_stat_start
+	      || prebuilt->select_lock_type != LOCK_NONE
+	      || trx->read_view);
+
 	trx_start_if_not_started(trx);
 
 	if (trx->isolation_level <= TRX_ISO_READ_COMMITTED

=== modified file 'storage/innodb_plugin/setup.sh'
--- a/storage/innodb_plugin/setup.sh	2010-04-07 11:18:43 +0000
+++ b/storage/innodb_plugin/setup.sh	2010-05-26 05:31:27 +0000
@@ -21,7 +21,7 @@
 
 set -eu
 
-TARGETDIR=../storage/innobase
+TARGETDIR=../storage/innodb_plugin
 
 # link the build scripts
 BUILDSCRIPTS="compile-innodb compile-innodb-debug"

=== modified file 'storage/innodb_plugin/srv/srv0srv.c'
--- a/storage/innodb_plugin/srv/srv0srv.c	2010-03-31 07:34:22 +0000
+++ b/storage/innodb_plugin/srv/srv0srv.c	2010-05-20 07:50:07 +0000
@@ -1609,12 +1609,16 @@ srv_suspend_mysql_thread(
 	innodb_lock_wait_timeout, because trx->mysql_thd == NULL. */
 	lock_wait_timeout = thd_lock_wait_timeout(trx->mysql_thd);
 
-	if (trx_is_interrupted(trx)
-	    || (lock_wait_timeout < 100000000
-		&& wait_time > (double) lock_wait_timeout)) {
+	if (lock_wait_timeout < 100000000
+	    && wait_time > (double) lock_wait_timeout) {
 
 		trx->error_state = DB_LOCK_WAIT_TIMEOUT;
 	}
+
+	if (trx_is_interrupted(trx)) {
+
+		trx->error_state = DB_INTERRUPTED;
+	}
 }
 
 /********************************************************************//**

=== modified file 'storage/innodb_plugin/sync/sync0arr.c'
--- a/storage/innodb_plugin/sync/sync0arr.c	2009-11-02 09:42:56 +0000
+++ b/storage/innodb_plugin/sync/sync0arr.c	2010-05-27 16:31:00 +0000
@@ -498,7 +498,9 @@ sync_array_cell_print(
 		   || type == RW_LOCK_WAIT_EX
 		   || type == RW_LOCK_SHARED) {
 
-		fputs(type == RW_LOCK_EX ? "X-lock on" : "S-lock on", file);
+		fputs(type == RW_LOCK_EX ? "X-lock on"
+		      : type == RW_LOCK_WAIT_EX ? "X-lock (wait_ex) on"
+		      : "S-lock on", file);
 
 		rwlock = cell->old_wait_rw_lock;
 

=== modified file 'storage/innodb_plugin/trx/trx0i_s.c'
--- a/storage/innodb_plugin/trx/trx0i_s.c	2010-03-26 14:19:01 +0000
+++ b/storage/innodb_plugin/trx/trx0i_s.c	2010-05-14 13:08:15 +0000
@@ -429,6 +429,9 @@ fill_trx_row(
 						which to copy volatile
 						strings */
 {
+	const char*	stmt;
+	size_t		stmt_len;
+
 	row->trx_id = trx_get_id(trx);
 	row->trx_started = (ib_time_t) trx->start_time;
 	row->trx_state = trx_get_que_state_str(trx);
@@ -449,38 +452,33 @@ fill_trx_row(
 
 	row->trx_weight = (ullint) ut_conv_dulint_to_longlong(TRX_WEIGHT(trx));
 
-	if (trx->mysql_thd != NULL) {
-		row->trx_mysql_thread_id
-			= thd_get_thread_id(trx->mysql_thd);
-	} else {
+	if (trx->mysql_thd == NULL) {
 		/* For internal transactions e.g., purge and transactions
 		being recovered at startup there is no associated MySQL
 		thread data structure. */
 		row->trx_mysql_thread_id = 0;
+		row->trx_query = NULL;
+		return(TRUE);
 	}
 
-	if (trx->mysql_query_str != NULL && *trx->mysql_query_str != NULL) {
+	row->trx_mysql_thread_id = thd_get_thread_id(trx->mysql_thd);
+	stmt = innobase_get_stmt(trx->mysql_thd, &stmt_len);
 
-		if (strlen(*trx->mysql_query_str)
-		    > TRX_I_S_TRX_QUERY_MAX_LEN) {
+	if (stmt != NULL) {
 
-			char	query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
+		char	query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
 
-			memcpy(query, *trx->mysql_query_str,
-			       TRX_I_S_TRX_QUERY_MAX_LEN);
-			query[TRX_I_S_TRX_QUERY_MAX_LEN] = '\0';
-
-			row->trx_query = ha_storage_put_memlim(
-				cache->storage, query,
-				TRX_I_S_TRX_QUERY_MAX_LEN + 1,
-				MAX_ALLOWED_FOR_STORAGE(cache));
-		} else {
-
-			row->trx_query = ha_storage_put_str_memlim(
-				cache->storage, *trx->mysql_query_str,
-				MAX_ALLOWED_FOR_STORAGE(cache));
+		if (stmt_len > TRX_I_S_TRX_QUERY_MAX_LEN) {
+			stmt_len = TRX_I_S_TRX_QUERY_MAX_LEN;
 		}
 
+		memcpy(query, stmt, stmt_len);
+		query[stmt_len] = '\0';
+
+		row->trx_query = ha_storage_put_memlim(
+			cache->storage, stmt, stmt_len + 1,
+			MAX_ALLOWED_FOR_STORAGE(cache));
+
 		if (row->trx_query == NULL) {
 
 			return(FALSE);

=== modified file 'storage/innodb_plugin/trx/trx0trx.c'
--- a/storage/innodb_plugin/trx/trx0trx.c	2010-04-06 18:05:54 +0000
+++ b/storage/innodb_plugin/trx/trx0trx.c	2010-05-14 13:08:15 +0000
@@ -119,7 +119,6 @@ trx_create(
 	trx->table_id = ut_dulint_zero;
 
 	trx->mysql_thd = NULL;
-	trx->mysql_query_str = NULL;
 	trx->active_trans = 0;
 	trx->duplicates = 0;
 
@@ -940,7 +939,6 @@ trx_commit_off_kernel(
 	trx->rseg = NULL;
 	trx->undo_no = ut_dulint_zero;
 	trx->last_sql_stat_start.least_undo_no = ut_dulint_zero;
-	trx->mysql_query_str = NULL;
 
 	ut_ad(UT_LIST_GET_LEN(trx->wait_thrs) == 0);
 	ut_ad(UT_LIST_GET_LEN(trx->trx_locks) == 0);


Attachment: [text/bzr-bundle] bzr/georgi.kodinov@oracle.com-20100601121635-a2zisixtnkxasfv9.bundle
Thread
bzr push into mysql-5.1-bugteam branch (Georgi.Kodinov:3404 to 3408)Bug#40928Georgi Kodinov1 Jun