List:Commits« Previous MessageNext Message »
From:Bjorn Munch Date:January 10 2011 9:52am
Subject:bzr commit into mysql-5.1-mtr branch (bjorn.munch:2963)
View as plain text  
#At file:///home/bm136801/my/merge-51/ based on revid:bjorn.munch@stripped

 2963 Bjorn Munch	2011-01-10 [merge]
      merge from 5.1 main

    added:
      mysql-test/suite/innodb_plugin/r/innodb-autoinc-18274.result
      mysql-test/suite/innodb_plugin/t/innodb-autoinc-18274.test
    renamed:
      mysql-test/suite/funcs_1/r/myisam_views.result => mysql-test/suite/funcs_1/r/myisam_views-big.result
      mysql-test/suite/funcs_1/t/myisam_views.test => mysql-test/suite/funcs_1/t/myisam_views-big.test
    modified:
      include/my_pthread.h
      include/my_sys.h
      mysql-test/collections/default.weekly*
      mysql-test/r/auto_increment.result
      mysql-test/suite/engines/funcs/r/rpl_000015.result
      mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result
      mysql-test/suite/engines/funcs/r/rpl_change_master.result
      mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result
      mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result
      mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result
      mysql-test/suite/engines/funcs/r/rpl_log_pos.result
      mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result
      mysql-test/suite/engines/funcs/r/rpl_row_drop.result
      mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result
      mysql-test/suite/engines/funcs/r/rpl_row_until.result
      mysql-test/suite/engines/funcs/r/rpl_server_id1.result
      mysql-test/suite/engines/funcs/r/rpl_server_id2.result
      mysql-test/suite/engines/funcs/r/rpl_slave_status.result
      mysql-test/suite/engines/funcs/r/rpl_sp.result
      mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result
      mysql-test/suite/engines/funcs/t/disabled.def
      mysql-test/suite/engines/funcs/t/rpl_000015.test
      mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test
      mysql-test/suite/engines/funcs/t/rpl_change_master.test
      mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test
      mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test
      mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test
      mysql-test/suite/engines/funcs/t/rpl_log_pos.test
      mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test
      mysql-test/suite/engines/funcs/t/rpl_row_drop.test
      mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test
      mysql-test/suite/engines/funcs/t/rpl_row_until.test
      mysql-test/suite/engines/funcs/t/rpl_server_id1.test
      mysql-test/suite/engines/funcs/t/rpl_server_id2.test
      mysql-test/suite/engines/funcs/t/rpl_slave_status.test
      mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test
      mysql-test/suite/engines/iuds/t/insert_year.test
      mysql-test/suite/innodb/t/innodb_bug57255.test
      mysql-test/suite/innodb_plugin/r/innodb.result
      mysql-test/suite/innodb_plugin/t/innodb.test
      mysql-test/suite/innodb_plugin/t/innodb_bug57255.test
      mysql-test/suite/rpl/t/disabled.def
      mysql-test/t/auto_increment.test
      mysys/my_fopen.c
      sql/log.cc
      sql/sql_show.cc
      storage/innobase/btr/btr0btr.c
      storage/innobase/buf/buf0buf.c
      storage/innobase/dict/dict0dict.c
      storage/innobase/dict/dict0mem.c
      storage/innobase/fsp/fsp0fsp.c
      storage/innobase/include/buf0buf.ic
      storage/innobase/log/log0recv.c
      storage/innobase/row/row0mysql.c
      storage/innobase/ut/ut0dbg.c
      storage/innodb_plugin/ChangeLog
      storage/innodb_plugin/btr/btr0btr.c
      storage/innodb_plugin/btr/btr0cur.c
      storage/innodb_plugin/buf/buf0buf.c
      storage/innodb_plugin/buf/buf0lru.c
      storage/innodb_plugin/dict/dict0dict.c
      storage/innodb_plugin/fsp/fsp0fsp.c
      storage/innodb_plugin/handler/ha_innodb.cc
      storage/innodb_plugin/handler/i_s.cc
      storage/innodb_plugin/include/btr0cur.h
      storage/innodb_plugin/include/data0data.h
      storage/innodb_plugin/include/data0data.ic
      storage/innodb_plugin/include/row0upd.h
      storage/innodb_plugin/include/trx0i_s.h
      storage/innodb_plugin/include/univ.i
      storage/innodb_plugin/log/log0recv.c
      storage/innodb_plugin/plug.in
      storage/innodb_plugin/row/row0mysql.c
      storage/innodb_plugin/row/row0purge.c
      storage/innodb_plugin/row/row0umod.c
      storage/innodb_plugin/row/row0upd.c
      storage/innodb_plugin/trx/trx0i_s.c
      storage/innodb_plugin/ut/ut0dbg.c
      mysql-test/suite/funcs_1/t/myisam_views-big.test
=== modified file 'include/my_pthread.h'
--- a/include/my_pthread.h	2010-10-20 13:40:04 +0000
+++ b/include/my_pthread.h	2011-01-07 19:28:06 +0000
@@ -126,7 +126,9 @@ struct tm *gmtime_r(const time_t *timep,
 
 void pthread_exit(void *a);	 /* was #define pthread_exit(A) ExitThread(A)*/
 
-#define ETIMEDOUT 145		    /* Win32 doesn't have this */
+#ifndef ETIMEDOUT
+#define ETIMEDOUT 145		    /* Win32 might not have this */
+#endif
 #define getpid() GetCurrentThreadId()
 #define HAVE_LOCALTIME_R		1
 #define _REENTRANT			1

=== modified file 'include/my_sys.h'
--- a/include/my_sys.h	2010-12-28 23:47:05 +0000
+++ b/include/my_sys.h	2011-01-07 18:33:36 +0000
@@ -664,6 +664,7 @@ extern void init_glob_errs(void);
 extern void wait_for_free_space(const char *filename, int errors);
 extern FILE *my_fopen(const char *FileName,int Flags,myf MyFlags);
 extern FILE *my_fdopen(File Filedes,const char *name, int Flags,myf MyFlags);
+extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
 extern int my_fclose(FILE *fd,myf MyFlags);
 extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
 extern int my_sync(File fd, myf my_flags);

=== modified file 'mysql-test/collections/default.weekly' (properties changed: -x to +x)
--- a/mysql-test/collections/default.weekly	2010-12-09 14:04:58 +0000
+++ b/mysql-test/collections/default.weekly	2011-01-06 10:39:45 +0000
@@ -1,2 +1,8 @@
 perl mysql-test-run.pl --timer --force --comment=1st       --experimental=collections/default.experimental 1st
-perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 parts.partition_alter1_2_ndb parts.part_supported_sql_func_innodb parts.partition_alter1_2_innodb parts.partition_alter4_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_ndb rpl_ndb.rpl_truncate_7ndb_2 main.archive-big main.sum_distinct-big main.mysqlbinlog_row_big main.alter_table-big main.variables-big main.type_newdecimal-big main.read_many_rows_innodb main.log_tables-big main.count_distinct3 main.events_time_zone main.merge-big main.create-big main.events_stress main.ssl-big
+perl mysql-test-run.pl --timer --force --comment=big-tests --experimental=collections/default.experimental --vardir=var-big-tests --big-test --testcase-timeout=60 --suite-timeout=600 parts.partition_alter1_2_ndb parts.part_supported_sql_func_innodb parts.partition_alter1_2_innodb parts.partition_alter4_innodb parts.partition_alter1_1_2_ndb parts.partition_alter1_1_2_innodb parts.partition_alter1_1_ndb rpl_ndb.rpl_truncate_7ndb_2 main.archive-big main.sum_distinct-big main.mysqlbinlog_row_big main.alter_table-big main.variables-big main.type_newdecimal-big main.read_many_rows_innodb main.log_tables-big main.count_distinct3 main.events_time_zone main.merge-big main.create-big main.events_stress main.ssl-big funcs_1.myisam_views-big
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam 
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-row-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=row
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-mixed-tests-myisam-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-myisam-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=myisam --do-test=rpl --mysqld=--binlog-format=mixed
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-stmt-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-row-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-row-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=row
+perl mysql-test-run.pl --timer --force --parallel=auto --comment=eits-rpl-binlog-mixed-tests-innodb-engine --experimental=collections/default.experimental --vardir=var-binlog-mixed-eits-tests-innodb-engine --suite=engines/iuds,engines/funcs --suite-timeout=500 --max-test-fail=0 --retry-failure=0 --mysqld=--default-storage-engine=innodb --mysqld=--innodb --do-test=rpl --mysqld=--binlog-format=mixed

=== modified file 'mysql-test/r/auto_increment.result'
--- a/mysql-test/r/auto_increment.result	2010-12-13 11:48:12 +0000
+++ b/mysql-test/r/auto_increment.result	2011-01-04 13:36:37 +0000
@@ -497,3 +497,22 @@ SET @@SESSION.AUTO_INCREMENT_INCREMENT=d
 SET @@SESSION.AUTO_INCREMENT_OFFSET=default;
 DROP TABLE t1;
 End of 5.1 tests
+#
+# Bug#50619 assert in handler::update_auto_increment
+#
+CREATE TABLE t1 (pk INT AUTO_INCREMENT, PRIMARY KEY (pk));
+INSERT INTO t1 VALUES (NULL), (-1), (NULL);
+SELECT * FROM t1;
+pk
+-1
+1
+2
+DROP TABLE t1;
+CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk));
+INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL);
+ERROR HY000: Failed to read auto-increment value from storage engine
+SELECT * FROM t1;
+pk
+1
+18446744073709551614
+DROP TABLE t1;

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_000015.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_000015.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_000015.result	2011-01-05 06:46:07 +0000
@@ -10,25 +10,166 @@ File	Position	Binlog_Do_DB	Binlog_Ignore
 master-bin.000001	106		
 stop slave;
 reset slave;
+show slave status;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	#
 Master_Log_File	
 Read_Master_Log_Pos	4
+Relay_Log_File	#
+Relay_Log_Pos	#
 Relay_Master_Log_File	
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
 Exec_Master_Log_Pos	0
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 change master to master_host='127.0.0.1';
+show slave status;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	#
 Master_Log_File	
 Read_Master_Log_Pos	4
+Relay_Log_File	#
+Relay_Log_Pos	#
 Relay_Master_Log_File	
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
 Exec_Master_Log_Pos	0
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 change master to master_host='127.0.0.1',master_user='root',
 master_password='',master_port=MASTER_PORT;
+show slave status;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	#
 Master_Log_File	
 Read_Master_Log_Pos	4
+Relay_Log_File	#
+Relay_Log_Pos	#
 Relay_Master_Log_File	
+Slave_IO_Running	No
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
 Exec_Master_Log_Pos	0
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 start slave;
+show slave status;
+Slave_IO_State	Waiting for master to send event
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
 Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	106
+Relay_Log_File	slave-relay-bin.000002
+Relay_Log_Pos	252
 Relay_Master_Log_File	master-bin.000001
-Checking that both slave threads are running.
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	106
+Relay_Log_Space	407
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 drop table if exists t1;
 create table t1 (n int, PRIMARY KEY(n));
 insert into t1 values (10),(45),(90);

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_REDIRECT.result	2011-01-05 06:46:07 +0000
@@ -4,7 +4,8 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
-SHOW SLAVE STATUS;;
+SHOW SLAVE STATUS;
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
 SHOW SLAVE HOSTS;
 Server_id	Host	Port	Rpl_recovery_rank	Master_id
 2	127.0.0.1	SLAVE_PORT	0	1

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_change_master.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_change_master.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_change_master.result	2011-01-05 06:46:07 +0000
@@ -11,7 +11,13 @@ stop slave sql_thread;
 insert into t1 values(1);
 insert into t1 values(2);
 stop slave;
+show slave status;
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	#	#	#	master-bin.000001	No	No							0		0	191	#	None		0	No						#	No	0		0	
 change master to master_user='root';
+show slave status;
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_MYPORT	1	master-bin.000001	#	#	#	master-bin.000001	No	No							0		0	191	#	None		0	No						#	No	0		0	
 start slave;
 select * from t1;
 n

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_empty_master_crash.result	2011-01-05 06:46:07 +0000
@@ -4,6 +4,8 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
+show slave status;
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
 load table t1 from master;
 ERROR 08S01: Error connecting to master: Master is not configured
 load table t1 from master;

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_flushlog_loop.result	2011-01-05 06:46:07 +0000
@@ -17,6 +17,43 @@ let $result_pattern= '%127.0.0.1%root%sl
 
 --source include/wait_slave_status.inc
 flush logs;
-Relay_Log_File	mysqld-relay-bin.000003
-Checking that both slave threads are running.
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	SLAVE_PORT
+Connect_Retry	60
+Master_Log_File	slave-bin.000001
+Read_Master_Log_Pos	106
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	slave-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	#
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	106
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 STOP SLAVE;

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_loaddata_s.result	2011-01-05 06:46:07 +0000
@@ -10,6 +10,6 @@ load data infile '../../std_data/rpl_loa
 select count(*) from test.t1;
 count(*)
 2
-show binlog events from <binlog_start>;
+show binlog events from 106;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
 drop table test.t1;

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_log_pos.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_log_pos.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_log_pos.result	2011-01-05 06:46:07 +0000
@@ -4,23 +4,39 @@ reset master;
 reset slave;
 drop table if exists t1,t2,t3,t4,t5,t6,t7,t8,t9;
 start slave;
+show master status;
+File	Position	Binlog_Do_DB	Binlog_Ignore_DB
+master-bin.000001	106	<Binlog_Ignore_DB>	
+show slave status;
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	106	#	#	master-bin.000001	Yes	Yes							0		0	106	#	None		0	No						#	No	0		0	
 stop slave;
-change master to master_log_pos=MASTER_LOG_POS;
+change master to master_log_pos=106;
 start slave;
 stop slave;
-change master to master_log_pos=MASTER_LOG_POS;
+change master to master_log_pos=106;
+show slave status;
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	106	#	#	master-bin.000001	No	No							0		0	106	#	None		0	No						#	No	0		0	
 start slave;
+show slave status;
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	106	#	#	master-bin.000001	Yes	Yes							0		0	106	#	None		0	No						#	No	0		0	
 stop slave;
-# impossible position leads to an error
-change master to master_log_pos=MASTER_LOG_POS;
+change master to master_log_pos=177;
 start slave;
-Last_IO_Error = Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position'
+show slave status;
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+#	127.0.0.1	root	MASTER_PORT	1	master-bin.000001	177	#	#	master-bin.000001	No	Yes							0		0	177	#	None		0	No						#	No	1236	Got fatal error 1236 from master when reading data from binary log: 'Client requested master to start replication from impossible position'	0	
+show master status;
+File	Position	Binlog_Do_DB	Binlog_Ignore_DB
+master-bin.000001	106	<Binlog_Ignore_DB>	
 create table if not exists t1 (n int);
 drop table if exists t1;
 create table t1 (n int);
 insert into t1 values (1),(2),(3);
 stop slave;
-change master to master_log_pos=MASTER_LOG_POS;
+change master to master_log_pos=206;
 start slave;
 select * from t1 ORDER BY n;
 n

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_rbr_to_sbr.result	2011-01-05 06:46:07 +0000
@@ -14,16 +14,47 @@ MIXED	MIXED
 CREATE TABLE t1 (a INT, b LONG);
 INSERT INTO t1 VALUES (1,1), (2,2);
 INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
-show binlog events from <binlog_start>;
+SHOW BINLOG EVENTS;
 **** On Slave ****
-show binlog events from <binlog_start>;
-Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-slave-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a INT, b LONG)
-slave-bin.000001	#	Query	#	#	use `test`; INSERT INTO t1 VALUES (1,1), (2,2)
-slave-bin.000001	#	Query	#	#	BEGIN
-slave-bin.000001	#	Table_map	#	#	table_id: # (test.t1)
-slave-bin.000001	#	Write_rows	#	#	table_id: # flags: STMT_END_F
-slave-bin.000001	#	Query	#	#	COMMIT
-show binlog events from <binlog_start>;
+SHOW SLAVE STATUS;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_PORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+SHOW BINLOG EVENTS;
 DROP TABLE IF EXISTS t1;
 SET GLOBAL BINLOG_FORMAT=@saved_binlog_format;

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_row_drop.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_row_drop.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_drop.result	2011-01-05 06:46:07 +0000
@@ -41,11 +41,12 @@ t1
 t2
 **** On Master ****
 DROP TABLE t1,t2;
-show binlog events from <binlog_start>;
+SHOW BINLOG EVENTS;
 Log_name	Pos	Event_type	Server_id	End_log_pos	Info
-master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t1 (a int)
-master-bin.000001	#	Query	#	#	use `test`; CREATE TABLE t2 (a int)
-master-bin.000001	#	Query	#	#	use `test`; DROP TABLE `t1` /* generated by server */
+master-bin.000001	4	Format_desc	1	106	Server ver: VERSION, Binlog ver: 4
+master-bin.000001	106	Query	1	192	use `test`; CREATE TABLE t1 (a int)
+master-bin.000001	192	Query	1	278	use `test`; CREATE TABLE t2 (a int)
+master-bin.000001	278	Query	1	382	use `test`; DROP TABLE `t1` /* generated by server */
 SHOW TABLES;
 Tables_in_test
 t2

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_inexist_tbl.result	2011-01-05 06:46:07 +0000
@@ -17,5 +17,43 @@ a
 0
 drop table t1;
 insert into t1 values (1);
