blob: 8dff90a84cf914613c118f4c04a01a13a47111dd (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
# Test of replication of time zones.
source include/master-slave.inc;
# Some preparations
let $VERSION=`select version()`;
create table t1 (t timestamp);
create table t2 (t char(32));
#
# Let us check how well replication works when we are saving datetime
# value in TIMESTAMP field.
#
connection master;
select @@time_zone;
set time_zone='UTC';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
# On slave we still in 'Europe/Moscow' so we should see equivalent but
# textually different values.
sync_slave_with_master;
select * from t1;
# Let us check also that setting of time_zone back to default also works
# well
connection master;
delete from t1;
set time_zone='Europe/Moscow';
insert into t1 values ('20040101000000'), ('20040611093902');
select * from t1;
sync_slave_with_master;
select * from t1;
connection master;
# We should not see SET ONE_SHOT time_zone before second insert
--replace_result $VERSION VERSION
show binlog events;
#
# Now let us check how well we replicate statments reading TIMESTAMP fields
# (We should see the same data on master and on slave but it should differ
# from originally inserted)
#
set time_zone='MET';
insert into t2 (select t from t1);
select * from t1;
sync_slave_with_master;
select * from t2;
#
# Now let us check how well we replicate various CURRENT_* functions
#
connection master;
delete from t2;
set timestamp=1000072000;
insert into t2 values (current_timestamp), (current_date), (current_time);
sync_slave_with_master;
# Values in ouput of these to queries should differ because we are in
# in 'MET' on master and in 'Europe/Moscow on slave...
set timestamp=1000072000;
select current_timestamp, current_date, current_time;
select * from t2;
#
# At last let us check replication of FROM_UNIXTIME/UNIX_TIMESTAMP functions.
#
connection master;
delete from t2;
insert into t2 values (from_unixtime(1000000000)),
(unix_timestamp('2001-09-09 03:46:40'));
select * from t2;
sync_slave_with_master;
# We should get same result on slave as on master
select * from t2;
#
# Let us check that we are not allowing to set global time_zone with
# replication
#
connection master;
--error 1105
set global time_zone='MET';
# Clean up
drop table t1, t2;
sync_slave_with_master;
|