1
0
mirror of https://github.com/MariaDB/server.git synced 2025-08-08 11:22:35 +03:00

MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change

Implement a special Copy_field method for timestamps, that copies
timestamps without converting them to MYSQL_TIME (the conversion
is lossy around DST change dates).
This commit is contained in:
Sergei Golubchik
2017-09-19 11:18:45 +02:00
parent 46a2917c0f
commit f4f48e0621
5 changed files with 120 additions and 1 deletions

View File

@@ -0,0 +1,28 @@
include/master-slave.inc
[connection master]
set global time_zone='Europe/Moscow';
set time_zone='UTC';
stop slave;
start slave;
set global mysql56_temporal_format=false;
set global time_zone='Europe/Moscow';
set time_zone='UTC';
create table t1 (pk int primary key, t timestamp not null);
set timestamp = 1288477526;
insert into t1 values (1,null);
set timestamp = 1288481126;
insert into t1 values (2,null);
select pk, t, unix_timestamp(t) from t1;
pk t unix_timestamp(t)
1 2010-10-30 22:25:26 1288477526
2 2010-10-30 23:25:26 1288481126
set time_zone=default;
select pk, t, unix_timestamp(t) from t1;
pk t unix_timestamp(t)
1 2010-10-31 02:25:26 1288477526
2 2010-10-31 02:25:26 1288481126
set global time_zone=default;
drop table t1;
set global time_zone=default;
set global mysql56_temporal_format=default;
include/rpl_end.inc

View File

@@ -0,0 +1,37 @@
#
# MDEV-12672 Replicated TIMESTAMP fields given wrong value near DST change
#
source include/have_binlog_format_row.inc;
source include/master-slave.inc;
connection slave;
set global time_zone='Europe/Moscow';
set time_zone='UTC';
stop slave;
start slave;
connection master;
set global mysql56_temporal_format=false;
set global time_zone='Europe/Moscow';
set time_zone='UTC';
create table t1 (pk int primary key, t timestamp not null);
set timestamp = 1288477526;
insert into t1 values (1,null);
set timestamp = 1288481126;
insert into t1 values (2,null);
sync_slave_with_master;
select pk, t, unix_timestamp(t) from t1;
set time_zone=default;
select pk, t, unix_timestamp(t) from t1;
set global time_zone=default;
connection master;
drop table t1;
set global time_zone=default;
set global mysql56_temporal_format=default;
source include/rpl_end.inc;