-Last_SQL_Error = Error 'Table 'test.t1' doesn't exist' on opening tables
+show slave status;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_MYPORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	test.t2
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	1146
+Last_Error	Error 'Table 'test.t1' doesn't exist' on opening tables
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	1146
+Last_SQL_Error	Error 'Table 'test.t1' doesn't exist' on opening tables
 drop table t1, t2;

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_row_until.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_row_until.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_row_until.result	2011-01-05 06:46:07 +0000
@@ -12,39 +12,193 @@ create table t2(n int not null auto_incr
 insert into t2 values (1),(2);
 insert into t2 values (3),(4);
 drop table t2;
-start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
+start slave until master_log_file='master-bin.000001', master_log_pos=311;
 select * from t1;
 n
 1
 2
 3
 4
-start slave until master_log_file='master-no-such-bin.000001', master_log_pos=MASTER_LOG_POS;
+show slave status;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_MYPORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	slave-relay-bin.000004
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	#
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	Master
+Until_Log_File	master-bin.000001
+Until_Log_Pos	311
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
 select * from t1;
-n
-1
-2
-3
-4
-start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=RELAY_LOG_POS;
+n	1
+n	2
+n	3
+n	4
+show slave status;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_MYPORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	slave-relay-bin.000004
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	#
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	Master
+Until_Log_File	master-no-such-bin.000001
+Until_Log_Pos	291
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
 select * from t2;
-n
-1
-2
+show slave status;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_MYPORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	slave-relay-bin.000004
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	#
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	Relay
+Until_Log_File	slave-relay-bin.000004
+Until_Log_Pos	728
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
 start slave;
 stop slave;
-start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
-start slave until master_log_file='master-bin', master_log_pos=MASTER_LOG_POS;
+start slave until master_log_file='master-bin.000001', master_log_pos=740;
+show slave status;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	root
+Master_Port	MASTER_MYPORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	slave-relay-bin.000004
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	Yes
+Slave_SQL_Running	No
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	Master
+Until_Log_File	master-bin.000001
+Until_Log_Pos	740
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	#
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	0
+Last_IO_Error	
+Last_SQL_Errno	0
+Last_SQL_Error	
+start slave until master_log_file='master-bin', master_log_pos=561;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS, relay_log_pos=RELAY_LOG_POS;
+start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until master_log_file='master-bin.000001';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave until relay_log_file='slave-relay-bin.000002';
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
-start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=MASTER_LOG_POS;
+start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
 ERROR HY000: Incorrect parameter or combination of parameters for START SLAVE UNTIL
 start slave sql_thread;
-start slave until master_log_file='master-bin.000001', master_log_pos=MASTER_LOG_POS;
+start slave until master_log_file='master-bin.000001', master_log_pos=740;
 Warnings:
-Note	1254	Slave is already running
+Level	Note
+Code	1254
+Message	Slave is already running

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_server_id1.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id1.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id1.result	2011-01-05 06:46:07 +0000
@@ -8,8 +8,10 @@ create table t1 (n int);
 reset master;
 stop slave;
 change master to master_port=SLAVE_PORT;
+show slave status;
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No				#		#	0		0	0	106	None		0	No						NULL	No	0		0	
 start slave;
-Last_IO_Error = Fatal error: The slave I/O thread stops because master and slave have equal MySQL server ids; these ids must be different for replication to work (or the --replicate-same-server-id option must be used on slave but this does not always make sense; please check the manual before using it).
 insert into t1 values (1);
 show status like "slave_running";
 Variable_name	Value

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_server_id2.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_server_id2.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_server_id2.result	2011-01-05 06:46:07 +0000
@@ -8,6 +8,9 @@ create table t1 (n int);
 reset master;
 stop slave;
 change master to master_port=SLAVE_PORT;
+show slave status;
+Slave_IO_State	Master_Host	Master_User	Master_Port	Connect_Retry	Master_Log_File	Read_Master_Log_Pos	Relay_Log_File	Relay_Log_Pos	Relay_Master_Log_File	Slave_IO_Running	Slave_SQL_Running	Replicate_Do_DB	Replicate_Ignore_DB	Replicate_Do_Table	Replicate_Ignore_Table	Replicate_Wild_Do_Table	Replicate_Wild_Ignore_Table	Last_Errno	Last_Error	Skip_Counter	Exec_Master_Log_Pos	Relay_Log_Space	Until_Condition	Until_Log_File	Until_Log_Pos	Master_SSL_Allowed	Master_SSL_CA_File	Master_SSL_CA_Path	Master_SSL_Cert	Master_SSL_Cipher	Master_SSL_Key	Seconds_Behind_Master	Master_SSL_Verify_Server_Cert	Last_IO_Errno	Last_IO_Error	Last_SQL_Errno	Last_SQL_Error
+	127.0.0.1	root	SLAVE_PORT	1		4	slave-relay-bin.000001	4		No	No						#	0		0	0	106	None		0	No						NULL	No	0		0	
 start slave;
 insert into t1 values (1);
 select * from t1;

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_slave_status.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_slave_status.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_slave_status.result	2011-01-05 06:46:07 +0000
@@ -18,5 +18,44 @@ drop user rpl@stripped;
 flush privileges;
 stop slave;
 start slave;
+show slave status;
+Slave_IO_State	#
+Master_Host	127.0.0.1
+Master_User	rpl
+Master_Port	MASTER_MYPORT
+Connect_Retry	1
+Master_Log_File	master-bin.000001
+Read_Master_Log_Pos	#
+Relay_Log_File	#
+Relay_Log_Pos	#
+Relay_Master_Log_File	master-bin.000001
+Slave_IO_Running	No
+Slave_SQL_Running	Yes
+Replicate_Do_DB	
+Replicate_Ignore_DB	
+Replicate_Do_Table	
+Replicate_Ignore_Table	
+Replicate_Wild_Do_Table	
+Replicate_Wild_Ignore_Table	
+Last_Errno	0
+Last_Error	
+Skip_Counter	0
+Exec_Master_Log_Pos	#
+Relay_Log_Space	#
+Until_Condition	None
+Until_Log_File	
+Until_Log_Pos	0
+Master_SSL_Allowed	No
+Master_SSL_CA_File	
+Master_SSL_CA_Path	
+Master_SSL_Cert	
+Master_SSL_Cipher	
+Master_SSL_Key	
+Seconds_Behind_Master	NULL
+Master_SSL_Verify_Server_Cert	No
+Last_IO_Errno	#
+Last_IO_Error	#
+Last_SQL_Errno	0
+Last_SQL_Error	
 drop table t1;
 drop table t1;

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_sp.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_sp.result	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_sp.result	2011-01-05 06:46:07 +0000
@@ -176,7 +176,7 @@ end|
 ERROR HY000: You do not have the SUPER privilege and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)
 set global log_bin_trust_routine_creators=1;
 Warnings:
-Warning	1287	The syntax '@@log_bin_trust_routine_creators' is deprecated and will be removed in MySQL 5.6. Please use '@@log_bin_trust_function_creators' instead
+Warning	1287	'@@log_bin_trust_routine_creators' is deprecated and will be removed in a future release. Please use '@@log_bin_trust_function_creators' instead
 set global log_bin_trust_function_creators=0;
 set global log_bin_trust_function_creators=1;
 set global log_bin_trust_function_creators=1;

=== modified file 'mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result'
--- a/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/r/rpl_switch_stm_row_mixed.result	2011-01-05 06:46:07 +0000
@@ -376,7 +376,7 @@ CREATE TABLE t12 (data LONG);
 LOCK TABLES t12 WRITE;
 INSERT INTO t12 VALUES(UUID());
 UNLOCK TABLES;
-show binlog events from <binlog_start>;
-show binlog events from <binlog_start>;
+show binlog events;
+show binlog events;
 drop database mysqltest1;
 set global binlog_format= @saved_binlog_format;

=== modified file 'mysql-test/suite/engines/funcs/t/disabled.def'
--- a/mysql-test/suite/engines/funcs/t/disabled.def	2010-04-06 18:06:34 +0000
+++ b/mysql-test/suite/engines/funcs/t/disabled.def	2011-01-05 06:46:07 +0000
@@ -5,3 +5,92 @@ crash_manycolumns_string : Bug#50495 'Ro
 ix_unique_lob : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
 ix_unique_string_length : Bug#52283 Innodb reports extra warnings when SELECT/WHERE is performed using invalid value
 
+rpl_create_database : Result Difference Due to Change in .inc file
+rpl_loaddata_m : Result Difference Due to Change in .inc file
+rpl_sp_effects : Result Difference Due to Change in .inc file
+rpl_variables : Result Difference Due to Change in .inc file
+rpl_loaddata_s : Result Difference Due to Change in .inc file
+rpl_server_id2 : Result Difference Due to Change in .inc file
+rpl000010 : Result Difference Due to Change in .inc file
+rpl_init_slave : Result Difference Due to Change in .inc file
+rpl_dual_pos_advance : Result Difference Due to Change in .inc file
+rpl_empty_master_crash : Result Difference Due to Change in .inc file
+rpl000011 : Result Difference Due to Change in .inc file
+rpl000013 : Result Difference Due to Change in .inc file
+rpl_000015 : Result Difference Due to Change in .inc file
+rpl_LD_INFILE : Result Difference Due to Change in .inc file
+rpl_REDIRECT : Result Difference Due to Change in .inc file
+rpl_alter : Result Difference Due to Change in .inc file
+rpl_alter_db : Result Difference Due to Change in .inc file
+rpl_bit : Result Difference Due to Change in .inc file
+rpl_bit_npk : Result Difference Due to Change in .inc file
+rpl_change_master : Result Difference Due to Change in .inc file
+rpl_do_grant : Result Difference Due to Change in .inc file
+rpl_drop : Result Difference Due to Change in .inc file
+rpl_drop_db : Result Difference Due to Change in .inc file
+rpl_flushlog_loop : Result Difference Due to Change in .inc file
+rpl_get_lock : Result Difference Due to Change in .inc file
+rpl_insert : Result Difference Due to Change in .inc file
+rpl_insert_select : Result Difference Due to Change in .inc file
+rpl_loaddata2 : Result Difference Due to Change in .inc file
+rpl_loaddatalocal : Result Difference Due to Change in .inc file
+rpl_loadfile : Result Difference Due to Change in .inc file
+rpl_log_pos : Result Difference Due to Change in .inc file
+rpl_many_optimize : Result Difference Due to Change in .inc file
+rpl_master_pos_wait : Result Difference Due to Change in .inc file
+rpl_misc_functions : Result Difference Due to Change in .inc file
+rpl_ps : Result Difference Due to Change in .inc file
+rpl_rbr_to_sbr : Result Difference Due to Change in .inc file
+rpl_row_max_relay_size : Result Difference Due to Change in .inc file
+rpl_server_id1 : Result Difference Due to Change in .inc file
+rpl_session_var : Result Difference Due to Change in .inc file
+rpl_sf : Result Difference Due to Change in .inc file
+rpl_slave_status : Result Difference Due to Change in .inc file
+rpl_sp004 : Result Difference Due to Change in .inc file
+rpl_start_stop_slave : Result Difference Due to Change in .inc file
+rpl_stm_max_relay_size : Result Difference Due to Change in .inc file
+rpl_stm_mystery22 : Result Difference Due to Change in .inc file
+rpl_stm_no_op : Result Difference Due to Change in .inc file
+rpl_stm_reset_slave : Result Difference Due to Change in .inc file
+rpl_temp_table : Result Difference Due to Change in .inc file
+rpl_temporary : Result Difference Due to Change in .inc file
+rpl_trigger : Result Difference Due to Change in .inc file
+rpl_trunc_temp : Result Difference Due to Change in .inc file
+rpl_user_variables : Result Difference Due to Change in .inc file
+rpl_relayspace : Result Difference Due to Change in .inc file
+rpl_multi_delete2 : Result Difference Due to Change in .inc file
+rpl_view : Result Difference Due to Change in .inc file
+rpl_ignore_table_update : Result Difference Due to Change in .inc file
+rpl_err_ignoredtable : Result Difference Due to Change in .inc file
+rpl_multi_update4 : Result Difference Due to Change in .inc file
+rpl_multi_delete : Result Difference Due to Change in .inc file
+rpl_ignore_grant : Result Difference Due to Change in .inc file
+rpl_ignore_revoke : Result Difference Due to Change in .inc file
+rpl_free_items : Result Difference Due to Change in .inc file
+rpl_replicate_ignore_db : Result Difference Due to Change in .inc file
+rpl000017 : Result Difference Due to Change in .inc file
+rpl_skip_error : Result Difference Due to Change in .inc file
+rpl_sp : Result Difference Due to Change in .inc file
+
+rpl_row_until : Test Present in rpl suite as well . Test Fails with table t2 not found.
+rpl_loaddata_s : Test Present in rpl suite as well . Test Fails due to bin log truncation.
+rpl_log_pos : Test Present in rpl suite as well . Test Fails due to bin log truncation.
+rpl_row_NOW : Result Difference Due to Change in .inc file
+rpl_row_USER : Result Difference Due to Change in .inc file
+rpl_row_drop : Result Difference Due to Change in .inc file
+rpl_row_func001 : Result Difference Due to Change in .inc file
+rpl_row_reset_slave : Result Difference Due to Change in .inc file
+rpl_row_sp001 : Result Difference Due to Change in .inc file
+rpl_row_sp005 : Result Difference Due to Change in .inc file
+rpl_row_sp008 : Result Difference Due to Change in .inc file
+rpl_row_sp009 : Result Difference Due to Change in .inc file
+rpl_row_sp010 : Result Difference Due to Change in .inc file
+rpl_row_sp011 : Result Difference Due to Change in .inc file
+rpl_row_sp012 : Result Difference Due to Change in .inc file
+rpl_row_stop_middle : Result Difference Due to Change in .inc file
+rpl_row_trig001 : Result Difference Due to Change in .inc file
+rpl_row_trig002 : Result Difference Due to Change in .inc file
+rpl_row_trig003 : Result Difference Due to Change in .inc file
+rpl_row_view01 : Result Difference Due to Change in .inc file
+rpl_switch_stm_row_mixed : Result Difference Due to Change in .inc file
+rpl_row_inexist_tbl : Result Difference Due to Change in .inc file

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_000015.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_000015.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_000015.test	2011-01-05 06:46:07 +0000
@@ -11,25 +11,31 @@ save_master_pos;
 connection slave;
 stop slave;
 reset slave;
-let $status_items= Master_Log_File, Read_Master_Log_Pos, Relay_Master_Log_File, Exec_Master_Log_Pos;
-source include/show_slave_status.inc;
+--vertical_results
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 5 # 8 # 9 # 23 # 33 #
+show slave status;
 
 change master to master_host='127.0.0.1';
 # The following needs to be cleaned up when change master is fixed
-source include/show_slave_status.inc;
-
+--vertical_results
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 5 # 8 # 9 # 23 # 33 #
+show slave status;
 --replace_result $MASTER_MYPORT MASTER_PORT
 eval change master to master_host='127.0.0.1',master_user='root',
  master_password='',master_port=$MASTER_MYPORT;
-source include/show_slave_status.inc;
-
+--vertical_results
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 5 # 8 # 9 # 23 # 33 #
+show slave status;
 start slave;
 sync_with_master;
-let $status_items= Master_Log_File, Relay_Master_Log_File;
-source include/show_slave_status.inc;
-source include/check_slave_is_running.inc;
-
 --vertical_results
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 5 # 8 # 9 # 23 # 33 #
+--replace_column 33 #
+show slave status;
 connection master;
 --disable_warnings
 drop table if exists t1;

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_REDIRECT.test	2011-01-05 06:46:07 +0000
@@ -7,11 +7,15 @@ source include/master-slave.inc;
 --disable_ps_protocol
 
 #first, make sure the slave has had enough time to register
-sync_slave_with_master;
+save_master_pos;
+connection slave;
+sync_with_master;
 
 #discover slaves
 connection master;
---query_vertical SHOW SLAVE STATUS;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+SHOW SLAVE STATUS;
 --replace_result $SLAVE_MYPORT SLAVE_PORT
 SHOW SLAVE HOSTS;
 rpl_probe;
@@ -21,7 +25,9 @@ enable_rpl_parse;
 create table t1 ( n int);
 insert into t1 values (1),(2),(3),(4);
 disable_rpl_parse;
-sync_slave_with_master;
+save_master_pos;
+connection slave;
+sync_with_master;
 insert into t1 values(5);
 connection master;
 enable_rpl_parse;

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_change_master.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_change_master.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_change_master.test	2011-01-05 06:46:07 +0000
@@ -18,26 +18,13 @@ save_master_pos;
 connection slave;
 --real_sleep 3 # wait for I/O thread to have read updates
 stop slave;
-source include/wait_for_slave_to_stop.inc;
-
-let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
-let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
-if (`SELECT $read_pos = $exec_pos`)
-{
-  source include/show_rpl_debug_info.inc;
-  echo 'Read_Master_Log_Pos: $read_pos' == 'Exec_Master_Log_Pos: $exec_pos';
-  die Failed because Read_Master_Log_Pos is equal to Exec_Master_Log_Pos;
-} 
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 8 # 9 # 23 # 33 #
+show slave status;
 change master to master_user='root';
