setting time_zoe='+00:00' on rowcopy
This commit is contained in:
parent
f5d5cc8d8c
commit
0c35a811f7
@ -414,7 +414,28 @@ func (this *Applier) ApplyIterationInsertQuery() (chunkSize int64, rowsAffected
|
||||
if err != nil {
|
||||
return chunkSize, rowsAffected, duration, err
|
||||
}
|
||||
sqlResult, err := sqlutils.Exec(this.db, query, explodedArgs...)
|
||||
|
||||
sqlResult, err := func() (gosql.Result, error) {
|
||||
tx, err := this.db.Begin()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if _, err := tx.Exec(`SET
|
||||
SESSION time_zone = '+00:00',
|
||||
sql_mode = CONCAT(@@session.sql_mode, ',STRICT_ALL_TABLES')
|
||||
`); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result, err := tx.Exec(query, explodedArgs...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if err := tx.Commit(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return result, nil
|
||||
}()
|
||||
|
||||
if err != nil {
|
||||
return chunkSize, rowsAffected, duration, err
|
||||
}
|
||||
|
@ -4,7 +4,7 @@ create table gh_ost_test (
|
||||
i int not null,
|
||||
ts0 timestamp default current_timestamp,
|
||||
ts1 timestamp,
|
||||
ts2 timestamp,
|
||||
ts2 datetime,
|
||||
t datetime,
|
||||
updated tinyint unsigned default 0,
|
||||
primary key(id),
|
||||
@ -21,11 +21,13 @@ create event gh_ost_test
|
||||
enable
|
||||
do
|
||||
begin
|
||||
insert into gh_ost_test values (null, 7, null, now(), now(), '2010-10-20 10:20:30', 0);
|
||||
|
||||
insert into gh_ost_test values (null, 11, null, now(), now(), '2010-10-20 10:20:30', 0);
|
||||
update gh_ost_test set ts2=now() + interval 10 minute, updated = 1 where i = 11 order by id desc limit 1;
|
||||
|
||||
set session time_zone='system';
|
||||
insert into gh_ost_test values (null, 11, null, now(), now(), '2010-10-20 10:20:30', 0);
|
||||
insert into gh_ost_test values (null, 13, null, now(), now(), '2010-10-20 10:20:30', 0);
|
||||
update gh_ost_test set ts2=now() + interval 10 minute, updated = 1 where i = 13 order by id desc limit 1;
|
||||
|
||||
set session time_zone='+00:00';
|
||||
|
Loading…
Reference in New Issue
Block a user