gh-ost icon indicating copy to clipboard operation
gh-ost copied to clipboard

Incorrect datetime value: '1970-01-01 00:00:00' for column 'create_time'

Open liuguoshun opened this issue 7 years ago • 17 comments

**https://dev.mysql.com/doc/refman/5.7/en/datetime.html The TIMESTAMP data type is used for values that contain both date and time parts. TIMESTAMP has a range of '1970-01-01 00:00:01' UTC to '2038-01-19 03:14:07' UTC.

Caused by :1970-01-01 00:00:00 is not in the range of timestamp. **

How to repeat:

mysql version:5.5.44-log

create database mysqlslap charset utf8;

CREATE TABLE test11 (
  id bigint(20) unsigned NOT NULL AUTO_INCREMENT COMMENT '',
  create_time timestamp NULL DEFAULT '0000-00-00 00:00:00',
  update_time timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  counter int(10) unsigned DEFAULT NULL,
  PRIMARY KEY (id)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;

insert into test11 values (1,'0000-00-00 00:00:00',now(),0);

3.create sql for test. more gh-ost_test.sql update test11 set counter=counter+1 where id=1;

  1. use mysqlslap for update mysqlslap -uroot -proot123 -h127.0.0.1 --port=3309 test -c 10 --query=gh-ost_test.sql --number-of-queries=1000000;

5.while mysqlslap is runing, in new window execute gh-ost . /apps/sh/gh-ost -user="root" -password=root123 -host=127.0.0.1 -port=3309 -allow-on-master --initially-drop-old-table -database="mysqlslap" -table="test11" -alter="add column name varchar(1)" -execute

6.logs:

2018/01/22 18:06:07 binlogsyncer.go:75: [info] create BinlogSyncer with config &{99999 mysql 127.0.0.1 3309 root root123  false false <nil>}
2018/01/22 18:06:07 binlogsyncer.go:241: [info] begin to sync binlog from position (mysql-bin.000003, 16900979)
2018/01/22 18:06:07 binlogsyncer.go:134: [info] register slave for master server 127.0.0.1:3309
2018/01/22 18:06:07 binlogsyncer.go:568: [info] rotate to (mysql-bin.000003, 16900979)
\# Migrating `mysqlslap`.`test11`; Ghost table is `mysqlslap`.`_test11_gho`
\# Migrating mysql-gs-qmduz.vclound.com:3309; inspecting mysql-gs-qmduz.vclound.com:3309; executing on mysql-gs-qmduz.vclound.com
\# Migration started at Mon Jan 22 18:06:07 +0800 2018
\# chunk-size: 1000; max-lag-millis: 1500ms; max-load: ; critical-load: ; nice-ratio: 0.000000
\# throttle-additional-flag-file: /tmp/gh-ost.throttle 
\# Serving on unix socket: /tmp/gh-ost.mysqlslap.test11.sock
Copy: 0/1 0.0%; Applied: 0; Backlog: 0/100; Time: 0s(total), 0s(copy); streamer: mysql-bin.000003:16908098; State: migrating; ETA: N/A
2018-01-22 18:06:07 ERROR Error 1292: Incorrect datetime value: '1970-01-01 00:00:00' for column 'create_time' at row 1; query=
                        update /* gh-ost `mysqlslap`.`_test11_gho` */
                                        `mysqlslap`.`_test11_gho`
                                set
                                        `id`=?, `create_time`=?, `update_time`=?, `counter`=?
                                where
                                        ((`id` = ?))
                ; args=[1 1970-01-01 08:00:00 +0800 CST 2018-01-22 18:06:07 +0800 CST 41448 1]
Copy: 1/1 100.0%; Applied: 1; Backlog: 100/100; Time: 1s(total), 1s(copy); streamer: mysql-bin.000003:16934720; State: migrating; ETA: due
2018-01-22 18:06:08 ERROR Error 1292: Incorrect datetime value: '1970-01-01 00:00:00' for column 'create_time' at row 1; query=
                        update /* gh-ost `mysqlslap`.`_test11_gho` */
                                        `mysqlslap`.`_test11_gho`
                                set
                                        `id`=?, `create_time`=?, `update_time`=?, `counter`=?
                                where
                                        ((`id` = ?))
                ; args=[1 1970-01-01 08:00:00 +0800 CST 2018-01-22 18:06:07 +0800 CST 41448 1]
Copy: 1/1 100.0%; Applied: 1; Backlog: 100/100; Time: 2s(total), 2s(copy); streamer: mysql-bin.000003:16934720; State: migrating; ETA: due
2018-01-22 18:06:09 ERROR Error 1292: Incorrect datetime value: '1970-01-01 00:00:00' for column 'create_time' at row 1; query=
                        update /* gh-ost `mysqlslap`.`_test11_gho` */
                                        `mysqlslap`.`_test11_gho`
                                set
                                        `id`=?, `create_time`=?, `update_time`=?, `counter`=?
                                where
                                        ((`id` = ?))
                ; args=[1 1970-01-01 08:00:00 +0800 CST 2018-01-22 18:06:07 +0800 CST 41448 1]
Copy: 1/1 100.0%; Applied: 1; Backlog: 100/100; Time: 3s(total), 3s(copy); streamer: mysql-bin.000003:16934720; State: migrating; ETA: due

liuguoshun avatar Jan 22 '18 10:01 liuguoshun