Commit 80ac8858 authored by unknown's avatar unknown

Fix Windows test failures in binlog tests in certain time zones.

On Unix systems TZ can be set to change the time zone for specific processes only.
But on Windows this does not fully work. It changes some aspects of time zones
in the system but not others (notably localtime() vs. file system time stamps).

This causes test failures in Windows in certain time zones (but not all),
where PURGE BEFORE DATE statements get the wrong files when TZ is set to
+03:00 by default.

Fix by only setting TZ in the small number of tests that really need it, and leave
it untouched in the rest.

Thanks to Alex Budovski for helping with this.

mysql-test/include/ps_conv.inc:
  Explicitly set TIME_ZONE, as mysql-test-run.pl now does not set it.
mysql-test/mysql-test-run.pl:
  Do not set TZ by default, as it causes problems on Windows.
mysql-test/suite/binlog/r/binlog_unsafe.result:
  Explicitly set TIME_ZONE, as mysql-test-run.pl now does not set it.
mysql-test/suite/binlog/t/binlog_unsafe.test:
  Explicitly set TIME_ZONE, as mysql-test-run.pl now does not set it.
mysql-test/suite/rpl/r/rpl_mixed_ddl_dml.result:
  Explicitly set TIME_ZONE, as mysql-test-run.pl now does not set it.
mysql-test/suite/rpl/t/rpl_mixed_ddl_dml.test:
  Explicitly set TIME_ZONE, as mysql-test-run.pl now does not set it.
mysql-test/t/mysqlbinlog2-master.opt:
  mysql-test-run.pl no longer sets TZ by default, so set it explicitly for this particular test.
parent 159ff4c1
......@@ -30,6 +30,9 @@
--disable_warnings
drop table if exists t5 ;
--enable_warnings
--disable_query_log
SET TIME_ZONE= '+03:00';
--enable_query_log
set @arg01= 8;
set @arg02= 8.0;
set @arg03= 80.00000000000e-1;
......
......@@ -3425,7 +3425,7 @@ sub restart_forced_by_test
# Return timezone value of tinfo or default value
sub timezone {
my ($tinfo)= @_;
return $tinfo->{timezone} || "GMT-3";
return $tinfo->{timezone} || "DEFAULT";
}
......@@ -3455,7 +3455,9 @@ sub run_testcase ($$) {
# Init variables that can change between each test case
# -------------------------------------------------------
my $timezone= timezone($tinfo);
$ENV{'TZ'}= $timezone;
if ($timezone ne 'DEFAULT') {
$ENV{'TZ'}= $timezone;
}
mtr_verbose("Setting timezone: $timezone");
if ( ! using_extern() )
......
......@@ -380,6 +380,7 @@ INSERT INTO t1 VALUES (VERSION());
Warnings:
Note 1592 Statement may not be safe to log in statement format.
DELETE FROM t1;
SET TIME_ZONE= '+03:00';
SET TIMESTAMP=1000000;
INSERT INTO t1 VALUES
(CURDATE()),
......
......@@ -422,6 +422,7 @@ DELETE FROM t1;
# following following functions depend on the TIMESTAMP variable and
# don't generate a warning.
SET TIME_ZONE= '+03:00';
SET TIMESTAMP=1000000;
INSERT INTO t1 VALUES
(CURDATE()),
......
......@@ -18,6 +18,7 @@ Server_id Host Port Rpl_recovery_rank Master_id
drop table t1;
stop slave;
create table t2(id int auto_increment primary key, created datetime);
SET TIME_ZONE= '+03:00';
set timestamp=12345;
insert into t2 set created=now();
select * from t2;
......
......@@ -23,6 +23,7 @@ connection master;
# Test replication of timestamp
create table t2(id int auto_increment primary key, created datetime);
SET TIME_ZONE= '+03:00';
set timestamp=12345;
insert into t2 set created=now();
select * from t2;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment