mirror of
https://github.com/MariaDB/server.git
synced 2025-01-17 20:42:30 +01:00
b114f4ef81
into neptunus.(none):/home/msvensson/mysql/mysqltest_var/my51-mysqltest_var mysql-test/mysql-test-run.sh: Auto merged mysql-test/extra/binlog_tests/blackhole.test: Auto merged mysql-test/extra/binlog_tests/ctype_ucs_binlog.test: Auto merged mysql-test/extra/rpl_tests/rpl_EE_err.test: Auto merged mysql-test/extra/rpl_tests/rpl_log.test: Auto merged mysql-test/extra/rpl_tests/rpl_stm_000001.test: Auto merged mysql-test/extra/rpl_tests/rpl_stm_charset.test: Auto merged mysql-test/r/backup.result: Auto merged mysql-test/r/loaddata.result: Auto merged mysql-test/r/query_cache.result: Auto merged mysql-test/r/rpl_loaddata_s.result: Auto merged mysql-test/r/rpl_replicate_do.result: Auto merged mysql-test/r/rpl_rewrt_db.result: Auto merged mysql-test/r/rpl_stm_000001.result: Auto merged mysql-test/r/trigger.result: Auto merged mysql-test/r/view.result: Auto merged mysql-test/r/warnings.result: Auto merged mysql-test/t/backup.test: Auto merged mysql-test/t/loaddata.test: Auto merged mysql-test/t/mysqldump.test: Auto merged mysql-test/t/ndb_autodiscover.test: Auto merged mysql-test/t/query_cache.test: Auto merged mysql-test/t/rpl_000015-slave.sh: Auto merged mysql-test/t/rpl_flushlog_loop-master.opt: Auto merged mysql-test/t/rpl_flushlog_loop-master.sh: Auto merged mysql-test/t/rpl_flushlog_loop-slave.opt: Auto merged mysql-test/t/rpl_flushlog_loop-slave.sh: Auto merged mysql-test/t/rpl_loaddata_s.test: Auto merged mysql-test/t/rpl_replicate_do.test: Auto merged mysql-test/t/rpl_rewrt_db.test: Auto merged mysql-test/t/rpl_rotate_logs.test: Auto merged mysql-test/t/show_check.test: Auto merged mysql-test/t/sp-destruct.test: Auto merged mysql-test/t/symlink.test: Auto merged mysql-test/t/trigger.test: Auto merged mysql-test/t/user_var-binlog.test: Auto merged mysql-test/t/view.test: Auto merged mysql-test/t/warnings.test: Auto merged mysql-test/mysql-test-run.pl: Merge 5.0 -> 5.1 mysql-test/r/binlog_stm_blackhole.result: Merge 5.0 -> 5.1 mysql-test/r/mysqltest.result: Merge 5.0 -> 5.1 mysql-test/r/rpl_loaddata.result: Merge 5.0 -> 5.1 mysql-test/r/rpl_loaddata_m.result: Merge 5.0 -> 5.1 mysql-test/r/rpl_stm_log.result: Merge 5.0 -> 5.1 mysql-test/r/rpl_timezone.result: Merge 5.0 -> 5.1 mysql-test/t/mysqlbinlog.test: Merge 5.0 -> 5.1 mysql-test/t/mysqlbinlog2.test: Merge 5.0 -> 5.1 mysql-test/t/mysqltest.test: Merge 5.0 -> 5.1 mysql-test/t/rpl_drop_db.test: Merge 5.0 -> 5.1 mysql-test/t/rpl_loaddata.test: Merge 5.0 -> 5.1 mysql-test/t/rpl_loaddata_m.test: Merge 5.0 -> 5.1 mysql-test/t/rpl_timezone.test: Merge 5.0 -> 5.1 mysql-test/t/trigger-compat.test: Merge 5.0 -> 5.1 mysql-test/t/trigger-grant.test: Merge 5.0 -> 5.1
135 lines
4.1 KiB
Text
135 lines
4.1 KiB
Text
#######################################
|
|
# Change Author: JBM
|
|
# Change Date: 2006-01-17
|
|
# Change: Added order by
|
|
#######################################
|
|
# Test of replication of time zones.
|
|
######################################
|
|
# There is currently some bug possibly in prepared statements (this
|
|
# test fails with --ps-protocol): sys_var_thd_time_zone::value_ptr()
|
|
# is called only at prepare time, not at execution time. So,
|
|
# thd->time_zone_used is not equal to 1 (it is back to 0, because of
|
|
# reset_thd_for_next_command called at execution time), so the
|
|
# timezone used in CONVERT_TZ is not binlogged. To debug (by Guilhem
|
|
# and possibly Konstantin).
|
|
|
|
--disable_ps_protocol
|
|
|
|
source include/master-slave.inc;
|
|
|
|
# Some preparations
|
|
let $VERSION=`select version()`;
|
|
set timestamp=100000000; # for fixed output of mysqlbinlog
|
|
create table t1 (t timestamp, n int not null auto_increment, PRIMARY KEY(n));
|
|
create table t2 (t char(32), n int not null auto_increment, PRIMARY KEY(n));
|
|
|
|
connection slave;
|
|
select @@time_zone;
|
|
#set time_zone='UTC';
|
|
#select @@time_zone;
|
|
#
|
|
# 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';
|
|
#select @@time_zone;
|
|
insert into t1 values ('20050101000000', NULL), ('20050611093902',NULL);
|
|
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
|
|
SELECT * FROM t1 ORDER BY n;
|
|
sync_slave_with_master;
|
|
#set time_zone='UTC';
|
|
SELECT * FROM t1 ORDER BY n;
|
|
|
|
# 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',NULL), ('20040611093902',NULL);
|
|
SELECT * FROM t1 ORDER BY n;
|
|
sync_slave_with_master;
|
|
set time_zone='Europe/Moscow';
|
|
SELECT * FROM t1 ORDER BY n;
|
|
connection master;
|
|
# Change Author: JBM
|
|
# Change Date: 2005-12-22
|
|
# Change: Comment out the exec of the binlog so test works for both SBR and RBR
|
|
#--replace_result $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
|
#--exec $MYSQL_BINLOG --short-form $MYSQLTEST_VARDIR/log/master-bin.000001
|
|
|
|
# Let us check with LOAD DATA INFILE
|
|
# (we do it after mysqlbinlog because the temp files names are not constant)
|
|
connection master;
|
|
delete from t1;
|
|
set time_zone='UTC';
|
|
load data infile '../std_data_ln/rpl_timezone2.dat' into table t1;
|
|
SELECT * FROM t1 ORDER BY n;
|
|
sync_slave_with_master;
|
|
set time_zone='UTC';
|
|
SELECT * FROM t1 ORDER BY n;
|
|
set time_zone='Europe/Moscow';
|
|
|
|
# Put back values of before the LOAD
|
|
connection master;
|
|
set time_zone='Europe/Moscow';
|
|
delete from t1;
|
|
insert into t1 values ('20040101000000',NULL), ('20040611093902',NULL);
|
|
|
|
#
|
|
# 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 * from t1);
|
|
SELECT * FROM t1 ORDER BY n;
|
|
sync_slave_with_master;
|
|
SELECT * FROM t2 ORDER BY n;
|
|
|
|
#
|
|
# 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,NULL), (current_date,NULL), (current_time,NULL);
|
|
sync_slave_with_master;
|
|
SELECT * FROM t2 ORDER BY n;
|
|
|
|
#
|
|
# At last let us check replication of FROM_UNIXTIME/UNIX_TIMESTAMP functions.
|
|
#
|
|
connection master;
|
|
delete from t2;
|
|
insert into t2 values (from_unixtime(1000000000),NULL),
|
|
(unix_timestamp('2001-09-09 03:46:40'),NULL);
|
|
SELECT * FROM t2 ORDER BY n;
|
|
sync_slave_with_master;
|
|
# We should get same result on slave as on master
|
|
SELECT * FROM t2 ORDER BY n;
|
|
|
|
#
|
|
# Let us check that we are allowing to set global time_zone with
|
|
# replication
|
|
#
|
|
connection master;
|
|
set global time_zone='MET';
|
|
|
|
#
|
|
# Let us see if CONVERT_TZ(@@time_zone) replicates
|
|
#
|
|
delete from t2;
|
|
set time_zone='UTC';
|
|
insert into t2 values(convert_tz('2004-01-01 00:00:00','MET',@@time_zone),NULL);
|
|
insert into t2 values(convert_tz('2005-01-01 00:00:00','MET','Japan'),NULL);
|
|
SELECT * FROM t2 ORDER BY n;
|
|
sync_slave_with_master;
|
|
SELECT * FROM t2 ORDER BY n;
|
|
|
|
# Clean up
|
|
connection master;
|
|
drop table t1, t2;
|
|
sync_slave_with_master;
|
|
|