Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*: consitent get infoschema #24230

Merged
merged 9 commits into from
May 10, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions distsql/request_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,9 @@ func (builder *RequestBuilder) SetFromSessionVars(sv *variable.SessionVars) *Req
builder.Request.TaskID = sv.StmtCtx.TaskID
builder.Request.Priority = builder.getKVPriority(sv)
builder.Request.ReplicaRead = sv.GetReplicaRead()
if sv.SnapshotInfoschema != nil {
builder.Request.SchemaVar = infoschema.GetInfoSchemaBySessionVars(sv).SchemaMetaVersion()
} else {
builder.Request.SchemaVar = sv.TxnCtx.SchemaVersion
// in tests, it may be null
if is, ok := sv.GetInfoSchema().(infoschema.InfoSchema); ok {
builder.Request.SchemaVar = is.SchemaMetaVersion()
}
builder.txnScope = sv.TxnCtx.TxnScope
builder.IsStaleness = sv.TxnCtx.IsStaleness
Expand Down
2 changes: 1 addition & 1 deletion executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ func (a *ExecStmt) IsReadOnly(vars *variable.SessionVars) bool {
// RebuildPlan rebuilds current execute statement plan.
// It returns the current information schema version that 'a' is using.
func (a *ExecStmt) RebuildPlan(ctx context.Context) (int64, error) {
is := infoschema.GetInfoSchema(a.Ctx)
is := a.Ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
a.InfoSchema = is
if err := plannercore.Preprocess(a.Ctx, a.StmtNode, is, plannercore.InTxnRetry); err != nil {
return 0, err
Expand Down
4 changes: 2 additions & 2 deletions executor/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ func (e *AnalyzeExec) Next(ctx context.Context, req *chunk.Chunk) error {
}
if needGlobalStats {
for globalStatsID, info := range globalStatsMap {
globalStats, err := statsHandle.MergePartitionStats2GlobalStatsByTableID(e.ctx, e.opts, infoschema.GetInfoSchema(e.ctx), globalStatsID.tableID, info.isIndex, info.idxID)
globalStats, err := statsHandle.MergePartitionStats2GlobalStatsByTableID(e.ctx, e.opts, e.ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema), globalStatsID.tableID, info.isIndex, info.idxID)
if err != nil {
if types.ErrPartitionStatsMissing.Equal(err) {
// When we find some partition-level stats are missing, we need to report warning.
Expand All @@ -205,7 +205,7 @@ func (e *AnalyzeExec) Next(ctx context.Context, req *chunk.Chunk) error {
}
}
}
return statsHandle.Update(infoschema.GetInfoSchema(e.ctx))
return statsHandle.Update(e.ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema))
}

func getBuildStatsConcurrency(ctx sessionctx.Context) (int, error) {
Expand Down
12 changes: 6 additions & 6 deletions executor/analyze_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ PARTITION BY RANGE ( a ) (
}
tk.MustExec("analyze table t")

is := infoschema.GetInfoSchema(tk.Se.(sessionctx.Context))
is := tk.Se.(sessionctx.Context).GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
table, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("t"))
c.Assert(err, IsNil)
pi := table.Meta().GetPartitionInfo()
Expand All @@ -96,7 +96,7 @@ PARTITION BY RANGE ( a ) (
tk.MustExec(fmt.Sprintf(`insert into t values (%d, %d, "hello")`, i, i))
}
tk.MustExec("alter table t analyze partition p0")
is = infoschema.GetInfoSchema(tk.Se.(sessionctx.Context))
is = tk.Se.(sessionctx.Context).GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
table, err = is.TableByName(model.NewCIStr("test"), model.NewCIStr("t"))
c.Assert(err, IsNil)
pi = table.Meta().GetPartitionInfo()
Expand Down Expand Up @@ -176,7 +176,7 @@ func (s *testSuite1) TestAnalyzeParameters(c *C) {

tk.MustExec("set @@tidb_enable_fast_analyze = 1")
tk.MustExec("analyze table t with 30 samples")
is := infoschema.GetInfoSchema(tk.Se.(sessionctx.Context))
is := tk.Se.(sessionctx.Context).GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
table, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("t"))
c.Assert(err, IsNil)
tableInfo := table.Meta()
Expand Down Expand Up @@ -227,7 +227,7 @@ func (s *testSuite1) TestAnalyzeTooLongColumns(c *C) {
tk.MustExec(fmt.Sprintf("insert into t values ('%s')", value))

tk.MustExec("analyze table t")
is := infoschema.GetInfoSchema(tk.Se.(sessionctx.Context))
is := tk.Se.(sessionctx.Context).GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
table, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("t"))
c.Assert(err, IsNil)
tableInfo := table.Meta()
Expand Down Expand Up @@ -259,7 +259,7 @@ func (s *testSuite1) TestAnalyzeIndexExtractTopN(c *C) {
tk.MustExec("set @@session.tidb_analyze_version=2")
tk.MustExec("analyze table t with 10 cmsketch width")

is := infoschema.GetInfoSchema(tk.Se.(sessionctx.Context))
is := tk.Se.(sessionctx.Context).GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
table, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("t"))
c.Assert(err, IsNil)
tableInfo := table.Meta()
Expand Down Expand Up @@ -435,7 +435,7 @@ func (s *testFastAnalyze) TestFastAnalyze(c *C) {
}
tk.MustExec("analyze table t with 5 buckets, 6 samples")

is := infoschema.GetInfoSchema(tk.Se.(sessionctx.Context))
is := tk.Se.(sessionctx.Context).GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
table, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("t"))
c.Assert(err, IsNil)
tableInfo := table.Meta()
Expand Down
2 changes: 1 addition & 1 deletion executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -3432,7 +3432,7 @@ func (builder *dataReaderBuilder) buildTableReaderBase(ctx context.Context, e *T
SetKeepOrder(e.keepOrder).
SetStreaming(e.streaming).
SetFromSessionVars(e.ctx.GetSessionVars()).
SetFromInfoSchema(infoschema.GetInfoSchema(e.ctx)).
SetFromInfoSchema(e.ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)).
Build()
if err != nil {
return nil, err
Expand Down
2 changes: 1 addition & 1 deletion executor/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c *Compiler) Compile(ctx context.Context, stmtNode ast.StmtNode) (*ExecStm
ctx = opentracing.ContextWithSpan(ctx, span1)
}

infoSchema := infoschema.GetInfoSchema(c.Ctx)
infoSchema := c.Ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
if err := plannercore.Preprocess(c.Ctx, stmtNode, infoSchema); err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion executor/coprocessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func (h *CoprocessorDAGHandler) buildDAGExecutor(req *coprocessor.Request) (Exec
return nil, errors.Trace(err)
}
h.dagReq = dagReq
is := h.sctx.GetSessionVars().TxnCtx.InfoSchema.(infoschema.InfoSchema)
is := h.sctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
// Build physical plan.
bp := core.NewPBPlanBuilder(h.sctx, is, req.Ranges)
plan, err := bp.Build(dagReq.Executors)
Expand Down
18 changes: 12 additions & 6 deletions executor/distsql.go
Original file line number Diff line number Diff line change
Expand Up @@ -271,16 +271,19 @@ func (e *IndexReaderExecutor) open(ctx context.Context, kvRanges []kv.KeyRange)
e.memTracker = memory.NewTracker(e.id, -1)
e.memTracker.AttachTo(e.ctx.GetSessionVars().StmtCtx.MemTracker)
var builder distsql.RequestBuilder
kvReq, err := builder.SetKeyRanges(kvRanges).
builder.SetKeyRanges(kvRanges).
SetDAGRequest(e.dagPB).
SetStartTS(e.startTS).
SetDesc(e.desc).
SetKeepOrder(e.keepOrder).
SetStreaming(e.streaming).
SetFromSessionVars(e.ctx.GetSessionVars()).
SetMemTracker(e.memTracker).
SetFromInfoSchema(infoschema.GetInfoSchema(e.ctx)).
Build()
SetMemTracker(e.memTracker)
// for tests, infoschema may be null
if is, ok := e.ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema); ok {
builder.SetFromInfoSchema(is)
}
kvReq, err := builder.Build()
if err != nil {
e.feedback.Invalidate()
return err
Expand Down Expand Up @@ -527,8 +530,11 @@ func (e *IndexLookUpExecutor) startIndexWorker(ctx context.Context, workCh chan<
SetKeepOrder(e.keepOrder).
SetStreaming(e.indexStreaming).
SetFromSessionVars(e.ctx.GetSessionVars()).
SetMemTracker(tracker).
SetFromInfoSchema(infoschema.GetInfoSchema(e.ctx))
SetMemTracker(tracker)
// for tests, infoschema may be null
if is, ok := e.ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema); ok {
builder.SetFromInfoSchema(is)
}

for partTblIdx, kvRange := range kvRanges {
// check if executor is closed
Expand Down
4 changes: 2 additions & 2 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2338,7 +2338,7 @@ func (s *testSuiteP2) TestIsPointGet(c *C) {
"select * from help_topic where help_topic_id=1": true,
"select * from help_topic where help_category_id=1": false,
}
infoSchema := infoschema.GetInfoSchema(ctx)
infoSchema := ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)

for sqlStr, result := range tests {
stmtNode, err := s.ParseOneStmt(sqlStr, "", "")
Expand Down Expand Up @@ -2370,7 +2370,7 @@ func (s *testSuiteP2) TestClusteredIndexIsPointGet(c *C) {
"select * from t where a='x' and c='x'": true,
"select * from t where a='x' and c='x' and b=1": false,
}
infoSchema := infoschema.GetInfoSchema(ctx)
infoSchema := ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
for sqlStr, result := range tests {
stmtNode, err := s.ParseOneStmt(sqlStr, "", "")
c.Check(err, IsNil)
Expand Down
2 changes: 1 addition & 1 deletion executor/grant.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ func (e *GrantExec) Next(ctx context.Context, req *chunk.Chunk) error {
// Make sure the table exist.
if e.Level.Level == ast.GrantLevelTable {
dbNameStr := model.NewCIStr(dbName)
schema := infoschema.GetInfoSchema(e.ctx)
schema := e.ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
tbl, err := schema.TableByName(dbNameStr, model.NewCIStr(e.Level.TableName))
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion executor/index_merge_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ func (e *IndexMergeReaderExecutor) startPartialIndexWorker(ctx context.Context,
SetStreaming(e.partialStreamings[workID]).
SetFromSessionVars(e.ctx.GetSessionVars()).
SetMemTracker(e.memTracker).
SetFromInfoSchema(infoschema.GetInfoSchema(e.ctx))
SetFromInfoSchema(e.ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema))

worker := &partialIndexWorker{
stats: e.stats,
Expand Down
16 changes: 8 additions & 8 deletions executor/infoschema_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func (e *memtableRetriever) retrieve(ctx context.Context, sctx sessionctx.Contex

// Cache the ret full rows in schemataRetriever
if !e.initialized {
is := infoschema.GetInfoSchema(sctx)
is := sctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
dbs := is.AllSchemas()
sort.Sort(infoschema.SchemasSorter(dbs))
var err error
Expand Down Expand Up @@ -295,7 +295,7 @@ func (c *statsCache) get(ctx sessionctx.Context) (map[int64]uint64, map[tableHis
}

func getAutoIncrementID(ctx sessionctx.Context, schema *model.DBInfo, tblInfo *model.TableInfo) (int64, error) {
is := infoschema.GetInfoSchema(ctx)
is := ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
tbl, err := is.TableByName(schema.Name, tblInfo.Name)
if err != nil {
return 0, err
Expand Down Expand Up @@ -583,7 +583,7 @@ func (e *hugeMemTableRetriever) setDataForColumns(ctx context.Context, sctx sess
}

func (e *hugeMemTableRetriever) dataForColumnsInTable(ctx context.Context, sctx sessionctx.Context, schema *model.DBInfo, tbl *model.TableInfo) {
if err := tryFillViewColumnType(ctx, sctx, infoschema.GetInfoSchema(sctx), schema.Name, tbl); err != nil {
if err := tryFillViewColumnType(ctx, sctx, sctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema), schema.Name, tbl); err != nil {
sctx.GetSessionVars().StmtCtx.AppendWarning(err)
return
}
Expand Down Expand Up @@ -1330,7 +1330,7 @@ func (e *memtableRetriever) setDataForTiKVRegionStatus(ctx sessionctx.Context) e
if err != nil {
return err
}
allSchemas := ctx.GetSessionVars().TxnCtx.InfoSchema.(infoschema.InfoSchema).AllSchemas()
allSchemas := ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema).AllSchemas()
tableInfos := tikvHelper.GetRegionsTableInfo(regionsInfo, allSchemas)
for _, region := range regionsInfo.Regions {
tableList := tableInfos[region.ID]
Expand Down Expand Up @@ -1442,7 +1442,7 @@ func (e *memtableRetriever) setDataForTiDBHotRegions(ctx sessionctx.Context) err
if !ok {
return errors.New("Information about hot region can be gotten only when the storage is TiKV")
}
allSchemas := ctx.GetSessionVars().TxnCtx.InfoSchema.(infoschema.InfoSchema).AllSchemas()
allSchemas := ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema).AllSchemas()
tikvHelper := &helper.Helper{
Store: tikvStore,
RegionCache: tikvStore.GetRegionCache(),
Expand Down Expand Up @@ -1591,7 +1591,7 @@ type initialTable struct {
}

func (e *tableStorageStatsRetriever) initialize(sctx sessionctx.Context) error {
is := infoschema.GetInfoSchema(sctx)
is := sctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
var databases []string
schemas := e.extractor.TableSchema
tables := e.extractor.TableName
Expand Down Expand Up @@ -1883,7 +1883,7 @@ func (e *memtableRetriever) setDataForStatementsSummary(ctx sessionctx.Context,

func (e *memtableRetriever) setDataForPlacementPolicy(ctx sessionctx.Context) error {
checker := privilege.GetPrivilegeManager(ctx)
is := infoschema.GetInfoSchema(ctx)
is := ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
var rows [][]types.Datum
for _, bundle := range is.RuleBundles() {
id, err := placement.ObjectIDFromGroupID(bundle.ID)
Expand Down Expand Up @@ -2030,7 +2030,7 @@ func (e *hugeMemTableRetriever) retrieve(ctx context.Context, sctx sessionctx.Co
}

if !e.initialized {
is := infoschema.GetInfoSchema(sctx)
is := sctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
dbs := is.AllSchemas()
sort.Sort(infoschema.SchemasSorter(dbs))
e.dbs = dbs
Expand Down
2 changes: 1 addition & 1 deletion executor/load_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,5 @@ func (e *LoadStatsInfo) Update(data []byte) error {
if h == nil {
return errors.New("Load Stats: handle is nil")
}
return h.LoadStatsFromJSON(infoschema.GetInfoSchema(e.Ctx), jsonTbl)
return h.LoadStatsFromJSON(e.Ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema), jsonTbl)
}
2 changes: 1 addition & 1 deletion executor/metrics_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (s *testSuite7) TestStmtLabel(c *C) {
for _, tt := range tests {
stmtNode, err := parser.New().ParseOneStmt(tt.sql, "", "")
c.Check(err, IsNil)
is := infoschema.GetInfoSchema(tk.Se)
is := tk.Se.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
err = plannercore.Preprocess(tk.Se.(sessionctx.Context), stmtNode, is)
c.Assert(err, IsNil)
_, _, err = planner.Optimize(context.TODO(), tk.Se, stmtNode, is)
Expand Down
2 changes: 1 addition & 1 deletion executor/partition_table_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ func (s *partitionTableSuite) TestPartitionInfoDisable(c *C) {
PARTITION p202010 VALUES LESS THAN ("2020-11-01"),
PARTITION p202011 VALUES LESS THAN ("2020-12-01")
)`)
is := infoschema.GetInfoSchema(tk.Se)
is := tk.Se.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
tbl, err := is.TableByName(model.NewCIStr("test"), model.NewCIStr("t_info_null"))
c.Assert(err, IsNil)

Expand Down
2 changes: 1 addition & 1 deletion executor/point_get.go
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ func (e *PointGetExecutor) verifyTxnScope() error {
var tblID int64
var tblName string
var partName string
is := infoschema.GetInfoSchema(e.ctx)
is := e.ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
if e.partInfo != nil {
tblID = e.partInfo.ID
tblInfo, _, partInfo := is.FindTableByPartitionID(tblID)
Expand Down
2 changes: 1 addition & 1 deletion executor/prepared.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ func CompileExecutePreparedStmt(ctx context.Context, sctx sessionctx.Context,
return nil, false, false, err
}
execStmt.BinaryArgs = args
is := infoschema.GetInfoSchema(sctx)
is := sctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema)
execPlan, names, err := planner.Optimize(ctx, sctx, execStmt, is)
if err != nil {
return nil, false, false, err
Expand Down
2 changes: 1 addition & 1 deletion executor/simple.go
Original file line number Diff line number Diff line change
Expand Up @@ -1406,7 +1406,7 @@ func (e *SimpleExec) executeDropStats(s *ast.DropStatsStmt) (err error) {
if err := h.DeleteTableStatsFromKV(statsIDs); err != nil {
return err
}
return h.Update(infoschema.GetInfoSchema(e.ctx))
return h.Update(e.ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema))
}

func (e *SimpleExec) autoNewTxn() bool {
Expand Down
11 changes: 7 additions & 4 deletions executor/table_reader.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ func (e *TableReaderExecutor) buildResp(ctx context.Context, ranges []*ranger.Ra
} else {
reqBuilder = builder.SetHandleRanges(e.ctx.GetSessionVars().StmtCtx, getPhysicalTableID(e.table), e.table.Meta() != nil && e.table.Meta().IsCommonHandle, ranges, e.feedback)
}
kvReq, err := reqBuilder.
reqBuilder.
SetDAGRequest(e.dagPB).
SetStartTS(e.startTS).
SetDesc(e.desc).
Expand All @@ -230,9 +230,12 @@ func (e *TableReaderExecutor) buildResp(ctx context.Context, ranges []*ranger.Ra
SetFromSessionVars(e.ctx.GetSessionVars()).
SetMemTracker(e.memTracker).
SetStoreType(e.storeType).
SetAllowBatchCop(e.batchCop).
SetFromInfoSchema(infoschema.GetInfoSchema(e.ctx)).
Build()
SetAllowBatchCop(e.batchCop)
// infoschema maybe null for tests
if is, ok := e.ctx.GetSessionVars().GetInfoSchema().(infoschema.InfoSchema); ok {
reqBuilder.SetFromInfoSchema(is)
}
kvReq, err := reqBuilder.Build()
if err != nil {
return nil, err
}
Expand Down
6 changes: 3 additions & 3 deletions expression/builtin_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ func (b *builtinNextValSig) evalInt(row chunk.Row) (int64, bool, error) {
db = b.ctx.GetSessionVars().CurrentDB
}
// Check the tableName valid.
sequence, err := b.ctx.GetSessionVars().TxnCtx.InfoSchema.(util.SequenceSchema).SequenceByName(model.NewCIStr(db), model.NewCIStr(seq))
sequence, err := b.ctx.GetSessionVars().GetInfoSchema().(util.SequenceSchema).SequenceByName(model.NewCIStr(db), model.NewCIStr(seq))
if err != nil {
return 0, false, err
}
Expand Down Expand Up @@ -903,7 +903,7 @@ func (b *builtinLastValSig) evalInt(row chunk.Row) (int64, bool, error) {
db = b.ctx.GetSessionVars().CurrentDB
}
// Check the tableName valid.
sequence, err := b.ctx.GetSessionVars().TxnCtx.InfoSchema.(util.SequenceSchema).SequenceByName(model.NewCIStr(db), model.NewCIStr(seq))
sequence, err := b.ctx.GetSessionVars().GetInfoSchema().(util.SequenceSchema).SequenceByName(model.NewCIStr(db), model.NewCIStr(seq))
if err != nil {
return 0, false, err
}
Expand Down Expand Up @@ -953,7 +953,7 @@ func (b *builtinSetValSig) evalInt(row chunk.Row) (int64, bool, error) {
db = b.ctx.GetSessionVars().CurrentDB
}
// Check the tableName valid.
sequence, err := b.ctx.GetSessionVars().TxnCtx.InfoSchema.(util.SequenceSchema).SequenceByName(model.NewCIStr(db), model.NewCIStr(seq))
sequence, err := b.ctx.GetSessionVars().GetInfoSchema().(util.SequenceSchema).SequenceByName(model.NewCIStr(db), model.NewCIStr(seq))
if err != nil {
return 0, false, err
}
Expand Down
Loading