List:Commits« Previous MessageNext Message »
From:Marc Alff Date:December 22 2011 9:26am
Subject:bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3456 to 3457)
View as plain text  
 3457 Marc Alff	2011-12-22 [merge]
      Merge mysql-trunk --> mysql-trunk-pfs-tuning

    added:
      mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_1.inc
      mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_2.inc
    renamed:
      mysql-test/r/mysqlbinlog2.result => mysql-test/r/mysqlbinlog_start_stop.result
      mysql-test/suite/rpl/r/rpl_mts_check_concurrency.result => mysql-test/suite/rpl/r/rpl_mts_debug.result
      mysql-test/suite/rpl/t/rpl_mts_check_concurrency-slave.opt => mysql-test/suite/rpl/t/rpl_mts_debug-slave.opt
      mysql-test/suite/rpl/t/rpl_mts_check_concurrency.test => mysql-test/suite/rpl/t/rpl_mts_debug.test
      mysql-test/t/mysqlbinlog2.test => mysql-test/t/mysqlbinlog_start_stop.test
    modified:
      client/mysql_upgrade.c
      mysql-test/include/order_by.inc
      mysql-test/r/order_by_all.result
      mysql-test/r/order_by_icp_mrr.result
      mysql-test/r/order_by_none.result
      mysql-test/r/partition_list.result
      mysql-test/r/partition_mgm.result
      mysql-test/r/ps_ddl.result
      mysql-test/r/type_temporal_fractional.result
      mysql-test/suite/innodb/r/innodb_buffer_pool_load.result
      mysql-test/suite/innodb/t/innodb_buffer_pool_load.test
      mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result
      mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test
      mysql-test/suite/sys_vars/r/innodb_buffer_pool_filename_basic.result
      mysql-test/suite/sys_vars/r/innodb_buffer_pool_load_now_basic.result
      mysql-test/suite/sys_vars/r/slave_checkpoint_group_basic.result
      mysql-test/suite/sys_vars/r/slave_checkpoint_period_basic.result
      mysql-test/suite/sys_vars/r/slave_parallel_workers_basic.result
      mysql-test/suite/sys_vars/r/slave_pending_jobs_size_max_basic.result
      mysql-test/suite/sys_vars/t/innodb_adaptive_max_sleep_delay_basic.test
      mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test
      mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test
      mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test
      mysql-test/suite/sys_vars/t/slave_checkpoint_group_basic.test
      mysql-test/suite/sys_vars/t/slave_checkpoint_period_basic.test
      mysql-test/suite/sys_vars/t/slave_parallel_workers_basic.test
      mysql-test/suite/sys_vars/t/slave_pending_jobs_size_max_basic.test
      mysql-test/t/partition_list.test
      mysql-test/t/partition_mgm.test
      mysql-test/t/ps_ddl.test
      mysql-test/t/type_temporal_fractional.test
      mysql-test/t/xa.test
      sql/field.h
      sql/ha_partition.cc
      sql/item.h
      sql/item_func.cc
      sql/item_sum.cc
      sql/item_sum.h
      sql/item_timefunc.h
      sql/mysqld.cc
      sql/mysqld.h
      sql/partition_element.h
      sql/partition_info.cc
      sql/partition_info.h
      sql/rpl_info_factory.cc
      sql/rpl_rli.cc
      sql/rpl_rli.h
      sql/rpl_rli_pdb.cc
      sql/rpl_slave.cc
      sql/rpl_slave.h
      sql/sql_admin.cc
      sql/sql_base.cc
      sql/sql_executor.cc
      sql/sql_partition.cc
      sql/sql_partition.h
      sql/sql_select.cc
      sql/sql_view.cc
      sql/sql_yacc.yy
      sql/sys_vars.cc
      sql/table.h
      sql/unireg.h
      storage/innobase/buf/buf0flu.cc
      storage/innobase/include/os0file.h
      storage/innobase/include/trx0sys.h
      storage/innobase/include/ut0rnd.ic
      storage/innobase/os/os0file.cc
      storage/innobase/row/row0sel.cc
      storage/innobase/trx/trx0sys.cc
      mysql-test/r/mysqlbinlog_start_stop.result
      mysql-test/suite/rpl/r/rpl_mts_debug.result
      mysql-test/suite/rpl/t/rpl_mts_debug.test
      mysql-test/t/mysqlbinlog_start_stop.test
 3456 Marc Alff	2011-12-19 [merge]
      Merge mysql-trunk --> mysql-trunk-pfs-tuning

    modified:
      storage/innobase/buf/buf0buddy.cc
      storage/innobase/buf/buf0buf.cc
      storage/innobase/buf/buf0flu.cc
      storage/innobase/buf/buf0lru.cc
      storage/innobase/dict/dict0dict.cc
      storage/innobase/dict/dict0mem.cc
      storage/innobase/dyn/dyn0dyn.cc
      storage/innobase/fil/fil0fil.cc
      storage/innobase/include/dict0mem.h
      storage/innobase/include/lock0lock.h
      storage/innobase/include/lock0priv.h
      storage/innobase/include/lock0types.h
      storage/innobase/include/mem0mem.ic
      storage/innobase/include/sync0sync.h
      storage/innobase/include/trx0roll.h
      storage/innobase/include/trx0trx.h
      storage/innobase/include/usr0sess.h
      storage/innobase/include/ut0lst.h
      storage/innobase/lock/lock0iter.cc
      storage/innobase/lock/lock0lock.cc
      storage/innobase/log/log0log.cc
      storage/innobase/log/log0recv.cc
      storage/innobase/mem/mem0mem.cc
      storage/innobase/mem/mem0pool.cc
      storage/innobase/os/os0sync.cc
      storage/innobase/pars/pars0opt.cc
      storage/innobase/pars/pars0pars.cc
      storage/innobase/pars/pars0sym.cc
      storage/innobase/que/que0que.cc
      storage/innobase/read/read0read.cc
      storage/innobase/row/row0ftsort.cc
      storage/innobase/row/row0ins.cc
      storage/innobase/row/row0merge.cc
      storage/innobase/row/row0mysql.cc
      storage/innobase/srv/srv0mon.cc
      storage/innobase/srv/srv0srv.cc
      storage/innobase/sync/sync0rw.cc
      storage/innobase/sync/sync0sync.cc
      storage/innobase/trx/trx0roll.cc
      storage/innobase/trx/trx0rseg.cc
      storage/innobase/trx/trx0sys.cc
      storage/innobase/trx/trx0trx.cc
      storage/innobase/trx/trx0undo.cc
      storage/innobase/usr/usr0sess.cc
      storage/innobase/ut/ut0mem.cc
=== modified file 'client/mysql_upgrade.c'
--- a/client/mysql_upgrade.c	2011-11-15 12:34:23 +0000
+++ b/client/mysql_upgrade.c	2011-12-21 19:46:44 +0000
@@ -243,7 +243,6 @@ get_one_option(int optid, const struct m
   switch (optid) {
 
   case '?':
-    puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2011"));
     printf("%s  Ver %s Distrib %s, for %s (%s)\n",
            my_progname, VER, MYSQL_SERVER_VERSION, SYSTEM_TYPE, MACHINE_TYPE);
     puts(ORACLE_WELCOME_COPYRIGHT_NOTICE("2000, 2010"));

=== added file 'mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_1.inc'
--- a/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_1.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_1.inc	2011-12-20 16:06:32 +0000
@@ -0,0 +1,52 @@
+# ==== Purpose ====
+#
+# Auxiliary file used by main.mysqlbinlog-start-stop.
+#
+# This file runs mysqlbinlog with a fixed set of parameters specifying
+# the source binlog, but varying how the start and stop positions are
+# specified.
+#
+# ==== Usage ====
+#
+# --let $start_position= <binlog offset>
+# --let $stop_position= <binlog offset>
+# --let $start_datetime= <timestamp>
+# --let $stop_datetime= <timestamp>
+# --let $extra_options= <options to mysqlbinlog>
+# --source extra/binlog_tests/mysqlbinlog_start_stop_1.inc
+#
+# Parameters:
+#   $start_position
+#     Offset to pass to --start-position
+#   $stop_position
+#     Offset to pass to --stop-position
+#   $start_datetime
+#     Offset to pass to --start-datetime
+#   $stop_datetime
+#     Offset to pass to --stop-datetime
+#   $extra_options
+#     Options for mysqlbinlog, specifying which input file to read.
+
+--let $option= --base64-output=never
+--source extra/binlog_tests/mysqlbinlog_start_stop_2.inc
+
+--let $option= --offset=2
+--source extra/binlog_tests/mysqlbinlog_start_stop_2.inc
+
+--let $option= --start-position=$start_position
+--source extra/binlog_tests/mysqlbinlog_start_stop_2.inc
+
+--let $option= --stop-position=$stop_position
+--source extra/binlog_tests/mysqlbinlog_start_stop_2.inc
+
+--let $option= --start-position=$start_position --stop-position=$stop_position
+--source extra/binlog_tests/mysqlbinlog_start_stop_2.inc
+
+--let $option= "--start-datetime=$start_datetime"
+--source extra/binlog_tests/mysqlbinlog_start_stop_2.inc
+
+--let $option= "--stop-datetime=$stop_datetime"
+--source extra/binlog_tests/mysqlbinlog_start_stop_2.inc
+
+--let $option= "--start-datetime=$start_datetime" "--stop-datetime=$stop_datetime"
+--source extra/binlog_tests/mysqlbinlog_start_stop_2.inc

=== added file 'mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_2.inc'
--- a/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_2.inc	1970-01-01 00:00:00 +0000
+++ b/mysql-test/extra/binlog_tests/mysqlbinlog_start_stop_2.inc	2011-12-20 16:06:32 +0000
@@ -0,0 +1,33 @@
+# ==== Purpose ====
+#
+# Auxiliary file used by include/mysqlbinlog_start_stop_1.inc
+#
+# This prints a header, then runs mysqlbinlog once with given parameters.
+#
+# ==== Usage ====
+#
+# --let $extra_options= X
+# --let $options= Y
+# --source include/mysqlbinlog-start-stop-2.inc
+#
+# Parameters:
+#
+#   $extra_options
+#     Options that will be passed to mysqlbinlog but not printed to the test log
+#
+#   $options
+#     Options that will be printed as a header in the test log.
+
+
+# Pretty-print $option_text
+--let $option_text= `SELECT SUBSTR(REPLACE('$option', '"', ''), 3)`
+while (`SELECT LOCATE('=', '$option_text')`)
+{
+  --let $dash_pos= `SELECT LOCATE('--', '$option_text')`
+  --let $option_text= `SELECT CONCAT(SUBSTR('$option_text', 1, LOCATE('=', '$option_text') - 1), IF($dash_pos, CONCAT(' ', SUBSTR('$option_text', $dash_pos + 2)), ''))`
+}
+--echo
+--echo ---- $option_text ----
+
+# Print output
+--exec $MYSQL_BINLOG --short-form $option $extra_options

=== modified file 'mysql-test/include/order_by.inc'
--- a/mysql-test/include/order_by.inc	2011-10-12 13:30:13 +0000
+++ b/mysql-test/include/order_by.inc	2011-12-19 09:22:28 +0000
@@ -1738,3 +1738,15 @@ SELECT t1.*, t2.* FROM t1 JOIN t2 ON t1.
   ORDER BY t1.i1 LIMIT 5;
 
 DROP TABLE t1, t2, t3;
+
+--echo #
+--echo # Bug #11885377 VOID JOIN_READ_KEY_UNLOCK_ROW(ST_JOIN_TABLE*): ASSERTION
+--echo # `TAB->REF.USE_COUNT'
+--echo #
+
+CREATE TABLE t1(a INT PRIMARY KEY);
+CREATE TABLE t2(b INT,c INT);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1,2), (2,3);
+SELECT (SELECT 1 FROM t1 WHERE a=b AND c=1 ORDER BY a DESC) FROM t2;
+DROP TABLE t1, t2;

=== renamed file 'mysql-test/r/mysqlbinlog2.result' => 'mysql-test/r/mysqlbinlog_start_stop.result'
--- a/mysql-test/r/mysqlbinlog2.result	2011-12-14 05:03:54 +0000
+++ b/mysql-test/r/mysqlbinlog_start_stop.result	2011-12-20 16:06:32 +0000
@@ -1,26 +1,26 @@
-drop table if exists t1;
-reset master;
-set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22");
-set timestamp=@a;
-create table t1 (a int auto_increment not null primary key, b char(3));
-insert into t1 values(null, "a");
-insert into t1 values(null, "b");
-set timestamp=@a+2;
-insert into t1 values(null, "c");
-set timestamp=@a+4;
-insert into t1 values(null, "d");
-insert into t1 values(null, "e");
-flush logs;
-set timestamp=@a+1;
-insert into t1 values(null, "f");
+CREATE TABLE t1 (a INT);
+RESET MASTER;
+SET TIMESTAMP= UNIX_TIMESTAMP("2031-01-01 12:00:00");
+INSERT INTO t1 VALUES(1);
+SET TIMESTAMP= UNIX_TIMESTAMP("2032-01-01 12:00:00");
+INSERT INTO t1 VALUES(2);
+SET TIMESTAMP= UNIX_TIMESTAMP("2033-01-01 12:00:00");
+INSERT INTO t1 VALUES(3);
+FLUSH LOGS;
+SET TIMESTAMP= UNIX_TIMESTAMP("2034-01-01 12:00:00");
+INSERT INTO t1 VALUES(4);
+SET TIMESTAMP= UNIX_TIMESTAMP("2035-01-01 12:00:00");
+INSERT INTO t1 VALUES(5);
+FLUSH LOGS;
 
---- Local --
+==== Local ====
+
+---- base64-output ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -29,56 +29,74 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
+/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
+COMMIT
+/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+---- offset ----
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -86,12 +104,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- offset --
+---- start-position ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -102,52 +120,85 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+---- stop-position ----
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+---- start-position stop-position ----
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+use test/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -155,12 +206,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- start-position --
+---- start-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -171,32 +222,29 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -204,13 +252,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- stop-position --
+---- stop-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -219,26 +266,13 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-COMMIT
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-BEGIN
-/*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -246,12 +280,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- start and stop positions ---
+---- start-datetime stop-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -262,22 +296,26 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
+/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+COMMIT
 /*!*/;
 DELIMITER ;
 # End of log file
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- start-datetime --
+==== Local with 2 binlogs on command line ====
+
+---- base64-output ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -288,46 +326,34 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
-# End of log file
-ROLLBACK /* added by mysqlbinlog */;
-/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
-
---- stop-datetime --
-/*!40019 SET @@session.max_insert_delayed_threads=0*/;
-/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
-ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -336,26 +362,22 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
+use test/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=2051254800/*!*/;
+INSERT INTO t1 VALUES(5)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -363,14 +385,13 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- Local with 2 binlogs on command line --
-flush logs;
+---- offset ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -379,61 +400,98 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
+INSERT INTO t1 VALUES(1)
+/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
+/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
+COMMIT
+/*!*/;
+DELIMITER ;
+DELIMITER /*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+use test/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=2051254800/*!*/;
+INSERT INTO t1 VALUES(5)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+---- start-position ----
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+use test/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -444,12 +502,20 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=6/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609943/*!*/;
-insert into t1 values(null, "f")
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
+/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+COMMIT
 /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
+INSERT INTO t1 VALUES(5)
+/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -457,12 +523,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- offset --
+---- stop-position ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -473,57 +539,91 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+DELIMITER ;
+DELIMITER /*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+use test/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+---- start-position stop-position ----
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+use test/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
+/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -534,12 +634,11 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=6/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609943/*!*/;
-insert into t1 values(null, "f")
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -547,12 +646,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- start-position --
+---- start-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -563,37 +662,34 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -604,12 +700,20 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=6/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609943/*!*/;
-insert into t1 values(null, "f")
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
+INSERT INTO t1 VALUES(5)
+/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -617,13 +721,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- stop-position --
+---- stop-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -632,61 +735,36 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-BEGIN
-/*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-COMMIT
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-BEGIN
-/*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-COMMIT
-/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -697,17 +775,24 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
+use test/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
+/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+COMMIT
+/*!*/;
 DELIMITER ;
 # End of log file
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- start-datetime --
+---- start-datetime stop-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -718,37 +803,34 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -759,12 +841,11 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=6/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609943/*!*/;
-insert into t1 values(null, "f")
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -772,13 +853,14 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- stop-datetime --
+==== Remote ====
+
+---- base64-output ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -787,26 +869,31 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
+BEGIN
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
+/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -814,13 +901,13 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- Remote --
+---- offset ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -829,56 +916,63 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-BEGIN
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+---- start-position ----
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+use test/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -886,12 +980,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- offset --
+---- stop-position ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -902,52 +996,47 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-COMMIT
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-BEGIN
-/*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-BEGIN
-/*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
-/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-COMMIT
-/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+---- start-position stop-position ----
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+use test/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -955,11 +1044,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- start-position --
+---- start-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -970,32 +1060,29 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -1003,13 +1090,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- stop-position --
+---- stop-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1018,26 +1104,13 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-COMMIT
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-BEGIN
-/*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -1045,11 +1118,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- start and stop positions ---
+---- start-datetime stop-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1060,22 +1134,26 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
+/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+COMMIT
 /*!*/;
 DELIMITER ;
 # End of log file
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- start-datetime --
+==== Remote with 2 binlogs on command line ====
+
+---- base64-output ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1086,46 +1164,34 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
-# End of log file
-ROLLBACK /* added by mysqlbinlog */;
-/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
-
---- stop-datetime --
-/*!40019 SET @@session.max_insert_delayed_threads=0*/;
-/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
-ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1134,26 +1200,22 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
+use test/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=2051254800/*!*/;
+INSERT INTO t1 VALUES(5)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -1161,13 +1223,13 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- Remote with 2 binlogs on command line --
+---- offset ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1176,61 +1238,68 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-BEGIN
-/*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+DELIMITER ;
+DELIMITER /*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+use test/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=2051254800/*!*/;
+INSERT INTO t1 VALUES(5)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+---- start-position ----
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1241,25 +1310,25 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=6/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609943/*!*/;
-insert into t1 values(null, "f")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
+/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
-# End of log file
-ROLLBACK /* added by mysqlbinlog */;
-/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
-
---- offset --
-/*!40019 SET @@session.max_insert_delayed_threads=0*/;
-/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
-ROLLBACK/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1270,57 +1339,71 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=2051254800/*!*/;
+INSERT INTO t1 VALUES(5)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+DELIMITER ;
+# End of log file
+ROLLBACK /* added by mysqlbinlog */;
+/*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
+
+---- stop-position ----
+/*!40019 SET @@session.max_insert_delayed_threads=0*/;
+/*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
+DELIMITER /*!*/;
+ROLLBACK/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1331,12 +1414,11 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=6/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609943/*!*/;
-insert into t1 values(null, "f")
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -1344,11 +1426,11 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- start-position --
+---- start-position stop-position ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1359,37 +1441,25 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
-/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-COMMIT
-/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-BEGIN
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
-/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1400,12 +1470,11 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=6/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609943/*!*/;
-insert into t1 values(null, "f")
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -1413,13 +1482,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- stop-position --
+---- start-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1428,61 +1496,36 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-BEGIN
-/*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-COMMIT
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-COMMIT
-/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-BEGIN
-/*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1493,17 +1536,33 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
+use test/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
+/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
+BEGIN
+/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
+INSERT INTO t1 VALUES(5)
+/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
+COMMIT
+/*!*/;
 DELIMITER ;
 # End of log file
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- start-datetime --
+---- stop-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1514,37 +1573,34 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
 DELIMITER /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1555,12 +1611,11 @@ SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=6/*!*/;
 use test/*!*/;
-SET TIMESTAMP=1579609943/*!*/;
-insert into t1 values(null, "f")
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -1568,13 +1623,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- stop-datetime --
+---- start-datetime stop-datetime ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1583,26 +1637,51 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
+BEGIN
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
+/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+COMMIT
+/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
+COMMIT
+/*!*/;
+DELIMITER ;
+DELIMITER /*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+SET @@session.pseudo_thread_id=999999999/*!*/;
+SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
+SET @@session.sql_mode=0/*!*/;
+SET @@session.auto_increment_increment=1, @@session.auto_increment_offset=1/*!*/;
+/*!\C latin1 *//*!*/;
+SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
+SET @@session.lc_time_names=0/*!*/;
+SET @@session.collation_database=DEFAULT/*!*/;
+BEGIN
+/*!*/;
+use test/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
+/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -1610,13 +1689,12 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- to-last-log --
+---- to-last-log ----
 /*!40019 SET @@session.max_insert_delayed_threads=0*/;
 /*!50003 SET @OLD_COMPLETION_TYPE=@@COMPLETION_TYPE,COMPLETION_TYPE=0*/;
 DELIMITER /*!*/;
 ROLLBACK/*!*/;
-use test/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 SET @@session.pseudo_thread_id=999999999/*!*/;
 SET @@session.foreign_key_checks=1, @@session.sql_auto_is_null=0, @@session.unique_checks=1, @@session.autocommit=1/*!*/;
 SET @@session.sql_mode=0/*!*/;
@@ -1625,66 +1703,49 @@ SET @@session.auto_increment_increment=1
 SET @@session.character_set_client=8,@@session.collation_connection=8,@@session.collation_server=8/*!*/;
 SET @@session.lc_time_names=0/*!*/;
 SET @@session.collation_database=DEFAULT/*!*/;
-create table t1 (a int auto_increment not null primary key, b char(3))
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=1/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "a")
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-COMMIT
-/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-BEGIN
-/*!*/;
-SET INSERT_ID=2/*!*/;
-SET TIMESTAMP=1579609942/*!*/;
-insert into t1 values(null, "b")
+use test/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
+INSERT INTO t1 VALUES(1)
 /*!*/;
