~vkolesnikov/pbxt/pbxt-07-diskfull

« back to all changes in this revision

Viewing changes to pbxt/mysql-test-update/mysql-test/t/rpl_timezone.test

  • Committer: paul-mccullagh
  • Date: 2006-10-23 09:14:04 UTC
  • Revision ID: paul-mccullagh-918861e03d351978a9541168a96e58cc826734ee
Initial import

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#######################################
 
2
# Change Author: JBM
 
3
# Change Date: 2006-01-17
 
4
# Change: Added order by
 
5
#######################################
 
6
# Test of replication of time zones.
 
7
######################################
 
8
# There is currently some bug possibly in prepared statements (this
 
9
# test fails with --ps-protocol): sys_var_thd_time_zone::value_ptr()
 
10
# is called only at prepare time, not at execution time. So,
 
11
# thd->time_zone_used is not equal to 1 (it is back to 0, because of
 
12
# reset_thd_for_next_command called at execution time), so the
 
13
# timezone used in CONVERT_TZ is not binlogged. To debug (by Guilhem
 
14
# and possibly Konstantin).
 
15
 
 
16
--disable_ps_protocol
 
17
 
 
18
source include/master-slave.inc;
 
19
 
 
20
# Some preparations
 
21
let $VERSION=`select version()`;
 
22
set timestamp=100000000; # for fixed output of mysqlbinlog
 
23
create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
 
24
create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
 
25
 
 
26
connection slave;
 
27
select @@time_zone;
 
28
#set time_zone='UTC';
 
29
#select @@time_zone;
 
30
#
 
31
# Let us check how well replication works when we are saving datetime
 
32
# value in TIMESTAMP field.
 
33
#
 
34
connection master;
 
35
select @@time_zone;
 
36
#set time_zone='UTC';
 
37
#select @@time_zone;
 
38
insert into t1 values ('20050101000000', NULL), ('20050611093902',NULL);
 
39
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
 
40
SELECT * FROM t1 ORDER BY n;
 
41
sync_slave_with_master;
 
42
#set time_zone='UTC';
 
43
SELECT * FROM t1 ORDER BY n;
 
44
 
 
45
# Let us check also that setting of time_zone back to default also works
 
46
# well
 
47
connection master;
 
48
delete from t1;
 
49
set time_zone='Europe/Moscow';
 
50
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
 
51
SELECT * FROM t1 ORDER BY n;
 
52
sync_slave_with_master;
 
53
set time_zone='Europe/Moscow';
 
54
SELECT * FROM t1 ORDER BY n;
 
55
connection master;
 
56
# Change Author: JBM
 
57
# Change Date: 2005-12-22
 
58
# Change: Comment out the exec of the binlog so test works for both SBR and RBR
 
59
#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
 
60
#--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
 
61
 
 
62
# Let us check with LOAD DATA INFILE
 
63
# (we do it after mysqlbinlog because the temp files names are not constant)
 
64
connection master;
 
65
delete from t1;
 
66
set time_zone='UTC';
 
67
load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
 
68
SELECT * FROM t1 ORDER BY n;
 
69
sync_slave_with_master;
 
70
set time_zone='UTC';
 
71
SELECT * FROM t1 ORDER BY n;
 
72
set time_zone='Europe/Moscow';
 
73
 
 
74
# Put back values of before the LOAD
 
75
connection master;
 
76
set time_zone='Europe/Moscow';
 
77
delete from t1;
 
78
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
 
79
 
 
80
#
 
81
# Now let us check how well we replicate statments reading TIMESTAMP fields
 
82
# (We should see the same data on master and on slave but it should differ
 
83
# from originally inserted)
 
84
#
 
85
set time_zone='MET';
 
86
insert into t2 (select * from t1);
 
87
SELECT * FROM t1 ORDER BY n;
 
88
sync_slave_with_master;
 
89
SELECT * FROM t2 ORDER BY n;
 
90
 
 
91
#
 
92
# Now let us check how well we replicate various CURRENT_* functions
 
93
#
 
94
connection master;
 
95
delete from t2;
 
96
set timestamp=1000072000;
 
97
insert into t2 values (current_timestamp,NULL), (current_date,NULL), (current_time,NULL);
 
98
sync_slave_with_master;
 
99
SELECT * FROM t2 ORDER BY n;
 
100
 
 
101
#
 
102
# At last let us check replication of FROM_UNIXTIME/UNIX_TIMESTAMP functions.
 
103
#
 
104
connection master;
 
105
delete from t2;
 
106
insert into t2 values (from_unixtime(1000000000),NULL),
 
107
                      (unix_timestamp('2001-09-09 03:46:40'),NULL);
 
108
SELECT * FROM t2 ORDER BY n;
 
109
sync_slave_with_master;
 
110
# We should get same result on slave as on master
 
111
SELECT * FROM t2 ORDER BY n;
 
112
 
 
113
#
 
114
# Let us check that we are allowing to set global time_zone with
 
115
# replication
 
116
#
 
117
connection master;
 
118
set global time_zone='MET';
 
119
 
 
120
#
 
121
# Let us see if CONVERT_TZ(@@time_zone) replicates
 
122
#
 
123
delete from t2;
 
124
set time_zone='UTC';
 
125
insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone),NULL);
 
126
insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'),NULL);
 
127
SELECT * FROM t2 ORDER BY n;
 
128
sync_slave_with_master;
 
129
SELECT * FROM t2 ORDER BY n;
 
130
 
 
131
# Clean up
 
132
connection master;
 
133
drop table t1, t2;
 
134
sync_slave_with_master;
 
135