diff --git a/ddl/index_cop.go b/ddl/index_cop.go index a220c9a57f7eb..909981f70f015 100644 --- a/ddl/index_cop.go +++ b/ddl/index_cop.go @@ -484,7 +484,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.TimeZoneName, dagReq.TimeZoneOffset = timeutil.Zone(sCtx.GetSessionVars().Location()) + _, dagReq.TimeZoneOffset = timeutil.Zone(sCtx.GetSessionVars().Location()) sc := sCtx.GetSessionVars().StmtCtx dagReq.Flags = sc.PushDownFlags() for i := range colInfos { diff --git a/ddl/ingest/BUILD.bazel b/ddl/ingest/BUILD.bazel index 4f716cfd51771..f18bc20f46c53 100644 --- a/ddl/ingest/BUILD.bazel +++ b/ddl/ingest/BUILD.bazel @@ -65,7 +65,7 @@ go_test( embed = [":ingest"], flaky = True, race = "on", - shard_count = 14, + shard_count = 15, deps = [ "//config", "//ddl", diff --git a/ddl/ingest/integration_test.go b/ddl/ingest/integration_test.go index 433a9b15cc65a..088e4bcbee59d 100644 --- a/ddl/ingest/integration_test.go +++ b/ddl/ingest/integration_test.go @@ -323,3 +323,22 @@ func TestAddIndexIngestRecoverPartition(t *testing.T) { tk.MustExec("alter table t add index idx(b);") tk.MustExec("admin check table t;") } + +func TestAddIndexIngestTimezone(t *testing.T) { + store := testkit.CreateMockStore(t) + tk := testkit.NewTestKit(t, store) + tk.MustExec("use test;") + defer injectMockBackendMgr(t, store)() + + tk.MustExec("SET time_zone = '-06:00';") + tk.MustExec("create table t (`src` varchar(48),`t` timestamp,`timezone` varchar(100));") + tk.MustExec("insert into t values('2000-07-29 23:15:30','2000-07-29 23:15:30','-6:00');") + tk.MustExec("alter table t add index idx(t);") + tk.MustExec("admin check table t;") + + tk.MustExec("alter table t drop index idx;") + tk.MustExec("SET time_zone = 'Asia/Shanghai';") + tk.MustExec("insert into t values('2000-07-29 23:15:30','2000-07-29 23:15:30', '+8:00');") + tk.MustExec("alter table t add index idx(t);") + tk.MustExec("admin check table t;") +}