Commit a38b705f authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-9560 Mariadb 10.1 Crashes when replicating from 10.0

when replicating old temporal type fields (that don't store
metadata in the binlog), take the precision from
destination fields.

(this fixes the replication failure, crashes were
fixed in a different commit)
parent 4cabc608
--- 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
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
[old2old]
--disable-mysql56-temporal-format
[old2new]
--enable-mysql56-temporal-format
#
# 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;
......@@ -991,6 +991,17 @@ TABLE *table_def::create_conversion_table(THD *thd, rpl_group_info *rgi,
*/
unsigned_flag= static_cast<Field_num*>(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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment