1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-01 03:47:19 +03:00

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)
This commit is contained in:
Sergei Golubchik
2016-02-20 19:30:14 +01:00
parent 4cabc608b6
commit a38b705fe0
6 changed files with 64 additions and 0 deletions

View File

@ -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

View File

@ -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

View File

@ -0,0 +1 @@
--disable-mysql56-temporal-format

View File

@ -0,0 +1,6 @@
[old2old]
--disable-mysql56-temporal-format
[old2new]
--enable-mysql56-temporal-format

View File

@ -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;

View File

@ -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;
}