diff --git a/mysql-test/suite/rpl/r/temporal_row-9560,old2new.rdiff b/mysql-test/suite/rpl/r/temporal_row-9560,old2new.rdiff new file mode 100644 index 00000000000..550f64173a7 --- /dev/null +++ b/mysql-test/suite/rpl/r/temporal_row-9560,old2new.rdiff @@ -0,0 +1,11 @@ +--- suite/rpl/r/temporal_row-9560.result ++++ suite/rpl/r/temporal_row-9560.reject +@@ -7,7 +7,7 @@ + insert into t1 values ('2016-02-15 12:50:06.123'); + select @@mysql56_temporal_format; + @@mysql56_temporal_format +-0 ++1 + select * from t1; + ts + 2016-02-15 12:50:06.123 diff --git a/mysql-test/suite/rpl/r/temporal_row-9560.result b/mysql-test/suite/rpl/r/temporal_row-9560.result new file mode 100644 index 00000000000..c6a57d43fd0 --- /dev/null +++ b/mysql-test/suite/rpl/r/temporal_row-9560.result @@ -0,0 +1,15 @@ +include/master-slave.inc +[connection master] +select @@mysql56_temporal_format; +@@mysql56_temporal_format +0 +create table t1 (ts timestamp(3), t time(3), dt datetime(3)); +insert into t1 values ('2016-02-15 12:50:06.123', '12:50:06.123', '2016-02-15 12:50:06.123'); +select @@mysql56_temporal_format; +@@mysql56_temporal_format +0 +select * from t1; +ts t dt +2016-02-15 12:50:06.123 12:50:06.123 2016-02-15 12:50:06.123 +drop table t1; +include/rpl_end.inc diff --git a/mysql-test/suite/rpl/t/temporal_row-9560-master.opt b/mysql-test/suite/rpl/t/temporal_row-9560-master.opt new file mode 100644 index 00000000000..07c4494e8b6 --- /dev/null +++ b/mysql-test/suite/rpl/t/temporal_row-9560-master.opt @@ -0,0 +1 @@ +--disable-mysql56-temporal-format diff --git a/mysql-test/suite/rpl/t/temporal_row-9560.combinations b/mysql-test/suite/rpl/t/temporal_row-9560.combinations new file mode 100644 index 00000000000..b1c360f8615 --- /dev/null +++ b/mysql-test/suite/rpl/t/temporal_row-9560.combinations @@ -0,0 +1,6 @@ +[old2old] +--disable-mysql56-temporal-format + +[old2new] +--enable-mysql56-temporal-format + diff --git a/mysql-test/suite/rpl/t/temporal_row-9560.test b/mysql-test/suite/rpl/t/temporal_row-9560.test new file mode 100644 index 00000000000..00fb59bc088 --- /dev/null +++ b/mysql-test/suite/rpl/t/temporal_row-9560.test @@ -0,0 +1,20 @@ +# +# MDEV-9560 Mariadb 10.1 Crashes when replicating from 10.0 +# +source include/have_binlog_format_row.inc; +source include/master-slave.inc; + +select @@mysql56_temporal_format; +create table t1 (ts timestamp(3), t time(3), dt datetime(3)); +insert into t1 values ('2016-02-15 12:50:06.123', '12:50:06.123', '2016-02-15 12:50:06.123'); + +sync_slave_with_master; + +select @@mysql56_temporal_format; +select * from t1; + +connection master; +drop table t1; + +source include/rpl_end.inc; + diff --git a/sql/rpl_utility.cc b/sql/rpl_utility.cc index f7fd17edb01..ff2cd74c3a7 100644 --- a/sql/rpl_utility.cc +++ b/sql/rpl_utility.cc @@ -991,6 +991,17 @@ TABLE *table_def::create_conversion_table(THD *thd, rpl_group_info *rgi, */ unsigned_flag= static_cast(target_field)->unsigned_flag; break; + case MYSQL_TYPE_TIMESTAMP: + case MYSQL_TYPE_TIME: + case MYSQL_TYPE_DATETIME: + /* + As we don't know the precision of the temporal field on the master, + assume it's the same on master and slave. This is true when not + using conversions so it should be true also when using conversions. + */ + if (target_field->decimals()) + max_length+= target_field->decimals() + 1; + break; default: break; }