-SET TIMESTAMP=1579609942/*!*/;
+SET TIMESTAMP=1925024400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=3/*!*/;
-SET TIMESTAMP=1579609944/*!*/;
-insert into t1 values(null, "c")
+SET TIMESTAMP=1956560400/*!*/;
+INSERT INTO t1 VALUES(2)
 /*!*/;
-SET TIMESTAMP=1579609944/*!*/;
+SET TIMESTAMP=1956560400/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=4/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "d")
+SET TIMESTAMP=1988182800/*!*/;
+INSERT INTO t1 VALUES(3)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=1988182800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=5/*!*/;
-SET TIMESTAMP=1579609946/*!*/;
-insert into t1 values(null, "e")
+SET TIMESTAMP=2019718800/*!*/;
+INSERT INTO t1 VALUES(4)
 /*!*/;
-SET TIMESTAMP=1579609946/*!*/;
+SET TIMESTAMP=2019718800/*!*/;
 COMMIT
 /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 BEGIN
 /*!*/;
-SET INSERT_ID=6/*!*/;
-SET TIMESTAMP=1579609943/*!*/;
-insert into t1 values(null, "f")
+SET TIMESTAMP=2051254800/*!*/;
+INSERT INTO t1 VALUES(5)
 /*!*/;
-SET TIMESTAMP=1579609943/*!*/;
+SET TIMESTAMP=2051254800/*!*/;
 COMMIT
 /*!*/;
 DELIMITER ;
@@ -1692,5 +1753,5 @@ DELIMITER ;
 ROLLBACK /* added by mysqlbinlog */;
 /*!50003 SET COMPLETION_TYPE=@OLD_COMPLETION_TYPE*/;
 
---- end of test --
-drop table t1;
+==== clean up ====
+DROP TABLE t1;

=== modified file 'mysql-test/r/order_by_all.result'
--- a/mysql-test/r/order_by_all.result	2011-10-12 13:30:13 +0000
+++ b/mysql-test/r/order_by_all.result	2011-12-19 09:22:28 +0000
@@ -2587,4 +2587,17 @@ i1	i2
 4	4
 5	5
 DROP TABLE t1, t2, t3;
+#
+# Bug #11885377 VOID JOIN_READ_KEY_UNLOCK_ROW(ST_JOIN_TABLE*): ASSERTION
+# `TAB->REF.USE_COUNT'
+#
+CREATE TABLE t1(a INT PRIMARY KEY);
+CREATE TABLE t2(b INT,c INT);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1,2), (2,3);
+SELECT (SELECT 1 FROM t1 WHERE a=b AND c=1 ORDER BY a DESC) FROM t2;
+(SELECT 1 FROM t1 WHERE a=b AND c=1 ORDER BY a DESC)
+NULL
+NULL
+DROP TABLE t1, t2;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/order_by_icp_mrr.result'
--- a/mysql-test/r/order_by_icp_mrr.result	2011-10-12 13:30:13 +0000
+++ b/mysql-test/r/order_by_icp_mrr.result	2011-12-19 09:22:28 +0000
@@ -2587,4 +2587,17 @@ i1	i2
 4	4
 5	5
 DROP TABLE t1, t2, t3;
+#
+# Bug #11885377 VOID JOIN_READ_KEY_UNLOCK_ROW(ST_JOIN_TABLE*): ASSERTION
+# `TAB->REF.USE_COUNT'
+#
+CREATE TABLE t1(a INT PRIMARY KEY);
+CREATE TABLE t2(b INT,c INT);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1,2), (2,3);
+SELECT (SELECT 1 FROM t1 WHERE a=b AND c=1 ORDER BY a DESC) FROM t2;
+(SELECT 1 FROM t1 WHERE a=b AND c=1 ORDER BY a DESC)
+NULL
+NULL
+DROP TABLE t1, t2;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/order_by_none.result'
--- a/mysql-test/r/order_by_none.result	2011-10-12 13:30:13 +0000
+++ b/mysql-test/r/order_by_none.result	2011-12-19 09:22:28 +0000
@@ -2586,4 +2586,17 @@ i1	i2
 4	4
 5	5
 DROP TABLE t1, t2, t3;
+#
+# Bug #11885377 VOID JOIN_READ_KEY_UNLOCK_ROW(ST_JOIN_TABLE*): ASSERTION
+# `TAB->REF.USE_COUNT'
+#
+CREATE TABLE t1(a INT PRIMARY KEY);
+CREATE TABLE t2(b INT,c INT);
+INSERT INTO t1 VALUES (1), (2);
+INSERT INTO t2 VALUES (1,2), (2,3);
+SELECT (SELECT 1 FROM t1 WHERE a=b AND c=1 ORDER BY a DESC) FROM t2;
+(SELECT 1 FROM t1 WHERE a=b AND c=1 ORDER BY a DESC)
+NULL
+NULL
+DROP TABLE t1, t2;
 set optimizer_switch=default;

=== modified file 'mysql-test/r/partition_list.result'
--- a/mysql-test/r/partition_list.result	2009-10-21 18:04:34 +0000
+++ b/mysql-test/r/partition_list.result	2011-10-12 11:33:18 +0000
@@ -1,4 +1,136 @@
 drop table if exists t1;