-let $read_pos= query_get_value(SHOW SLAVE STATUS, Read_Master_Log_Pos, 1);
-let $exec_pos= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1);
-if (`SELECT $read_pos <> $exec_pos`)
-{
-  source include/show_rpl_debug_info.inc;
-  echo 'Read_Master_Log_Pos: $read_pos' <> 'Exec_Master_Log_Pos: $exec_pos';
-  die Failed because Read_Master_Log_Pos is not equal to Exec_Master_Log_Pos;
-}
-
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 8 # 9 # 23 # 33 #
+show slave status;
 start slave;
 sync_with_master;
 select * from t1;

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_empty_master_crash.test	2011-01-05 06:46:07 +0000
@@ -1,5 +1,8 @@
 source include/master-slave.inc;
 
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+show slave status;
+
 #
 # Load table should not succeed on the master as this is not a slave
 #

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_flushlog_loop.test	2011-01-05 06:46:07 +0000
@@ -41,7 +41,8 @@ sleep 5;
 #
 #  Show status of slave
 #
---let status_items= Relay_Log_File
---source include/show_slave_status.inc
---source include/check_slave_is_running.inc
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 1 # 8 # 9 # 16 # 23 # 33 #
+--vertical_results
+SHOW SLAVE STATUS;
 STOP SLAVE;

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_loaddata_s.test	2011-01-05 06:46:07 +0000
@@ -20,7 +20,9 @@ save_master_pos;
 connection slave;
 sync_with_master;
 select count(*) from test.t1; # check that LOAD was replicated
-source include/show_binlog_events.inc;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events from 106; # should be nothing
 
 # Cleanup
 connection master;

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_log_pos.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_log_pos.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_log_pos.test	2011-01-05 06:46:07 +0000
@@ -11,41 +11,36 @@
 # Passes with rbr no problem, removed statement include [jbm]
 
 source include/master-slave.inc;
-let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+--replace_column 3 <Binlog_Ignore_DB>
+show master status;
 sync_slave_with_master;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+show slave status;
 stop slave;
-
---replace_result $master_log_pos MASTER_LOG_POS
-eval change master to master_log_pos=$master_log_pos;
+change master to master_log_pos=106;
 start slave;
 sleep 5;
 stop slave;
-
---replace_result $master_log_pos MASTER_LOG_POS
-eval change master to master_log_pos=$master_log_pos;
---let $slave_param= Read_Master_Log_Pos
---let $slave_param_value= $master_log_pos
---source include/wait_for_slave_param.inc
-
+change master to master_log_pos=106;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+show slave status;
 start slave;
 sleep 5;
---let $slave_param= Read_Master_Log_Pos
---let $slave_param_value= $master_log_pos
---source include/wait_for_slave_param.inc
---source include/check_slave_no_error.inc
-
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+show slave status;
 stop slave;
---echo # impossible position leads to an error
---replace_result 177 MASTER_LOG_POS
 change master to master_log_pos=177;
 start slave;
 sleep 2;
-let $slave_io_errno= 1236;
-let $show_slave_io_error= 1;
-source include/wait_for_slave_io_error.inc;
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 8 # 9 # 23 # 33 #
+show slave status;
 connection master;
-
-let $master_log_pos= query_get_value(SHOW MASTER STATUS, Position, 1);
+--replace_column 3 <Binlog_Ignore_DB>
+show master status;
 create table if not exists t1 (n int);
 drop table if exists t1;
 create table t1 (n int);
@@ -53,9 +48,7 @@ insert into t1 values (1),(2),(3);
 save_master_pos;
 connection slave;
 stop slave;
-
---replace_result $master_log_pos MASTER_LOG_POS
-eval change master to master_log_pos=$master_log_pos;
+change master to master_log_pos=206;
 start slave;
 sync_with_master;
 select * from t1 ORDER BY n;

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_rbr_to_sbr.test	2011-01-05 06:46:07 +0000
@@ -15,17 +15,25 @@ SELECT @@GLOBAL.BINLOG_FORMAT, @@SESSION
 CREATE TABLE t1 (a INT, b LONG);
 INSERT INTO t1 VALUES (1,1), (2,2);
 INSERT INTO t1 VALUES (3,UUID()), (4,UUID());
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
 # Different number of binlog events are generated by different engines
 --disable_result_log
-source include/show_binlog_events.inc;
+SHOW BINLOG EVENTS;
 --enable_result_log
 sync_slave_with_master;
 --echo **** On Slave ****
-source include/show_binlog_events.inc;
-
+--replace_result $MASTER_MYPORT MASTER_PORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--query_vertical SHOW SLAVE STATUS
+--replace_result $VERSION VERSION
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
 # Different number of binlog events are generated by different engines
 --disable_result_log
-source include/show_binlog_events.inc;
+SHOW BINLOG EVENTS;
 --enable_result_log
 --exec $MYSQL_DUMP --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_master.sql
 --exec $MYSQL_DUMP_SLAVE --compact --order-by-primary --skip-extended-insert --no-create-info test > $MYSQLTEST_VARDIR/tmp/rpl_rbr_to_sbr_slave.sql

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_row_drop.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_row_drop.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_drop.test	2011-01-05 06:46:07 +0000
@@ -30,7 +30,10 @@ connection master;
 --echo **** On Master ****
 # Should drop the non-temporary table t1 and the temporary table t2
 DROP TABLE t1,t2;
-source include/show_binlog_events.inc;
+let $VERSION=`select version()`;
+--replace_result $VERSION VERSION
+--replace_regex /table_id: [0-9]+/table_id: #/
+SHOW BINLOG EVENTS;
 SHOW TABLES;
 sync_slave_with_master;
 --echo **** On Slave ****

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_inexist_tbl.test	2011-01-05 06:46:07 +0000
@@ -22,11 +22,13 @@ connection master;
 insert into t1 values (1);
 
 connection slave;
-# slave should have stopped because can't find table t1 
+# slave should have stopped because can't find table t1
+wait_for_slave_to_stop;
 # see if we have a good error message:
---let $slave_sql_errno= 1146
---let $show_slave_sql_error= 1
---source include/wait_for_slave_sql_error.inc
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 33 #
+--vertical_results
+show slave status;
 
 # cleanup
 connection master;

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_row_until.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_row_until.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_row_until.test	2011-01-05 06:46:07 +0000
@@ -18,50 +18,44 @@ connection master;
 # create some events on master
 create table t1(n int not null auto_increment primary key);
 insert into t1 values (1),(2),(3),(4);
-let $master_log_pos_1= query_get_value(SHOW MASTER STATUS, Position, 1);
 drop table t1;
-
 create table t2(n int not null auto_increment primary key);
 insert into t2 values (1),(2);
-let $master_log_pos_2= query_get_value(SHOW MASTER STATUS, Position, 1);
 insert into t2 values (3),(4);
 drop table t2;
 
 # try to replicate all queries until drop of t1
 connection slave;
---replace_result $master_log_pos_1 MASTER_LOG_POS
-eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_log_pos_1;
+start slave until master_log_file='master-bin.000001', master_log_pos=311;
 sleep 2;
 wait_for_slave_to_stop;
 # here table should be still not deleted
 select * from t1;
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_log_pos_1
---source include/check_slave_param.inc
+--vertical_results
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
+show slave status;
 
 # this should fail right after start
---replace_result 291 MASTER_LOG_POS
 start slave until master_log_file='master-no-such-bin.000001', master_log_pos=291;
 # again this table should be still not deleted
 select * from t1;
 sleep 2;
 wait_for_slave_to_stop;
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_log_pos_1
---source include/check_slave_param.inc
+--vertical_results
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
+show slave status;
 
 # try replicate all up to and not including the second insert to t2;
-let $master_log_pos= $master_log_pos_2;
-let $relay_log_file= slave-relay-bin.000004;
---source include/get_relay_log_pos.inc
---replace_result $relay_log_pos RELAY_LOG_POS
-eval start slave until relay_log_file='$relay_log_file', relay_log_pos=$relay_log_pos;
+start slave until relay_log_file='slave-relay-bin.000004', relay_log_pos=728;
 sleep 2;
 wait_for_slave_to_stop;
 select * from t2;
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $master_log_pos
---source include/check_slave_param.inc
+--vertical_results
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+--replace_column 1 # 7 # 9 # 11 # 22 # 23 # 33 #
+show slave status;
 
 # clean up
 start slave;
@@ -71,32 +65,27 @@ connection slave;
 sync_with_master;
 stop slave;
 
---let $exec_log_pos_1= query_get_value(SHOW SLAVE STATUS, Exec_Master_Log_Pos, 1)
 # this should stop immediately as we are already there
---replace_result $master_log_pos_2 MASTER_LOG_POS
-eval start slave until master_log_file='master-bin.000001', master_log_pos=$master_log_pos_2;
+start slave until master_log_file='master-bin.000001', master_log_pos=740;
 sleep 2;
 wait_for_slave_to_stop;
 # here the sql slave thread should be stopped
---let $slave_param= Exec_Master_Log_Pos
---let $slave_param_value= $exec_log_pos_1
---source include/check_slave_param.inc
+--vertical_results
+--replace_result $MASTER_MYPORT MASTER_MYPORT bin.000005 bin.000004 bin.000006 bin.000004 bin.000007 bin.000004
+--replace_column 1 # 7 # 9 # 22 # 23 # 33 #
+show slave status;
 
 #testing various error conditions
---replace_result 561 MASTER_LOG_POS
 --error 1277
 start slave until master_log_file='master-bin', master_log_pos=561;
---replace_result 561 MASTER_LOG_POS 12 RELAY_LOG_POS
 --error 1277
 start slave until master_log_file='master-bin.000001', master_log_pos=561, relay_log_pos=12;
 --error 1277
 start slave until master_log_file='master-bin.000001';
 --error 1277
 start slave until relay_log_file='slave-relay-bin.000002';
---replace_result 561 MASTER_LOG_POS
 --error 1277
 start slave until relay_log_file='slave-relay-bin.000002', master_log_pos=561;
 # Warning should be given for second command
 start slave sql_thread;
---replace_result 740 MASTER_LOG_POS
 start slave until master_log_file='master-bin.000001', master_log_pos=740;

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_server_id1.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id1.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id1.test	2011-01-05 06:46:07 +0000
@@ -12,13 +12,10 @@ reset master;
 stop slave;
 --replace_result $SLAVE_MYPORT SLAVE_PORT
 eval change master to master_port=$SLAVE_MYPORT;
-source include/check_slave_no_error.inc;
-
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 16 # 18 #
+show slave status;
 start slave;
-let $slave_io_errno= 1593;
-let $show_slave_io_error= 1;
-source include/wait_for_slave_io_error.inc;
-
 insert into t1 values (1);
 # can't MASTER_POS_WAIT(), it does not work in this weird setup
 # (when slave is its own master without --replicate-same-server-id)

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_server_id2.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_server_id2.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_server_id2.test	2011-01-05 06:46:07 +0000
@@ -9,6 +9,9 @@ reset master;
 stop slave;
 --replace_result $SLAVE_MYPORT SLAVE_PORT
 eval change master to master_port=$SLAVE_MYPORT;
+--replace_result $SLAVE_MYPORT SLAVE_PORT
+--replace_column 18 #
+show slave status;
 start slave;
 insert into t1 values (1);
 save_master_pos;

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_slave_status.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_slave_status.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_slave_status.test	2011-01-05 06:46:07 +0000
@@ -22,7 +22,9 @@ drop table if exists t1;
 --enable_warnings
 create table t1 (n int);
 insert into t1 values (1);
-sync_slave_with_master;
+save_master_pos;
+connection slave;
+sync_with_master;
 select * from t1;
 
 # 3. Delete new replication user
@@ -38,8 +40,12 @@ stop slave;
 start slave;
 
 # 5. Make sure Slave_IO_Running = No
-let $slave_io_errno= 1045;
-source include/wait_for_slave_io_error.inc;
+--replace_result $MASTER_MYPORT MASTER_MYPORT
+# Column 1 is replaced, since the output can be either
+# "Connecting to master" or "Waiting for master update"
+--replace_column 1 # 7 # 8 # 9 # 22 # 23 # 35 # 36 #
+--vertical_results
+show slave status;
 
 # Cleanup (Note that slave IO thread is not running)
 connection slave;

=== modified file 'mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test'
--- a/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test	2010-05-24 13:54:08 +0000
+++ b/mysql-test/suite/engines/funcs/t/rpl_switch_stm_row_mixed.test	2011-01-05 06:46:07 +0000
@@ -501,7 +501,9 @@ INSERT INTO t12 VALUES(UUID());
 UNLOCK TABLES;
 
 --disable_result_log
-source include/show_binlog_events.inc;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events;
 --enable_result_log
 sync_slave_with_master;
 
@@ -518,7 +520,9 @@ diff_files $MYSQLTEST_VARDIR/tmp/rpl_swi
 
 connection master;
 --disable_result_log
-source include/show_binlog_events.inc;
+--replace_column 2 # 5 #
+--replace_regex /table_id: [0-9]+/table_id: #/
+show binlog events;
 --enable_result_log
 
 # Now test that mysqlbinlog works fine on a binlog generated by the

=== modified file 'mysql-test/suite/engines/iuds/t/insert_year.test'
--- a/mysql-test/suite/engines/iuds/t/insert_year.test	2010-03-18 06:42:07 +0000
+++ b/mysql-test/suite/engines/iuds/t/insert_year.test	2011-01-05 06:46:07 +0000
@@ -226,6 +226,7 @@ SELECT * FROM t2 WHERE c1 IS NOT NULL OR
 ## Full table scan ##
 --sorted_result
 SELECT * FROM t2;
+
 --sorted_result
 SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2;
 --sorted_result
@@ -300,6 +301,7 @@ SELECT * FROM t2 WHERE c2 IS NOT NULL OR
 ## Full table scan ##
 --sorted_result
 SELECT * FROM t2;
+
 --sorted_result
 SELECT count(*) as total_rows, min(c2) as min_value, max(c2) FROM t2;
 --sorted_result

=== renamed file 'mysql-test/suite/funcs_1/r/myisam_views.result' => 'mysql-test/suite/funcs_1/r/myisam_views-big.result'
=== renamed file 'mysql-test/suite/funcs_1/t/myisam_views.test' => 'mysql-test/suite/funcs_1/t/myisam_views-big.test'
--- a/mysql-test/suite/funcs_1/t/myisam_views.test	2009-06-09 14:36:14 +0000
+++ b/mysql-test/suite/funcs_1/t/myisam_views-big.test	2010-12-31 11:07:34 +0000
@@ -1,6 +1,9 @@
 #### suite/funcs_1/t/myisam_views.test
 
 --source include/no_valgrind_without_big.inc
+# because of a pair of slow Solaris Sparc machines in pb2,
+# this test is marked as big:
+--source include/big_test.inc
 
 # MyISAM tables should be used
 #

=== modified file 'mysql-test/suite/innodb/t/innodb_bug57255.test'
--- a/mysql-test/suite/innodb/t/innodb_bug57255.test	2010-10-06 10:41:26 +0000
+++ b/mysql-test/suite/innodb/t/innodb_bug57255.test	2010-12-14 09:38:19 +0000
@@ -12,6 +12,7 @@ create table C(id int not null auto_incr
 insert into A values(1), (2);
 
 --disable_query_log
+begin;
 let $i=257;
 while ($i)
 {
@@ -24,6 +25,7 @@ while ($i)
 insert into C(f1) values(2);
 dec $i;
 }
+commit;
 --enable_query_log
 
 # Following Deletes should not report error

=== added file 'mysql-test/suite/innodb_plugin/r/innodb-autoinc-18274.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb-autoinc-18274.result	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb-autoinc-18274.result	2010-11-24 03:07:43 +0000
@@ -0,0 +1,26 @@
+drop table if exists t1;
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (null);
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+DELETE FROM t1;
+OPTIMIZE TABLE t1;
+Table	Op	Msg_type	Msg_text
+test.t1	optimize	note	Table does not support optimize, doing recreate + analyze instead
+test.t1	optimize	status	OK
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `c1` int(11) NOT NULL AUTO_INCREMENT,
+  PRIMARY KEY (`c1`)
+) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=latin1
+INSERT INTO t1 VALUES(null);
+SELECT * FROM t1;
+c1
+2
+DROP TABLE t1;

=== modified file 'mysql-test/suite/innodb_plugin/r/innodb.result'
--- a/mysql-test/suite/innodb_plugin/r/innodb.result	2010-05-05 10:44:25 +0000
+++ b/mysql-test/suite/innodb_plugin/r/innodb.result	2010-12-21 09:39:19 +0000
@@ -1,5 +1,8 @@
 drop table if exists t1,t2,t3,t4;
 drop database if exists mysqltest;
+CREATE TABLE bug58912 (a BLOB, b TEXT, PRIMARY KEY(a(1))) ENGINE=InnoDB;
+INSERT INTO bug58912 VALUES(REPEAT('a',8000),REPEAT('b',8000));
+UPDATE bug58912 SET a=REPEAT('a',7999);
 create table t1 (id int unsigned not null auto_increment, code tinyint unsigned not null, name char(20) not null, primary key (id), key (code), unique (name)) engine=innodb;
 insert into t1 (code, name) values (1, 'Tim'), (1, 'Monty'), (2, 'David'), (2, 'Erik'), (3, 'Sasha'), (3, 'Jeremy'), (4, 'Matt');
 select id, code, name from t1 order by id;
@@ -1676,10 +1679,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
-1066
+1067
 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
-865
+866
 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
@@ -3239,3 +3242,4 @@ Variable_name	Value
 Handler_update	1
 Variable_name	Value
 Handler_delete	1
+DROP TABLE bug58912;

