Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
lcwangchao committed Apr 11, 2022
1 parent 8f4906c commit b1bf822
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions planner/core/preprocess.go
Original file line number Diff line number Diff line change
Expand Up @@ -1681,11 +1681,21 @@ func (p *preprocessor) initTxnContextProviderIfNecessary(node ast.Node) {
return
}

if p.LastSnapshotTS == 0 {
p.err = sessiontxn.GetTxnManager(p.ctx).SetContextProvider(&sessiontxn.SimpleTxnContextProvider{
InfoSchema: p.ensureInfoSchema(),
})
txnManager := sessiontxn.GetTxnManager(p.ctx)
currentProvider := txnManager.GetContextProvider()

// If currentProvider is nil or not a `SimpleTxnContextProvider`, it means
if currentProvider == nil {
return
}

if _, ok := currentProvider.(*sessiontxn.SimpleTxnContextProvider); !ok {
return
}

p.err = sessiontxn.GetTxnManager(p.ctx).SetContextProvider(&sessiontxn.SimpleTxnContextProvider{
InfoSchema: p.ensureInfoSchema(),
})
}

func (p *preprocessor) hasAutoConvertWarning(colDef *ast.ColumnDef) bool {
Expand Down

0 comments on commit b1bf822

Please sign in to comment.