Skip to content

Commit

Permalink
executor: fix plan replay cannot deal with placement mode (#56774) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Nov 4, 2024
1 parent 4fec22b commit df19951
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions executor/plan_replayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -520,12 +520,15 @@ func (e *PlanReplayerLoadInfo) Update(data []byte) error {
}

func (e *PlanReplayerLoadInfo) createTable(z *zip.Reader) error {
origin := e.Ctx.GetSessionVars().ForeignKeyChecks
originForeignKeyChecks := e.Ctx.GetSessionVars().ForeignKeyChecks
originPlacementMode := e.Ctx.GetSessionVars().PlacementMode
// We need to disable foreign key check when we create schema and tables.
// because the order of creating schema and tables is not guaranteed.
e.Ctx.GetSessionVars().ForeignKeyChecks = false
e.Ctx.GetSessionVars().PlacementMode = variable.PlacementModeIgnore
defer func() {
e.Ctx.GetSessionVars().ForeignKeyChecks = origin
e.Ctx.GetSessionVars().ForeignKeyChecks = originForeignKeyChecks
e.Ctx.GetSessionVars().PlacementMode = originPlacementMode
}()
for _, zipFile := range z.File {
if zipFile.Name == fmt.Sprintf("schema/%v", domain.PlanReplayerSchemaMetaFile) {
Expand Down

0 comments on commit df19951

Please sign in to comment.