=== added file 'mysql-test/suite/innodb_plugin/t/innodb-autoinc-18274.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb-autoinc-18274.test	1970-01-01 00:00:00 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb-autoinc-18274.test	2010-11-24 03:07:43 +0000
@@ -0,0 +1,29 @@
+-- source include/have_innodb_plugin.inc
+# embedded server ignores 'delayed', so skip this
+-- source include/not_embedded.inc
+
+let $innodb_file_format_check_orig=`select @@innodb_file_format_check`;
+
+--disable_warnings
+drop table if exists t1;
+--enable_warnings
+
+#
+# Bug #18274	InnoDB auto_increment field reset on OPTIMIZE TABLE
+SET @@SESSION.AUTO_INCREMENT_INCREMENT=1, @@SESSION.AUTO_INCREMENT_OFFSET=1;
+CREATE TABLE t1 (c1 INT PRIMARY KEY AUTO_INCREMENT) ENGINE=InnoDB;
+INSERT INTO t1 VALUES (null);
+SHOW CREATE TABLE t1;
+DELETE FROM t1;
+OPTIMIZE TABLE t1;
+SHOW CREATE TABLE t1;
+INSERT INTO t1 VALUES(null);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+#
+# restore environment to the state it was before this test execution
+#
+
+-- disable_query_log
+eval set global innodb_file_format_check=$innodb_file_format_check_orig;

=== modified file 'mysql-test/suite/innodb_plugin/t/innodb.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb.test	2010-05-05 10:44:25 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb.test	2010-12-21 09:39:19 +0000
@@ -43,6 +43,15 @@ drop table if exists t1,t2,t3,t4;
 drop database if exists mysqltest;
 --enable_warnings
 
+# Bug#58912 InnoDB unnecessarily avoids update-in-place on column prefixes
+CREATE TABLE bug58912 (a BLOB, b TEXT, PRIMARY KEY(a(1))) ENGINE=InnoDB;
+INSERT INTO bug58912 VALUES(REPEAT('a',8000),REPEAT('b',8000));
+UPDATE bug58912 SET a=REPEAT('a',7999);
+# The above statements used to trigger a failure during purge when
+# Bug#55284 was fixed while Bug#58912 was not. Defer the DROP TABLE,
+# so that purge gets a chance to run (and a double free of the
+# off-page column can be detected, if one is to occur.)
+
 #
 # Small basic test with ignore
 #
@@ -2541,6 +2550,9 @@ SET GLOBAL innodb_thread_concurrency = @
 
 -- enable_query_log
 
+# Clean up after the Bug#55284/Bug#58912 test case.
+DROP TABLE bug58912;
+
 #######################################################################
 #                                                                     #
 # Please, DO NOT TOUCH this file as well as the innodb.result file.   #