+#
+# Bug#62505: ALTER TABLE ADD PARTITION fails for LIST partitions with
+#            more than 16 items
+#
+CREATE TABLE t1 (a INT);
+# SUCCESS with 20 items because this is initial partitioning action
+# (The parser already knows that it is only on column)
+ALTER TABLE t1
+PARTITION BY LIST(a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,
+11,12,13,14,15,16,17,18,19,20));
+# BUG: FAILED, because number of items > 16 during partition add
+# (The parser do not know how many columns the table is partitioned on)
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,
+31,32,33,34,35,36,37,38,39,40));
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50100 PARTITION BY LIST (a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM,
+ PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM) */
+# Test with single column LIST COLUMNS too
+ALTER TABLE t1
+PARTITION BY LIST COLUMNS (a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20));
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN ((71),(72),(73),(74),(75),(76),(77),(78),(79),(80),
+(81),(82),(83),(84),(85),(86),(87),(88),(89),(90)));
+ERROR 42000: Row expressions in VALUES IN only allowed for multi-field column partitioning near '))' at line 3
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,
+31,32,33,34,35,36,37,38,39,40));
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY LIST  COLUMNS(a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20) ENGINE = MyISAM,
+ PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40) ENGINE = MyISAM) */
+DROP TABLE t1;
+# Test with two columns in LIST COLUMNS partitioning
+CREATE TABLE t1
+(a INT,
+b CHAR(2))
+PARTITION BY LIST COLUMNS (a, b)
+(PARTITION p0_a VALUES IN
+((0, "a0"), (0, "a1"), (0, "a2"), (0, "a3"), (0, "a4"), (0, "a5"), (0, "a6"),
+(0, "a7"), (0, "a8"), (0, "a9"), (0, "aa"), (0, "ab"), (0, "ac"), (0, "ad"),
+(0, "ae"), (0, "af"), (0, "ag"), (0, "ah"), (0, "ai"), (0, "aj"), (0, "ak"),
+(0, "al")));
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p1_a VALUES IN
+((1, "a0"), (1, "a1"), (1, "a2"), (1, "a3"), (1, "a4"), (1, "a5"), (1, "a6"),
+(1, "a7"), (1, "a8"), (1, "a9"), (1, "aa"), (1, "ab"), (1, "ac"), (1, "ad"),
+(1, "ae"), (1, "af"), (1, "ag"), (1, "ah"), (1, "ai"), (1, "aj"), (1, "ak"),
+(1, "al")));
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` char(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY LIST  COLUMNS(a,b)
+(PARTITION p0_a VALUES IN ((0,'a0'),(0,'a1'),(0,'a2'),(0,'a3'),(0,'a4'),(0,'a5'),(0,'a6'),(0,'a7'),(0,'a8'),(0,'a9'),(0,'aa'),(0,'ab'),(0,'ac'),(0,'ad'),(0,'ae'),(0,'af'),(0,'ag'),(0,'ah'),(0,'ai'),(0,'aj'),(0,'ak'),(0,'al')) ENGINE = MyISAM,
+ PARTITION p1_a VALUES IN ((1,'a0'),(1,'a1'),(1,'a2'),(1,'a3'),(1,'a4'),(1,'a5'),(1,'a6'),(1,'a7'),(1,'a8'),(1,'a9'),(1,'aa'),(1,'ab'),(1,'ac'),(1,'ad'),(1,'ae'),(1,'af'),(1,'ag'),(1,'ah'),(1,'ai'),(1,'aj'),(1,'ak'),(1,'al')) ENGINE = MyISAM) */
+# Test of the parser for '('
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2_a VALUES IN
+(((1 + 1), "a0"), (2, "a1"), (2, "a2"), (2, "a3"), (2, "a4"), (2, "a5"),
+(2, "a6"), (2, "a7"), (2, "a8"), (2, "a9"), (2, "aa"), (2, "ab"), (2, "ac"),
+(2, "ad"), (2, "ae"), (2, "af"), (2, "ag"), (2, "ah"), (2, "ai"), (2, "aj"),
+(2, "ak"), (2, "al")));
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` char(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY LIST  COLUMNS(a,b)
+(PARTITION p0_a VALUES IN ((0,'a0'),(0,'a1'),(0,'a2'),(0,'a3'),(0,'a4'),(0,'a5'),(0,'a6'),(0,'a7'),(0,'a8'),(0,'a9'),(0,'aa'),(0,'ab'),(0,'ac'),(0,'ad'),(0,'ae'),(0,'af'),(0,'ag'),(0,'ah'),(0,'ai'),(0,'aj'),(0,'ak'),(0,'al')) ENGINE = MyISAM,
+ PARTITION p1_a VALUES IN ((1,'a0'),(1,'a1'),(1,'a2'),(1,'a3'),(1,'a4'),(1,'a5'),(1,'a6'),(1,'a7'),(1,'a8'),(1,'a9'),(1,'aa'),(1,'ab'),(1,'ac'),(1,'ad'),(1,'ae'),(1,'af'),(1,'ag'),(1,'ah'),(1,'ai'),(1,'aj'),(1,'ak'),(1,'al')) ENGINE = MyISAM,
+ PARTITION p2_a VALUES IN ((2,'a0'),(2,'a1'),(2,'a2'),(2,'a3'),(2,'a4'),(2,'a5'),(2,'a6'),(2,'a7'),(2,'a8'),(2,'a9'),(2,'aa'),(2,'ab'),(2,'ac'),(2,'ad'),(2,'ae'),(2,'af'),(2,'ag'),(2,'ah'),(2,'ai'),(2,'aj'),(2,'ak'),(2,'al')) ENGINE = MyISAM) */
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((1 + 1 + 1), "a0"));
+ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"a0"))' at line 2
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN (1 + 1 + 1, "a0"));
+ERROR HY000: Inconsistency in usage of column lists for partitioning
+# Test with 3 columns when it only has 2.
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((3, "a1", 0), (3, "a2", 0)));
+ERROR HY000: Inconsistency in usage of column lists for partitioning
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((1 + 1 + 1, "a0")));
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` char(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY LIST  COLUMNS(a,b)
+(PARTITION p0_a VALUES IN ((0,'a0'),(0,'a1'),(0,'a2'),(0,'a3'),(0,'a4'),(0,'a5'),(0,'a6'),(0,'a7'),(0,'a8'),(0,'a9'),(0,'aa'),(0,'ab'),(0,'ac'),(0,'ad'),(0,'ae'),(0,'af'),(0,'ag'),(0,'ah'),(0,'ai'),(0,'aj'),(0,'ak'),(0,'al')) ENGINE = MyISAM,
+ PARTITION p1_a VALUES IN ((1,'a0'),(1,'a1'),(1,'a2'),(1,'a3'),(1,'a4'),(1,'a5'),(1,'a6'),(1,'a7'),(1,'a8'),(1,'a9'),(1,'aa'),(1,'ab'),(1,'ac'),(1,'ad'),(1,'ae'),(1,'af'),(1,'ag'),(1,'ah'),(1,'ai'),(1,'aj'),(1,'ak'),(1,'al')) ENGINE = MyISAM,
+ PARTITION p2_a VALUES IN ((2,'a0'),(2,'a1'),(2,'a2'),(2,'a3'),(2,'a4'),(2,'a5'),(2,'a6'),(2,'a7'),(2,'a8'),(2,'a9'),(2,'aa'),(2,'ab'),(2,'ac'),(2,'ad'),(2,'ae'),(2,'af'),(2,'ag'),(2,'ah'),(2,'ai'),(2,'aj'),(2,'ak'),(2,'al')) ENGINE = MyISAM,
+ PARTITION p3_a VALUES IN ((3,'a0')) ENGINE = MyISAM) */
+# Test with more than 16 columns (cause of regression)
+ALTER TABLE t1 ADD PARTITION
+(PARTITION part_2 VALUES IN ((21 ,22, 23, 24, 25, 26, 27, 28, 29, 30,
+31 ,32, 33, 34, 35, 36, 37, 38, 39, 40),
+(41 ,42, 43, 44, 45, 46, 47, 48, 49, 50,
+51 ,52, 53, 54, 55, 56, 57, 58, 59, 60)));
+ERROR 42000: Row expressions in VALUES IN only allowed for multi-field column partitioning near '))' at line 5
+ALTER TABLE t1 ADD PARTITION
+(PARTITION part_2 VALUES IN (21 ,22, 23, 24, 25, 26, 27, 28, 29, 30,
+31 ,32, 33, 34, 35, 36, 37, 38, 39, 40));
+ERROR HY000: Inconsistency in usage of column lists for partitioning
+SHOW CREATE TABLE t1;
+Table	Create Table
+t1	CREATE TABLE `t1` (
+  `a` int(11) DEFAULT NULL,
+  `b` char(2) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=latin1
+/*!50500 PARTITION BY LIST  COLUMNS(a,b)
+(PARTITION p0_a VALUES IN ((0,'a0'),(0,'a1'),(0,'a2'),(0,'a3'),(0,'a4'),(0,'a5'),(0,'a6'),(0,'a7'),(0,'a8'),(0,'a9'),(0,'aa'),(0,'ab'),(0,'ac'),(0,'ad'),(0,'ae'),(0,'af'),(0,'ag'),(0,'ah'),(0,'ai'),(0,'aj'),(0,'ak'),(0,'al')) ENGINE = MyISAM,
+ PARTITION p1_a VALUES IN ((1,'a0'),(1,'a1'),(1,'a2'),(1,'a3'),(1,'a4'),(1,'a5'),(1,'a6'),(1,'a7'),(1,'a8'),(1,'a9'),(1,'aa'),(1,'ab'),(1,'ac'),(1,'ad'),(1,'ae'),(1,'af'),(1,'ag'),(1,'ah'),(1,'ai'),(1,'aj'),(1,'ak'),(1,'al')) ENGINE = MyISAM,
+ PARTITION p2_a VALUES IN ((2,'a0'),(2,'a1'),(2,'a2'),(2,'a3'),(2,'a4'),(2,'a5'),(2,'a6'),(2,'a7'),(2,'a8'),(2,'a9'),(2,'aa'),(2,'ab'),(2,'ac'),(2,'ad'),(2,'ae'),(2,'af'),(2,'ag'),(2,'ah'),(2,'ai'),(2,'aj'),(2,'ak'),(2,'al')) ENGINE = MyISAM,
+ PARTITION p3_a VALUES IN ((3,'a0')) ENGINE = MyISAM) */
+DROP TABLE t1;
 create table t1 (a int unsigned)
 partition by list (a)
 (partition p0 values in (0),

=== modified file 'mysql-test/r/partition_mgm.result'
--- a/mysql-test/r/partition_mgm.result	2011-10-14 12:28:58 +0000
+++ b/mysql-test/r/partition_mgm.result	2011-12-19 13:21:37 +0000
@@ -1,5 +1,16 @@
 DROP TABLE IF EXISTS t1;
 #
+# Bug#13357766: ASSERT IN HANDLER::HA_CREATE
+#
+CREATE TABLE t1
+(a INT)
+PARTITION BY KEY(a) PARTITIONS 3;
+ALTER TABLE t1 REPAIR PARTITION p2,p3,p1;
+Table	Op	Msg_type	Msg_text
+test.t1	repair	error	Error in list of partitions to test.t1
+ALTER TABLE t1 ORDER BY a;
+DROP TABLE t1;
+#
 # Bug#11764110/bug#56909: REORGANIZE PARTITION is allowed on
 #                         HASH/KEY partitioned tables
 #

=== modified file 'mysql-test/r/ps_ddl.result'
--- a/mysql-test/r/ps_ddl.result	2011-04-01 18:08:48 +0000
+++ b/mysql-test/r/ps_ddl.result	2011-12-19 11:42:11 +0000
@@ -355,25 +355,24 @@ a
 drop view v1;
 create view v1 as select a from t2;
 set @var=8;
-# XXX: bug, the SQL statement in the trigger is still
-# pointing at table 't3', since the view was expanded
-# at first statement execution.
-# Since the view definition is inlined in the statement
-# at prepare, changing the view definition does not cause 
-# repreparation.
-# Repreparation of the main statement doesn't cause repreparation
+# View in the INSERT-statement in the trigger is still pointing to
+# table 't3', because the trigger hasn't noticed the change
+# in view definition. This will be fixed by WL#4179.
+#
+# The prepared INSERT-statement however does notice the change,
+# but repreparation of the main statement doesn't cause repreparation
 # of trigger statements.
+#
+# The following EXECUTE results in ER_NO_SUCH_TABLE (t3) error, because
+# pre-locking list of the prepared statement has been changed
+# (the prepared statement has noticed the meta-data change),
+# but the trigger still tries to deal with 't3', which is not opened.
+# That's why '8' is not inserted neither into 't2', nor into 't3'.
 execute stmt using @var;
-call p_verify_reprepare_count(0);
+ERROR 42S02: Table 'test.t3' doesn't exist
+call p_verify_reprepare_count(1);
 SUCCESS
 
-#
-# Sic: the insert went into t3, even though the view now
-# points at t2. This is because neither the merged view
-#  nor its prelocking list are affected by view DDL
-# The binary log is of course wrong, since it is not
-# using prepared statements
-#
 select * from t2;
 a
 5
@@ -381,7 +380,6 @@ select * from t3;
 a
 6
 7
-8
 flush table t1;
 set @var=9;
 execute stmt using @var;
@@ -396,7 +394,6 @@ select * from t3;
 a
 6
 7
-8
 drop view v1;
 drop table t1,t2,t3;
 # Test 7-d: dependent TABLE has changed
@@ -816,17 +813,14 @@ a	b	c
 10	20	50
 20	40	100
 30	60	150
-# Currently a different result from conventional statements.
-# A view is inlined once at prepare, later on view DDL
-# does not affect prepared statement and it is not re-prepared.
-# This is reported in Bug#36002 Prepared statements: if a view
-# used in a statement is replaced, bad data
+# This is actually a test case for Bug#11748352 (36002 Prepared
+# statements: if a view used in a statement is replaced, bad data).
 execute stmt;
 a	b	c
-10	20	30
-20	40	60
-30	60	90
-call p_verify_reprepare_count(0);
+10	20	50
+20	40	100
+30	60	150
+call p_verify_reprepare_count(1);
 SUCCESS
 
 flush table t2;
@@ -838,9 +832,200 @@ a	b	c
 call p_verify_reprepare_count(1);
 SUCCESS
 
+# Check that we properly handle ALTER VIEW statements.
+execute stmt;
+a	b	c
+10	20	50
+20	40	100
+30	60	150
+call p_verify_reprepare_count(0);
+SUCCESS
+
+alter view t1 as select a, 3*a as b, 4*a as c from t2;
+execute stmt;
+a	b	c
+10	30	40
+20	60	80
+30	90	120
+call p_verify_reprepare_count(1);
+SUCCESS
+
+execute stmt;
+a	b	c
+10	30	40
+20	60	80
+30	90	120
+call p_verify_reprepare_count(0);
+SUCCESS
+
+execute stmt;
+a	b	c
+10	30	40
+20	60	80
+30	90	120
+call p_verify_reprepare_count(0);
+SUCCESS
+
+select * from t1;
+a	b	c
+10	30	40
+20	60	80
+30	90	120
+# Check that DROP & CREATE is properly handled under LOCK TABLES.
+drop view t1;
+flush tables;
+create view t1 as select a, 5*a as b, 6*a as c from t2;
+lock tables t1 read, t2 read;
+execute stmt;
+a	b	c
+10	50	60
+20	100	120
+30	150	180
+call p_verify_reprepare_count(1);
+SUCCESS
+
+execute stmt;
+a	b	c
+10	50	60
+20	100	120
+30	150	180
+call p_verify_reprepare_count(0);
+SUCCESS
+
+execute stmt;
+a	b	c
+10	50	60
+20	100	120
+30	150	180
+call p_verify_reprepare_count(0);
+SUCCESS
+
+unlock tables;
+#   ... and once again...
+drop view t1;
+create view t1 as select a, 6*a as b, 7*a as c from t2;
+lock tables t1 read, t2 read;
+execute stmt;
+a	b	c
+10	60	70
+20	120	140
+30	180	210
+call p_verify_reprepare_count(1);
+SUCCESS
+
+execute stmt;
+a	b	c
+10	60	70
+20	120	140
+30	180	210
+call p_verify_reprepare_count(0);
+SUCCESS
+
+execute stmt;
+a	b	c
+10	60	70
+20	120	140
+30	180	210
+call p_verify_reprepare_count(0);
+SUCCESS
+
+unlock tables;
+# Check that ALTER VIEW is properly handled under LOCK TABLES.
+alter view t1 as select a, 7*a as b, 8*a as c from t2;
+lock tables t1 read, t2 read;
+execute stmt;
+a	b	c
+10	70	80
+20	140	160
+30	210	240
+call p_verify_reprepare_count(1);
+SUCCESS
+
+execute stmt;
+a	b	c
+10	70	80
+20	140	160
+30	210	240
+call p_verify_reprepare_count(0);
+SUCCESS
+
+execute stmt;
+a	b	c
+10	70	80
+20	140	160
+30	210	240
+call p_verify_reprepare_count(0);
+SUCCESS
+
+unlock tables;
 drop table t2;
 drop view t1;
 deallocate prepare stmt;
+# Check that DROP & CREATE is properly handled under LOCK TABLES when
+# LOCK TABLES does not contain the complete set of views.
+create table t1(a int);
+insert into t1 values (1), (2), (3);
+create view v1 as select a from t1;
+lock tables t1 read, v1 read;
+prepare stmt from 'select * from v1';
+execute stmt;
+a
+1
+2
+3
+call p_verify_reprepare_count(0);
+SUCCESS
+
+execute stmt;
+a
+1
+2
+3
+call p_verify_reprepare_count(0);
+SUCCESS
+
+unlock tables;
+drop view v1;
+create view v1 as select 2*a from t1;
+lock tables t1 read;
+execute stmt;
+ERROR HY000: Table 'v1' was not locked with LOCK TABLES
+unlock tables;
+drop table t1;
+drop view v1;
+deallocate prepare stmt;
+# Check that ALTER VIEW is properly handled under LOCK TABLES when
+# LOCK TABLES does not contain the complete set of views.
+create table t1(a int);
+insert into t1 values (1), (2), (3);
+create view v1 as select a from t1;
+lock tables t1 read, v1 read;
+prepare stmt from 'select * from v1';
+execute stmt;
+a
+1
+2
+3
+call p_verify_reprepare_count(0);
+SUCCESS
+
+execute stmt;
+a
+1
+2
+3
+call p_verify_reprepare_count(0);
+SUCCESS
+
+unlock tables;
+alter view v1 as select 2*a from t1;
+lock tables t1 read;
+execute stmt;
+ERROR HY000: Table 'v1' was not locked with LOCK TABLES
+unlock tables;
+drop table t1;
+drop view v1;
+deallocate prepare stmt;
 =====================================================================
 Part 18: VIEW -> VIEW (VIEW dependencies) transitions
 =====================================================================
@@ -938,15 +1123,15 @@ drop view v2;
 create view v2 as select a from t2;
 execute stmt;
 a
-1
-2
-3
+4
+5
+6
 execute stmt;
 a
-1
-2
-3
-call p_verify_reprepare_count(0);
+4
+5
+6
+call p_verify_reprepare_count(1);
 SUCCESS
 
 flush table t1;
@@ -955,7 +1140,7 @@ a
 4
 5
 6
-call p_verify_reprepare_count(1);
+call p_verify_reprepare_count(0);
 SUCCESS
 
 execute stmt;

=== modified file 'mysql-test/r/type_temporal_fractional.result'
--- a/mysql-test/r/type_temporal_fractional.result	2011-12-16 16:57:46 +0000
+++ b/mysql-test/r/type_temporal_fractional.result	2011-12-20 09:45:15 +0000
@@ -16984,3 +16984,40 @@ SEC_TO_TIME(-3200399.000001)
 -838:59:59.000000
 Warnings:
 Warning	1292	Truncated incorrect time value: '-3200399.000001'
+#
+# BUG#13451866 - DIFFERENCE IN RESULTS WHEN USING
+# EXTRACT( MINUTE_MICROSECOND )
+#
+CREATE TABLE t1 (a DATETIME(6) DEFAULT NULL);
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000000');
+SELECT * FROM t1;
+a
+0000-00-00 00:00:00.000000
+SELECT EXTRACT(MINUTE_MICROSECOND FROM a) FROM t1;
+EXTRACT(MINUTE_MICROSECOND FROM a)
+0
+SELECT EXTRACT(MINUTE_MICROSECOND FROM '0000-00-00 00:00:00.000000');
+EXTRACT(MINUTE_MICROSECOND FROM '0000-00-00 00:00:00.000000')
+0
+DROP TABLE t1;
+#
+# BUG#13436875 - ASSERTION '!ARGS[0]->IS_TEMPORAL() ||
+# !ARGS[1]->IS_TEMPORAL()'
+#
+CREATE TABLE t1 (a DATETIME NOT NULL);
+SELECT 1 FROM t1 WHERE GREATEST(a, a) / a;
+1
+SELECT 1 FROM t1 WHERE LEAST(a, a) / a;
+1
+SELECT 1 FROM t1 WHERE COALESCE(a, a) / a;
+1
+SELECT 1 FROM t1 WHERE IF(0, a, a) / a;
+1
+SELECT 1 FROM t1 WHERE IFNULL(a, a) / a;
+1
+SELECT 1 FROM t1 WHERE CASE WHEN 0 then a ELSE a END / a;
+1
+SELECT 1 FROM t1 WHERE (SELECT a FROM t1) / a;
+1
+DROP TABLE t1;
+# End of 5.6 tests

=== modified file 'mysql-test/suite/innodb/r/innodb_buffer_pool_load.result'
--- a/mysql-test/suite/innodb/r/innodb_buffer_pool_load.result	2011-11-20 21:00:25 +0000
+++ b/mysql-test/suite/innodb/r/innodb_buffer_pool_load.result	2011-12-08 09:14:27 +0000
@@ -16,7 +16,7 @@ count(*)
 SET GLOBAL innodb_buffer_pool_load_now = ON;
 SELECT variable_value
 FROM information_schema.global_status
-WHERE variable_name = 'INNODB_BUFFER_POOL_LOAD_STATUS';
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
 variable_value
 Buffer pool(s) load completed at TIMESTAMP_NOW
 SELECT COUNT(*) FROM information_schema.innodb_buffer_page_lru

=== modified file 'mysql-test/suite/innodb/t/innodb_buffer_pool_load.test'
--- a/mysql-test/suite/innodb/t/innodb_buffer_pool_load.test	2011-11-20 21:00:25 +0000
+++ b/mysql-test/suite/innodb/t/innodb_buffer_pool_load.test	2011-12-08 09:14:27 +0000
@@ -47,7 +47,7 @@ SET GLOBAL innodb_buffer_pool_dump_now =
 let $wait_condition =
   SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at '
   FROM information_schema.global_status
-  WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
+  WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
 -- source include/wait_condition.inc
 
 # Confirm the file has been created
@@ -76,14 +76,14 @@ SET GLOBAL innodb_buffer_pool_load_now =
 let $wait_condition =
   SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at '
   FROM information_schema.global_status
-  WHERE variable_name = 'INNODB_BUFFER_POOL_LOAD_STATUS';
+  WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
 -- source include/wait_condition.inc
 
 # Show the status, interesting if the above timed out
 -- replace_regex /[0-9]{6}[[:space:]]+[0-9]{1,2}:[0-9]{2}:[0-9]{2}/TIMESTAMP_NOW/
 SELECT variable_value
 FROM information_schema.global_status
-WHERE variable_name = 'INNODB_BUFFER_POOL_LOAD_STATUS';
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
 
 # Accept 329 for 16k page size, 662 for 8k page size & 1392 for 4k page size
 -- replace_result 329 {checked_valid} 662 {checked_valid} 1392 {checked_valid}
@@ -107,7 +107,7 @@ SET GLOBAL innodb_buffer_pool_load_now =
 let $wait_condition =
   SELECT SUBSTR(variable_value, 1, 13) = 'Error parsing'
   FROM information_schema.global_status
-  WHERE variable_name = 'INNODB_BUFFER_POOL_LOAD_STATUS';
+  WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
 -- source include/wait_condition.inc
 
 DROP TABLE ib_bp_test;

=== modified file 'mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result'
--- a/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result	2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_circular_for_4_hosts.result	2011-12-19 14:26:51 +0000
@@ -20,6 +20,7 @@ include/rpl_sync.inc
 call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
 call mtr.add_suppression("Slave SQL: Coordinator thread of multi-threaded slave is exiting seeing a failed Worker to apply an event");
+call mtr.add_suppression("Slave worker thread has failed to apply an event");
 
 *** Testing schema A->B->C->D->A ***
 

=== renamed file 'mysql-test/suite/rpl/r/rpl_mts_check_concurrency.result' => 'mysql-test/suite/rpl/r/rpl_mts_debug.result'
--- a/mysql-test/suite/rpl/r/rpl_mts_check_concurrency.result	2011-11-19 08:08:03 +0000
+++ b/mysql-test/suite/rpl/r/rpl_mts_debug.result	2011-12-16 15:53:16 +0000
@@ -21,4 +21,19 @@ include/stop_slave.inc
 SET @@global.slave_parallel_workers= save_slave_parallel_workers;
 SET @@global.debug= "";
 include/start_slave.inc
+call mtr.add_suppression('Error reading slave worker configuration');
+call mtr.add_suppression('Failed during slave workers initialization');
+call mtr.add_suppression('Failed during slave worker thread create');
+include/stop_slave.inc
+set @save.slave_checkpoint_group= @@global.slave_checkpoint_group;
+set @save.slave_parallel_workers= @@global.slave_parallel_workers;
+set @save.debug= @@global.debug;
+SET @@global.debug= "d,mts_worker_thread_fails";
+set @@global.slave_parallel_workers= 2;
+start slave sql_thread;
+include/wait_for_slave_sql_error.inc [errno=1593]
+set @@global.slave_checkpoint_group= @save.slave_checkpoint_group;
+set @@global.slave_parallel_workers= @save.slave_parallel_workers;
+set @@global.debug= @save.debug;
+include/start_slave.inc
 include/rpl_end.inc

=== modified file 'mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test'
--- a/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/rpl/t/rpl_circular_for_4_hosts.test	2011-11-24 18:26:55 +0000
@@ -33,6 +33,7 @@ CREATE TABLE t2 (a INT NOT NULL AUTO_INC
 call mtr.add_suppression("Slave SQL.*Request to stop slave SQL Thread received while applying a group that has non-transactional changes; waiting for completion of the group");
 call mtr.add_suppression("The slave coordinator and worker threads are stopped, possibly leaving data in inconsistent state");
 call mtr.add_suppression("Slave SQL: Coordinator thread of multi-threaded slave is exiting seeing a failed Worker to apply an event");
+call mtr.add_suppression("Slave worker thread has failed to apply an event");
 --echo
 
 #

=== renamed file 'mysql-test/suite/rpl/t/rpl_mts_check_concurrency-slave.opt' => 'mysql-test/suite/rpl/t/rpl_mts_debug-slave.opt'
=== renamed file 'mysql-test/suite/rpl/t/rpl_mts_check_concurrency.test' => 'mysql-test/suite/rpl/t/rpl_mts_debug.test'
--- a/mysql-test/suite/rpl/t/rpl_mts_check_concurrency.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/rpl/t/rpl_mts_debug.test	2011-12-16 15:53:16 +0000
@@ -10,6 +10,8 @@
 --source include/master-slave.inc
 --source include/have_debug.inc
 --source include/have_innodb.inc
+# no format specific tests so we run it only in MIXED mode
+--source include/have_binlog_format_mixed.inc
 
 --connection master
 CREATE DATABASE db_1;
@@ -46,4 +48,46 @@ DROP DATABASE db_2;
 --eval SET @@global.slave_parallel_workers= $save_slave_parallel_workers
 --eval SET @@global.debug= "$save_debug"
 --source include/start_slave.inc
+
+#
+# Bug#12964649 MTS memory not released
+#
+# Originally reported when opt_slave_checkpoint_group is set to be greater
+# than sizeof(BLOB) * 8 - 1 Workers initialization code fails.
+# VALID_RANGE() for opt_slave_checkpoint_group is fixed in bug12979420.
+# 
+# The current bug test simulates a failure to start by a Worker
+# thread, checks the error, and verifies that all memory is released
+# (valgrind proves, the user can watch top report).
+#
+
+connection slave;
+
+call mtr.add_suppression('Error reading slave worker configuration');
+call mtr.add_suppression('Failed during slave workers initialization');
+call mtr.add_suppression('Failed during slave worker thread create');
+
+source include/stop_slave.inc;
+set @save.slave_checkpoint_group= @@global.slave_checkpoint_group;
+set @save.slave_parallel_workers= @@global.slave_parallel_workers;
+
+# The following assignment can work only with debug builds.
+# It sets opt_slave_checkpoint_group to one more to its VALID_RANGE() maximum.
+# set @@global.slave_checkpoint_group= 524287 + 1;
+
+set @save.debug= @@global.debug;
+SET @@global.debug= "d,mts_worker_thread_fails";
+set @@global.slave_parallel_workers= 2;
+
+start slave sql_thread;
+--let $slave_sql_errno= 1593
+source include/wait_for_slave_sql_error.inc;
+
+set @@global.slave_checkpoint_group= @save.slave_checkpoint_group;
+set @@global.slave_parallel_workers= @save.slave_parallel_workers;
+set @@global.debug= @save.debug;
+
+source include/start_slave.inc;
+
+
 --source include/rpl_end.inc

=== modified file 'mysql-test/suite/sys_vars/r/innodb_buffer_pool_filename_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_filename_basic.result	2011-11-17 00:20:31 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_filename_basic.result	2011-12-08 09:14:27 +0000
@@ -4,7 +4,7 @@ SELECT @orig;
 ib_buffer_pool
 SELECT variable_value
 FROM information_schema.global_status
-WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
 variable_value
 not started
 SET GLOBAL innodb_buffer_pool_filename = 'innodb_foobar_dump';

=== modified file 'mysql-test/suite/sys_vars/r/innodb_buffer_pool_load_now_basic.result'
--- a/mysql-test/suite/sys_vars/r/innodb_buffer_pool_load_now_basic.result	2011-11-17 00:20:31 +0000
+++ b/mysql-test/suite/sys_vars/r/innodb_buffer_pool_load_now_basic.result	2011-12-08 09:14:27 +0000
@@ -6,6 +6,6 @@ SET GLOBAL innodb_buffer_pool_dump_now =
 SET GLOBAL innodb_buffer_pool_load_now = ON;
 SELECT variable_value
 FROM information_schema.global_status
-WHERE variable_name = 'INNODB_BUFFER_POOL_LOAD_STATUS';
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
 variable_value
 Buffer pool(s) load completed at TIMESTAMP_NOW

=== modified file 'mysql-test/suite/sys_vars/r/slave_checkpoint_group_basic.result'
--- a/mysql-test/suite/sys_vars/r/slave_checkpoint_group_basic.result	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/sys_vars/r/slave_checkpoint_group_basic.result	2011-11-24 18:26:55 +0000
@@ -37,6 +37,9 @@ Warning	1292	Truncated incorrect slave_c
 set global slave_checkpoint_group=cast(-1 as unsigned int);
 Warnings:
 Warning	1292	Truncated incorrect slave_checkpoint_group value: '18446744073709551615'
+select @@global.slave_checkpoint_group as "truncated to the maximum" ;
+truncated to the maximum
+524287
 SET @@global.slave_checkpoint_group = @start_global_value;
 SELECT @@global.slave_checkpoint_group;
 @@global.slave_checkpoint_group

=== modified file 'mysql-test/suite/sys_vars/r/slave_checkpoint_period_basic.result'
--- a/mysql-test/suite/sys_vars/r/slave_checkpoint_period_basic.result	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/sys_vars/r/slave_checkpoint_period_basic.result	2011-11-24 18:26:55 +0000
@@ -38,8 +38,8 @@ select @@global.slave_checkpoint_period;
 set global slave_checkpoint_period=cast(-1 as unsigned int);
 Warnings:
 Warning	1292	Truncated incorrect slave_checkpoint_period value: '18446744073709551615'
-select @@global.slave_checkpoint_period;
-@@global.slave_checkpoint_period
+select @@global.slave_checkpoint_period as "truncated to the maximum";
+truncated to the maximum
 4294967295
 SET @@global.slave_checkpoint_period = @start_global_value;
 SELECT @@global.slave_checkpoint_period;

=== modified file 'mysql-test/suite/sys_vars/r/slave_parallel_workers_basic.result'
--- a/mysql-test/suite/sys_vars/r/slave_parallel_workers_basic.result	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/sys_vars/r/slave_parallel_workers_basic.result	2011-11-24 18:26:55 +0000
@@ -17,7 +17,7 @@ set @@global.slave_parallel_workers= 0;
 set @@global.slave_parallel_workers= cast(-1 as unsigned int);
 Warnings:
 Warning	1292	Truncated incorrect slave_parallel_workers value: '18446744073709551615'
-select @@global.slave_parallel_workers;
-@@global.slave_parallel_workers
+select @@global.slave_parallel_workers as "truncated to the maximum";
+truncated to the maximum
 1024
 set @@global.slave_parallel_workers= @save.slave_parallel_workers;

=== modified file 'mysql-test/suite/sys_vars/r/slave_pending_jobs_size_max_basic.result'
--- a/mysql-test/suite/sys_vars/r/slave_pending_jobs_size_max_basic.result	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/sys_vars/r/slave_pending_jobs_size_max_basic.result	2011-11-24 18:26:55 +0000
@@ -27,7 +27,7 @@ Warning	1292	Truncated incorrect slave_p
 set @@global.slave_pending_jobs_size_max= cast(-1 as unsigned int);
 Warnings:
 Warning	1292	Truncated incorrect slave_pending_jobs_size_max value: '18446744073709551615'
-select @@global.slave_pending_jobs_size_max;
-@@global.slave_pending_jobs_size_max
+select @@global.slave_pending_jobs_size_max as "truncated to the maximum";
+truncated to the maximum
 18446744073709550592
 set @@global.slave_pending_jobs_size_max= @save.slave_pending_jobs_size_max;

=== modified file 'mysql-test/suite/sys_vars/t/innodb_adaptive_max_sleep_delay_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_adaptive_max_sleep_delay_basic.test	2011-08-19 06:13:33 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_adaptive_max_sleep_delay_basic.test	2011-12-08 09:14:27 +0000
@@ -20,8 +20,8 @@
 --source include/have_innodb.inc
 
 # Check if builtins are enabled
-if (`SELECT VARIABLE_VALUE='OFF' FROM INFORMATION_SCHEMA.GLOBAL_STATUS
-    WHERE variable_name = 'INNODB_HAVE_ATOMIC_BUILTINS'`) {
+if (`SELECT LOWER(VARIABLE_VALUE)='off' FROM INFORMATION_SCHEMA.GLOBAL_STATUS
+    WHERE LOWER(variable_name) = 'innodb_have_atomic_builtins'`) {
 	--skip Test requires InnoDB atomic builtins
 }
 

=== modified file 'mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test	2011-11-17 00:20:31 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_dump_now_basic.test	2011-12-08 09:14:27 +0000
@@ -17,7 +17,7 @@ SELECT @@global.innodb_buffer_pool_dump_
 let $wait_condition =
   SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at '
   FROM information_schema.global_status
-  WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
+  WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
 -- source include/wait_condition.inc
 
 # Confirm that the dump file has been created

=== modified file 'mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test	2011-11-17 00:20:31 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_filename_basic.test	2011-12-08 09:14:27 +0000
@@ -15,7 +15,7 @@ SELECT @orig;
 # dump actually being complete and file_exists may fail.
 SELECT variable_value
 FROM information_schema.global_status
-WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
 
 # Try with a non-default filename
 
@@ -28,7 +28,7 @@ SET GLOBAL innodb_buffer_pool_dump_now =
 let $wait_condition =
   SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at '
   FROM information_schema.global_status
-  WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
+  WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
 -- source include/wait_condition.inc
 
 -- file_exists $file

=== modified file 'mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test'
--- a/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test	2011-11-17 00:20:31 +0000
+++ b/mysql-test/suite/sys_vars/t/innodb_buffer_pool_load_now_basic.test	2011-12-08 09:14:27 +0000
@@ -15,7 +15,7 @@ SET GLOBAL innodb_buffer_pool_dump_now =
 let $wait_condition =
   SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) dump completed at '
   FROM information_schema.global_status
-  WHERE variable_name = 'INNODB_BUFFER_POOL_DUMP_STATUS';
+  WHERE LOWER(variable_name) = 'innodb_buffer_pool_dump_status';
 -- source include/wait_condition.inc
 
 # Confirm the file is really created
@@ -29,11 +29,11 @@ SET GLOBAL innodb_buffer_pool_load_now =
 let $wait_condition =
   SELECT SUBSTR(variable_value, 1, 33) = 'Buffer pool(s) load completed at '
   FROM information_schema.global_status
-  WHERE variable_name = 'INNODB_BUFFER_POOL_LOAD_STATUS';
+  WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';
 -- source include/wait_condition.inc
 
 # Show the status, interesting if the above timed out
 -- replace_regex /[0-9]{6}[[:space:]]+[0-9]{1,2}:[0-9]{2}:[0-9]{2}/TIMESTAMP_NOW/
 SELECT variable_value
 FROM information_schema.global_status
-WHERE variable_name = 'INNODB_BUFFER_POOL_LOAD_STATUS';
+WHERE LOWER(variable_name) = 'innodb_buffer_pool_load_status';

=== modified file 'mysql-test/suite/sys_vars/t/slave_checkpoint_group_basic.test'
--- a/mysql-test/suite/sys_vars/t/slave_checkpoint_group_basic.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/sys_vars/t/slave_checkpoint_group_basic.test	2011-11-24 18:26:55 +0000
@@ -38,5 +38,7 @@ set global slave_checkpoint_group="foo";
 set global slave_checkpoint_group=0;
 set global slave_checkpoint_group=cast(-1 as unsigned int);
 
+select @@global.slave_checkpoint_group as "truncated to the maximum" ;
+
 SET @@global.slave_checkpoint_group = @start_global_value;
 SELECT @@global.slave_checkpoint_group;

=== modified file 'mysql-test/suite/sys_vars/t/slave_checkpoint_period_basic.test'
--- a/mysql-test/suite/sys_vars/t/slave_checkpoint_period_basic.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/sys_vars/t/slave_checkpoint_period_basic.test	2011-11-24 18:26:55 +0000
@@ -42,7 +42,7 @@ set global slave_checkpoint_period="foo"
 set global slave_checkpoint_period=1;
 select @@global.slave_checkpoint_period;
 set global slave_checkpoint_period=cast(-1 as unsigned int);
-select @@global.slave_checkpoint_period;
+select @@global.slave_checkpoint_period as "truncated to the maximum";
 
 SET @@global.slave_checkpoint_period = @start_global_value;
 SELECT @@global.slave_checkpoint_period;

=== modified file 'mysql-test/suite/sys_vars/t/slave_parallel_workers_basic.test'
--- a/mysql-test/suite/sys_vars/t/slave_parallel_workers_basic.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/sys_vars/t/slave_parallel_workers_basic.test	2011-11-24 18:26:55 +0000
@@ -32,7 +32,7 @@ eval set @@global.$var= "foo";
 #
 eval set @@global.$var= 0;
 eval set @@global.$var= cast(-1 as unsigned int);
-eval select @@global.$var;
+eval select @@global.$var as "truncated to the maximum";
 
 # cleanup
 

=== modified file 'mysql-test/suite/sys_vars/t/slave_pending_jobs_size_max_basic.test'
--- a/mysql-test/suite/sys_vars/t/slave_pending_jobs_size_max_basic.test	2011-08-19 13:04:28 +0000
+++ b/mysql-test/suite/sys_vars/t/slave_pending_jobs_size_max_basic.test	2011-11-24 18:26:55 +0000
@@ -34,7 +34,7 @@ eval set @@global.$var= "foo";
 #
 eval set @@global.$var= 0;
 eval set @@global.$var= cast(-1 as unsigned int);
-eval select @@global.$var;
+eval select @@global.$var as "truncated to the maximum";
 
 # cleanup
 

=== renamed file 'mysql-test/t/mysqlbinlog2.test' => 'mysql-test/t/mysqlbinlog_start_stop.test'
--- a/mysql-test/t/mysqlbinlog2.test	2011-10-19 10:15:25 +0000
+++ b/mysql-test/t/mysqlbinlog_start_stop.test	2011-12-20 16:06:32 +0000
@@ -1,146 +1,92 @@
-# Test for the new options --start-datetime, stop-datetime,
-# and a few others.
+# ==== Purpose ====
+#
+# Test the --[start|stop]-[position|datetime] options to mysqlbinlog,
+# with/without --read-from-remote-server, with one or two binary logs
+# as input.
+#
+# ==== Implementation ====
 
 # TODO: Need to look at making row based version once new binlog client is complete.
 -- source include/have_binlog_format_mixed_or_statement.inc
 
+CREATE TABLE t1 (a INT);
+RESET MASTER;
 
---disable_warnings
-drop table if exists t1;
---enable_warnings
-reset master;
-
-# We need this for getting fixed timestamps inside of this test.
-# I use a date in the future to keep a growing timestamp along the
+# We need to set fixed timestamps in this test.
+# Use a date in the future to keep a growing timestamp along the
 # binlog (including the Start_log_event). This test will work 
 # unchanged everywhere, because mysql-test-run has fixed TZ, which it
 # exports (so mysqlbinlog has same fixed TZ).
-set @a=UNIX_TIMESTAMP("2020-01-21 15:32:22");
-set timestamp=@a;
-create table t1 (a int auto_increment not null primary key, b char(3));
-insert into t1 values(null, "a");
-insert into t1 values(null, "b");
-set timestamp=@a+2;
---let $binlog_pos_760=query_get_value(SHOW MASTER STATUS, Position, 1)
-insert into t1 values(null, "c");
---let $binlog_pos_951=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000001' from $binlog_pos_760, Pos, 4)
-set timestamp=@a+4;
-insert into t1 values(null, "d");
-insert into t1 values(null, "e");
-
-flush logs;
-set timestamp=@a+1; # this could happen on a slave
-insert into t1 values(null, "f");
---let $binlog_pos_135=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 3)
---let $binlog_pos_203=query_get_value(SHOW BINLOG EVENTS in 'master-bin.000002', Pos, 4)
-
-# delimiters are for easier debugging in future
-
---disable_query_log ONCE
-select "--- Local --" as "";
-
-#
-# We should use --short-form everywhere because in other case output will
-# be time dependent (the Start events). Better than nothing.
-#
-let $MYSQLD_DATADIR= `select @@datadir`;
---exec $MYSQL_BINLOG --short-form --base64-output=never $MYSQLD_DATADIR/master-bin.000001 
-
---disable_query_log ONCE
-select "--- offset --" as "";
---exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001 
---disable_query_log ONCE
-select "--- start-position --" as "";
---exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 
---disable_query_log ONCE
-select "--- stop-position --" as "";
---exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 
---disable_query_log ONCE
-select "--- start and stop positions ---" as "";
---exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --stop-position=$binlog_pos_951  $MYSQLD_DATADIR/master-bin.000001 
---disable_query_log ONCE
-select "--- start-datetime --" as "";
---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 
---disable_query_log ONCE
-select "--- stop-datetime --" as "";
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 
-
---disable_query_log ONCE
-select "--- Local with 2 binlogs on command line --" as "";
+--let $datetime_1= 2031-01-01 12:00:00
+eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_1");
+INSERT INTO t1 VALUES(1);
+--let $pos_1= query_get_value(SHOW MASTER STATUS, Position, 1)
+
+--let $datetime_2= 2032-01-01 12:00:00
+eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_2");
+INSERT INTO t1 VALUES(2);
+--let $pos_2= query_get_value(SHOW MASTER STATUS, Position, 1)
+
+eval SET TIMESTAMP= UNIX_TIMESTAMP("2033-01-01 12:00:00");
+INSERT INTO t1 VALUES(3);
+
+--let $file_1= query_get_value(SHOW MASTER STATUS, File, 1)
+FLUSH LOGS;
+
+SET TIMESTAMP= UNIX_TIMESTAMP("2034-01-01 12:00:00");
+INSERT INTO t1 VALUES(4);
+--let $pos_3= query_get_value(SHOW MASTER STATUS, Position, 1)
+--let $datetime_3= 2035-01-01 12:00:00
+eval SET TIMESTAMP= UNIX_TIMESTAMP("$datetime_3");
+INSERT INTO t1 VALUES(5);
+
+--let $file_2= query_get_value(SHOW MASTER STATUS, File, 1)
+FLUSH LOGS;
+
+--let $MYSQLD_DATADIR= `select @@datadir`
+
+--echo
+--echo ==== Local ====
+
+--let $start_position= $pos_1
+--let $start_datetime= $datetime_1
+
+--let $stop_position= $pos_2
+--let $stop_datetime= $datetime_2
+--let $extra_options= $MYSQLD_DATADIR/$file_1
+--source extra/binlog_tests/mysqlbinlog_start_stop_1.inc
 
+--echo
+--echo ==== Local with 2 binlogs on command line ====
 # This is to verify that some options apply only to first, or last binlog
 
-flush logs;
---exec $MYSQL_BINLOG --short-form $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
-
---disable_query_log ONCE
-select "--- offset --" as "";
---exec $MYSQL_BINLOG --short-form --offset=2 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
---disable_query_log ONCE
-select "--- start-position --" as "";
---exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
---disable_query_log ONCE
-select "--- stop-position --" as "";
---exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_203 $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
---disable_query_log ONCE
-select "--- start-datetime --" as "";
---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
---disable_query_log ONCE
-select "--- stop-datetime --" as "";
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" $MYSQLD_DATADIR/master-bin.000001 $MYSQLD_DATADIR/master-bin.000002
-
---disable_query_log ONCE
-select "--- Remote --" as "";
---exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 
-
---disable_query_log ONCE
-select "--- offset --" as "";
---exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 
---disable_query_log ONCE
-select "--- start-position --" as "";
---exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 
---disable_query_log ONCE
-select "--- stop-position --" as "";
---exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 
---disable_query_log ONCE
-select "--- start and stop positions ---" as "";
---exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --stop-position=$binlog_pos_951 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
---disable_query_log ONCE
-select "--- start-datetime --" as "";
---exec $MYSQL_BINLOG --short-form "--start-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
---disable_query_log ONCE
-select "--- stop-datetime --" as "";
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020-01-21 15:32:24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001
-
---disable_query_log ONCE
-select "--- Remote with 2 binlogs on command line --" as "";
-
---exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
-
---disable_query_log ONCE
-select "--- offset --" as "";
---exec $MYSQL_BINLOG --short-form --offset=2 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001  master-bin.000002
---disable_query_log ONCE
-select "--- start-position --" as "";
---exec $MYSQL_BINLOG --short-form --start-position=$binlog_pos_760 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001  master-bin.000002
---disable_query_log ONCE
-select "--- stop-position --" as "";
---exec $MYSQL_BINLOG --short-form --stop-position=$binlog_pos_135 --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001  master-bin.000002
---disable_query_log ONCE
-select "--- start-datetime --" as "";
---exec $MYSQL_BINLOG --short-form "--start-datetime=20200121153224" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
---disable_query_log ONCE
-select "--- stop-datetime --" as "";
---exec $MYSQL_BINLOG --short-form "--stop-datetime=2020/01/21 15@32@24" --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT master-bin.000001 master-bin.000002
-
---disable_query_log ONCE
-select "--- to-last-log --" as "";
-
---exec $MYSQL_BINLOG --short-form --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT --to-last-log master-bin.000001
-
-# clean up
---disable_query_log ONCE
-select "--- end of test --" as "";
-drop table t1;
-
-# End of 4.1 tests
+--let $stop_position= $pos_3
+--let $stop_datetime= $datetime_3
+--let $extra_options= $MYSQLD_DATADIR/$file_1 $MYSQLD_DATADIR/$file_2
+--source extra/binlog_tests/mysqlbinlog_start_stop_1.inc
+
+--echo
+--echo ==== Remote ====
+
+--let $stop_position= $pos_2
+--let $stop_datetime= $datetime_2
+--let $extra_options= --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $file_1
+--source extra/binlog_tests/mysqlbinlog_start_stop_1.inc
+
+--echo
+--echo ==== Remote with 2 binlogs on command line ====
+
+--let $stop_position= $pos_3
+--let $stop_datetime= $datetime_3
+--let $extra_options= --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $file_1 $file_2
+--source extra/binlog_tests/mysqlbinlog_start_stop_1.inc
+
+# ==== to-last-log ====
+
+--let $extra_options= --read-from-remote-server --user=root --host=127.0.0.1 --port=$MASTER_MYPORT $file_1
+--let $option= --to-last-log
+--source extra/binlog_tests/mysqlbinlog_start_stop_2.inc
+
+--echo
+--echo ==== clean up ====
+DROP TABLE t1;

=== modified file 'mysql-test/t/partition_list.test'
--- a/mysql-test/t/partition_list.test	2009-10-21 18:04:34 +0000
+++ b/mysql-test/t/partition_list.test	2011-10-12 11:33:18 +0000
@@ -9,6 +9,101 @@
 drop table if exists t1;
 --enable_warnings
 
+--echo #
+--echo # Bug#62505: ALTER TABLE ADD PARTITION fails for LIST partitions with
+--echo #            more than 16 items
+--echo #
+
+CREATE TABLE t1 (a INT);
+
+--echo # SUCCESS with 20 items because this is initial partitioning action
+--echo # (The parser already knows that it is only on column)
+ALTER TABLE t1
+PARTITION BY LIST(a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,
+                         11,12,13,14,15,16,17,18,19,20));
+
+--echo # BUG: FAILED, because number of items > 16 during partition add
+--echo # (The parser do not know how many columns the table is partitioned on)
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,
+                         31,32,33,34,35,36,37,38,39,40));
+
+
+SHOW CREATE TABLE t1;
+
+--echo # Test with single column LIST COLUMNS too
+ALTER TABLE t1
+PARTITION BY LIST COLUMNS (a)
+(PARTITION p1 VALUES IN (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20));
+
+--error ER_PARSE_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN ((71),(72),(73),(74),(75),(76),(77),(78),(79),(80),
+                         (81),(82),(83),(84),(85),(86),(87),(88),(89),(90)));
+
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2 VALUES IN (21,22,23,24,25,26,27,28,29,30,
+                         31,32,33,34,35,36,37,38,39,40));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
+--echo # Test with two columns in LIST COLUMNS partitioning
+CREATE TABLE t1
+(a INT,
+ b CHAR(2))
+PARTITION BY LIST COLUMNS (a, b)
+(PARTITION p0_a VALUES IN
+((0, "a0"), (0, "a1"), (0, "a2"), (0, "a3"), (0, "a4"), (0, "a5"), (0, "a6"),
+ (0, "a7"), (0, "a8"), (0, "a9"), (0, "aa"), (0, "ab"), (0, "ac"), (0, "ad"),
+ (0, "ae"), (0, "af"), (0, "ag"), (0, "ah"), (0, "ai"), (0, "aj"), (0, "ak"),
+ (0, "al")));
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p1_a VALUES IN
+((1, "a0"), (1, "a1"), (1, "a2"), (1, "a3"), (1, "a4"), (1, "a5"), (1, "a6"),
+ (1, "a7"), (1, "a8"), (1, "a9"), (1, "aa"), (1, "ab"), (1, "ac"), (1, "ad"),
+ (1, "ae"), (1, "af"), (1, "ag"), (1, "ah"), (1, "ai"), (1, "aj"), (1, "ak"),
+ (1, "al")));
+SHOW CREATE TABLE t1;
+
+--echo # Test of the parser for '('
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p2_a VALUES IN
+(((1 + 1), "a0"), (2, "a1"), (2, "a2"), (2, "a3"), (2, "a4"), (2, "a5"),
+ (2, "a6"), (2, "a7"), (2, "a8"), (2, "a9"), (2, "aa"), (2, "ab"), (2, "ac"),
+ (2, "ad"), (2, "ae"), (2, "af"), (2, "ag"), (2, "ah"), (2, "ai"), (2, "aj"),
+ (2, "ak"), (2, "al")));
+
+SHOW CREATE TABLE t1;
+
+--error ER_PARSE_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((1 + 1 + 1), "a0"));
+--error ER_PARTITION_COLUMN_LIST_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN (1 + 1 + 1, "a0"));
+
+--echo # Test with 3 columns when it only has 2.
+--error ER_PARTITION_COLUMN_LIST_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((3, "a1", 0), (3, "a2", 0)));
+ALTER TABLE t1 ADD PARTITION
+(PARTITION p3_a VALUES IN ((1 + 1 + 1, "a0")));
+SHOW CREATE TABLE t1;
+--echo # Test with more than 16 columns (cause of regression)
+--error ER_PARSE_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION part_2 VALUES IN ((21 ,22, 23, 24, 25, 26, 27, 28, 29, 30,
+                              31 ,32, 33, 34, 35, 36, 37, 38, 39, 40),
+                             (41 ,42, 43, 44, 45, 46, 47, 48, 49, 50,
+                              51 ,52, 53, 54, 55, 56, 57, 58, 59, 60)));
+--error ER_PARTITION_COLUMN_LIST_ERROR
+ALTER TABLE t1 ADD PARTITION
+(PARTITION part_2 VALUES IN (21 ,22, 23, 24, 25, 26, 27, 28, 29, 30,
+                             31 ,32, 33, 34, 35, 36, 37, 38, 39, 40));
+SHOW CREATE TABLE t1;
+DROP TABLE t1;
+
 #
 # Bug 20733: Zerofill columns gives wrong result with partitioned tables
 #

=== modified file 'mysql-test/t/partition_mgm.test'
--- a/mysql-test/t/partition_mgm.test	2011-10-14 12:28:58 +0000
+++ b/mysql-test/t/partition_mgm.test	2011-12-19 13:21:37 +0000
@@ -4,6 +4,16 @@ DROP TABLE IF EXISTS t1;
 --enable_warnings
 
 --echo #
+--echo # Bug#13357766: ASSERT IN HANDLER::HA_CREATE
+--echo #
+CREATE TABLE t1
+(a INT)
+PARTITION BY KEY(a) PARTITIONS 3;
+ALTER TABLE t1 REPAIR PARTITION p2,p3,p1;
+ALTER TABLE t1 ORDER BY a; 
+DROP TABLE t1;
+
+--echo #
 --echo # Bug#11764110/bug#56909: REORGANIZE PARTITION is allowed on
 --echo #                         HASH/KEY partitioned tables
 --echo #

=== modified file 'mysql-test/t/ps_ddl.test'
--- a/mysql-test/t/ps_ddl.test	2011-10-19 10:15:25 +0000
+++ b/mysql-test/t/ps_ddl.test	2011-12-19 11:42:11 +0000
@@ -349,23 +349,22 @@ select * from t2;
 drop view v1;
 create view v1 as select a from t2;
 set @var=8;
---echo # XXX: bug, the SQL statement in the trigger is still
---echo # pointing at table 't3', since the view was expanded
---echo # at first statement execution.
---echo # Since the view definition is inlined in the statement
---echo # at prepare, changing the view definition does not cause 
---echo # repreparation.
---echo # Repreparation of the main statement doesn't cause repreparation
---echo # of trigger statements.
-execute stmt using @var;
-call p_verify_reprepare_count(0);
+--echo # View in the INSERT-statement in the trigger is still pointing to
+--echo # table 't3', because the trigger hasn't noticed the change
+--echo # in view definition. This will be fixed by WL#4179.
 --echo #
---echo # Sic: the insert went into t3, even though the view now
---echo # points at t2. This is because neither the merged view
---echo #  nor its prelocking list are affected by view DDL
---echo # The binary log is of course wrong, since it is not
---echo # using prepared statements
+--echo # The prepared INSERT-statement however does notice the change,
+--echo # but repreparation of the main statement doesn't cause repreparation
+--echo # of trigger statements.
 --echo #
+--echo # The following EXECUTE results in ER_NO_SUCH_TABLE (t3) error, because
+--echo # pre-locking list of the prepared statement has been changed
+--echo # (the prepared statement has noticed the meta-data change),
+--echo # but the trigger still tries to deal with 't3', which is not opened.
+--echo # That's why '8' is not inserted neither into 't2', nor into 't3'.
+--error ER_NO_SUCH_TABLE
+execute stmt using @var;
+call p_verify_reprepare_count(1);
 select * from t2;
 select * from t3;
 flush table t1;
@@ -732,21 +731,136 @@ drop view t1;
 create view t1 as select a, 2*a as b, 5*a as c from t2;
 select * from t1;
 
---echo # Currently a different result from conventional statements.
---echo # A view is inlined once at prepare, later on view DDL
---echo # does not affect prepared statement and it is not re-prepared.
---echo # This is reported in Bug#36002 Prepared statements: if a view
---echo # used in a statement is replaced, bad data
+--echo # This is actually a test case for Bug#11748352 (36002 Prepared
+--echo # statements: if a view used in a statement is replaced, bad data).
 execute stmt;
-call p_verify_reprepare_count(0);
+call p_verify_reprepare_count(1);
+
 flush table t2;
+
 execute stmt;
 call p_verify_reprepare_count(1);
 
+--echo # Check that we properly handle ALTER VIEW statements.
+execute stmt;
+call p_verify_reprepare_count(0);
+alter view t1 as select a, 3*a as b, 4*a as c from t2;
+execute stmt;
+call p_verify_reprepare_count(1);
+execute stmt;
+call p_verify_reprepare_count(0);
+execute stmt;
+call p_verify_reprepare_count(0);
+select * from t1;
+
+--echo # Check that DROP & CREATE is properly handled under LOCK TABLES.
+drop view t1;
+flush tables; # empty TDC
+create view t1 as select a, 5*a as b, 6*a as c from t2;
+lock tables t1 read, t2 read;
+execute stmt;
+call p_verify_reprepare_count(1);
+execute stmt;
+call p_verify_reprepare_count(0);
+execute stmt;
+call p_verify_reprepare_count(0);
+unlock tables;
+--echo #   ... and once again...
+drop view t1;
+create view t1 as select a, 6*a as b, 7*a as c from t2;
+lock tables t1 read, t2 read;
+execute stmt;
+call p_verify_reprepare_count(1);
+execute stmt;
+call p_verify_reprepare_count(0);
+execute stmt;
+call p_verify_reprepare_count(0);
+unlock tables;
+
+--echo # Check that ALTER VIEW is properly handled under LOCK TABLES.
+alter view t1 as select a, 7*a as b, 8*a as c from t2;
+lock tables t1 read, t2 read;
+execute stmt;
+call p_verify_reprepare_count(1);
+execute stmt;
+call p_verify_reprepare_count(0);
+execute stmt;
+call p_verify_reprepare_count(0);
+unlock tables;
+
 drop table t2;
 drop view t1;
 deallocate prepare stmt;
 
+--echo # Check that DROP & CREATE is properly handled under LOCK TABLES when
+--echo # LOCK TABLES does not contain the complete set of views.
+
+create table t1(a int);
+insert into t1 values (1), (2), (3);
+
+create view v1 as select a from t1;
+
+lock tables t1 read, v1 read;
+
+prepare stmt from 'select * from v1';
+
+execute stmt;
+call p_verify_reprepare_count(0);
+
+execute stmt;
+call p_verify_reprepare_count(0);
+
+unlock tables;
+
+drop view v1;
+create view v1 as select 2*a from t1;
+
+# Miss v1.
+lock tables t1 read;
+
+--error ER_TABLE_NOT_LOCKED
+execute stmt;
+
+unlock tables;
+
+drop table t1;
+drop view v1;
+deallocate prepare stmt;
+
+--echo # Check that ALTER VIEW is properly handled under LOCK TABLES when
+--echo # LOCK TABLES does not contain the complete set of views.
+
+create table t1(a int);
+insert into t1 values (1), (2), (3);
+
+create view v1 as select a from t1;
+
+lock tables t1 read, v1 read;
+
+prepare stmt from 'select * from v1';
+
+execute stmt;
+call p_verify_reprepare_count(0);
+
+execute stmt;
+call p_verify_reprepare_count(0);
+
+unlock tables;
+
+alter view v1 as select 2*a from t1;
+
+# Miss v1.
+lock tables t1 read;
+
+--error ER_TABLE_NOT_LOCKED
+execute stmt;
+
+unlock tables;
+
+drop table t1;
+drop view v1;
+deallocate prepare stmt;
+
 --echo =====================================================================
 --echo Part 18: VIEW -> VIEW (VIEW dependencies) transitions
 --echo =====================================================================
@@ -815,10 +929,10 @@ drop view v2;
 create view v2 as select a from t2;
 execute stmt;
 execute stmt;
-call p_verify_reprepare_count(0);
+call p_verify_reprepare_count(1);
 flush table t1;
 execute stmt;
-call p_verify_reprepare_count(1);
+call p_verify_reprepare_count(0);
 execute stmt;
 --echo # Test 18-d: dependent TABLE has changed
 drop view v2;

=== modified file 'mysql-test/t/type_temporal_fractional.test'
--- a/mysql-test/t/type_temporal_fractional.test	2011-12-16 16:57:46 +0000
+++ b/mysql-test/t/type_temporal_fractional.test	2011-12-20 09:45:15 +0000
@@ -7488,3 +7488,33 @@ SELECT SEC_TO_TIME(3200399.999999);
 SELECT SEC_TO_TIME(3200399.000001);
 SELECT SEC_TO_TIME(-3200399.999999);
 SELECT SEC_TO_TIME(-3200399.000001);
+
+
+--echo #
+--echo # BUG#13451866 - DIFFERENCE IN RESULTS WHEN USING
+--echo # EXTRACT( MINUTE_MICROSECOND )
+--echo #
+CREATE TABLE t1 (a DATETIME(6) DEFAULT NULL);
+INSERT INTO t1 VALUES ('0000-00-00 00:00:00.000000');
+SELECT * FROM t1;
+SELECT EXTRACT(MINUTE_MICROSECOND FROM a) FROM t1;
+SELECT EXTRACT(MINUTE_MICROSECOND FROM '0000-00-00 00:00:00.000000');
+DROP TABLE t1;
+
+
+--echo #
+--echo # BUG#13436875 - ASSERTION '!ARGS[0]->IS_TEMPORAL() ||
+--echo # !ARGS[1]->IS_TEMPORAL()'
+--echo #
+CREATE TABLE t1 (a DATETIME NOT NULL);
+SELECT 1 FROM t1 WHERE GREATEST(a, a) / a;
+SELECT 1 FROM t1 WHERE LEAST(a, a) / a;
+SELECT 1 FROM t1 WHERE COALESCE(a, a) / a;
+SELECT 1 FROM t1 WHERE IF(0, a, a) / a;
+SELECT 1 FROM t1 WHERE IFNULL(a, a) / a;
+SELECT 1 FROM t1 WHERE CASE WHEN 0 then a ELSE a END / a;    
+SELECT 1 FROM t1 WHERE (SELECT a FROM t1) / a;
+DROP TABLE t1;
+
+
+--echo # End of 5.6 tests

=== modified file 'mysql-test/t/xa.test'
--- a/mysql-test/t/xa.test	2011-05-31 13:52:09 +0000
+++ b/mysql-test/t/xa.test	2011-12-22 09:27:58 +0000
@@ -343,8 +343,8 @@ DROP TABLE t1;
 DROP TABLE IF EXISTS t1, t2;
 --enable_warnings
 
-CREATE TABLE t1 (a INT);
-CREATE TABLE t2 (a INT);
+CREATE TABLE t1 (a INT) ENGINE=InnoDB;
+CREATE TABLE t2 (a INT) ENGINE=InnoDB;
 
 START TRANSACTION;
 INSERT INTO t1 VALUES (1);

=== modified file 'sql/field.h'
--- a/sql/field.h	2011-12-15 12:12:14 +0000
+++ b/sql/field.h	2011-12-20 09:45:15 +0000
@@ -1171,6 +1171,10 @@ public:
 	    uchar null_bit_arg, utype unireg_check_arg,
 	    const char *field_name_arg, const CHARSET_INFO *charset);
   Item_result result_type () const { return STRING_RESULT; }
+  Item_result numeric_context_result_type() const
+  { 
+    return REAL_RESULT; 
+  }
   uint decimals() const { return NOT_FIXED_DEC; }
   void make_field(Send_field *field);
   int  store(double nr);
@@ -1931,7 +1935,7 @@ public:
   virtual uint32 max_display_length() { return field_length; }
   virtual bool str_needs_quotes() { return TRUE; }
   virtual uint is_equal(Create_field *new_field);
-  virtual Item_result numeric_context_result_type() const
+  Item_result numeric_context_result_type() const
   {
     return dec ? DECIMAL_RESULT : INT_RESULT;
   }
@@ -2017,7 +2021,7 @@ public:
   longlong val_date_temporal();
   bool get_time(MYSQL_TIME *ltime)
   {
-    return get_date(ltime, 0);
+    return get_date(ltime, TIME_FUZZY_DATE);
   }
 };
 

=== modified file 'sql/ha_partition.cc'
--- a/sql/ha_partition.cc	2011-12-14 16:49:31 +0000
+++ b/sql/ha_partition.cc	2011-12-19 22:31:09 +0000
@@ -3801,14 +3801,14 @@ int ha_partition::truncate_partition(Alt
   uint num_parts= m_part_info->num_parts;
   uint num_subparts= m_part_info->num_subparts;
   uint i= 0;
-  uint num_parts_set= alter_info->partition_names.elements;
-  uint num_parts_found= set_part_state(alter_info, m_part_info,
-                                        PART_ADMIN);
   DBUG_ENTER("ha_partition::truncate_partition");
 
   /* Only binlog when it starts any call to the partitions handlers */
   *binlog_stmt= false;
 
+  if (set_part_state(alter_info, m_part_info, PART_ADMIN))
+    DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
+
   /*
     TRUNCATE also means resetting auto_increment. Hence, reset
     it so that it will be initialized again at the next use.
@@ -3818,10 +3818,6 @@ int ha_partition::truncate_partition(Alt
   table_share->ha_part_data->auto_inc_initialized= FALSE;
   unlock_auto_increment();
 
-  if (num_parts_set != num_parts_found &&
-      (!(alter_info->flags & ALTER_ALL_PARTITION)))
-    DBUG_RETURN(HA_ERR_NO_PARTITION_FOUND);
-
   *binlog_stmt= true;
 
   do

=== modified file 'sql/item.h'
--- a/sql/item.h	2011-11-21 11:58:25 +0000
+++ b/sql/item.h	2011-12-13 18:18:20 +0000
@@ -643,6 +643,10 @@ public:
   */
   virtual enum Item_result numeric_context_result_type() const
   {
+    if (is_temporal())
+      return decimals ? DECIMAL_RESULT : INT_RESULT;
+    if (result_type() == STRING_RESULT)
+      return REAL_RESULT; 
     return result_type();
   }
   virtual Item_result cast_to_int_type() const { return result_type(); }

=== modified file 'sql/item_func.cc'
--- a/sql/item_func.cc	2011-11-21 11:58:25 +0000
+++ b/sql/item_func.cc	2011-12-13 18:18:20 +0000
@@ -789,9 +789,10 @@ void Item_num_op::find_num_type(void)
   DBUG_ASSERT(arg_count == 2);
   Item_result r0= args[0]->numeric_context_result_type();
   Item_result r1= args[1]->numeric_context_result_type();
+  
+  DBUG_ASSERT(r0 != STRING_RESULT && r1 != STRING_RESULT);
 
-  if (r0 == REAL_RESULT || r1 == REAL_RESULT ||
-      r0 == STRING_RESULT || r1 ==STRING_RESULT)
+  if (r0 == REAL_RESULT || r1 == REAL_RESULT)
   {
     /*
       Since DATE/TIME/DATETIME data types return INT_RESULT/DECIMAL_RESULT

=== modified file 'sql/item_sum.cc'
--- a/sql/item_sum.cc	2011-12-15 15:15:37 +0000
+++ b/sql/item_sum.cc	2011-12-20 09:45:15 +0000
@@ -1297,7 +1297,6 @@ void Item_sum_sum::fix_length_and_dec()
   decimals= args[0]->decimals;
   switch (args[0]->numeric_context_result_type()) {
   case REAL_RESULT:
-  case STRING_RESULT:
     hybrid_type= REAL_RESULT;
     sum= 0.0;
     break;
@@ -1314,6 +1313,7 @@ void Item_sum_sum::fix_length_and_dec()
     my_decimal_set_zero(dec_buffs);
     break;
   }
+  case STRING_RESULT:
   case ROW_RESULT:
   default:
     DBUG_ASSERT(0);

=== modified file 'sql/item_sum.h'
--- a/sql/item_sum.h	2011-11-10 14:58:23 +0000
+++ b/sql/item_sum.h	2011-12-13 18:18:20 +0000
@@ -1051,10 +1051,6 @@ protected:
   bool keep_field_type(void) const { return 1; }
   enum Item_result result_type () const { return hybrid_type; }
   enum enum_field_types field_type() const { return hybrid_field_type; }
-  enum Item_result numeric_context_result_type() const
-  {
-    return args[0]->numeric_context_result_type();
-  }
   void update_field();
   void min_max_update_str_field();
   void min_max_update_temporal_field();

=== modified file 'sql/item_timefunc.h'
--- a/sql/item_timefunc.h	2011-11-28 10:08:20 +0000
+++ b/sql/item_timefunc.h	2011-12-13 18:18:20 +0000
@@ -513,11 +513,6 @@ public:
     DBUG_ASSERT(fixed);
     return decimals;
   }
-  enum Item_result numeric_context_result_type() const
-  {
-    DBUG_ASSERT(fixed);
-    return decimals ? DECIMAL_RESULT : INT_RESULT;
-  }
 };
 
 
@@ -545,12 +540,6 @@ public:
     sql_mode(0)
   { }
   enum Item_result result_type () const { return STRING_RESULT; }
-  enum Item_result numeric_context_result_type() const
-  {
-    DBUG_ASSERT(fixed);
-    return cached_field_type == MYSQL_TYPE_STRING ? STRING_RESULT :
-           decimals ? DECIMAL_RESULT : INT_RESULT;
-  }
   enum_field_types field_type() const { return cached_field_type; }
   const CHARSET_INFO *charset_for_protocol() const
   {

=== modified file 'sql/mysqld.cc'
--- a/sql/mysqld.cc	2011-12-13 17:06:27 +0000
+++ b/sql/mysqld.cc	2011-12-16 15:53:16 +0000
@@ -524,7 +524,7 @@ ulong thread_id=1L,current_pid;
 ulong slow_launch_threads = 0;
 uint sync_binlog_period= 0, sync_relaylog_period= 0,
      sync_relayloginfo_period= 0, sync_masterinfo_period= 0,
-     mts_checkpoint_period= 0, mts_checkpoint_group= 0;
+     opt_mts_checkpoint_period, opt_mts_checkpoint_group;
 ulong expire_logs_days = 0;
 
 const double log_10[] = {

=== modified file 'sql/mysqld.h'
--- a/sql/mysqld.h	2011-12-06 17:25:19 +0000
+++ b/sql/mysqld.h	2011-12-16 15:53:16 +0000
@@ -140,7 +140,7 @@ extern ulong expire_logs_days;
 extern my_bool relay_log_recovery;
 extern uint sync_binlog_period, sync_relaylog_period, 
             sync_relayloginfo_period, sync_masterinfo_period,
-            mts_checkpoint_period, mts_checkpoint_group;
+            opt_mts_checkpoint_period, opt_mts_checkpoint_group;
 extern ulong opt_tc_log_size, tc_log_max_pages_used, tc_log_page_size;
 extern ulong tc_log_page_waits;
 extern my_bool relay_log_purge, opt_innodb_safe_binlog, opt_innodb;

=== modified file 'sql/partition_element.h'
--- a/sql/partition_element.h	2011-06-30 15:50:45 +0000
+++ b/sql/partition_element.h	2011-12-19 12:53:11 +0000
@@ -92,7 +92,7 @@ struct st_ddl_log_memory_entry;
 class partition_element :public Sql_alloc {
 public:
   List<partition_element> subpartitions;
-  List<part_elem_value> list_val_list;
+  List<part_elem_value> list_val_list;  // list of LIST values/column arrays
   ha_rows part_max_rows;
   ha_rows part_min_rows;
   longlong range_value;

=== modified file 'sql/partition_info.cc'
--- a/sql/partition_info.cc	2011-07-28 10:54:44 +0000
+++ b/sql/partition_info.cc	2011-12-19 12:53:11 +0000
@@ -900,6 +900,7 @@ bool partition_info::check_range_constan
         List_iterator<part_elem_value> list_val_it(part_def->list_val_list);
         part_elem_value *range_val= list_val_it++;
         part_column_list_val *col_val= range_val->col_val_array;
+        DBUG_ASSERT(part_def->list_val_list.elements == 1);
 
         if (fix_column_value_functions(thd, range_val, i))
           goto end;
@@ -1788,11 +1789,11 @@ id_err:
 
 
 /**
-  Check what kind of error to report
+  Check what kind of error to report.
 
   @param use_subpart_expr Use the subpart_expr instead of part_expr
-  @param part_str         Name of partition to report error (or NULL)
 */
+
 void partition_info::report_part_expr_error(bool use_subpart_expr)
 {
   Item *expr= part_expr;
@@ -1832,18 +1833,17 @@ void partition_info::report_part_expr_er
 }
  
 
-/*
-  Create a new column value in current list with maxvalue
-  Called from parser
+/**
+  Create a new column value in current list with maxvalue.
 
-  SYNOPSIS
-    add_max_value()
-  RETURN
-    TRUE               Error
-    FALSE              Success
+  @return Operation status
+    @retval TRUE   Error
+    @retval FALSE  Success
+
+  @note Called from parser.
 */
 
-int partition_info::add_max_value()
+bool partition_info::add_max_value()
 {
   DBUG_ENTER("partition_info::add_max_value");
 
@@ -1856,16 +1856,16 @@ int partition_info::add_max_value()
   DBUG_RETURN(FALSE);
 }
 
-/*
-  Create a new column value in current list
-  Called from parser
 
-  SYNOPSIS
-    add_column_value()
-  RETURN
-    >0                 A part_column_list_val object which have been
-                       inserted into its list
-    0                  Memory allocation failure
+/**
+  Create a new column value in current list.
+
+  @return Pointer to a new part_column_list_val
+    @retval  != 0  A part_column_list_val object which have been
+                   inserted into its list
+    @retval  NULL  Memory allocation failure
+    
+  @note Called from parser.
 */
 
 part_column_list_val *partition_info::add_column_value()
@@ -1890,7 +1890,7 @@ part_column_list_val *partition_info::ad
       into the structure used for 1 column. After this we call
       ourselves recursively which should always succeed.
     */
-    if (!reorganize_into_single_field_col_val())
+    if (!reorganize_into_single_field_col_val() && !init_column_part())
     {
       DBUG_RETURN(add_column_value());
     }
@@ -1911,19 +1911,19 @@ part_column_list_val *partition_info::ad
 }
 
 
-/*
-  Initialise part_elem_value object at setting of a new object
-  (Helper functions to functions called by parser)
+/**
+  Initialise part_elem_value object at setting of a new object.
 
-  SYNOPSIS
-    init_col_val
-    col_val                  Column value object to be initialised
-    item                     Item object representing column value
+  @param col_val  Column value object to be initialised
+  @param item     Item object representing column value
 
-  RETURN VALUES
-    TRUE                     Failure
-    FALSE                    Success
+  @return Operation status
+    @retval TRUE   Failure
+    @retval FALSE  Success
+
+  @note Helper functions to functions called by parser.
 */
+
 void partition_info::init_col_val(part_column_list_val *col_val, Item *item)
 {
   DBUG_ENTER("partition_info::init_col_val");
@@ -1948,20 +1948,21 @@ void partition_info::init_col_val(part_c
   col_val->part_info= NULL;
   DBUG_VOID_RETURN;
 }
-/*
-  Add a column value in VALUES LESS THAN or VALUES IN
-  (Called from parser)
 
-  SYNOPSIS
-    add_column_list_value()
-    lex                      Parser's lex object
-    thd                      Thread object
-    item                     Item object representing column value
 
-  RETURN VALUES
-    TRUE                     Failure
-    FALSE                    Success
+/**
+  Add a column value in VALUES LESS THAN or VALUES IN.
+
+  @param thd   Thread object
+  @param item  Item object representing column value
+
+  @return Operation status
+    @retval TRUE   Failure
+    @retval FALSE  Success
+
+  @note Called from parser.
 */
+
 bool partition_info::add_column_list_value(THD *thd, Item *item)
 {
   part_column_list_val *col_val;
@@ -2010,19 +2011,19 @@ bool partition_info::add_column_list_val
   DBUG_RETURN(FALSE);
 }
 
-/*
-  Initialise part_info object for receiving a set of column values
+
+/**
+  Initialize a new column for VALUES {LESS THAN|IN}.
+
+  Initialize part_info object for receiving a set of column values
   for a partition, called when parser reaches VALUES LESS THAN or
   VALUES IN.
 
-  SYNOPSIS
-    init_column_part()
-    lex                    Parser's lex object
-
-  RETURN VALUES
-    TRUE                     Failure
-    FALSE                    Success
+  @return Operation status
+    @retval TRUE   Failure
+    @retval FALSE  Success
 */
+
 bool partition_info::init_column_part()
 {
   partition_element *p_elem= curr_part_elem;
@@ -2056,8 +2057,15 @@ bool partition_info::init_column_part()
   DBUG_RETURN(FALSE);
 }
 
-/*
-  In the case of ALTER TABLE ADD/REORGANIZE PARTITION for LIST
+
+/**
+  Reorganize the preallocated buffer into a single field col list.
+
+  @return Operation status
+    @retval  true   Failure
+    @retval  false  Success
+
+  @note In the case of ALTER TABLE ADD/REORGANIZE PARTITION for LIST
   partitions we can specify list values as:
   VALUES IN (v1, v2,,,, v17) if we're using the first partitioning
   variant with a function or a column list partitioned table with
@@ -2069,30 +2077,27 @@ bool partition_info::init_column_part()
   partitioning and we used a VALUES IN like above where number of
   values was smaller than MAX_REF_PARTS or equal, then we will
   reorganize after discovering this in the parser.
-
-  SYNOPSIS
-    reorganize_into_single_field_col_val()
-
-  RETURN VALUES
-    TRUE                     Failure
-    FALSE                    Success
 */
-int partition_info::reorganize_into_single_field_col_val()
+
+bool partition_info::reorganize_into_single_field_col_val()
 {
   part_column_list_val *col_val, *new_col_val;
   part_elem_value *val= curr_list_val;
-  uint loc_num_columns= num_columns;
+  uint num_values= num_columns;
   uint i;
   DBUG_ENTER("partition_info::reorganize_into_single_field_col_val");
+  DBUG_ASSERT(part_type == LIST_PARTITION);
+  DBUG_ASSERT(!num_columns || num_columns == val->added_items);
 
+  if (!num_values)
+    num_values= val->added_items;
   num_columns= 1;
   val->added_items= 1U;
   col_val= &val->col_val_array[0];
   init_col_val(col_val, col_val->item_expression);
-  for (i= 1; i < loc_num_columns; i++)
+  for (i= 1; i < num_values; i++)
   {
     col_val= &val->col_val_array[i];
-    DBUG_ASSERT(part_type == LIST_PARTITION);
     if (init_column_part())
     {
       DBUG_RETURN(TRUE);
@@ -2108,27 +2113,28 @@ int partition_info::reorganize_into_sing
   DBUG_RETURN(FALSE);
 }
 
-/*
+
+/**
   This function handles the case of function-based partitioning.
+  
   It fixes some data structures created in the parser and puts
   them in the format required by the rest of the partitioning
   code.
 
-  SYNOPSIS
-  fix_partition_values()
-  thd                             Thread object
-  col_val                         Array of one value
-  part_elem                       The partition instance
-  part_id                         Id of partition instance
-
-  RETURN VALUES
-    TRUE                     Failure
-    FALSE                    Success
+  @param thd        Thread object
+  @param col_val    Array of one value
+  @param part_elem  The partition instance
+  @param part_id    Id of partition instance
+
+  @return Operation status
+    @retval TRUE   Failure
+    @retval FALSE  Success
 */
-int partition_info::fix_partition_values(THD *thd,
-                                         part_elem_value *val,
-                                         partition_element *part_elem,
-                                         uint part_id)
+
+bool partition_info::fix_partition_values(THD *thd,
+                                          part_elem_value *val,
+                                          partition_element *part_elem,
+                                          uint part_id)
 {
   part_column_list_val *col_val= val->col_val_array;
   DBUG_ENTER("partition_info::fix_partition_values");
@@ -2195,17 +2201,16 @@ int partition_info::fix_partition_values
   DBUG_RETURN(FALSE);
 }
 
-/*
-  Get column item with a proper character set according to the field
 
-  SYNOPSIS
-    get_column_item()
-    item                     Item object to start with
-    field                    Field for which the item will be compared to
+/**
+  Get column item with a proper character set according to the field.
 
-  RETURN VALUES
-    NULL                     Error
-    item                     Returned item
+  @param item   Item object to start with
+  @param field  Field for which the item will be compared to
+
+  @return Column item
+    @retval NULL  Error
+    @retval item  Returned item
 */
 
 Item* partition_info::get_column_item(Item *item, Field *field)
@@ -2224,19 +2229,18 @@ Item* partition_info::get_column_item(It
 }
 
 
-/*
-  Evaluate VALUES functions for column list values
-  SYNOPSIS
-    fix_column_value_functions()
-    thd                              Thread object
-    col_val                          List of column values
-    part_id                          Partition id we are fixing
+/**
+  Evaluate VALUES functions for column list values.
 
-  RETURN VALUES
-    TRUE                             Error
-    FALSE                            Success
-  DESCRIPTION
-    Fix column VALUES and store in memory array adapted to the data type
+  @param thd      Thread object
+  @param col_val  List of column values
+  @param part_id  Partition id we are fixing
+
+  @return Operation status
+    @retval TRUE   Error
+    @retval FALSE  Success
+  
+  @note Fix column VALUES and store in memory array adapted to the data type.
 */
 
 bool partition_info::fix_column_value_functions(THD *thd,
@@ -2306,9 +2310,11 @@ end:
   DBUG_RETURN(result);
 }
 
-/*
-  The parser generates generic data structures, we need to set them up
-  as the rest of the code expects to find them. This is in reality part
+/**
+  Fix partition data from parser.
+
+  @details The parser generates generic data structures, we need to set them
+  up as the rest of the code expects to find them. This is in reality part
   of the syntax check of the parser code.
 
   It is necessary to call this function in the case of a CREATE TABLE
@@ -2340,16 +2346,14 @@ end:
   and number of elements are in synch with each other. So only partitioning
   using functions need to be set-up to their data structures.
 
-  SYNOPSIS
-    fix_parser_data()
-    thd                      Thread object
+  @param thd  Thread object
 
-  RETURN VALUES
-    TRUE                     Failure
-    FALSE                    Success
+  @return Operation status
+    @retval TRUE   Failure
+    @retval FALSE  Success
 */
 
-int partition_info::fix_parser_data(THD *thd)
+bool partition_info::fix_parser_data(THD *thd)
 {
   List_iterator<partition_element> it(partitions);
   partition_element *part_elem;
@@ -2411,6 +2415,7 @@ int partition_info::fix_parser_data(THD
   DBUG_RETURN(FALSE);
 }
 
+
 void partition_info::print_debug(const char *str, uint *value)
 {
   DBUG_ENTER("print_debug");
@@ -2442,7 +2447,7 @@ bool partition_info::set_part_expr(char
   return FALSE;
 }
 
-int partition_info::reorganize_into_single_field_col_val()
+bool partition_info::reorganize_into_single_field_col_val()
 {
   return 0;
 }
@@ -2456,9 +2461,10 @@ bool partition_info::add_column_list_val
 {
   return FALSE;
 }
-int partition_info::add_max_value()
+
+bool partition_info::add_max_value()
 {
-  return 0;
+  return false;
 }
 
 void partition_info::print_debug(const char *str, uint *value)

=== modified file 'sql/partition_info.h'
--- a/sql/partition_info.h	2011-06-30 15:50:45 +0000
+++ b/sql/partition_info.h	2011-12-19 12:53:11 +0000
@@ -164,8 +164,8 @@ public:
   char *part_func_string;
   char *subpart_func_string;
 
-  partition_element *curr_part_elem;
-  partition_element *current_partition;
+  partition_element *curr_part_elem;     // part or sub part
+  partition_element *current_partition;  // partition
   part_elem_value *curr_list_val;
   uint curr_list_object;
   uint num_columns;
@@ -213,14 +213,14 @@ public:
   bool use_default_num_subpartitions;
   bool default_partitions_setup;
   bool defined_max_value;
-  bool list_of_part_fields;
-  bool list_of_subpart_fields;
-  bool linear_hash_ind;
+  bool list_of_part_fields;                  // KEY or COLUMNS PARTITIONING
+  bool list_of_subpart_fields;               // KEY SUBPARTITIONING
+  bool linear_hash_ind;                      // LINEAR HASH/KEY
   bool fixed;
   bool is_auto_partitioned;
   bool from_openfrm;
   bool has_null_value;
-  bool column_list;
+  bool column_list;                          // COLUMNS PARTITIONING, 5.5+
 
   partition_info()
   : get_partition_id(NULL), get_part_partition_id(NULL),
@@ -289,17 +289,17 @@ public:
   void print_no_partition_found(TABLE *table);
   void print_debug(const char *str, uint*);
   Item* get_column_item(Item *item, Field *field);
-  int fix_partition_values(THD *thd,
-                           part_elem_value *val,
-                           partition_element *part_elem,
-                           uint part_id);
+  bool fix_partition_values(THD *thd,
+                            part_elem_value *val,
+                            partition_element *part_elem,
+                            uint part_id);
   bool fix_column_value_functions(THD *thd,
                                   part_elem_value *val,
                                   uint part_id);
-  int fix_parser_data(THD *thd);
-  int add_max_value();
+  bool fix_parser_data(THD *thd);
+  bool add_max_value();
   void init_col_val(part_column_list_val *col_val, Item *item);
-  int reorganize_into_single_field_col_val();
+  bool reorganize_into_single_field_col_val();
   part_column_list_val *add_column_value();
   bool set_part_expr(char *start_token, Item *item_ptr,
                      char *end_token, bool is_subpart);

=== modified file 'sql/rpl_info_factory.cc'
--- a/sql/rpl_info_factory.cc	2011-10-13 14:01:50 +0000
+++ b/sql/rpl_info_factory.cc	2011-12-13 12:13:37 +0000
@@ -401,7 +401,9 @@ bool Rpl_info_factory::decide_repository
       If there is an error, we cannot proceed with the normal operation.
       In this case, we just pick the dest repository if check_info() has
       not failed to execute against it in order to give users the chance
-      to fix the problem and restart the server.
+      to fix the problem and restart the server. One particular case can
+      happen when there is an inplace upgrade: no source table (it did 
+      not exist in 5.5) and the default destination is a file.
 
       Notice that migration will not take place and the destination may
       be empty.
@@ -411,7 +413,9 @@ bool Rpl_info_factory::decide_repository
       sql_print_warning("Error while checking replication metadata. "
                         "Setting the requested repository in order to "
                         "give users the chance to fix the problem and "
-                        "restart the server.");
+                        "restart the server. If this is a live upgrade "
+                        "please consider using mysql_upgrade to fix the "
+                        "problem.");
       delete (*handler_src);
       *handler_src= NULL;
       info->set_rpl_info_handler(*handler_dest);
@@ -421,7 +425,12 @@ bool Rpl_info_factory::decide_repository
     }
     else
     {
-      *msg= "Error while checking replication metadata.";
+      *msg= "Error while checking replication metadata. This might also happen "
+            "when doing a live upgrade from a version that did not make use "
+            "of the replication metadata tables. If that was the case, consider "
+            "starting the server with the option --skip-slave-start which "
+            "causes the server to bypass the replication metadata tables check "
+            "while it is starting up";
       goto err;
     }
   }

=== modified file 'sql/rpl_rli.cc'
--- a/sql/rpl_rli.cc	2011-11-16 01:19:40 +0000
+++ b/sql/rpl_rli.cc	2011-12-16 15:53:16 +0000
@@ -82,7 +82,7 @@ Relay_log_info::Relay_log_info(bool is_s
    rows_query_ev(NULL), last_event_start_time(0),
    slave_parallel_workers(0),
    recovery_parallel_workers(0), checkpoint_seqno(0),
-   checkpoint_group(mts_checkpoint_group), mts_recovery_group_cnt(0),
+   checkpoint_group(opt_mts_checkpoint_group), mts_recovery_group_cnt(0),
    mts_recovery_index(0), mts_recovery_group_seen_begin(0),
    mts_group_status(MTS_NOT_IN_GROUP), reported_unsafe_warning(false),
    sql_delay(0), sql_delay_end(0), m_flags(0), row_stmt_start_timestamp(0),

=== modified file 'sql/rpl_rli.h'
--- a/sql/rpl_rli.h	2011-11-21 17:46:02 +0000
+++ b/sql/rpl_rli.h	2011-12-16 15:53:16 +0000
@@ -467,7 +467,7 @@ public:
   ulong slave_parallel_workers; // the one slave session time number of workers
   ulong recovery_parallel_workers; // number of workers while recovering
   uint checkpoint_seqno;  // counter of groups executed after the most recent CP
-  uint checkpoint_group;  // number of groups in one checkpoint interval (period).
+  uint checkpoint_group;  // cache for ::opt_mts_checkpoint_group 
   MY_BITMAP recovery_groups;  // bitmap used during recovery
   ulong mts_recovery_group_cnt; // number of groups to execute at recovery
   ulong mts_recovery_index;     // running index of recoverable groups

=== modified file 'sql/rpl_rli_pdb.cc'
--- a/sql/rpl_rli_pdb.cc	2011-11-22 10:19:19 +0000
+++ b/sql/rpl_rli_pdb.cc	2011-12-16 15:53:16 +0000
@@ -430,20 +430,23 @@ bool init_hash_workers(ulong slave_paral
 {
   DBUG_ENTER("init_hash_workers");
 
-#ifdef HAVE_PSI_INTERFACE
-  mysql_mutex_init(key_mutex_slave_worker_hash, &slave_worker_hash_lock,
-                   MY_MUTEX_INIT_FAST);
-  mysql_cond_init(key_cond_slave_worker_hash, &slave_worker_hash_cond, NULL);
-#else
-  mysql_mutex_init(NULL, &slave_worker_hash_lock,
-                   MY_MUTEX_INIT_FAST);
-  mysql_cond_init(NULL, &slave_worker_hash_cond, NULL);
-#endif
-
   inited_hash_workers=
     (my_hash_init(&mapping_db_to_worker, &my_charset_bin,
                  0, 0, 0, get_key,
                  (my_hash_free_key) free_entry, 0) == 0);
+  if (inited_hash_workers)
+  {
+#ifdef HAVE_PSI_INTERFACE
+    mysql_mutex_init(key_mutex_slave_worker_hash, &slave_worker_hash_lock,
+                     MY_MUTEX_INIT_FAST);
+    mysql_cond_init(key_cond_slave_worker_hash, &slave_worker_hash_cond, NULL);
+#else
+    mysql_mutex_init(NULL, &slave_worker_hash_lock,
+                     MY_MUTEX_INIT_FAST);
+    mysql_cond_init(NULL, &slave_worker_hash_cond, NULL);
+#endif
+  }
+
   DBUG_RETURN (!inited_hash_workers);
 }
 
@@ -453,9 +456,10 @@ void destroy_hash_workers(Relay_log_info
   if (inited_hash_workers)
   {
     my_hash_free(&mapping_db_to_worker);
+    mysql_mutex_destroy(&slave_worker_hash_lock);
+    mysql_cond_destroy(&slave_worker_hash_cond);
+    inited_hash_workers= false;
   }
-  mysql_mutex_destroy(&slave_worker_hash_lock);
-  mysql_cond_destroy(&slave_worker_hash_cond);
 
   DBUG_VOID_RETURN;
 }
@@ -1173,9 +1177,9 @@ bool Slave_committed_queue::count_done(R
 
   DBUG_PRINT("mts", ("Checking if it can simulate a crash:"
              " mts_checkpoint_group %u counter %lu parallel slaves %lu\n",
-             mts_checkpoint_group, cnt, rli->slave_parallel_workers));
+             opt_mts_checkpoint_group, cnt, rli->slave_parallel_workers));
 
-  return (cnt == (rli->slave_parallel_workers * mts_checkpoint_group));
+  return (cnt == (rli->slave_parallel_workers * opt_mts_checkpoint_group));
 }
 #endif
 
@@ -1214,7 +1218,7 @@ ulong Slave_committed_queue::move_queue_
 
 #ifndef DBUG_OFF
     if (DBUG_EVALUATE_IF("check_slave_debug_group", 1, 0) &&
-        cnt == mts_checkpoint_period)
+        cnt == opt_mts_checkpoint_period)
       return cnt;
 #endif
 
@@ -1743,11 +1747,11 @@ int slave_worker_exec_job(Slave_worker *
 
 #ifndef DBUG_OFF
     DBUG_PRINT("mts", ("Check_slave_debug_group worker %lu mts_checkpoint_group"
-               " %u processed %lu debug %d\n", worker->id, mts_checkpoint_group,
+               " %u processed %lu debug %d\n", worker->id, opt_mts_checkpoint_group,
                worker->groups_done,
                DBUG_EVALUATE_IF("check_slave_debug_group", 1, 0)));
     if (DBUG_EVALUATE_IF("check_slave_debug_group", 1, 0) &&
-        mts_checkpoint_group == worker->groups_done)
+        opt_mts_checkpoint_group == worker->groups_done)
     {
       DBUG_PRINT("mts", ("Putting worker %lu in busy wait.", worker->id));
       while (true) my_sleep(6000000);

=== modified file 'sql/rpl_slave.cc'
--- a/sql/rpl_slave.cc	2011-12-02 20:46:47 +0000
+++ b/sql/rpl_slave.cc	2011-12-21 10:29:44 +0000
@@ -87,7 +87,7 @@ const char *relay_log_basename= 0;
   of Relay_log_info::gaq (see @c slave_start_workers()).
   It can be set to any value in [1, ULONG_MAX - 1] range.
 */
-const ulong mts_slave_worker_queue_len_max= 32768;
+const ulong mts_slave_worker_queue_len_max= 16384;
 
 /*
   MTS load-ballancing parameter.
@@ -340,8 +340,9 @@ int init_slave()
   /* If server id is not set, start_slave_thread() will say it */
   if (active_mi->host[0] && !opt_skip_slave_start)
   {
-    /* same as in start_slave() cache the global var value into rli's member */
+    /* same as in start_slave() cache the global var values into rli's members */
     active_mi->rli->opt_slave_parallel_workers= opt_mts_slave_parallel_workers;
+    active_mi->rli->checkpoint_group= opt_mts_checkpoint_group;
     if (start_slave_threads(1 /* need mutex */,
                             0 /* no wait for start*/,
                             active_mi,
@@ -4268,7 +4269,7 @@ bool mts_checkpoint_routine(Relay_log_in
     cnt= rli->gaq->move_queue_head(&rli->workers);
 #ifndef DBUG_OFF
     if (DBUG_EVALUATE_IF("check_slave_debug_group", 1, 0) &&
-        cnt != mts_checkpoint_period)
+        cnt != opt_mts_checkpoint_period)
       sql_print_error("This an error cnt != mts_checkpoint_period");
 #endif
   } while (!sql_slave_killed(rli->info_thd, rli) &&
@@ -4381,7 +4382,8 @@ int slave_start_single_worker(Relay_log_
   }
   set_dynamic(&rli->workers, (uchar*) &w, i);
 
-  if (pthread_create(&th, &connection_attrib, handle_slave_worker,
+  if (DBUG_EVALUATE_IF("mts_worker_thread_fails", i == 1, 0) ||
+      pthread_create(&th, &connection_attrib, handle_slave_worker,
                      (void*) w))
   {
     sql_print_error("Failed during slave worker thread create");
@@ -4397,6 +4399,18 @@ int slave_start_single_worker(Relay_log_
   insert_dynamic(&rli->least_occupied_workers, (uchar*) &w->jobs.len);
 
 err:
+  if (error && w)
+  {
+    w->end_info();
+    delete_dynamic(&w->jobs.Q);
+    delete w;
+    /*
+      Any failure after dynarray inserted must follow with deletion
+      of just created item.
+    */
+    if (rli->workers.elements == i + 1)
+      delete_dynamic_element(&rli->workers, i);
+  }
   return error;
 }
 
@@ -4408,7 +4422,7 @@ err:
    @return 0         success
            non-zero  as failure
 */
-int slave_start_workers(Relay_log_info *rli, ulong n)
+int slave_start_workers(Relay_log_info *rli, ulong n, bool *mts_inited)
 {
   uint i;
   int error= 0;
@@ -4416,6 +4430,8 @@ int slave_start_workers(Relay_log_info *
   if (n == 0) 
     return error;
 
+  *mts_inited= true;
+
   // RLI constructor time alloc/init
 
   rli->init_workers(n);
@@ -4431,7 +4447,7 @@ int slave_start_workers(Relay_log_info *
 
   /* 
      GAQ  queue holds seqno:s of scheduled groups. C polls workers in 
-     @c lwm_checkpoint_period to update GAQ (see @c next_event())
+     @c opt_mts_checkpoint_period to update GAQ (see @c next_event())
      The length of GAQ is set to be equal to checkpoint_group.
      Notice, the size matters for mts_checkpoint_routine's progress loop.
   */
@@ -4462,12 +4478,6 @@ int slave_start_workers(Relay_log_info *
   init_alloc_root(&rli->mts_coor_mem_root, NAME_LEN,
                   (MAX_DBS_IN_EVENT_MTS / 2) * NAME_LEN);
 
-  for (i= 0; i < n; i++)
-  {
-    if ((error= slave_start_single_worker(rli, i)))
-      goto err;
-  }
-
   if (init_hash_workers(n))  // MTS: mapping_db_to_worker
   {
     sql_print_error("Failed to init partitions hash");
@@ -4475,6 +4485,12 @@ int slave_start_workers(Relay_log_info *
     goto err;
   }
 
+  for (i= 0; i < n; i++)
+  {
+    if ((error= slave_start_single_worker(rli, i)))
+      goto err;
+  }
+
 err:
   rli->slave_parallel_workers= rli->workers.elements;
   // end recovery right now if mts_recovery_groups() did not find any gaps
@@ -4494,14 +4510,16 @@ err:
    worker's running_status.
    Coordinator finalizes with its MTS running status to reset few objects.
 */
-void slave_stop_workers(Relay_log_info *rli)
+void slave_stop_workers(Relay_log_info *rli, bool *mts_inited)
 {
   int i;
   THD *thd= rli->info_thd;
 
-  if (rli->slave_parallel_workers == 0) 
+  if (!*mts_inited) 
     return;
-  
+  else if (rli->slave_parallel_workers == 0)
+    goto end;
+
   /*
     In case of the "soft" graceful stop Coordinator
     guaranteed Workers were assigned with full groups so waiting
@@ -4597,6 +4615,7 @@ void slave_stop_workers(Relay_log_info *
   DBUG_ASSERT(rli->pending_jobs == 0);
   DBUG_ASSERT(rli->mts_pending_jobs_size == 0);
 
+end:
   rli->mts_group_status= Relay_log_info::MTS_NOT_IN_GROUP;
   destroy_hash_workers(rli);
   delete rli->gaq;
@@ -4606,6 +4625,7 @@ void slave_stop_workers(Relay_log_info *
   rli->deinit_workers();
   rli->slave_parallel_workers= 0;
   free_root(&rli->mts_coor_mem_root, MYF(0));
+  *mts_inited= false;
 }
 
 /**
@@ -4628,7 +4648,8 @@ pthread_handler_t handle_slave_sql(void
 
   Relay_log_info* rli = ((Master_info*)arg)->rli;
   const char *errmsg;
- 
+  bool mts_inited= false;
+
   // needs to call my_thread_init(), otherwise we get a coredump in DBUG_ stuff
   my_thread_init();
   DBUG_ENTER("handle_slave_sql");
@@ -4671,7 +4692,7 @@ pthread_handler_t handle_slave_sql(void
   mysql_mutex_unlock(&LOCK_thread_count);
 
   /* MTS: starting the worker pool */
-  if (slave_start_workers(rli, rli->opt_slave_parallel_workers) != 0)
+  if (slave_start_workers(rli, rli->opt_slave_parallel_workers, &mts_inited) != 0)
   {
     mysql_cond_broadcast(&rli->start_cond);
     mysql_mutex_unlock(&rli->run_lock);
@@ -4921,7 +4942,7 @@ llstr(rli->get_group_master_log_pos(), l
 
  err:
 
-  slave_stop_workers(rli); // stopping worker pool before clearing own error
+  slave_stop_workers(rli, &mts_inited); // stopping worker pool
 
   /*
     Some events set some playgrounds, which won't be cleared because thread
@@ -6229,9 +6250,9 @@ static Log_event* next_event(Relay_log_i
          MTS checkpoint in the successful read branch 
       */
       bool force= (rli->checkpoint_seqno > (rli->checkpoint_group - 1));
-      if (rli->is_parallel_exec() && (mts_checkpoint_period != 0 || force))
+      if (rli->is_parallel_exec() && (opt_mts_checkpoint_period != 0 || force))
       {
-        ulonglong period= static_cast<ulonglong>(mts_checkpoint_period * 1000000ULL);
+        ulonglong period= static_cast<ulonglong>(opt_mts_checkpoint_period * 1000000ULL);
         mysql_mutex_unlock(&rli->data_lock);
         /*
           At this point the coordinator has is delegating jobs to workers and
@@ -6367,12 +6388,12 @@ static Log_event* next_event(Relay_log_i
         mysql_cond_broadcast(&rli->log_space_cond);
         // Note that wait_for_update_relay_log unlocks lock_log !
 
-        if (rli->is_parallel_exec() && (mts_checkpoint_period != 0 ||
+        if (rli->is_parallel_exec() && (opt_mts_checkpoint_period != 0 ||
             DBUG_EVALUATE_IF("check_slave_debug_group", 1, 0)))
         {
           int ret= 0;
           struct timespec waittime;
-          ulonglong period= static_cast<ulonglong>(mts_checkpoint_period * 1000000ULL);
+          ulonglong period= static_cast<ulonglong>(opt_mts_checkpoint_period * 1000000ULL);
           ulong signal_cnt= rli->relay_log.signal_cnt;
 
           mysql_mutex_unlock(log_lock);
@@ -6863,10 +6884,15 @@ int start_slave(THD* thd , Master_info*
       if (thread_mask & SLAVE_SQL)
       {
         /*
-          To cache the system var value and used it in the following.
-          The system var can change but not the cached.
+          To cache the MTS system var values and used them in the following
+          runtime. The system var:s can change meanwhile but having no other
+          effects.
         */
         mi->rli->opt_slave_parallel_workers= opt_mts_slave_parallel_workers;
+#ifndef DBUG_OFF
+        if (!DBUG_EVALUATE_IF("check_slave_debug_group", 1, 0))
+#endif
+          mi->rli->checkpoint_group= opt_mts_checkpoint_group;
 
         mysql_mutex_lock(&mi->rli->data_lock);
 

=== modified file 'sql/rpl_slave.h'
--- a/sql/rpl_slave.h	2011-08-19 13:04:28 +0000
+++ b/sql/rpl_slave.h	2011-11-24 18:26:55 +0000
@@ -57,6 +57,7 @@ typedef enum { SLAVE_THD_IO, SLAVE_THD_S
 
 #define MTS_WORKER_UNDEF ((ulong) -1)
 #define MTS_MAX_WORKERS  1024
+#define MTS_MAX_BITS_IN_GROUP ((1L << 19) - 1) /* 524287 */
 
 // Forward declarations
 class Relay_log_info;

=== modified file 'sql/sql_admin.cc'
--- a/sql/sql_admin.cc	2011-07-28 10:54:44 +0000
+++ b/sql/sql_admin.cc	2011-12-19 22:31:09 +0000
@@ -417,12 +417,8 @@ static bool mysql_admin_table(THD* thd,
             my_error(ER_PARTITION_MGMT_ON_NONPARTITIONED, MYF(0));
             DBUG_RETURN(TRUE);
           }
-          uint num_parts_found;
-          uint num_parts_opt= alter_info->partition_names.elements;
-          num_parts_found= set_part_state(alter_info, table->table->part_info,
-                                          PART_ADMIN);
-          if (num_parts_found != num_parts_opt &&
-              (!(alter_info->flags & ALTER_ALL_PARTITION)))
+          
+          if (set_part_state(alter_info, table->table->part_info, PART_ADMIN))
           {
             char buff[FN_REFLEN + MYSQL_ERRMSG_SIZE];
             size_t length;
@@ -453,6 +449,9 @@ static bool mysql_admin_table(THD* thd,
       case  1:           // error, message written to net
         trans_rollback_stmt(thd);
         trans_rollback(thd);
+        /* Make sure this table instance is not reused after the operation. */
+        if (table->table)
+          table->table->m_needs_reopen= true;
         close_thread_tables(thd);
         thd->mdl_context.release_transactional_locks();
         DBUG_PRINT("admin", ("simple error, admin next table"));
@@ -525,6 +524,9 @@ static bool mysql_admin_table(THD* thd,
       protocol->store(buff, length, system_charset_info);
       trans_commit_stmt(thd);
       trans_commit(thd);
+      /* Make sure this table instance is not reused after the operation. */
+      if (table->table)
+        table->table->m_needs_reopen= true;
       close_thread_tables(thd);
       thd->mdl_context.release_transactional_locks();
       lex->reset_query_tables_list(FALSE);
@@ -601,6 +603,9 @@ static bool mysql_admin_table(THD* thd,
 
         trans_rollback_stmt(thd);
         trans_rollback(thd);
+        /* Make sure this table instance is not reused after the operation. */
+        if (table->table)
+          table->table->m_needs_reopen= true;
         close_thread_tables(thd);
         thd->mdl_context.release_transactional_locks();
 
@@ -821,6 +826,9 @@ send_result_message:
           }
           thd->clear_error();
         }
+        /* Make sure this table instance is not reused after the operation. */
+        if (table->table)
+          table->table->m_needs_reopen= true;
       }
       result_code= result_code ? HA_ADMIN_FAILED : HA_ADMIN_OK;
       table->next_local= save_next_local;
@@ -920,6 +928,9 @@ send_result_message:
 err:
   trans_rollback_stmt(thd);
   trans_rollback(thd);
+  /* Make sure this table instance is not reused after the operation. */
+  if (table->table)
+    table->table->m_needs_reopen= true;
   close_thread_tables(thd);			// Shouldn't be needed
   thd->mdl_context.release_transactional_locks();
   DBUG_RETURN(TRUE);

=== modified file 'sql/sql_base.cc'
--- a/sql/sql_base.cc	2011-12-16 11:55:10 +0000
+++ b/sql/sql_base.cc	2011-12-22 09:25:51 +0000
@@ -2845,7 +2845,7 @@ bool open_table(THD *thd, TABLE_LIST *ta
       if (dd_frm_type(thd, path, &not_used) == FRMTYPE_VIEW)
       {
         if (!tdc_open_view(thd, table_list, alias, key, key_length,
-                           mem_root, 0))
+                           mem_root, CHECK_METADATA_VERSION))
         {
           DBUG_ASSERT(table_list->view != 0);
           DBUG_RETURN(FALSE); // VIEW
@@ -2983,6 +2983,11 @@ retry_share:
     DBUG_RETURN(TRUE);
   }
 
+  /*
+    Check if this TABLE_SHARE-object corresponds to a view. Note, that there is
+    no need to call TABLE_SHARE::has_old_version() as we do for regular tables,
+    because view shares are always up to date.
+  */
   if (share->is_view)
   {
     /*
@@ -3819,6 +3824,24 @@ bool tdc_open_view(THD *thd, TABLE_LIST
                                hash_value)))
     goto err;
 
+  if ((flags & CHECK_METADATA_VERSION))
+  {
+    /*
+      Check TABLE_SHARE-version of view only if we have been instructed to do
+      so. We do not need to check the version if we're executing CREATE VIEW or
+      ALTER VIEW statements.
+
+      In the future, this functionality should be moved out from
+      tdc_open_view(), and  tdc_open_view() should became a part of a clean
+      table-definition-cache interface.
+    */
+    if (check_and_update_table_version(thd, table_list, share))
+    {
+      release_table_share(share);
+      goto err;
+    }
+  }
+
   if (share->is_view &&
       !open_new_frm(thd, share, alias,
                     (uint) (HA_OPEN_KEYFILE | HA_OPEN_RNDFILE |

=== modified file 'sql/sql_executor.cc'
--- a/sql/sql_executor.cc	2011-12-15 09:00:42 +0000
+++ b/sql/sql_executor.cc	2011-12-19 09:53:30 +0000
@@ -1738,6 +1738,7 @@ sub_select_sjm(JOIN *join, JOIN_TAB *joi
     last_tab->read_record.copy_field_end= sjm->copy_field +
                                           sjm->table_cols.elements;
     last_tab->read_record.read_record= rr_sequential_and_unpack;
+    DBUG_ASSERT(last_tab->read_record.unlock_row == rr_unlock_row);
 
     // Clear possible outer join information from earlier use of this join tab
     last_tab->last_inner= NULL;
@@ -3188,35 +3189,41 @@ pick_table_access_method(JOIN_TAB *tab)
   case JT_REF:
     tab->read_first_record= join_read_always_key;
     tab->read_record.read_record= join_read_next_same;
+    tab->read_record.unlock_row= rr_unlock_row;
     break;
 
   case JT_REF_OR_NULL:
     tab->read_first_record= join_read_always_key_or_null;
     tab->read_record.read_record= join_read_next_same_or_null;
+    tab->read_record.unlock_row= rr_unlock_row;
     break;
 
   case JT_CONST:
     tab->read_first_record= join_read_const;
     tab->read_record.read_record= join_no_more_records;
+    tab->read_record.unlock_row= rr_unlock_row;
     break;
 
   case JT_EQ_REF:
     tab->read_first_record= join_read_key;
     tab->read_record.read_record= join_no_more_records;
+    tab->read_record.unlock_row= join_read_key_unlock_row;
     break;
 
   case JT_FT:
     tab->read_first_record= join_ft_read_first;
     tab->read_record.read_record= join_ft_read_next;
+    tab->read_record.unlock_row= rr_unlock_row;
     break;
 
   case JT_SYSTEM:
     tab->read_first_record= join_read_system;
     tab->read_record.read_record= join_no_more_records;
+    tab->read_record.unlock_row= rr_unlock_row;
     break;
 
-  /* keep gcc happy */  
   default:
+    tab->read_record.unlock_row= rr_unlock_row;
     break;  
   }
 }

=== modified file 'sql/sql_partition.cc'
--- a/sql/sql_partition.cc	2011-12-15 12:13:36 +0000
+++ b/sql/sql_partition.cc	2011-12-19 13:21:37 +0000
@@ -4550,11 +4550,20 @@ error:
 }
 
 
-/*
-  Sets which partitions to be used in the command
+/**
+  Sets which partitions to be used in the command.
+
+  @param alter_info     Alter_info pointer holding partition names and flags.
+  @param tab_part_info  partition_info holding all partitions.
+  @param part_state     Which state to set for the named partitions.
+
+  @return Operation status
+    @retval false  Success
+    @retval true   Failure
 */
-uint set_part_state(Alter_info *alter_info, partition_info *tab_part_info,
-               enum partition_state part_state)
+
+bool set_part_state(Alter_info *alter_info, partition_info *tab_part_info,
+                    enum partition_state part_state)
 {
   uint part_count= 0;
   uint num_parts_found= 0;
@@ -4580,7 +4589,21 @@ uint set_part_state(Alter_info *alter_in
     else
       part_elem->part_state= PART_NORMAL;
   } while (++part_count < tab_part_info->num_parts);
-  return num_parts_found;
+
+  if (num_parts_found != alter_info->partition_names.elements &&
+      !(alter_info->flags & ALTER_ALL_PARTITION))
+  {
+    /* Not all given partitions found, revert and return failure */
+    part_it.rewind();
+    part_count= 0;
+    do
+    {
+      partition_element *part_elem= part_it++;
+      part_elem->part_state= PART_NORMAL;
+    } while (++part_count < tab_part_info->num_parts);
+    return true;
+  }
+  return false;
 }
 
 
@@ -5149,11 +5172,7 @@ that are reorganised.
     }
     else if (alter_info->flags & ALTER_REBUILD_PARTITION)
     {
-      uint num_parts_found;
-      uint num_parts_opt= alter_info->partition_names.elements;
-      num_parts_found= set_part_state(alter_info, tab_part_info, PART_CHANGED);
-      if (num_parts_found != num_parts_opt &&
-          (!(alter_info->flags & ALTER_ALL_PARTITION)))
+      if (set_part_state(alter_info, tab_part_info, PART_CHANGED))
       {
         my_error(ER_DROP_PARTITION_NON_EXISTENT, MYF(0), "REBUILD");
         goto err;

=== modified file 'sql/sql_partition.h'
--- a/sql/sql_partition.h	2011-06-30 15:50:45 +0000
+++ b/sql/sql_partition.h	2011-11-08 12:55:37 +0000
@@ -250,7 +250,7 @@ uint fast_alter_partition_table(THD *thd
                                 char *db,
                                 const char *table_name,
                                 TABLE  *fast_alter_table);
-uint set_part_state(Alter_info *alter_info, partition_info *tab_part_info,
+bool set_part_state(Alter_info *alter_info, partition_info *tab_part_info,
                     enum partition_state part_state);
 uint prep_alter_part_table(THD *thd, TABLE *table, Alter_info *alter_info,
                            HA_CREATE_INFO *create_info,

=== modified file 'sql/sql_select.cc'
--- a/sql/sql_select.cc	2011-12-15 17:14:28 +0000
+++ b/sql/sql_select.cc	2011-12-19 09:53:30 +0000
@@ -2672,7 +2672,6 @@ make_join_readinfo(JOIN *join, ulonglong
     TABLE    *const table= tab->table;
     bool icp_other_tables_ok;
     tab->read_record.table= table;
-    tab->read_record.unlock_row= rr_unlock_row;
     tab->next_select=sub_select;		/* normal select */
     tab->cache_idx_cond= 0;
     /*
@@ -2706,8 +2705,6 @@ make_join_readinfo(JOIN *join, ulonglong
     }
     switch (tab->type) {
     case JT_EQ_REF:
-      tab->read_record.unlock_row= join_read_key_unlock_row;
-      /* fall through */
     case JT_REF_OR_NULL:
     case JT_REF:
       if (tab->select)
@@ -4049,6 +4046,7 @@ check_reverse_order:
         */
         tab->read_first_record= join_read_last_key;
         tab->read_record.read_record= join_read_prev_same;
+        tab->read_record.unlock_row= rr_unlock_row;
       }
     }
     else if (select && select->quick)

=== modified file 'sql/sql_view.cc'
--- a/sql/sql_view.cc	2011-12-09 08:59:22 +0000
+++ b/sql/sql_view.cc	2011-12-19 11:42:11 +0000
@@ -675,6 +675,15 @@ bool mysql_create_view(THD *thd, TABLE_L
 
   res= mysql_register_view(thd, view, mode);
 
+  /*
+    View TABLE_SHARE must be removed from the table definition cache in order to
+    make ALTER VIEW work properly. Otherwise, we would not be able to detect
+    meta-data changes after ALTER VIEW.
+  */
+
+  if (!res)
+    tdc_remove_table(thd, TDC_RT_REMOVE_ALL, view->db, view->table_name, false);
+
   if (mysql_bin_log.is_open())
   {
     String buff;

=== modified file 'sql/sql_yacc.yy'
--- a/sql/sql_yacc.yy	2011-12-14 15:55:30 +0000
+++ b/sql/sql_yacc.yy	2011-12-19 12:53:11 +0000
@@ -5029,7 +5029,7 @@ part_values_in:
                 arrays with one entry in each array. This can happen
                 in the first partition of an ALTER TABLE statement where
                 we ADD or REORGANIZE partitions. Also can only happen
-                for LIST partitions.
+                for LIST [COLUMNS] partitions.
               */
               if (part_info->reorganize_into_single_field_col_val())
               {

=== modified file 'sql/sys_vars.cc'
--- a/sql/sys_vars.cc	2011-12-02 16:18:37 +0000
+++ b/sql/sys_vars.cc	2011-12-19 18:05:58 +0000
@@ -3637,7 +3637,7 @@ static Sys_var_uint Sys_checkpoint_mts_p
        "slave_checkpoint_period", "Gather workers' activities to "
        "Update progress status of Multi-threaded slave and flush "
        "the relay log info to disk after every #th milli-seconds.",
-       GLOBAL_VAR(mts_checkpoint_period), CMD_LINE(REQUIRED_ARG),
+       GLOBAL_VAR(opt_mts_checkpoint_period), CMD_LINE(REQUIRED_ARG),
 #ifndef DBUG_OFF
        VALID_RANGE(0, UINT_MAX), DEFAULT(300), BLOCK_SIZE(1));
 #else
@@ -3648,11 +3648,11 @@ static Sys_var_uint Sys_checkpoint_mts_g
        "slave_checkpoint_group",
        "Maximum number of processed transactions by Multi-threaded slave "
        "before a checkpoint operation is called to update progress status.",
-       GLOBAL_VAR(mts_checkpoint_group), CMD_LINE(REQUIRED_ARG),
+       GLOBAL_VAR(opt_mts_checkpoint_group), CMD_LINE(REQUIRED_ARG),
 #ifndef DBUG_OFF
-       VALID_RANGE(1, UINT_MAX), DEFAULT(512), BLOCK_SIZE(1));
+       VALID_RANGE(1, MTS_MAX_BITS_IN_GROUP), DEFAULT(512), BLOCK_SIZE(1));
 #else
-       VALID_RANGE(512, UINT_MAX), DEFAULT(512), BLOCK_SIZE(8));
+       VALID_RANGE(512, MTS_MAX_BITS_IN_GROUP), DEFAULT(512), BLOCK_SIZE(1));
 #endif /* DBUG_OFF */
 #endif /* HAVE_REPLICATION */
 

=== modified file 'sql/table.h'
--- a/sql/table.h	2011-12-15 12:12:14 +0000
+++ b/sql/table.h	2011-12-19 11:42:11 +0000
@@ -867,7 +867,7 @@ struct TABLE_SHARE
   }
   /**
     Return a table metadata version.
-     * for base tables, we return table_map_id.
+     * for base tables and views, we return table_map_id.
        It is assigned from a global counter incremented for each
        new table loaded into the table definition cache (TDC).
      * for temporary tables it's table_map_id again. But for
@@ -876,7 +876,7 @@ struct TABLE_SHARE
        counter incremented for every new SQL statement. Since
        temporary tables are thread-local, each temporary table
        gets a unique id.
-     * for everything else (views, information schema tables),
+     * for everything else (e.g. information schema tables),
        the version id is zero.
 
    This choice of version id is a large compromise
@@ -891,8 +891,8 @@ struct TABLE_SHARE
    version id of a temporary table is never compared with
    a version id of a view, and vice versa.
 
-   Secondly, for base tables, we know that each DDL flushes the
-   respective share from the TDC. This ensures that whenever
+   Secondly, for base tables and views, we know that each DDL flushes
+   the respective share from the TDC. This ensures that whenever
    a table is altered or dropped and recreated, it gets a new
    version id.
    Unfortunately, since elements of the TDC are also flushed on
@@ -913,26 +913,6 @@ struct TABLE_SHARE
    Metadata of information schema tables never changes.
    Thus we can safely assume 0 for a good enough version id.
 
-   Views are a special and tricky case. A view is always inlined
-   into the parse tree of a prepared statement at prepare.
-   Thus, when we execute a prepared statement, the parse tree
-   will not get modified even if the view is replaced with another
-   view.  Therefore, we can safely choose 0 for version id of
-   views and effectively never invalidate a prepared statement
-   when a view definition is altered. Note, that this leads to
-   wrong binary log in statement-based replication, since we log
-   prepared statement execution in form Query_log_events
-   containing conventional statements. But since there is no
-   metadata locking for views, the very same problem exists for
-   conventional statements alone, as reported in Bug#25144. The only
-   difference between prepared and conventional execution is,
-   effectively, that for prepared statements the race condition
-   window is much wider.
-   In 6.0 we plan to support view metadata locking (WL#3726) and
-   extend table definition cache to cache views (WL#4298).
-   When this is done, views will be handled in the same fashion
-   as the base tables.
-
    Finally, by taking into account table type, we always
    track that a change has taken place when a view is replaced
    with a base table, a base table is replaced with a temporary
@@ -942,7 +922,7 @@ struct TABLE_SHARE
   */
   ulong get_table_ref_version() const
   {
-    return (tmp_table == SYSTEM_TMP_TABLE || is_view) ? 0 : table_map_id;
+    return (tmp_table == SYSTEM_TMP_TABLE) ? 0 : table_map_id;
   }
 
   bool visit_subgraph(Wait_for_flush *waiting_ticket,

=== modified file 'sql/unireg.h'
--- a/sql/unireg.h	2011-10-12 13:30:13 +0000
+++ b/sql/unireg.h	2011-12-19 11:42:11 +0000
@@ -134,11 +134,14 @@ typedef struct st_ha_create_information
   The flag means that I_S table uses optimization algorithm.
 */
 #define OPTIMIZE_I_S_TABLE     OPEN_VIEW_FULL*2
-
-/*
+/**
   The flag means that we need to process trigger files only.
 */
 #define OPEN_TRIGGER_ONLY      OPTIMIZE_I_S_TABLE*2
+/**
+  This flag is used to instruct tdc_open_view() to check metadata version.
+*/
+#define CHECK_METADATA_VERSION OPEN_TRIGGER_ONLY*2
 
 #define SC_INFO_LENGTH 4		/* Form format constant */
 #define TE_INFO_LENGTH 3

=== modified file 'storage/innobase/buf/buf0flu.cc'
--- a/storage/innobase/buf/buf0flu.cc	2011-12-19 08:43:28 +0000
+++ b/storage/innobase/buf/buf0flu.cc	2011-12-21 03:24:58 +0000
@@ -670,6 +670,40 @@ buf_flush_relocate_on_flush_list(
 }
 
 /********************************************************************//**
+Updates the doublewrite buffer when an IO request that is part of an
+LRU or flush batch is completed. */
+UNIV_INLINE
+void
+buf_flush_update_doublewrite(void)
+/*==============================*/
+{
+	if (!srv_use_doublewrite_buf || trx_doublewrite == NULL) {
+		return;
+	}
+
+	mutex_enter(&trx_doublewrite->mutex);
+
+	ut_ad(trx_doublewrite->batch_running);
+	ut_ad(trx_doublewrite->b_reserved > 0);
+
+	trx_doublewrite->b_reserved--;
+	if (trx_doublewrite->b_reserved == 0) {
+
+		mutex_exit(&trx_doublewrite->mutex);
+		/* This will finish the batch. Sync data files
+		to the disk. */
+		fil_flush_file_spaces(FIL_TABLESPACE);
+		mutex_enter(&trx_doublewrite->mutex);
+
+		/* We can now reuse the doublewrite memory buffer: */
+		trx_doublewrite->first_free = 0;
+		trx_doublewrite->batch_running = FALSE;
+	}
+
+	mutex_exit(&trx_doublewrite->mutex);
+}
+
+/********************************************************************//**
 Updates the flush system data structures when a write is completed. */
 UNIV_INTERN
 void
@@ -697,6 +731,19 @@ buf_flush_write_complete(
 
 		os_event_set(buf_pool->no_flush[flush_type]);
 	}
+
+	switch (flush_type) {
+	case BUF_FLUSH_LIST:
+	case BUF_FLUSH_LRU:
+		buf_flush_update_doublewrite();
+		break;
+	case BUF_FLUSH_SINGLE_PAGE:
+		/* Single page flushes are synchronous. No need
+		to update doublewrite */
+		break;
+	case BUF_FLUSH_N_TYPES:
+		ut_error;
+	}
 }
 
 /********************************************************************//**
@@ -970,16 +1017,11 @@ flush:
 		buf_flush_write_block_to_datafile(block);
 	}
 
-	/* Sync the writes to the disk. */
-	buf_flush_sync_datafiles();
-
-	mutex_enter(&trx_doublewrite->mutex);
-
-	/* We can now reuse the doublewrite memory buffer: */
-	trx_doublewrite->first_free = 0;
-	trx_doublewrite->batch_running = FALSE;
-
-	mutex_exit(&(trx_doublewrite->mutex));
+	/* Wake possible simulated aio thread to actually post the
+	writes to the operating system. We don't flush the files
+	at this point. We leave it to the IO helper thread to flush
+	datafiles when the whole batch has been processed. */
+	os_aio_simulated_wake_handler_threads();
 }
 
 /********************************************************************//**
@@ -1046,6 +1088,9 @@ try_again:
 	trx_doublewrite->buf_block_arr[trx_doublewrite->first_free] = bpage;
 
 	trx_doublewrite->first_free++;
+	trx_doublewrite->b_reserved++;
+
+	ut_ad(trx_doublewrite->b_reserved <= srv_doublewrite_batch_size);
 
 	if (trx_doublewrite->first_free == srv_doublewrite_batch_size) {
 		mutex_exit(&(trx_doublewrite->mutex));
@@ -1105,7 +1150,7 @@ buf_flush_write_to_dblwr_and_datafile(
 
 retry:
 	mutex_enter(&trx_doublewrite->mutex);
-	if (trx_doublewrite->n_reserved == n_slots) {
+	if (trx_doublewrite->s_reserved == n_slots) {
 
 		mutex_exit(&trx_doublewrite->mutex);
 		/* All slots are reserved. Since it involves two IOs
@@ -1125,7 +1170,7 @@ retry:
 	/* We are guaranteed to find a slot. */
 	ut_a(i < size);
 	trx_doublewrite->in_use[i] = TRUE;
-	trx_doublewrite->n_reserved++;
+	trx_doublewrite->s_reserved++;
 	trx_doublewrite->buf_block_arr[i] = bpage;
 	mutex_exit(&trx_doublewrite->mutex);
 
@@ -1182,7 +1227,7 @@ retry:
 
 	mutex_enter(&trx_doublewrite->mutex);
 
-	trx_doublewrite->n_reserved--;
+	trx_doublewrite->s_reserved--;
 	trx_doublewrite->buf_block_arr[i] = NULL;
 	trx_doublewrite->in_use[i] = FALSE;
 

=== modified file 'storage/innobase/include/os0file.h'
--- a/storage/innobase/include/os0file.h	2011-11-24 07:15:35 +0000
+++ b/storage/innobase/include/os0file.h	2011-12-21 19:35:09 +0000
@@ -46,9 +46,6 @@ Created 10/21/1995 Heikki Tuuri
 /** File node of a tablespace or the log data space */
 typedef	struct fil_node_struct	fil_node_t;
 
-#ifdef UNIV_DO_FLUSH
-extern ibool	os_do_not_call_flush_at_each_write;
-#endif /* UNIV_DO_FLUSH */
 extern ibool	os_has_said_disk_full;
 /** Flag: enable debug printout for asynchronous i/o */
 extern ibool	os_aio_print_debug;

=== modified file 'storage/innobase/include/trx0sys.h'
--- a/storage/innobase/include/trx0sys.h	2011-11-30 10:09:12 +0000
+++ b/storage/innobase/include/trx0sys.h	2011-12-21 03:24:58 +0000
@@ -651,8 +651,10 @@ struct trx_doublewrite_struct{
 	ulint	block2;		/*!< page number of the second block */
 	ulint	first_free;	/*!< first free position in write_buf measured
 				in units of UNIV_PAGE_SIZE */
-	ulint	n_reserved;	/*!< number of slots currently reserved
+	ulint	s_reserved;	/*!< number of slots currently reserved
 				for single page flushes. */
+	ulint	b_reserved;	/*!< number of slots currently reserved
+				for batch flush. */
 	ibool*	in_use;		/*!< flag used to indicate if a slot is
 				in use. Only used for single page
 				flushes. */

=== modified file 'storage/innobase/include/ut0rnd.ic'
--- a/storage/innobase/include/ut0rnd.ic	2011-11-21 04:58:23 +0000
+++ b/storage/innobase/include/ut0rnd.ic	2011-12-22 02:47:18 +0000
@@ -117,7 +117,7 @@ ut_rnd_interval(
 
 	rnd = ut_rnd_gen_ulint();
 
-	return(low + (rnd % (high - low + 1)));
+	return(low + (rnd % (high - low)));
 }
 
 /*********************************************************//**

=== modified file 'storage/innobase/os/os0file.cc'
--- a/storage/innobase/os/os0file.cc	2011-12-01 10:04:44 +0000
+++ b/storage/innobase/os/os0file.cc	2011-12-21 19:35:09 +0000
@@ -73,14 +73,6 @@ UNIV_INTERN ulint	os_innodb_umask
 UNIV_INTERN ulint	os_innodb_umask		= 0;
 #endif
 
-#ifdef UNIV_DO_FLUSH
-/* If the following is set to TRUE, we do not call os_file_flush in every
-os_file_write. We can set this TRUE when the doublewrite buffer is used. */
-UNIV_INTERN ibool	os_do_not_call_flush_at_each_write	= FALSE;
-#else
-/* We do not call os_file_flush in every os_file_write. */
-#endif /* UNIV_DO_FLUSH */
-
 #ifndef UNIV_HOTBACKUP
 /* We use these mutexes to protect lseek + file i/o operation, if the
 OS does not provide an atomic pread or pwrite, or similar */
@@ -2355,19 +2347,6 @@ os_file_pwrite(
 	MONITOR_ATOMIC_DEC(MONITOR_OS_PENDING_WRITES);
 #endif /* !HAVE_ATOMIC_BUILTINS || UNIV_WORD < 8 */
 
-# ifdef UNIV_DO_FLUSH
-	if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
-	    && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
-	    && !os_do_not_call_flush_at_each_write) {
-
-		/* Always do fsync to reduce the probability that when
-		the OS crashes, a database page is only partially
-		physically written to disk. */
-
-		ut_a(TRUE == os_file_flush(file));
-	}
-# endif /* UNIV_DO_FLUSH */
-
 	return(ret);
 #else
 	{
@@ -2398,19 +2377,6 @@ os_file_pwrite(
 
 		ret = write(file, buf, (ssize_t) n);
 
-# ifdef UNIV_DO_FLUSH
-		if (srv_unix_file_flush_method != SRV_UNIX_LITTLESYNC
-		    && srv_unix_file_flush_method != SRV_UNIX_NOSYNC
-		    && !os_do_not_call_flush_at_each_write) {
-
-			/* Always do fsync to reduce the probability that when
-			the OS crashes, a database page is only partially
-			physically written to disk. */
-
-			ut_a(TRUE == os_file_flush(file));
-		}
-# endif /* UNIV_DO_FLUSH */
-
 func_exit:
 # ifndef UNIV_HOTBACKUP
 		os_mutex_exit(os_file_seek_mutexes[i]);
@@ -2773,15 +2739,6 @@ retry:
 
 	ret = WriteFile(file, buf, (DWORD) n, &len, NULL);
 
-	/* Always do fsync to reduce the probability that when the OS crashes,
-	a database page is only partially physically written to disk. */
-
-# ifdef UNIV_DO_FLUSH
-	if (!os_do_not_call_flush_at_each_write) {
-		ut_a(TRUE == os_file_flush(file));
-	}
-# endif /* UNIV_DO_FLUSH */
-
 #ifndef UNIV_HOTBACKUP
 	os_mutex_exit(os_file_seek_mutexes[i]);
 #endif /* !UNIV_HOTBACKUP */
@@ -4312,16 +4269,8 @@ os_aio_windows_handle(
 	*type = slot->type;
 
 	if (ret && len == slot->len) {
-		ret_val = TRUE;
 
-#ifdef UNIV_DO_FLUSH
-		if (slot->type == OS_FILE_WRITE
-		    && !os_do_not_call_flush_at_each_write) {
-			if (!os_file_flush(slot->file)) {
-				ut_error;
-			}
-		}
-#endif /* UNIV_DO_FLUSH */
+		ret_val = TRUE;
 	} else if (os_file_handle_error(slot->name, "Windows aio")) {
 
 		retry = TRUE;
@@ -4613,15 +4562,8 @@ found:
 	*type = slot->type;
 
 	if ((slot->ret == 0) && (slot->n_bytes == (long) slot->len)) {
-		ret = TRUE;
 
-#ifdef UNIV_DO_FLUSH
-		if (slot->type == OS_FILE_WRITE
-		    && !os_do_not_call_flush_at_each_write)
-		    && !os_file_flush(slot->file) {
-			ut_error;
-		}
-#endif /* UNIV_DO_FLUSH */
+		ret = TRUE;
 	} else {
 		errno = -slot->ret;
 

=== modified file 'storage/innobase/row/row0sel.cc'
--- a/storage/innobase/row/row0sel.cc	2011-12-05 08:30:46 +0000
+++ b/storage/innobase/row/row0sel.cc	2011-12-21 13:01:49 +0000
@@ -4208,10 +4208,12 @@ rec_loop:
 #ifdef UNIV_SEARCH_DEBUG
 	/*
 	fputs("Using ", stderr);
-	dict_index_name_print(stderr, index);
+	dict_index_name_print(stderr, trx, index);
 	fprintf(stderr, " cnt %lu ; Page no %lu\n", cnt,
 	page_get_page_no(page_align(rec)));
-	rec_print(rec);
+	rec_print(stderr, rec, index);
+	printf("delete-mark: %lu\n",
+	       rec_get_deleted_flag(rec, page_rec_is_comp(rec)));
 	*/
 #endif /* UNIV_SEARCH_DEBUG */
 
@@ -4392,8 +4394,10 @@ wrong_offs:
 			btr_pcur_store_position(pcur, &mtr);
 
 			err = DB_RECORD_NOT_FOUND;
-			/* ut_print_name(stderr, index->name);
-			fputs(" record not found 3\n", stderr); */
+#if 0
+			ut_print_name(stderr, trx, FALSE, index->name);
+			fputs(" record not found 3\n", stderr);
+#endif
 
 			goto normal_return;
 		}
@@ -4431,8 +4435,10 @@ wrong_offs:
 			btr_pcur_store_position(pcur, &mtr);
 
 			err = DB_RECORD_NOT_FOUND;
-			/* ut_print_name(stderr, index->name);
-			fputs(" record not found 4\n", stderr); */
+#if 0
+			ut_print_name(stderr, trx, FALSE, index->name);
+			fputs(" record not found 4\n", stderr);
+#endif
 
 			goto normal_return;
 		}

=== modified file 'storage/innobase/trx/trx0sys.cc'
--- a/storage/innobase/trx/trx0sys.cc	2011-12-19 08:43:28 +0000
+++ b/storage/innobase/trx/trx0sys.cc	2011-12-21 19:35:09 +0000
@@ -194,17 +194,12 @@ trx_doublewrite_init(
 	ut_a(srv_doublewrite_batch_size > 0
 	     && srv_doublewrite_batch_size < buf_size);
 
-	/* Since we now start to use the doublewrite buffer, no need to call
-	fsync() after every write to a data file */
-#ifdef UNIV_DO_FLUSH
-	os_do_not_call_flush_at_each_write = TRUE;
-#endif /* UNIV_DO_FLUSH */
-
 	mutex_create(trx_doublewrite_mutex_key,
 		     &trx_doublewrite->mutex, SYNC_DOUBLEWRITE);
 
 	trx_doublewrite->first_free = 0;
-	trx_doublewrite->n_reserved = 0;
+	trx_doublewrite->s_reserved = 0;
+	trx_doublewrite->b_reserved = 0;
 
 	trx_doublewrite->block1 = mach_read_from_4(
 		doublewrite + TRX_SYS_DOUBLEWRITE_BLOCK1);
@@ -1736,7 +1731,8 @@ trx_sys_close(void)
 
 	/* Free the double write data structures. */
 	ut_a(trx_doublewrite != NULL);
-	ut_ad(trx_doublewrite->n_reserved == 0);
+	ut_ad(trx_doublewrite->s_reserved == 0);
+	ut_ad(trx_doublewrite->b_reserved == 0);
 
 	ut_free(trx_doublewrite->write_buf_unaligned);
 	trx_doublewrite->write_buf_unaligned = NULL;

No bundle (reason: useless for push emails).
Thread
bzr push into mysql-trunk-pfs-tuning branch (marc.alff:3456 to 3457) Marc Alff22 Dec