From 25ba04b3b17199472a4057312339a31b0851251a Mon Sep 17 00:00:00 2001 From: tiancaiamao Date: Mon, 20 Jul 2020 22:41:39 +0800 Subject: [PATCH] cherry pick #18676 to release-4.0 Signed-off-by: ti-srebot --- executor/infoschema_reader.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/executor/infoschema_reader.go b/executor/infoschema_reader.go index be45e88c43687..1d90bffd7f8ea 100644 --- a/executor/infoschema_reader.go +++ b/executor/infoschema_reader.go @@ -265,7 +265,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 := ctx.GetSessionVars().TxnCtx.InfoSchema.(infoschema.InfoSchema) + is := infoschema.GetInfoSchema(ctx) tbl, err := is.TableByName(schema.Name, tblInfo.Name) if err != nil { return 0, err