=== modified file 'mysql-test/suite/innodb_plugin/t/innodb_bug57255.test'
--- a/mysql-test/suite/innodb_plugin/t/innodb_bug57255.test	2010-10-06 10:41:26 +0000
+++ b/mysql-test/suite/innodb_plugin/t/innodb_bug57255.test	2010-12-14 09:38:19 +0000
@@ -12,6 +12,7 @@ create table C(id int not null auto_incr
 insert into A values(1), (2);
 
 --disable_query_log
+begin;
 let $i=257;
 while ($i)
 {
@@ -24,6 +25,7 @@ while ($i)
 insert into C(f1) values(2);
 dec $i;
 }
+commit;
 --enable_query_log
 
 # Following Deletes should not report error

=== modified file 'mysql-test/suite/rpl/t/disabled.def'
--- a/mysql-test/suite/rpl/t/disabled.def	2010-09-10 10:49:57 +0000
+++ b/mysql-test/suite/rpl/t/disabled.def	2011-01-05 12:58:05 +0000
@@ -12,3 +12,4 @@
 
 rpl_row_create_table : Bug#51574 Feb 27 2010 andrei failed different way than earlier with bug#45576
 rpl_log_pos : BUG#55675 Sep 10 2010 27 2010 alfranio rpl.rpl_log_pos fails sporadically with error binlog truncated in the middle
+rpl_get_master_version_and_clock : Bug#59178 Jan 05 2011 joro Valgrind warnings rpl_get_master_version_and_clock

=== modified file 'mysql-test/t/auto_increment.test'
--- a/mysql-test/t/auto_increment.test	2010-12-13 11:48:12 +0000
+++ b/mysql-test/t/auto_increment.test	2011-01-04 13:36:37 +0000
@@ -363,3 +363,20 @@ SET @@SESSION.AUTO_INCREMENT_OFFSET=defa
 DROP TABLE t1;
 
 --echo End of 5.1 tests
+
+--echo #
+--echo # Bug#50619 assert in handler::update_auto_increment
+--echo #
+
+CREATE TABLE t1 (pk INT AUTO_INCREMENT, PRIMARY KEY (pk));
+# This triggered the assert
+INSERT INTO t1 VALUES (NULL), (-1), (NULL);
+SELECT * FROM t1;
+DROP TABLE t1;
+
+# Check that that true overflow still gives error
+CREATE TABLE t1 (pk BIGINT UNSIGNED AUTO_INCREMENT, PRIMARY KEY (pk));
+--error ER_AUTOINC_READ_FAILED
+INSERT INTO t1 VALUES (NULL), (18446744073709551615-1), (NULL);
+SELECT * FROM t1;
+DROP TABLE t1;

=== modified file 'mysys/my_fopen.c'
--- a/mysys/my_fopen.c	2007-08-13 13:11:25 +0000
+++ b/mysys/my_fopen.c	2011-01-07 19:28:06 +0000
@@ -18,6 +18,10 @@
 #include <errno.h>
 #include "mysys_err.h"
 
+#if defined(__FreeBSD__)
+extern int getosreldate(void);
+#endif
+
 static void make_ftype(char * to,int flag);
 
 /*
@@ -97,8 +101,137 @@ FILE *my_fopen(const char *filename, int
 } /* my_fopen */
 
 
-	/* Close a stream */
+#if defined(_WIN32)
+
+static FILE *my_win_freopen(const char *path, const char *mode, FILE *stream)
+{
+  int handle_fd, fd= _fileno(stream);
+  HANDLE osfh;
+
+  DBUG_ASSERT(path && stream);
+
+  /* Services don't have stdout/stderr on Windows, so _fileno returns -1. */
+  if (fd < 0)
+  {
+    if (!freopen(path, mode, stream))
+      return NULL;
+
+    fd= _fileno(stream);
+  }
+
+  if ((osfh= CreateFile(path, GENERIC_READ | GENERIC_WRITE,
+                        FILE_SHARE_READ | FILE_SHARE_WRITE |
+                        FILE_SHARE_DELETE, NULL,
+                        OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
+                        NULL)) == INVALID_HANDLE_VALUE)
+    return NULL;
+
+  if ((handle_fd= _open_osfhandle((intptr_t)osfh,
+                                  _O_APPEND | _O_TEXT)) == -1)
+  {
+    CloseHandle(osfh);
+    return NULL;
+  }
+
+  if (_dup2(handle_fd, fd) < 0)
+  {
+    CloseHandle(osfh);
+    return NULL;
+  }
+
+  _close(handle_fd);
+
+  return stream;
+}
+
+#elif defined(__FreeBSD__)
+
+/* No close operation hook. */
+
+static int no_close(void *cookie __attribute__((unused)))
+{
+  return 0;
+}
+
+/*
+  A hack around a race condition in the implementation of freopen.
+
+  The race condition steams from the fact that the current fd of
+  the stream is closed before its number is used to duplicate the
+  new file descriptor. This defeats the desired atomicity of the
+  close and duplicate of dup2().
+
+  See PR number 79887 for reference:
+  http://www.freebsd.org/cgi/query-pr.cgi?pr=79887
+*/
+
+static FILE *my_freebsd_freopen(const char *path, const char *mode, FILE *stream)
+{
+  int old_fd;
+  FILE *result;
+
+  flockfile(stream);
+
+  old_fd= fileno(stream);
+
+  /* Use a no operation close hook to avoid having the fd closed. */
+  stream->_close= no_close;
+
+  /* Relies on the implicit dup2 to close old_fd. */
+  result= freopen(path, mode, stream);
+
+  /* If successful, the _close hook was replaced. */
+
+  if (result == NULL)
+    close(old_fd);
+  else
+    funlockfile(result);
+
+  return result;
+}
+
+#endif
+
+
+/**
+  Change the file associated with a file stream.
+
+  @param path   Path to file.
+  @param mode   Mode of the stream.
+  @param stream File stream.
+
+  @note
+    This function is used to redirect stdout and stderr to a file and
+    subsequently to close and reopen that file for log rotation.
+
+  @retval A FILE pointer on success. Otherwise, NULL.
+*/
+
+FILE *my_freopen(const char *path, const char *mode, FILE *stream)
+{
+  FILE *result;
+
+#if defined(_WIN32)
+  result= my_win_freopen(path, mode, stream);
+#elif defined(__FreeBSD__)
+  /*
+    XXX: Once the fix is ported to the stable releases, this should
+         be dependent upon the specific FreeBSD versions. Check at:
+         http://www.freebsd.org/cgi/query-pr.cgi?pr=79887
+  */
+  if (getosreldate() > 900027)
+    result= freopen(path, mode, stream);
+  else
+    result= my_freebsd_freopen(path, mode, stream);
+#else
+  result= freopen(path, mode, stream);
+#endif
+
+  return result;
+}
+
 
+/* Close a stream */
 int my_fclose(FILE *fd, myf MyFlags)
 {
   int err,file;

=== modified file 'sql/log.cc'
--- a/sql/log.cc	2010-12-17 01:17:03 +0000
+++ b/sql/log.cc	2011-01-07 18:33:36 +0000
@@ -5171,80 +5171,26 @@ void sql_perror(const char *message)
 }
 
 
-#ifdef __WIN__
+/*
+  Change the file associated with two output streams. Used to
+  redirect stdout and stderr to a file. The streams are reopened
+  only for appending (writing at end of file).
+*/
 extern "C" my_bool reopen_fstreams(const char *filename,
                                    FILE *outstream, FILE *errstream)
 {
-  int handle_fd;
-  int err_fd, out_fd;
-  HANDLE osfh;
-
-  DBUG_ASSERT(filename && errstream);
-
-  // Services don't have stdout/stderr on Windows, so _fileno returns -1.
-  err_fd= _fileno(errstream);
-  if (err_fd < 0)
-  {
-    if (!freopen(filename, "a+", errstream))
-      return TRUE;
-
-    setbuf(errstream, NULL);
-    err_fd= _fileno(errstream);
-  }
-
-  if (outstream)
-  {
-    out_fd= _fileno(outstream);
-    if (out_fd < 0)
-    {
-      if (!freopen(filename, "a+", outstream))
-        return TRUE;
-      out_fd= _fileno(outstream);
-    }
-  }
-
-  if ((osfh= CreateFile(filename, GENERIC_READ | GENERIC_WRITE,
-                        FILE_SHARE_READ | FILE_SHARE_WRITE |
-                        FILE_SHARE_DELETE, NULL,
-                        OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL,
-                        NULL)) == INVALID_HANDLE_VALUE)
+  if (outstream && !my_freopen(filename, "a", outstream))
     return TRUE;
 
-  if ((handle_fd= _open_osfhandle((intptr_t)osfh,
-                                  _O_APPEND | _O_TEXT)) == -1)
-  {
-    CloseHandle(osfh);
+  if (errstream && !my_freopen(filename, "a", errstream))
     return TRUE;
-  }
 
-  if (_dup2(handle_fd, err_fd) < 0)
-  {
-    CloseHandle(osfh);
-    return TRUE;
-  }
-
-  if (outstream && _dup2(handle_fd, out_fd) < 0)
-  {
-    CloseHandle(osfh);
-    return TRUE;
-  }
-
-  _close(handle_fd);
-  return FALSE;
-}
-#else
-extern "C" my_bool reopen_fstreams(const char *filename,
-                                   FILE *outstream, FILE *errstream)
-{
-  if (outstream && !freopen(filename, "a+", outstream))
-    return TRUE;
-
-  if (errstream && !freopen(filename, "a+", errstream))
-    return TRUE;
+  /* The error stream must be unbuffered. */
+  if (errstream)
+    setbuf(errstream, NULL);
 
   return FALSE;
 }
-#endif
 
 
 /*

=== modified file 'sql/sql_show.cc'
--- a/sql/sql_show.cc	2010-12-28 23:47:05 +0000
+++ b/sql/sql_show.cc	2011-01-07 11:46:21 +0000
@@ -4647,9 +4647,10 @@ static int get_schema_constraints_record
     TABLE *show_table= tables->table;
     KEY *key_info=show_table->key_info;
     uint primary_key= show_table->s->primary_key;
-    show_table->file->info(HA_STATUS_VARIABLE | 
-                           HA_STATUS_NO_LOCK |
-                           HA_STATUS_TIME);
+
+    // This is not needed since no statistics are displayed.
+    // show_table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_TIME);
+
     for (uint i=0 ; i < show_table->s->keys ; i++, key_info++)
     {
       if (i != primary_key && !(key_info->flags & HA_NOSAME))
@@ -4831,9 +4832,10 @@ static int get_schema_key_column_usage_r
     TABLE *show_table= tables->table;
     KEY *key_info=show_table->key_info;
     uint primary_key= show_table->s->primary_key;
-    show_table->file->info(HA_STATUS_VARIABLE | 
-                           HA_STATUS_NO_LOCK |
-                           HA_STATUS_TIME);
+
+    // This is not needed since no statistics are displayed.
+    // show_table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_TIME);
+
     for (uint i=0 ; i < show_table->s->keys ; i++, key_info++)
     {
       if (i != primary_key && !(key_info->flags & HA_NOSAME))
@@ -5562,9 +5564,9 @@ get_referential_constraints_record(THD *
   {
     List<FOREIGN_KEY_INFO> f_key_list;
     TABLE *show_table= tables->table;
-    show_table->file->info(HA_STATUS_VARIABLE | 
-                           HA_STATUS_NO_LOCK |
-                           HA_STATUS_TIME);
+
+    // This is not needed since no statistics are displayed.
+    // show_table->file->info(HA_STATUS_VARIABLE | HA_STATUS_NO_LOCK | HA_STATUS_TIME);
 
     show_table->file->get_foreign_key_list(thd, &f_key_list);
     FOREIGN_KEY_INFO *f_key_info;

=== modified file 'storage/innobase/btr/btr0btr.c'
--- a/storage/innobase/btr/btr0btr.c	2010-09-13 13:39:40 +0000
+++ b/storage/innobase/btr/btr0btr.c	2011-01-06 07:05:45 +0000
@@ -610,7 +610,7 @@ btr_page_get_father_for_rec(
 		      "InnoDB: corruption. If the crash happens at "
 		      "the database startup, see\n"
 		      "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
-		      "forcing-recovery.html about\n"
+		      "forcing-innodb-recovery.html about\n"
 		      "InnoDB: forcing recovery. "
 		      "Then dump + drop + reimport.\n", stderr);
 	}

=== modified file 'storage/innobase/buf/buf0buf.c'
--- a/storage/innobase/buf/buf0buf.c	2010-10-19 05:58:53 +0000
+++ b/storage/innobase/buf/buf0buf.c	2011-01-06 07:05:45 +0000
@@ -334,7 +334,7 @@ buf_page_is_corrupted(
 				"InnoDB: tablespace but not the InnoDB "
 				"log files. See\n"
 				"InnoDB: http://dev.mysql.com/doc/refman/"
-				"5.1/en/forcing-recovery.html\n"
+				"5.1/en/forcing-innodb-recovery.html\n"
 				"InnoDB: for more information.\n",
 				(ulong) mach_read_from_4(read_buf
 							 + FIL_PAGE_OFFSET),
@@ -2067,7 +2067,7 @@ buf_page_io_complete(
 			      " table for corruption.\n"
 			      "InnoDB: See also"
 			      " http://dev.mysql.com/doc/refman/5.1/en/"
-			      "forcing-recovery.html\n"
+			      "forcing-innodb-recovery.html\n"
 			      "InnoDB: about forcing recovery.\n", stderr);
 
 			if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {

=== modified file 'storage/innobase/dict/dict0dict.c'
--- a/storage/innobase/dict/dict0dict.c	2010-08-23 10:28:54 +0000
+++ b/storage/innobase/dict/dict0dict.c	2011-01-05 06:44:12 +0000
@@ -2217,7 +2217,7 @@ dict_scan_to(
 			quote = '\0';
 		} else if (quote) {
 			/* Within quotes: do nothing. */
-		} else if (*ptr == '`' || *ptr == '"') {
+		} else if (*ptr == '`' || *ptr == '"' || *ptr == '\'') {
 			/* Starting quote: remember the quote character. */
 			quote = *ptr;
 		} else {

=== modified file 'storage/innobase/dict/dict0mem.c'
--- a/storage/innobase/dict/dict0mem.c	2008-10-23 04:30:32 +0000
+++ b/storage/innobase/dict/dict0mem.c	2011-01-05 06:31:46 +0000
@@ -87,6 +87,8 @@ dict_mem_table_create(
 
 	table->big_rows = 0;
 
+	table->fk_max_recusive_level = 0;
+
 	mutex_create(&table->autoinc_mutex, SYNC_DICT_AUTOINC_MUTEX);
 
 	table->autoinc = 0;

=== modified file 'storage/innobase/fsp/fsp0fsp.c'
--- a/storage/innobase/fsp/fsp0fsp.c	2010-08-20 07:49:43 +0000
+++ b/storage/innobase/fsp/fsp0fsp.c	2011-01-06 07:05:45 +0000
@@ -3046,7 +3046,7 @@ fseg_free_page_low(
 crash:
 		fputs("InnoDB: Please refer to\n"
 		      "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
-		      "forcing-recovery.html\n"
+		      "forcing-innodb-recovery.html\n"
 		      "InnoDB: about forcing recovery.\n", stderr);
 		ut_error;
 	}

=== modified file 'storage/innobase/include/buf0buf.ic'
--- a/storage/innobase/include/buf0buf.ic	2007-07-10 21:29:56 +0000
+++ b/storage/innobase/include/buf0buf.ic	2011-01-06 07:05:45 +0000
@@ -218,7 +218,7 @@ buf_block_align(
 			"InnoDB: corruption. If this happens in an"
 			" InnoDB database recovery, see\n"
 			"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
-			"forcing-recovery.html\n"
+			"forcing-innodb-recovery.html\n"
 			"InnoDB: how to force recovery.\n",
 			ptr, frame_zero,
 			buf_pool->high_end);
@@ -257,7 +257,7 @@ buf_frame_align(
 			"InnoDB: corruption. If this happens in an"
 			" InnoDB database recovery, see\n"
 			"InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
-			"forcing-recovery.html\n"
+			"forcing-innodb-recovery.html\n"
 			"InnoDB: how to force recovery.\n",
 			ptr, buf_pool->frame_zero,
 			buf_pool->high_end);

=== modified file 'storage/innobase/log/log0recv.c'
--- a/storage/innobase/log/log0recv.c	2010-09-14 09:46:23 +0000
+++ b/storage/innobase/log/log0recv.c	2011-01-06 07:05:45 +0000
@@ -1826,7 +1826,7 @@ recv_report_corrupt_log(
 	      "InnoDB: on your InnoDB tables to check that they are ok!\n"
 	      "InnoDB: If mysqld crashes after this recovery, look at\n"
 	      "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
-	      "forcing-recovery.html\n"
+	      "forcing-innodb-recovery.html\n"
 	      "InnoDB: about forcing recovery.\n", stderr);
 
 	fflush(stderr);

=== modified file 'storage/innobase/row/row0mysql.c'
--- a/storage/innobase/row/row0mysql.c	2010-12-16 14:40:52 +0000
+++ b/storage/innobase/row/row0mysql.c	2011-01-06 07:05:45 +0000
@@ -552,7 +552,7 @@ handle_new_error:
 		      " after the startup or when\n"
 		      "InnoDB: you dump the tables, look at\n"
 		      "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
-		      "forcing-recovery.html"
+		      "forcing-innodb-recovery.html"
 		      " for help.\n", stderr);
 
 	} else if (err == DB_FOREIGN_EXCEED_MAX_CASCADE) {

=== modified file 'storage/innobase/ut/ut0dbg.c'
--- a/storage/innobase/ut/ut0dbg.c	2006-08-29 07:33:51 +0000
+++ b/storage/innobase/ut/ut0dbg.c	2011-01-06 07:05:45 +0000
@@ -58,7 +58,7 @@ ut_dbg_assertion_failed(
 	      "InnoDB: immediately after the mysqld startup, there may be\n"
 	      "InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
 	      "InnoDB: http://dev.mysql.com/doc/refman/5.1/en/"
-	      "forcing-recovery.html\n"
+	      "forcing-innodb-recovery.html\n"
 	      "InnoDB: about forcing recovery.\n", stderr);
 #if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
 	ut_dbg_stop_threads = TRUE;

=== modified file 'storage/innodb_plugin/ChangeLog'
--- a/storage/innodb_plugin/ChangeLog	2010-12-16 14:40:52 +0000
+++ b/storage/innodb_plugin/ChangeLog	2011-01-07 03:36:20 +0000
@@ -1,4 +1,34 @@
+2011-01-06	The InnoDB Team
+	* handler/i_s.cc, include/trx0i_s.h, trx/trx0i_s.c:
+	Fix Bug#55397 cannot select from innodb_trx when trx_query contains
+	blobs that aren't strings
+
+2011-01-04	The InnoDB Team
+	* dict/dict0dict.c:
+	Fix Bug#59197 double quote in field comment prevents foreign
+	key constraint creation
+
+2010-12-21	The InnoDB Team
+	* include/btr0cur.h, include/row0upd.h, btr/btr0cur.c,
+	row/row0umod.c, row/row0upd.c:
+	Fix Bug#55284 Double free of off-page columns due to lock wait
+	while updating PRIMARY KEY
+
+2010-12-21	The InnoDB Team
+
+	* include/data0data.h, include/data0data.ic, include/row0upd.h,
+	btr/btr0cur.c, row/row0purge.c, row/row0umod.c, row/row0upd.c,
+	innodb.result, innodb.test:
+	Fix Bug#58912 InnoDB unnecessarily avoids update-in-place
+	on column prefix indexes
+
+2010-12-09	The InnoDB Team
+
+	* buf/buf0lru.c:
+	Fix Bug#57600 output of I/O sum[%lu] can go negative
+
 2010-11-11	The InnoDB Team
+
 	* thr/thr0loc.c, trx/trx0i_s.c:
 	Fix Bug#57802 Empty ASSERTION parameter passed to the HASH_SEARCH macro
 

=== modified file 'storage/innodb_plugin/btr/btr0btr.c'
--- a/storage/innodb_plugin/btr/btr0btr.c	2010-09-14 18:14:42 +0000
+++ b/storage/innodb_plugin/btr/btr0btr.c	2011-01-06 07:12:53 +0000
@@ -663,7 +663,7 @@ btr_page_get_father_node_ptr_func(
 		      " to fix the\n"
 		      "InnoDB: corruption. If the crash happens at "
 		      "the database startup, see\n"
-		      "InnoDB: " REFMAN "forcing-recovery.html about\n"
+		      "InnoDB: " REFMAN "forcing-innodb-recovery.html about\n"
 		      "InnoDB: forcing recovery. "
 		      "Then dump + drop + reimport.\n", stderr);
 

=== modified file 'storage/innodb_plugin/btr/btr0cur.c'
--- a/storage/innodb_plugin/btr/btr0cur.c	2010-11-10 08:40:22 +0000
+++ b/storage/innodb_plugin/btr/btr0cur.c	2010-12-21 11:27:22 +0000
@@ -1756,7 +1756,8 @@ btr_cur_update_in_place(
 		NOT call it if index is secondary */
 
 		if (!dict_index_is_clust(index)
-		    || row_upd_changes_ord_field_binary(NULL, index, update)) {
+		    || row_upd_changes_ord_field_binary(NULL, NULL,
+							index, update)) {
 
 			/* Remove possible hash index pointer to this record */
 			btr_search_update_hash_on_delete(cursor);
@@ -2508,27 +2509,24 @@ ulint
 btr_cur_del_mark_set_clust_rec(
 /*===========================*/
 	ulint		flags,	/*!< in: undo logging and locking flags */
-	btr_cur_t*	cursor,	/*!< in: cursor */
+	buf_block_t*	block,	/*!< in/out: buffer block of the record */
+	rec_t*		rec,	/*!< in/out: record */
+	dict_index_t*	index,	/*!< in: clustered index of the record */
+	const ulint*	offsets,/*!< in: rec_get_offsets(rec) */
 	ibool		val,	/*!< in: value to set */
 	que_thr_t*	thr,	/*!< in: query thread */
 	mtr_t*		mtr)	/*!< in: mtr */
 {
-	dict_index_t*	index;
-	buf_block_t*	block;
 	roll_ptr_t	roll_ptr;
 	ulint		err;
-	rec_t*		rec;
 	page_zip_des_t*	page_zip;
 	trx_t*		trx;
-	mem_heap_t*	heap		= NULL;
-	ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-	ulint*		offsets		= offsets_;
-	rec_offs_init(offsets_);
 
-	rec = btr_cur_get_rec(cursor);
-	index = cursor->index;
+	ut_ad(dict_index_is_clust(index));
+	ut_ad(rec_offs_validate(rec, index, offsets));
 	ut_ad(!!page_rec_is_comp(rec) == dict_table_is_comp(index->table));
-	offsets = rec_get_offsets(rec, index, offsets, ULINT_UNDEFINED, &heap);
+	ut_ad(buf_block_get_frame(block) == page_align(rec));
+	ut_ad(page_is_leaf(page_align(rec)));
 
 #ifdef UNIV_DEBUG
 	if (btr_cur_print_record_ops && thr) {
@@ -2540,13 +2538,12 @@ btr_cur_del_mark_set_clust_rec(
 	ut_ad(dict_index_is_clust(index));
 	ut_ad(!rec_get_deleted_flag(rec, rec_offs_comp(offsets)));
 
-	err = lock_clust_rec_modify_check_and_lock(flags,
-						   btr_cur_get_block(cursor),
+	err = lock_clust_rec_modify_check_and_lock(flags, block,
 						   rec, index, offsets, thr);
 
 	if (err != DB_SUCCESS) {
 
-		goto func_exit;
+		return(err);
 	}
 
 	err = trx_undo_report_row_operation(flags, TRX_UNDO_MODIFY_OP, thr,
@@ -2554,11 +2551,9 @@ btr_cur_del_mark_set_clust_rec(
 					    &roll_ptr);
 	if (err != DB_SUCCESS) {
 
-		goto func_exit;
+		return(err);
 	}
 
-	block = btr_cur_get_block(cursor);
-
 	if (block->is_hashed) {
 		rw_lock_x_lock(&btr_search_latch);
 	}
@@ -2581,10 +2576,6 @@ btr_cur_del_mark_set_clust_rec(
 	btr_cur_del_mark_set_clust_rec_log(flags, rec, index, val, trx,
 					   roll_ptr, mtr);
 
-func_exit:
-	if (UNIV_LIKELY_NULL(heap)) {
-		mem_heap_free(heap);
-	}
 	return(err);
 }
 
@@ -3476,108 +3467,36 @@ btr_cur_set_ownership_of_extern_field(
 }
 
 /*******************************************************************//**
-Marks not updated extern fields as not-owned by this record. The ownership
-is transferred to the updated record which is inserted elsewhere in the
+Marks non-updated off-page fields as disowned by this record. The ownership
+must be transferred to the updated record which is inserted elsewhere in the
 index tree. In purge only the owner of externally stored field is allowed
-to free the field.
-@return TRUE if BLOB ownership was transferred */
+to free the field. */
 UNIV_INTERN
-ibool
-btr_cur_mark_extern_inherited_fields(
-/*=================================*/
+void
+btr_cur_disown_inherited_fields(
+/*============================*/
 	page_zip_des_t*	page_zip,/*!< in/out: compressed page whose uncompressed
 				part will be updated, or NULL */
 	rec_t*		rec,	/*!< in/out: record in a clustered index */
 	dict_index_t*	index,	/*!< in: index of the page */
 	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
 	const upd_t*	update,	/*!< in: update vector */
-	mtr_t*		mtr)	/*!< in: mtr, or NULL if not logged */
+	mtr_t*		mtr)	/*!< in/out: mini-transaction */
 {
-	ulint	n;
-	ulint	j;
 	ulint	i;
-	ibool	change_ownership = FALSE;
 
-	ut_ad(rec_offs_validate(rec, NULL, offsets));
+	ut_ad(rec_offs_validate(rec, index, offsets));
 	ut_ad(!rec_offs_comp(offsets) || !rec_get_node_ptr_flag(rec));
+	ut_ad(rec_offs_any_extern(offsets));
+	ut_ad(mtr);
 
-	if (!rec_offs_any_extern(offsets)) {
-
-		return(FALSE);
-	}
-
-	n = rec_offs_n_fields(offsets);
-
-	for (i = 0; i < n; i++) {
-		if (rec_offs_nth_extern(offsets, i)) {
-
-			/* Check it is not in updated fields */
-
-			if (update) {
-				for (j = 0; j < upd_get_n_fields(update);
-				     j++) {
-					if (upd_get_nth_field(update, j)
-					    ->field_no == i) {
-
-						goto updated;
-					}
-				}
-			}
-
+	for (i = 0; i < rec_offs_n_fields(offsets); i++) {
+		if (rec_offs_nth_extern(offsets, i)
+		    && !upd_get_field_by_field_no(update, i)) {
 			btr_cur_set_ownership_of_extern_field(
 				page_zip, rec, index, offsets, i, FALSE, mtr);
-
-			change_ownership = TRUE;
-updated:
-			;
 		}
 	}
-
-	return(change_ownership);
-}
-
-/*******************************************************************//**
-The complement of the previous function: in an update entry may inherit
-some externally stored fields from a record. We must mark them as inherited
-in entry, so that they are not freed in a rollback. */
-UNIV_INTERN
-void
-btr_cur_mark_dtuple_inherited_extern(
-/*=================================*/
-	dtuple_t*	entry,		/*!< in/out: updated entry to be
-					inserted to clustered index */
-	const upd_t*	update)		/*!< in: update vector */
-{
-	ulint		i;
-
-	for (i = 0; i < dtuple_get_n_fields(entry); i++) {
-
-		dfield_t*	dfield = dtuple_get_nth_field(entry, i);
-		byte*		data;
-		ulint		len;
-		ulint		j;
-
-		if (!dfield_is_ext(dfield)) {
-			continue;
-		}
-
-		/* Check if it is in updated fields */
-
-		for (j = 0; j < upd_get_n_fields(update); j++) {
-			if (upd_get_nth_field(update, j)->field_no == i) {
-
-				goto is_updated;
-			}
-		}
-
-		data = dfield_get_data(dfield);
-		len = dfield_get_len(dfield);
-		data[len - BTR_EXTERN_FIELD_REF_SIZE + BTR_EXTERN_LEN]
-			|= BTR_EXTERN_INHERITED_FLAG;
-
-is_updated:
-		;
-	}
 }
 
 /*******************************************************************//**
@@ -3614,29 +3533,6 @@ btr_cur_unmark_extern_fields(
 		}
 	}
 }
-
-/*******************************************************************//**
-Marks all extern fields in a dtuple as owned by the record. */
-UNIV_INTERN
-void
-btr_cur_unmark_dtuple_extern_fields(
-/*================================*/
-	dtuple_t*	entry)		/*!< in/out: clustered index entry */
-{
-	ulint	i;
-
-	for (i = 0; i < dtuple_get_n_fields(entry); i++) {
-		dfield_t* dfield = dtuple_get_nth_field(entry, i);
-
-		if (dfield_is_ext(dfield)) {
-			byte*	data = dfield_get_data(dfield);
-			ulint	len = dfield_get_len(dfield);
-
-			data[len - BTR_EXTERN_FIELD_REF_SIZE + BTR_EXTERN_LEN]
-				&= ~BTR_EXTERN_OWNER_FLAG;
-		}
-	}
-}
 
 /*******************************************************************//**
 Flags the data tuple fields that are marked as extern storage in the

=== modified file 'storage/innodb_plugin/buf/buf0buf.c'
--- a/storage/innodb_plugin/buf/buf0buf.c	2010-10-19 06:04:15 +0000
+++ b/storage/innodb_plugin/buf/buf0buf.c	2011-01-06 07:12:53 +0000
@@ -375,7 +375,7 @@ buf_page_is_corrupted(
 				"you may have copied the InnoDB\n"
 				"InnoDB: tablespace but not the InnoDB "
 				"log files. See\n"
-				"InnoDB: " REFMAN "forcing-recovery.html\n"
+				"InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
 				"InnoDB: for more information.\n",
 				(ulong) mach_read_from_4(read_buf
 							 + FIL_PAGE_OFFSET),
@@ -3240,7 +3240,7 @@ corrupt:
 			      "InnoDB: TABLE to scan your"
 			      " table for corruption.\n"
 			      "InnoDB: See also "
-			      REFMAN "forcing-recovery.html\n"
+			      REFMAN "forcing-innodb-recovery.html\n"
 			      "InnoDB: about forcing recovery.\n", stderr);
 
 			if (srv_force_recovery < SRV_FORCE_IGNORE_CORRUPT) {

=== modified file 'storage/innodb_plugin/buf/buf0lru.c'
--- a/storage/innodb_plugin/buf/buf0lru.c	2010-05-20 13:07:34 +0000
+++ b/storage/innodb_plugin/buf/buf0lru.c	2010-12-09 09:19:46 +0000
@@ -1942,6 +1942,7 @@ buf_LRU_stat_update(void)
 /*=====================*/
 {
 	buf_LRU_stat_t*	item;
+	buf_LRU_stat_t	cur_stat;
 
 	/* If we haven't started eviction yet then don't update stats. */
 	if (buf_pool->freed_page_clock == 0) {
@@ -1955,12 +1956,19 @@ buf_LRU_stat_update(void)
 	buf_LRU_stat_arr_ind++;
 	buf_LRU_stat_arr_ind %= BUF_LRU_STAT_N_INTERVAL;
 
-	/* Add the current value and subtract the obsolete entry. */
-	buf_LRU_stat_sum.io += buf_LRU_stat_cur.io - item->io;
-	buf_LRU_stat_sum.unzip += buf_LRU_stat_cur.unzip - item->unzip;
+	/* Add the current value and subtract the obsolete entry.
+	Since buf_LRU_stat_cur is not protected by any mutex,
+	it can be changing between adding to buf_LRU_stat_sum
+	and copying to item. Assign it to local variables to make
+	sure the same value assign to the buf_LRU_stat_sum
+	and item */
+	cur_stat = buf_LRU_stat_cur;
+
+	buf_LRU_stat_sum.io += cur_stat.io - item->io;
+	buf_LRU_stat_sum.unzip += cur_stat.unzip - item->unzip;
 
 	/* Put current entry in the array. */
-	memcpy(item, &buf_LRU_stat_cur, sizeof *item);
+	memcpy(item, &cur_stat, sizeof *item);
 
 	buf_pool_mutex_exit();
 

=== modified file 'storage/innodb_plugin/dict/dict0dict.c'
--- a/storage/innodb_plugin/dict/dict0dict.c	2010-11-11 11:11:52 +0000
+++ b/storage/innodb_plugin/dict/dict0dict.c	2011-01-05 06:44:12 +0000
@@ -2688,7 +2688,7 @@ dict_scan_to(
 			quote = '\0';
 		} else if (quote) {
 			/* Within quotes: do nothing. */
-		} else if (*ptr == '`' || *ptr == '"') {
+		} else if (*ptr == '`' || *ptr == '"' || *ptr == '\'') {
 			/* Starting quote: remember the quote character. */
 			quote = *ptr;
 		} else {

=== modified file 'storage/innodb_plugin/fsp/fsp0fsp.c'
--- a/storage/innodb_plugin/fsp/fsp0fsp.c	2010-11-03 01:40:53 +0000
+++ b/storage/innodb_plugin/fsp/fsp0fsp.c	2011-01-06 07:12:53 +0000
@@ -3326,7 +3326,7 @@ fseg_free_page_low(
 			"InnoDB: database!\n", (ulong) page);
 crash:
 		fputs("InnoDB: Please refer to\n"
-		      "InnoDB: " REFMAN "forcing-recovery.html\n"
+		      "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
 		      "InnoDB: about forcing recovery.\n", stderr);
 		ut_error;
 	}

=== modified file 'storage/innodb_plugin/handler/ha_innodb.cc'
--- a/storage/innodb_plugin/handler/ha_innodb.cc	2010-12-16 14:40:52 +0000
+++ b/storage/innodb_plugin/handler/ha_innodb.cc	2010-12-27 17:21:21 +0000
@@ -6293,10 +6293,11 @@ create_clustered_index_when_no_primary(
 /*****************************************************************//**
 Return a display name for the row format
 @return row format name */
-
-const char *get_row_format_name(
-/*============================*/
-enum row_type row_format)		/*!< in: Row Format */
+UNIV_INTERN
+const char*
+get_row_format_name(
+/*================*/
+	enum row_type	row_format)		/*!< in: Row Format */
 {
 	switch (row_format) {
 	case ROW_TYPE_COMPACT:
@@ -6311,12 +6312,38 @@ enum row_type row_format)		/*!< in: Row
 		return("DEFAULT");
 	case ROW_TYPE_FIXED:
 		return("FIXED");
-	default:
+	case ROW_TYPE_PAGE:
+	case ROW_TYPE_NOT_USED:
 		break;
 	}
 	return("NOT USED");
 }
 
+/** If file-per-table is missing, issue warning and set ret false */
+#define CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE		\
+	if (!srv_file_per_table) {				\
+		push_warning_printf(				\
+			thd, MYSQL_ERROR::WARN_LEVEL_WARN,	\
+			ER_ILLEGAL_HA_CREATE_OPTION,		\
+			"InnoDB: ROW_FORMAT=%s requires"	\
+			" innodb_file_per_table.",		\
+			get_row_format_name(row_format));	\
+		ret = FALSE;					\
+	}
+
+/** If file-format is Antelope, issue warning and set ret false */
+#define CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE			\
+	if (srv_file_format < DICT_TF_FORMAT_ZIP) {		\
+		push_warning_printf(				\
+			thd, MYSQL_ERROR::WARN_LEVEL_WARN,	\
+			ER_ILLEGAL_HA_CREATE_OPTION,		\
+			"InnoDB: ROW_FORMAT=%s requires"	\
+			" innodb_file_format > Antelope.",	\
+			get_row_format_name(row_format));	\
+		ret = FALSE;					\
+	}
+
+
 /*****************************************************************//**
 Validates the create options. We may build on this function
 in future. For now, it checks two specifiers:
@@ -6334,7 +6361,7 @@ create_options_are_valid(
 {
 	ibool	kbs_specified	= FALSE;
 	ibool	ret		= TRUE;
-	enum row_type	row_type	= form->s->row_type;
+	enum row_type	row_format	= form->s->row_type;
 
 	ut_ad(thd != NULL);
 
@@ -6343,23 +6370,6 @@ create_options_are_valid(
 		return(TRUE);
 	}
 
-	/* Check for a valid Innodb ROW_FORMAT specifier. For example,
-	ROW_TYPE_FIXED can be sent to Innodb */
-	switch (row_type) {
-	case ROW_TYPE_COMPACT:
-	case ROW_TYPE_COMPRESSED:
-	case ROW_TYPE_DYNAMIC:
-	case ROW_TYPE_REDUNDANT:
-	case ROW_TYPE_DEFAULT:
-		break;
-	default:
-		push_warning(
-			thd, MYSQL_ERROR::WARN_LEVEL_WARN,
-			ER_ILLEGAL_HA_CREATE_OPTION,
-			"InnoDB: invalid ROW_FORMAT specifier.");
-		ret = FALSE;
-	}
-
 	ut_ad(form != NULL);
 	ut_ad(create_info != NULL);
 
@@ -6372,7 +6382,23 @@ create_options_are_valid(
 		case 4:
 		case 8:
 		case 16:
-			/* Valid value. */
+			/* Valid KEY_BLOCK_SIZE, check its dependencies. */
+			if (!srv_file_per_table) {
+				push_warning(
+					thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+					ER_ILLEGAL_HA_CREATE_OPTION,
+					"InnoDB: KEY_BLOCK_SIZE requires"
+					" innodb_file_per_table.");
+				ret = FALSE;
+			}
+			if (srv_file_format < DICT_TF_FORMAT_ZIP) {
+				push_warning(
+					thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+					ER_ILLEGAL_HA_CREATE_OPTION,
+					"InnoDB: KEY_BLOCK_SIZE requires"
+					" innodb_file_format > Antelope.");
+					ret = FALSE;
+			}
 			break;
 		default:
 			push_warning_printf(
@@ -6382,72 +6408,43 @@ create_options_are_valid(
 				" Valid values are [1, 2, 4, 8, 16]",
 				create_info->key_block_size);
 			ret = FALSE;
+			break;
 		}
 	}
 	
-	/* If KEY_BLOCK_SIZE was specified, check for its
-	dependencies. */
-	if (kbs_specified && !srv_file_per_table) {
-		push_warning(
-			thd, MYSQL_ERROR::WARN_LEVEL_WARN,
-			ER_ILLEGAL_HA_CREATE_OPTION,
-			"InnoDB: KEY_BLOCK_SIZE"
-			" requires innodb_file_per_table.");
-		ret = FALSE;
-	}
-
-	if (kbs_specified && srv_file_format < DICT_TF_FORMAT_ZIP) {
-		push_warning(
-			thd, MYSQL_ERROR::WARN_LEVEL_WARN,
-			ER_ILLEGAL_HA_CREATE_OPTION,
-			"InnoDB: KEY_BLOCK_SIZE requires"
-			" innodb_file_format > Antelope.");
-		ret = FALSE;
-	}
-
-	switch (row_type) {
+	/* Check for a valid Innodb ROW_FORMAT specifier and
+	other incompatibilities. */
+	switch (row_format) {
 	case ROW_TYPE_COMPRESSED:
-	case ROW_TYPE_DYNAMIC:
-		/* These two ROW_FORMATs require srv_file_per_table
-		and srv_file_format > Antelope */
-		if (!srv_file_per_table) {
-			push_warning_printf(
-				thd, MYSQL_ERROR::WARN_LEVEL_WARN,
-				ER_ILLEGAL_HA_CREATE_OPTION,
-				"InnoDB: ROW_FORMAT=%s"
-				" requires innodb_file_per_table.",
-				get_row_format_name(row_type));
-				ret = FALSE;
-		}
-
-		if (srv_file_format < DICT_TF_FORMAT_ZIP) {
-			push_warning_printf(
-				thd, MYSQL_ERROR::WARN_LEVEL_WARN,
-				ER_ILLEGAL_HA_CREATE_OPTION,
-				"InnoDB: ROW_FORMAT=%s requires"
-				" innodb_file_format > Antelope.",
-				get_row_format_name(row_type));
-				ret = FALSE;
-		}
-	default:
+		CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE;
+		CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE;
 		break;
-	}
-
-	switch (row_type) {
-	case ROW_TYPE_REDUNDANT:
-	case ROW_TYPE_COMPACT:
 	case ROW_TYPE_DYNAMIC:
-		/* KEY_BLOCK_SIZE is only allowed with Compressed or Default */
+		CHECK_ERROR_ROW_TYPE_NEEDS_FILE_PER_TABLE;
+		CHECK_ERROR_ROW_TYPE_NEEDS_GT_ANTELOPE;
+		/* fall through since dynamic also shuns KBS */
+	case ROW_TYPE_COMPACT:
+	case ROW_TYPE_REDUNDANT:
 		if (kbs_specified) {
 			push_warning_printf(
 				thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 				ER_ILLEGAL_HA_CREATE_OPTION,
 				"InnoDB: cannot specify ROW_FORMAT = %s"
 				" with KEY_BLOCK_SIZE.",
-				get_row_format_name(row_type));
-				ret = FALSE;
+				get_row_format_name(row_format));
+			ret = FALSE;
 		}
-	default:
+		break;
+	case ROW_TYPE_DEFAULT:
+		break;
+	case ROW_TYPE_FIXED:
+	case ROW_TYPE_PAGE:
+	case ROW_TYPE_NOT_USED:
+		push_warning(
+			thd, MYSQL_ERROR::WARN_LEVEL_WARN,
+			ER_ILLEGAL_HA_CREATE_OPTION,		\
+			"InnoDB: invalid ROW_FORMAT specifier.");
+		ret = FALSE;
 		break;
 	}
 
@@ -6498,7 +6495,7 @@ ha_innobase::create(
 	const ulint	file_format = srv_file_format;
 	const char*	stmt;
 	size_t		stmt_len;
-	enum row_type	row_type;
+	enum row_type	row_format;
 
 	DBUG_ENTER("ha_innobase::create");
 
@@ -6598,8 +6595,8 @@ ha_innobase::create(
 			push_warning(
 				thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 				ER_ILLEGAL_HA_CREATE_OPTION,
-				"InnoDB: KEY_BLOCK_SIZE"
-				" requires innodb_file_per_table.");
+				"InnoDB: KEY_BLOCK_SIZE requires"
+				" innodb_file_per_table.");
 			flags = 0;
 		}
 
@@ -6616,20 +6613,19 @@ ha_innobase::create(
 			push_warning_printf(
 				thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 				ER_ILLEGAL_HA_CREATE_OPTION,
-				"InnoDB: ignoring"
-				" KEY_BLOCK_SIZE=%lu.",
+				"InnoDB: ignoring KEY_BLOCK_SIZE=%lu.",
 				create_info->key_block_size);
 		}
 	}
 
-	row_type = form->s->row_type;
+	row_format = form->s->row_type;
 
 	if (flags) {
 		/* if ROW_FORMAT is set to default,
 		automatically change it to COMPRESSED.*/
-		if (row_type == ROW_TYPE_DEFAULT) {
-			row_type = ROW_TYPE_COMPRESSED;
-		} else if (row_type != ROW_TYPE_COMPRESSED) {
+		if (row_format == ROW_TYPE_DEFAULT) {
+			row_format = ROW_TYPE_COMPRESSED;
+		} else if (row_format != ROW_TYPE_COMPRESSED) {
 			/* ROW_FORMAT other than COMPRESSED
 			ignores KEY_BLOCK_SIZE.  It does not
 			make sense to reject conflicting
@@ -6646,7 +6642,7 @@ ha_innobase::create(
 		}
 	} else {
 		/* flags == 0 means no KEY_BLOCK_SIZE.*/
-		if (row_type == ROW_TYPE_COMPRESSED) {
+		if (row_format == ROW_TYPE_COMPRESSED) {
 			/* ROW_FORMAT=COMPRESSED without
 			KEY_BLOCK_SIZE implies half the
 			maximum KEY_BLOCK_SIZE. */
@@ -6661,7 +6657,7 @@ ha_innobase::create(
 		}
 	}
 
-	switch (row_type) {
+	switch (row_format) {
 	case ROW_TYPE_REDUNDANT:
 		break;
 	case ROW_TYPE_COMPRESSED:
@@ -6672,25 +6668,25 @@ ha_innobase::create(
 				ER_ILLEGAL_HA_CREATE_OPTION,
 				"InnoDB: ROW_FORMAT=%s requires"
 				" innodb_file_per_table.",
-				get_row_format_name(row_type));
+				get_row_format_name(row_format));
 		} else if (file_format < DICT_TF_FORMAT_ZIP) {
 			push_warning_printf(
 				thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 				ER_ILLEGAL_HA_CREATE_OPTION,
 				"InnoDB: ROW_FORMAT=%s requires"
 				" innodb_file_format > Antelope.",
-				get_row_format_name(row_type));
+				get_row_format_name(row_format));
 		} else {
 			flags |= DICT_TF_COMPACT
-				| (DICT_TF_FORMAT_ZIP
-				   << DICT_TF_FORMAT_SHIFT);
+			         | (DICT_TF_FORMAT_ZIP
+			            << DICT_TF_FORMAT_SHIFT);
 			break;
 		}
 
 		/* fall through */
 	case ROW_TYPE_NOT_USED:
 	case ROW_TYPE_FIXED:
-	default:
+	case ROW_TYPE_PAGE:
 		push_warning(
 			thd, MYSQL_ERROR::WARN_LEVEL_WARN,
 			ER_ILLEGAL_HA_CREATE_OPTION,
@@ -6808,23 +6804,25 @@ ha_innobase::create(
 	setup at this stage and so we use thd. */
 
 	/* We need to copy the AUTOINC value from the old table if
-	this is an ALTER TABLE or CREATE INDEX because CREATE INDEX
-	does a table copy too. */
+	this is an ALTER|OPTIMIZE TABLE or CREATE INDEX because CREATE INDEX
+	does a table copy too. If query was one of :
+
+		CREATE TABLE ...AUTO_INCREMENT = x; or
+		ALTER TABLE...AUTO_INCREMENT = x;   or
+		OPTIMIZE TABLE t; or
+		CREATE INDEX x on t(...);
+
+	Find out a table definition from the dictionary and get
+	the current value of the auto increment field. Set a new
+	value to the auto increment field if the value is greater
+	than the maximum value in the column. */
 
 	if (((create_info->used_fields & HA_CREATE_USED_AUTO)
 	    || thd_sql_command(thd) == SQLCOM_ALTER_TABLE
+	    || thd_sql_command(thd) == SQLCOM_OPTIMIZE
 	    || thd_sql_command(thd) == SQLCOM_CREATE_INDEX)
 	    && create_info->auto_increment_value > 0) {
 
-		/* Query was one of :
-		CREATE TABLE ...AUTO_INCREMENT = x; or
-		ALTER TABLE...AUTO_INCREMENT = x;   or
-		CREATE INDEX x on t(...);
-		Find out a table definition from the dictionary and get
-		the current value of the auto increment field. Set a new
-		value to the auto increment field if the value is greater
-		than the maximum value in the column. */
-
 		auto_inc_value = create_info->auto_increment_value;
 
 		dict_table_autoinc_lock(innobase_table);

=== modified file 'storage/innodb_plugin/handler/i_s.cc'
--- a/storage/innodb_plugin/handler/i_s.cc	2010-09-28 08:12:34 +0000
+++ b/storage/innodb_plugin/handler/i_s.cc	2011-01-07 03:36:20 +0000
@@ -371,8 +371,16 @@ fill_innodb_trx_from_cache(
 			   row->trx_mysql_thread_id));
 
 		/* trx_query */
-		OK(field_store_string(fields[IDX_TRX_QUERY],
-				      row->trx_query));
+		if (row->trx_query) {
+			/* store will do appropriate character set
+			conversion check */
+			fields[IDX_TRX_QUERY]->store(
+				row->trx_query, strlen(row->trx_query),
+				row->trx_query_cs);
+			fields[IDX_TRX_QUERY]->set_notnull();
+		} else {
+			fields[IDX_TRX_QUERY]->set_null();
+		}
 
 		OK(schema_table_store_record(thd, table));
 	}

=== modified file 'storage/innodb_plugin/include/btr0cur.h'
--- a/storage/innodb_plugin/include/btr0cur.h	2010-11-03 09:16:11 +0000
+++ b/storage/innodb_plugin/include/btr0cur.h	2010-12-21 11:27:22 +0000
@@ -332,10 +332,14 @@ ulint
 btr_cur_del_mark_set_clust_rec(
 /*===========================*/
 	ulint		flags,	/*!< in: undo logging and locking flags */
-	btr_cur_t*	cursor,	/*!< in: cursor */
+	buf_block_t*	block,	/*!< in/out: buffer block of the record */
+	rec_t*		rec,	/*!< in/out: record */
+	dict_index_t*	index,	/*!< in: clustered index of the record */
+	const ulint*	offsets,/*!< in: rec_get_offsets(rec) */
 	ibool		val,	/*!< in: value to set */
 	que_thr_t*	thr,	/*!< in: query thread */
-	mtr_t*		mtr);	/*!< in: mtr */
+	mtr_t*		mtr)	/*!< in: mtr */
+	__attribute__((nonnull));
 /***********************************************************//**
 Sets a secondary index record delete mark to TRUE or FALSE.
 @return	DB_SUCCESS, DB_LOCK_WAIT, or error number */
@@ -481,40 +485,22 @@ btr_estimate_number_of_different_key_val
 /*======================================*/
 	dict_index_t*	index);	/*!< in: index */
 /*******************************************************************//**
-Marks not updated extern fields as not-owned by this record. The ownership
-is transferred to the updated record which is inserted elsewhere in the
+Marks non-updated off-page fields as disowned by this record. The ownership
+must be transferred to the updated record which is inserted elsewhere in the
 index tree. In purge only the owner of externally stored field is allowed
-to free the field.
-@return TRUE if BLOB ownership was transferred */
+to free the field. */
 UNIV_INTERN
-ibool
-btr_cur_mark_extern_inherited_fields(
-/*=================================*/
+void
+btr_cur_disown_inherited_fields(
+/*============================*/
 	page_zip_des_t*	page_zip,/*!< in/out: compressed page whose uncompressed
 				part will be updated, or NULL */
 	rec_t*		rec,	/*!< in/out: record in a clustered index */
 	dict_index_t*	index,	/*!< in: index of the page */
 	const ulint*	offsets,/*!< in: array returned by rec_get_offsets() */
 	const upd_t*	update,	/*!< in: update vector */
-	mtr_t*		mtr);	/*!< in: mtr, or NULL if not logged */
-/*******************************************************************//**
-The complement of the previous function: in an update entry may inherit
-some externally stored fields from a record. We must mark them as inherited
-in entry, so that they are not freed in a rollback. */
-UNIV_INTERN
-void
-btr_cur_mark_dtuple_inherited_extern(
-/*=================================*/
-	dtuple_t*	entry,		/*!< in/out: updated entry to be
-					inserted to clustered index */
-	const upd_t*	update);	/*!< in: update vector */
-/*******************************************************************//**
-Marks all extern fields in a dtuple as owned by the record. */
-UNIV_INTERN
-void
-btr_cur_unmark_dtuple_extern_fields(
-/*================================*/
-	dtuple_t*	entry);		/*!< in/out: clustered index entry */
+	mtr_t*		mtr)	/*!< in/out: mini-transaction */
+	__attribute__((nonnull(2,3,4,5,6)));
 /*******************************************************************//**
 Stores the fields in big_rec_vec to the tablespace and puts pointers to
 them in rec.  The extern flags in rec will have to be set beforehand.

=== modified file 'storage/innodb_plugin/include/data0data.h'
--- a/storage/innodb_plugin/include/data0data.h	2009-05-25 12:09:24 +0000
+++ b/storage/innodb_plugin/include/data0data.h	2010-12-21 09:39:19 +0000
@@ -154,14 +154,19 @@ dfield_dup(
 	dfield_t*	field,	/*!< in/out: data field */
 	mem_heap_t*	heap);	/*!< in: memory heap where allocated */
 /*********************************************************************//**
-Tests if data length and content is equal for two dfields.
-@return	TRUE if equal */
+Tests if two data fields are equal.
+If len==0, tests the data length and content for equality.
+If len>0, tests the first len bytes of the content for equality.
+@return	TRUE if both fields are NULL or if they are equal */
 UNIV_INLINE
 ibool
 dfield_datas_are_binary_equal(
 /*==========================*/
 	const dfield_t*	field1,	/*!< in: field */
-	const dfield_t*	field2);/*!< in: field */
+	const dfield_t*	field2,	/*!< in: field */
+	ulint		len)	/*!< in: maximum prefix to compare,
+				or 0 to compare the whole field length */
+	__attribute__((nonnull, warn_unused_result));
 /*********************************************************************//**
 Tests if dfield data length and content is equal to the given.
 @return	TRUE if equal */

=== modified file 'storage/innodb_plugin/include/data0data.ic'
--- a/storage/innodb_plugin/include/data0data.ic	2009-05-25 12:09:24 +0000
+++ b/storage/innodb_plugin/include/data0data.ic	2010-12-21 09:39:19 +0000
@@ -229,20 +229,30 @@ dfield_dup(
 }
 
 /*********************************************************************//**
-Tests if data length and content is equal for two dfields.
-@return	TRUE if equal */
+Tests if two data fields are equal.
+If len==0, tests the data length and content for equality.
+If len>0, tests the first len bytes of the content for equality.
+@return	TRUE if both fields are NULL or if they are equal */
 UNIV_INLINE
 ibool
 dfield_datas_are_binary_equal(
 /*==========================*/
 	const dfield_t*	field1,	/*!< in: field */
-	const dfield_t*	field2)	/*!< in: field */
+	const dfield_t*	field2,	/*!< in: field */
+	ulint		len)	/*!< in: maximum prefix to compare,
+				or 0 to compare the whole field length */
 {
-	ulint	len;
+	ulint	len2 = len;
 
-	len = field1->len;
+	if (field1->len == UNIV_SQL_NULL || len == 0 || field1->len < len) {
+		len = field1->len;
+	}
 
-	return(len == field2->len
+	if (field2->len == UNIV_SQL_NULL || len2 == 0 || field2->len < len2) {
+		len2 = field2->len;
+	}
+
+	return(len == len2
 	       && (len == UNIV_SQL_NULL
 		   || !memcmp(field1->data, field2->data, len)));
 }

=== modified file 'storage/innodb_plugin/include/row0upd.h'
--- a/storage/innodb_plugin/include/row0upd.h	2010-11-03 09:16:11 +0000
+++ b/storage/innodb_plugin/include/row0upd.h	2010-12-21 11:27:22 +0000
@@ -286,10 +286,13 @@ row_upd_changes_ord_field_binary(
 				row and the data values in update are not
 				known when this function is called, e.g., at
 				compile time */
+	const row_ext_t*ext,	/*!< NULL, or prefixes of the externally
+				stored columns in the old row */
 	dict_index_t*	index,	/*!< in: index of the record */
-	const upd_t*	update);/*!< in: update vector for the row; NOTE: the
+	const upd_t*	update)	/*!< in: update vector for the row; NOTE: the
 				field numbers in this MUST be clustered index
 				positions! */
+	__attribute__((nonnull(3,4), warn_unused_result));
 /***********************************************************//**
 Checks if an update vector changes an ordering field of an index record.
 This function is fast if the update vector is short or the number of ordering
@@ -462,11 +465,16 @@ struct upd_node_struct{
 #define UPD_NODE_INSERT_CLUSTERED  3	/* clustered index record should be
 					inserted, old record is already delete
 					marked */
-#define UPD_NODE_UPDATE_ALL_SEC	   4	/* an ordering field of the clustered
+#define UPD_NODE_INSERT_BLOB	   4	/* clustered index record should be
+					inserted, old record is already
+					delete-marked; non-updated BLOBs
+					should be inherited by the new record
+					and disowned by the old record */
+#define UPD_NODE_UPDATE_ALL_SEC	   5	/* an ordering field of the clustered
 					index record was changed, or this is
 					a delete operation: should update
 					all the secondary index records */
-#define	UPD_NODE_UPDATE_SOME_SEC   5	/* secondary index entries should be
+#define UPD_NODE_UPDATE_SOME_SEC   6	/* secondary index entries should be
 					looked at and updated if an ordering
 					field changed */
 

=== modified file 'storage/innodb_plugin/include/trx0i_s.h'
--- a/storage/innodb_plugin/include/trx0i_s.h	2009-11-02 09:42:56 +0000
+++ b/storage/innodb_plugin/include/trx0i_s.h	2011-01-07 03:36:20 +0000
@@ -110,6 +110,8 @@ struct i_s_trx_row_struct {
 						/*!< thd_get_thread_id() */
 	const char*		trx_query;	/*!< MySQL statement being
 						executed in the transaction */
+	struct charset_info_st*	trx_query_cs;	/*!< charset encode the MySQL
+						statement */
 };
 
 /** This structure represents INFORMATION_SCHEMA.innodb_lock_waits row */

=== modified file 'storage/innodb_plugin/include/univ.i'
--- a/storage/innodb_plugin/include/univ.i	2010-11-03 01:40:53 +0000
+++ b/storage/innodb_plugin/include/univ.i	2011-01-08 14:51:19 +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	14
+#define INNODB_VERSION_BUGFIX	15
 
 /* The following is the InnoDB version as shown in
 SELECT plugin_version FROM information_schema.plugins;

=== modified file 'storage/innodb_plugin/log/log0recv.c'
--- a/storage/innodb_plugin/log/log0recv.c	2010-09-15 15:32:12 +0000
+++ b/storage/innodb_plugin/log/log0recv.c	2011-01-06 07:12:53 +0000
@@ -2188,7 +2188,7 @@ recv_report_corrupt_log(
 	      "InnoDB: far enough in recovery! Please run CHECK TABLE\n"
 	      "InnoDB: on your InnoDB tables to check that they are ok!\n"
 	      "InnoDB: If mysqld crashes after this recovery, look at\n"
-	      "InnoDB: " REFMAN "forcing-recovery.html\n"
+	      "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
 	      "InnoDB: about forcing recovery.\n", stderr);
 
 	fflush(stderr);

=== modified file 'storage/innodb_plugin/plug.in'
--- a/storage/innodb_plugin/plug.in	2010-10-19 14:32:26 +0000
+++ b/storage/innodb_plugin/plug.in	2011-01-07 14:52:44 +0000
@@ -17,6 +17,9 @@
 MYSQL_STORAGE_ENGINE(innodb_plugin,, [InnoDB Storage Engine],
         [Transactional Tables using InnoDB], [max,max-no-ndb])
 MYSQL_PLUGIN_DIRECTORY(innodb_plugin, [storage/innodb_plugin])
+# Enable if you know what you are doing (trying to link both InnoDB and
+# InnoDB Plugin statically into MySQL does not work).
+#MYSQL_PLUGIN_STATIC(innodb_plugin, [libinnobase.a])
 MYSQL_PLUGIN_DYNAMIC(innodb_plugin,  [ha_innodb_plugin.la])
 MYSQL_PLUGIN_ACTIONS(innodb_plugin,  [
   AC_CHECK_HEADERS(sched.h)
@@ -136,17 +139,24 @@ MYSQL_PLUGIN_ACTIONS(innodb_plugin,  [
   )
 
   AC_MSG_CHECKING(whether Solaris libc atomic functions are available)
-  # either define HAVE_IB_SOLARIS_ATOMICS or not
-  AC_CHECK_FUNCS(atomic_cas_ulong \
+  # Define HAVE_IB_SOLARIS_ATOMICS if _all_ of the following
+  # functions are present.
+  AC_CHECK_FUNCS(atomic_add_long_nv \
 		 atomic_cas_32 \
 		 atomic_cas_64 \
-		 atomic_add_long_nv \
-		 atomic_swap_uchar,
+		 atomic_cas_ulong \
+		 atomic_swap_uchar)
 
-		 AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1],
-			   [Define to 1 if Solaris libc atomic functions \
-			    are available])
-  )
+  if test "${ac_cv_func_atomic_add_long_nv}" = "yes" -a \
+          "${ac_cv_func_atomic_cas_32}" = "yes" -a \
+          "${ac_cv_func_atomic_cas_64}" = "yes" -a \
+          "${ac_cv_func_atomic_cas_ulong}" = "yes" -a \
+          "${ac_cv_func_atomic_swap_uchar}" = "yes" ; then
+
+    AC_DEFINE([HAVE_IB_SOLARIS_ATOMICS], [1],
+      [Define to 1 if Solaris libc atomic functions are available]
+    )
+  fi
 
   AC_MSG_CHECKING(whether pthread_t can be used by Solaris libc atomic functions)
   # either define HAVE_IB_ATOMIC_PTHREAD_T_SOLARIS or not

=== modified file 'storage/innodb_plugin/row/row0mysql.c'
--- a/storage/innodb_plugin/row/row0mysql.c	2010-12-16 14:40:52 +0000
+++ b/storage/innodb_plugin/row/row0mysql.c	2011-01-06 07:12:53 +0000
@@ -573,7 +573,7 @@ handle_new_error:
 		      "InnoDB: If the mysqld server crashes"
 		      " after the startup or when\n"
 		      "InnoDB: you dump the tables, look at\n"
-		      "InnoDB: " REFMAN "forcing-recovery.html"
+		      "InnoDB: " REFMAN "forcing-innodb-recovery.html"
 		      " for help.\n", stderr);
 		break;
 	case DB_FOREIGN_EXCEED_MAX_CASCADE:

=== modified file 'storage/innodb_plugin/row/row0purge.c'
--- a/storage/innodb_plugin/row/row0purge.c	2010-09-15 15:37:24 +0000
+++ b/storage/innodb_plugin/row/row0purge.c	2010-12-21 09:39:19 +0000
@@ -413,7 +413,7 @@ row_purge_upd_exist_or_extern(
 	while (node->index != NULL) {
 		index = node->index;
 
-		if (row_upd_changes_ord_field_binary(NULL, node->index,
+		if (row_upd_changes_ord_field_binary(NULL, NULL, node->index,
 						     node->update)) {
 			/* Build the older version of the index entry */
 			entry = row_build_index_entry(node->row, NULL,

=== modified file 'storage/innodb_plugin/row/row0umod.c'
--- a/storage/innodb_plugin/row/row0umod.c	2010-09-15 15:41:35 +0000
+++ b/storage/innodb_plugin/row/row0umod.c	2010-12-21 11:27:22 +0000
@@ -668,19 +668,18 @@ row_undo_mod_upd_exist_sec(
 	while (node->index != NULL) {
 		index = node->index;
 
-		if (row_upd_changes_ord_field_binary(node->row, node->index,
-						     node->update)) {
+		if (row_upd_changes_ord_field_binary(
+			    node->row, node->ext, node->index, node->update)) {
 
 			/* Build the newest version of the index entry */
 			entry = row_build_index_entry(node->row, node->ext,
 						      index, heap);
 			if (UNIV_UNLIKELY(!entry)) {
 				/* The server must have crashed in
-				row_upd_clust_rec_by_insert(), in
-				row_ins_index_entry_low() before
-				btr_store_big_rec_extern_fields()
-				has written the externally stored columns
-				(BLOBs) of the new clustered index entry. */
+				row_upd_clust_rec_by_insert() before
+				the updated externally stored columns (BLOBs)
+				of the new clustered index entry were
+				written. */
 
 				/* The table must be in DYNAMIC or COMPRESSED
 				format.  REDUNDANT and COMPACT formats

=== modified file 'storage/innodb_plugin/row/row0upd.c'
--- a/storage/innodb_plugin/row/row0upd.c	2010-11-03 09:16:11 +0000
+++ b/storage/innodb_plugin/row/row0upd.c	2010-12-28 04:55:49 +0000
@@ -1198,20 +1198,21 @@ row_upd_changes_ord_field_binary(
 				row and the data values in update are not
 				known when this function is called, e.g., at
 				compile time */
+	const row_ext_t*ext,	/*!< NULL, or prefixes of the externally
+				stored columns in the old row */
 	dict_index_t*	index,	/*!< in: index of the record */
 	const upd_t*	update)	/*!< in: update vector for the row; NOTE: the
 				field numbers in this MUST be clustered index
 				positions! */
 {
-	ulint		n_unique;
-	ulint		n_upd_fields;
-	ulint		i, j;
-	dict_index_t*	clust_index;
+	ulint			n_unique;
+	ulint			i;
+	const dict_index_t*	clust_index;
 
-	ut_ad(update && index);
+	ut_ad(update);
+	ut_ad(index);
 
 	n_unique = dict_index_get_n_unique(index);
-	n_upd_fields = upd_get_n_fields(update);
 
 	clust_index = dict_table_get_first_index(index->table);
 
@@ -1219,33 +1220,72 @@ row_upd_changes_ord_field_binary(
 
 		const dict_field_t*	ind_field;
 		const dict_col_t*	col;
-		ulint			col_pos;
 		ulint			col_no;
+		const upd_field_t*	upd_field;
+		const dfield_t*		dfield;
+		dfield_t		dfield_ext;
+		ulint			dfield_len;
+		const byte*		buf;
 
 		ind_field = dict_index_get_nth_field(index, i);
 		col = dict_field_get_col(ind_field);
-		col_pos = dict_col_get_clust_pos(col, clust_index);
 		col_no = dict_col_get_no(col);
 
-		for (j = 0; j < n_upd_fields; j++) {
+		upd_field = upd_get_field_by_field_no(
+			update, dict_col_get_clust_pos(col, clust_index));
 
-			const upd_field_t*	upd_field
-				= upd_get_nth_field(update, j);
+		if (upd_field == NULL) {
+			continue;
+		}
+
+		if (row == NULL) {
+			ut_ad(ext == NULL);
+			return(TRUE);
+		}
 
-			/* Note that if the index field is a column prefix
-			then it may be that row does not contain an externally
-			stored part of the column value, and we cannot compare
-			the datas */
+		dfield = dtuple_get_nth_field(row, col_no);
 
-			if (col_pos == upd_field->field_no
-			    && (row == NULL
-				|| ind_field->prefix_len > 0
-				|| !dfield_datas_are_binary_equal(
-					dtuple_get_nth_field(row, col_no),
-					&(upd_field->new_val)))) {
+		/* This treatment of column prefix indexes is loosely
+		based on row_build_index_entry(). */
 
-				return(TRUE);
+		if (UNIV_LIKELY(ind_field->prefix_len == 0)
+		    || dfield_is_null(dfield)) {
+			/* do nothing special */
+		} else if (UNIV_LIKELY_NULL(ext)) {
+			/* See if the column is stored externally. */
+			buf = row_ext_lookup(ext, col_no, &dfield_len);
+
+			ut_ad(col->ord_part);
+
+			if (UNIV_LIKELY_NULL(buf)) {
+				if (UNIV_UNLIKELY(buf == field_ref_zero)) {
+					/* This should never happen, but
+					we try to fail safe here. */
+					ut_ad(0);
+					return(TRUE);
+				}
+
+				goto copy_dfield;
 			}
+		} else if (dfield_is_ext(dfield)) {
+			dfield_len = dfield_get_len(dfield);
+			ut_a(dfield_len > BTR_EXTERN_FIELD_REF_SIZE);
+			dfield_len -= BTR_EXTERN_FIELD_REF_SIZE;
+			ut_a(dict_index_is_clust(index)
+			     || ind_field->prefix_len <= dfield_len);
+			buf = dfield_get_data(dfield);
+copy_dfield:
+			ut_a(dfield_len > 0);
+			dfield_copy(&dfield_ext, dfield);
+			dfield_set_data(&dfield_ext, buf, dfield_len);
+			dfield = &dfield_ext;
+		}
+
+		if (!dfield_datas_are_binary_equal(
+			    dfield, &upd_field->new_val,
+			    ind_field->prefix_len)) {
+
+			return(TRUE);
 		}
 	}
 
@@ -1329,7 +1369,7 @@ row_upd_changes_first_fields_binary(
 			if (col_pos == upd_field->field_no
 			    && !dfield_datas_are_binary_equal(
 				    dtuple_get_nth_field(entry, i),
-				    &(upd_field->new_val))) {
+				    &upd_field->new_val, 0)) {
 
 				return(TRUE);
 			}
@@ -1568,14 +1608,99 @@ row_upd_sec_step(
 	ut_ad(!dict_index_is_clust(node->index));
 
 	if (node->state == UPD_NODE_UPDATE_ALL_SEC
-	    || row_upd_changes_ord_field_binary(node->row, node->index,
-						node->update)) {
+	    || row_upd_changes_ord_field_binary(node->row, node->ext,
+						node->index, node->update)) {
 		return(row_upd_sec_index_entry(node, thr));
 	}
 
 	return(DB_SUCCESS);
 }
 
+#ifdef UNIV_DEBUG
+# define row_upd_clust_rec_by_insert_inherit(rec,offsets,entry,update)	\
+	row_upd_clust_rec_by_insert_inherit_func(rec,offsets,entry,update)
+#else /* UNIV_DEBUG */
+# define row_upd_clust_rec_by_insert_inherit(rec,offsets,entry,update)	\
+	row_upd_clust_rec_by_insert_inherit_func(entry,update)
+#endif /* UNIV_DEBUG */
+/*******************************************************************//**
+Mark non-updated off-page columns inherited when the primary key is
+updated. We must mark them as inherited in entry, so that they are not
+freed in a rollback. A limited version of this function used to be
+called btr_cur_mark_dtuple_inherited_extern().
+@return TRUE if any columns were inherited */
+static __attribute__((warn_unused_result))
+ibool
+row_upd_clust_rec_by_insert_inherit_func(
+/*=====================================*/
+#ifdef UNIV_DEBUG
+	const rec_t*	rec,	/*!< in: old record, or NULL */
+	const ulint*	offsets,/*!< in: rec_get_offsets(rec), or NULL */
+#endif /* UNIV_DEBUG */
+	dtuple_t*	entry,	/*!< in/out: updated entry to be
+				inserted into the clustered index */
+	const upd_t*	update)	/*!< in: update vector */
+{
+	ibool	inherit	= FALSE;
+	ulint	i;
+
+	ut_ad(!rec == !offsets);
+	ut_ad(!rec || rec_offs_any_extern(offsets));
+
+	for (i = 0; i < dtuple_get_n_fields(entry); i++) {
+		dfield_t*	dfield	= dtuple_get_nth_field(entry, i);
+		byte*		data;
+		ulint		len;
+
+		ut_ad(!offsets
+		      || !rec_offs_nth_extern(offsets, i)
+		      == !dfield_is_ext(dfield)
+		      || upd_get_field_by_field_no(update, i));
+		if (!dfield_is_ext(dfield)
+		    || upd_get_field_by_field_no(update, i)) {
+			continue;
+		}
+
+#ifdef UNIV_DEBUG
+		if (UNIV_LIKELY(rec != NULL)) {
+			const byte* rec_data
+				= rec_get_nth_field(rec, offsets, i, &len);
+			ut_ad(len == dfield_get_len(dfield));
+			ut_ad(len != UNIV_SQL_NULL);
+			ut_ad(len >= BTR_EXTERN_FIELD_REF_SIZE);
+
+			rec_data += len - BTR_EXTERN_FIELD_REF_SIZE;
+
+			/* The pointer must not be zero. */
+			ut_ad(memcmp(rec_data, field_ref_zero,
+				     BTR_EXTERN_FIELD_REF_SIZE));
+			/* The BLOB must be owned. */
+			ut_ad(!(rec_data[BTR_EXTERN_LEN]
+				& BTR_EXTERN_OWNER_FLAG));
+		}
+#endif /* UNIV_DEBUG */
+
+		len = dfield_get_len(dfield);
+		ut_a(len != UNIV_SQL_NULL);
+		ut_a(len >= BTR_EXTERN_FIELD_REF_SIZE);
+		data = dfield_get_data(dfield);
+		data += len - BTR_EXTERN_FIELD_REF_SIZE;
+		/* The pointer must not be zero. */
+		ut_a(memcmp(data, field_ref_zero, BTR_EXTERN_FIELD_REF_SIZE));
+		/* The BLOB must be owned. */
+		ut_a(!(data[BTR_EXTERN_LEN] & BTR_EXTERN_OWNER_FLAG));
+
+		data[BTR_EXTERN_LEN] |= BTR_EXTERN_INHERITED_FLAG;
+		/* The BTR_EXTERN_INHERITED_FLAG only matters in
+		rollback. Purge will always free the extern fields of
+		a delete-marked row. */
+
+		inherit = TRUE;
+	}
+
+	return(inherit);
+}
+
 /***********************************************************//**
 Marks the clustered index record deleted and inserts the updated version
 of the record to the index. This function should be used when the ordering
@@ -1594,14 +1719,16 @@ row_upd_clust_rec_by_insert(
 				a foreign key constraint */
 	mtr_t*		mtr)	/*!< in/out: mtr; gets committed here */
 {
-	mem_heap_t*	heap	= NULL;
+	mem_heap_t*	heap;
 	btr_pcur_t*	pcur;
 	btr_cur_t*	btr_cur;
 	trx_t*		trx;
 	dict_table_t*	table;
 	dtuple_t*	entry;
 	ulint		err;
-	ibool		change_ownership = FALSE;
+	ibool		change_ownership	= FALSE;
+	rec_t*		rec;
+	ulint*		offsets			= NULL;
 
 	ut_ad(node);
 	ut_ad(dict_index_is_clust(index));
@@ -1611,77 +1738,112 @@ row_upd_clust_rec_by_insert(
 	pcur = node->pcur;
 	btr_cur	= btr_pcur_get_btr_cur(pcur);
 
-	if (node->state != UPD_NODE_INSERT_CLUSTERED) {
-		rec_t*		rec;
-		dict_index_t*	index;
-		ulint		offsets_[REC_OFFS_NORMAL_SIZE];
-		ulint*		offsets;
-		rec_offs_init(offsets_);
+	heap = mem_heap_create(1000);
+
+	entry = row_build_index_entry(node->upd_row, node->upd_ext,
+				      index, heap);
+	ut_a(entry);
+
+	row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id);
+
+	switch (node->state) {
+	default:
+		ut_error;
+	case UPD_NODE_INSERT_BLOB:
+		/* A lock wait occurred in row_ins_index_entry() in
+		the previous invocation of this function. Mark the
+		off-page columns in the entry inherited. */
+
+		change_ownership = row_upd_clust_rec_by_insert_inherit(
+			NULL, NULL, entry, node->update);
+		ut_a(change_ownership);
+		/* fall through */
+	case UPD_NODE_INSERT_CLUSTERED:
+		/* A lock wait occurred in row_ins_index_entry() in
+		the previous invocation of this function. */
+		break;
+	case UPD_NODE_UPDATE_CLUSTERED:
+		/* This is the first invocation of the function where
+		we update the primary key.  Delete-mark the old record
+		in the clustered index and prepare to insert a new entry. */
+		rec = btr_cur_get_rec(btr_cur);
+		offsets = rec_get_offsets(rec, index, NULL,
+					  ULINT_UNDEFINED, &heap);
+		ut_ad(page_rec_is_user_rec(rec));
 
-		err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG,
-						     btr_cur, TRUE, thr, mtr);
+		err = btr_cur_del_mark_set_clust_rec(
+			BTR_NO_LOCKING_FLAG, btr_cur_get_block(btr_cur),
+			rec, index, offsets, TRUE, thr, mtr);
 		if (err != DB_SUCCESS) {
+err_exit:
 			mtr_commit(mtr);
+			mem_heap_free(heap);
 			return(err);
 		}
 
-		/* Mark as not-owned the externally stored fields which the new
-		row inherits from the delete marked record: purge should not
-		free those externally stored fields even if the delete marked
-		record is removed from the index tree, or updated. */
+		/* If the the new row inherits externally stored
+		fields (off-page columns a.k.a. BLOBs) from the
+		delete-marked old record, mark them disowned by the
+		old record and owned by the new entry. */
+
+		if (rec_offs_any_extern(offsets)) {
+			change_ownership = row_upd_clust_rec_by_insert_inherit(
+				rec, offsets, entry, node->update);
+
+			if (change_ownership) {
+				btr_pcur_store_position(pcur, mtr);
+			}
+		}
 
-		rec = btr_cur_get_rec(btr_cur);
-		index = dict_table_get_first_index(table);
-		offsets = rec_get_offsets(rec, index, offsets_,
-					  ULINT_UNDEFINED, &heap);
-		change_ownership = btr_cur_mark_extern_inherited_fields(
-			btr_cur_get_page_zip(btr_cur), rec, index, offsets,
-			node->update, mtr);
 		if (check_ref) {
 			/* NOTE that the following call loses
 			the position of pcur ! */
 			err = row_upd_check_references_constraints(
 				node, pcur, table, index, offsets, thr, mtr);
 			if (err != DB_SUCCESS) {
-				mtr_commit(mtr);
-				if (UNIV_LIKELY_NULL(heap)) {
-					mem_heap_free(heap);
-				}
-				return(err);
+				goto err_exit;
 			}
 		}
 	}
 
 	mtr_commit(mtr);
 
-	if (!heap) {
-		heap = mem_heap_create(500);
-	}
-	node->state = UPD_NODE_INSERT_CLUSTERED;
-
-	entry = row_build_index_entry(node->upd_row, node->upd_ext,
-				      index, heap);
-	ut_a(entry);
+	err = row_ins_index_entry(index, entry,
+				  node->upd_ext ? node->upd_ext->n_ext : 0,
+				  TRUE, thr);
+	node->state = change_ownership
+		? UPD_NODE_INSERT_BLOB
+		: UPD_NODE_INSERT_CLUSTERED;
+
+	if (err == DB_SUCCESS && change_ownership) {
+		/* Mark the non-updated fields disowned by the old record. */
+
+		/* NOTE: this transaction has an x-lock on the record
+		and therefore other transactions cannot modify the
+		record when we have no latch on the page. In addition,
+		we assume that other query threads of the same
+		transaction do not modify the record in the meantime.
+		Therefore we can assert that the restoration of the
+		cursor succeeds. */
 
-	row_upd_index_entry_sys_field(entry, index, DATA_TRX_ID, trx->id);
+		mtr_start(mtr);
 
-	if (change_ownership) {
-		/* If we return from a lock wait, for example, we may have
-		extern fields marked as not-owned in entry (marked in the
-		if-branch above). We must unmark them, take the ownership
-		back. */
+		if (!btr_pcur_restore_position(BTR_MODIFY_LEAF, pcur, mtr)) {
+			ut_error;
+		}
 
-		btr_cur_unmark_dtuple_extern_fields(entry);
+		rec = btr_cur_get_rec(btr_cur);
+		offsets = rec_get_offsets(rec, index, offsets,
+					  ULINT_UNDEFINED, &heap);
+		ut_ad(page_rec_is_user_rec(rec));
 
-		/* We must mark non-updated extern fields in entry as
-		inherited, so that a possible rollback will not free them. */
+		btr_cur_disown_inherited_fields(
+			btr_cur_get_page_zip(btr_cur),
+			rec, index, offsets, node->update, mtr);
 
-		btr_cur_mark_dtuple_inherited_extern(entry, node->update);
+		mtr_commit(mtr);
 	}
 
-	err = row_ins_index_entry(index, entry,
-				  node->upd_ext ? node->upd_ext->n_ext : 0,
-				  TRUE, thr);
 	mem_heap_free(heap);
 
 	return(err);
@@ -1825,8 +1987,9 @@ row_upd_del_mark_clust_rec(
 	/* Mark the clustered index record deleted; we do not have to check
 	locks, because we assume that we have an x-lock on the record */
 
-	err = btr_cur_del_mark_set_clust_rec(BTR_NO_LOCKING_FLAG,
-					     btr_cur, TRUE, thr, mtr);
+	err = btr_cur_del_mark_set_clust_rec(
+		BTR_NO_LOCKING_FLAG, btr_cur_get_block(btr_cur),
+		btr_cur_get_rec(btr_cur), index, offsets, TRUE, thr, mtr);
 	if (err == DB_SUCCESS && check_ref) {
 		/* NOTE that the following call loses the position of pcur ! */
 
@@ -1973,7 +2136,8 @@ exit_func:
 
 	row_upd_store_row(node);
 
-	if (row_upd_changes_ord_field_binary(node->row, index, node->update)) {
+	if (row_upd_changes_ord_field_binary(node->row, node->ext, index,
+					     node->update)) {
 
 		/* Update causes an ordering field (ordering fields within
 		the B-tree) of the clustered index record to change: perform
@@ -2042,7 +2206,8 @@ row_upd(
 	}
 
 	if (node->state == UPD_NODE_UPDATE_CLUSTERED
-	    || node->state == UPD_NODE_INSERT_CLUSTERED) {
+	    || node->state == UPD_NODE_INSERT_CLUSTERED
+	    || node->state == UPD_NODE_INSERT_BLOB) {
 
 		log_free_check();
 		err = row_upd_clust_step(node, thr);

=== modified file 'storage/innodb_plugin/trx/trx0i_s.c'
--- a/storage/innodb_plugin/trx/trx0i_s.c	2010-11-11 09:55:35 +0000
+++ b/storage/innodb_plugin/trx/trx0i_s.c	2011-01-07 03:36:20 +0000
@@ -435,7 +435,7 @@ i_s_locks_row_validate(
 		/* record lock */
 		ut_ad(!strcmp("RECORD", row->lock_type));
 		ut_ad(row->lock_index != NULL);
-		ut_ad(row->lock_data != NULL);
+		/* row->lock_data == NULL if buf_page_try_get() == NULL */
 		ut_ad(row->lock_page != ULINT_UNDEFINED);
 		ut_ad(row->lock_rec != ULINT_UNDEFINED);
 	}
@@ -498,7 +498,6 @@ fill_trx_row(
 	stmt = innobase_get_stmt(trx->mysql_thd, &stmt_len);
 
 	if (stmt != NULL) {
-
 		char	query[TRX_I_S_TRX_QUERY_MAX_LEN + 1];
 
 		if (stmt_len > TRX_I_S_TRX_QUERY_MAX_LEN) {
@@ -512,6 +511,8 @@ fill_trx_row(
 			cache->storage, stmt, stmt_len + 1,
 			MAX_ALLOWED_FOR_STORAGE(cache));
 
+		row->trx_query_cs = innobase_get_charset(trx->mysql_thd);
+
 		if (row->trx_query == NULL) {
 
 			return(FALSE);

=== modified file 'storage/innodb_plugin/ut/ut0dbg.c'
--- a/storage/innodb_plugin/ut/ut0dbg.c	2009-05-25 12:09:24 +0000
+++ b/storage/innodb_plugin/ut/ut0dbg.c	2011-01-06 07:12:53 +0000
@@ -79,7 +79,7 @@ ut_dbg_assertion_failed(
 	      " or crashes, even\n"
 	      "InnoDB: immediately after the mysqld startup, there may be\n"
 	      "InnoDB: corruption in the InnoDB tablespace. Please refer to\n"
-	      "InnoDB: " REFMAN "forcing-recovery.html\n"
+	      "InnoDB: " REFMAN "forcing-innodb-recovery.html\n"
 	      "InnoDB: about forcing recovery.\n", stderr);
 #if defined(UNIV_SYNC_DEBUG) || !defined(UT_DBG_USE_ABORT)
 	ut_dbg_stop_threads = TRUE;

No bundle (reason: revision is a merge).
Thread
bzr commit into mysql-5.1-mtr branch (bjorn.munch:2963) Bjorn Munch10 Jan