Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lcwangchao committed Jun 28, 2022
1 parent 6487d47 commit c672f4f
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ func (b *executorBuilder) buildSelectLock(v *plannercore.PhysicalLock) Executor
defer func() { b.inSelectLockStmt = false }()
}
b.hasLock = true
if b.err = b.updateForUpdateTSIfNeeded(); b.err != nil {
if b.err = b.updateForUpdateTS(); b.err != nil {
return nil
}

Expand Down Expand Up @@ -846,7 +846,7 @@ func (b *executorBuilder) buildSetConfig(v *plannercore.SetConfig) Executor {

func (b *executorBuilder) buildInsert(v *plannercore.Insert) Executor {
b.inInsertStmt = true
if b.err = b.updateForUpdateTSIfNeeded(); b.err != nil {
if b.err = b.updateForUpdateTS(); b.err != nil {
return nil
}

Expand Down Expand Up @@ -2055,9 +2055,10 @@ func (b *executorBuilder) buildUpdate(v *plannercore.Update) Executor {
}
}
}
if b.err = b.updateForUpdateTSIfNeeded(); b.err != nil {
if b.err = b.updateForUpdateTS(); b.err != nil {
return nil
}

selExec := b.build(v.SelectPlan)
if b.err != nil {
return nil
Expand Down Expand Up @@ -2112,9 +2113,10 @@ func (b *executorBuilder) buildDelete(v *plannercore.Delete) Executor {
tblID2table[info.TblID], _ = b.is.TableByID(info.TblID)
}

if b.err = b.updateForUpdateTSIfNeeded(); b.err != nil {
if b.err = b.updateForUpdateTS(); b.err != nil {
return nil
}

selExec := b.build(v.SelectPlan)
if b.err != nil {
return nil
Expand All @@ -2130,8 +2132,8 @@ func (b *executorBuilder) buildDelete(v *plannercore.Delete) Executor {
return deleteExec
}

func (b *executorBuilder) updateForUpdateTSIfNeeded() error {
// GetStmtForUpdateTS will auto update the for update ts if necessary
func (b *executorBuilder) updateForUpdateTS() error {
// GetStmtForUpdateTS will auto update the for update ts if it is necessary
_, err := sessiontxn.GetTxnManager(b.ctx).GetStmtForUpdateTS()
return err
}
Expand Down

0 comments on commit c672f4f

Please sign in to comment.