Skip to content

Commit d37ad9c

Browse files
author
Shlomi Noach
authored
Merge pull request #539 from github/incorrect-datetime-1970
Incorrect datetime 1970
2 parents ffc9583 + 1f772df commit d37ad9c

File tree

7 files changed

+42
-0
lines changed

7 files changed

+42
-0
lines changed

localtests/datetime-1970/create.sql

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
drop table if exists gh_ost_test;
2+
create table gh_ost_test (
3+
id int auto_increment,
4+
create_time timestamp NULL DEFAULT '0000-00-00 00:00:00',
5+
update_time timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
6+
counter int(10) unsigned DEFAULT NULL,
7+
primary key(id)
8+
) auto_increment=1;
9+
10+
insert into gh_ost_test values (1, '0000-00-00 00:00:00', now(), 0);
11+
12+
drop event if exists gh_ost_test;
13+
delimiter ;;
14+
create event gh_ost_test
15+
on schedule every 1 second
16+
starts current_timestamp
17+
ends current_timestamp + interval 60 second
18+
on completion not preserve
19+
enable
20+
do
21+
begin
22+
update gh_ost_test set counter = counter + 1 where id = 1;
23+
end ;;

localtests/datetime-1970/extra_args

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
--alter='add column name varchar(1)'
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
id, create_time, update_time, counter

localtests/datetime-1970/orig_columns

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
id, create_time, update_time, counter

localtests/datetime-1970/sql_mode

Whitespace-only changes.

localtests/test.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ start_replication() {
8787
test_single() {
8888
local test_name
8989
test_name="$1"
90+
original_sql_mode="$(gh-ost-test-mysql-master -e "select @@global.sql_mode" -s -s)"
9091

9192
if [ -f $tests_path/$test_name/ignore_versions ] ; then
9293
ignore_versions=$(cat $tests_path/$test_name/ignore_versions)
@@ -102,6 +103,12 @@ test_single() {
102103
echo_dot
103104
start_replication
104105
echo_dot
106+
107+
if [ -f $tests_path/$test_name/sql_mode ] ; then
108+
gh-ost-test-mysql-master --default-character-set=utf8mb4 test -e "set @@global.sql_mode='$(cat $tests_path/$test_name/sql_mode)'"
109+
gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "set @@global.sql_mode='$(cat $tests_path/$test_name/sql_mode)'"
110+
fi
111+
105112
gh-ost-test-mysql-master --default-character-set=utf8mb4 test < $tests_path/$test_name/create.sql
106113

107114
extra_args=""
@@ -154,6 +161,11 @@ test_single() {
154161

155162
execution_result=$?
156163

164+
if [ -f $tests_path/$test_name/sql_mode ] ; then
165+
gh-ost-test-mysql-master --default-character-set=utf8mb4 test -e "set @@global.sql_mode='${original_sql_mode}'"
166+
gh-ost-test-mysql-replica --default-character-set=utf8mb4 test -e "set @@global.sql_mode='${original_sql_mode}'"
167+
fi
168+
157169
if [ -f $tests_path/$test_name/destroy.sql ] ; then
158170
gh-ost-test-mysql-master --default-character-set=utf8mb4 test < $tests_path/$test_name/destroy.sql
159171
fi

vendor/github.com/siddontang/go-mysql/replication/row_event.go

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)