Skip to content

Commit

Permalink
ddl: fix DST times for adding index (#47425) (#47447)
Browse files Browse the repository at this point in the history
ref #46033, close #47426
  • Loading branch information
ti-chi-bot authored Nov 20, 2023
1 parent 643b328 commit 51b3779
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
10 changes: 5 additions & 5 deletions ddl/db_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,12 +141,12 @@ func TestGetTimeZone(t *testing.T) {
offset int
err string
}{
{"set time_zone = '+00:00'", "", "UTC", 0, ""},
{"set time_zone = '-00:00'", "", "UTC", 0, ""},
{"set time_zone = '+00:00'", "", "", 0, ""},
{"set time_zone = '-00:00'", "", "", 0, ""},
{"set time_zone = 'UTC'", "UTC", "UTC", 0, ""},
{"set time_zone = '+05:00'", "", "UTC", 18000, ""},
{"set time_zone = '-08:00'", "", "UTC", -28800, ""},
{"set time_zone = '+08:00'", "", "UTC", 28800, ""},
{"set time_zone = '+05:00'", "", "", 18000, ""},
{"set time_zone = '-08:00'", "", "", -28800, ""},
{"set time_zone = '+08:00'", "", "", 28800, ""},
{"set time_zone = 'Asia/Shanghai'", "Asia/Shanghai", "Asia/Shanghai", 0, ""},
{"set time_zone = 'SYSTEM'", "Asia/Shanghai", "Asia/Shanghai", 0, ""},
{"set time_zone = DEFAULT", "Asia/Shanghai", "Asia/Shanghai", 0, ""},
Expand Down
2 changes: 1 addition & 1 deletion ddl/index_cop.go
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ func getRestoreData(tblInfo *model.TableInfo, targetIdx, pkIdx *model.IndexInfo,

func buildDAGPB(sCtx sessionctx.Context, tblInfo *model.TableInfo, colInfos []*model.ColumnInfo) (*tipb.DAGRequest, error) {
dagReq := &tipb.DAGRequest{}
_, dagReq.TimeZoneOffset = timeutil.Zone(sCtx.GetSessionVars().Location())
dagReq.TimeZoneName, dagReq.TimeZoneOffset = timeutil.Zone(sCtx.GetSessionVars().Location())
sc := sCtx.GetSessionVars().StmtCtx
dagReq.Flags = sc.PushDownFlags()
for i := range colInfos {
Expand Down
2 changes: 1 addition & 1 deletion ddl/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ func GetTimeZone(sctx sessionctx.Context) (string, int) {
}
}
_, offset := time.Now().In(loc).Zone()
return "UTC", offset
return "", offset
}

// enableEmulatorGC means whether to enable emulator GC. The default is enable.
Expand Down

0 comments on commit 51b3779

Please sign in to comment.