Skip to content

Commit

Permalink
done
Browse files Browse the repository at this point in the history
Signed-off-by: wjhuang2016 <huangwenjun1997@gmail.com>
  • Loading branch information
wjhuang2016 committed Nov 22, 2023
1 parent 7370494 commit 66fa684
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
3 changes: 0 additions & 3 deletions pkg/ddl/backfilling_operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -648,9 +648,6 @@ func (w *indexIngestWorker) initSessCtx() {
return
}
w.restore = restoreSessCtx(sessCtx)
tz := *time.UTC
sessCtx.GetSessionVars().TimeZone = &tz
sessCtx.GetSessionVars().StmtCtx.SetTimeZone(&tz)
if err := initSessCtx(sessCtx,
w.reorgMeta.SQLMode,
w.reorgMeta.Location,
Expand Down
6 changes: 6 additions & 0 deletions pkg/ddl/backfilling_scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,12 +143,18 @@ func newSessCtx(
return sessCtx, nil
}

// initSessCtx initializes the session context. Be careful to the timezone.
func initSessCtx(
sessCtx sessionctx.Context,
sqlMode mysql.SQLMode,
tzLocation *model.TimeZoneLocation,
resGroupName string,
) error {
// Correct the initial timezone.
tz := *time.UTC
sessCtx.GetSessionVars().TimeZone = &tz
sessCtx.GetSessionVars().StmtCtx.SetTimeZone(&tz)

// Set the row encode format version.
rowFormat := variable.GetDDLReorgRowFormat()
sessCtx.GetSessionVars().RowEncoder.Enable = rowFormat != variable.DefTiDBRowFormatV1
Expand Down

0 comments on commit 66fa684

Please sign in to comment.