Skip to content

Commit

Permalink
*: fix oom in the infoSchema.TableByName (#52220) (#52820)
Browse files Browse the repository at this point in the history
close #52219
  • Loading branch information
ti-chi-bot authored Apr 23, 2024
1 parent 3917c31 commit 971fec0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion infoschema/infoschema.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ func (is *infoSchema) TableByName(schema, table model.CIStr) (t table.Table, err
return
}
}
return nil, ErrTableNotExists.GenWithStackByArgs(schema, table)
return nil, ErrTableNotExists.FastGenByArgs(schema, table)
}

func (is *infoSchema) TableIsView(schema, table model.CIStr) bool {
Expand Down
2 changes: 1 addition & 1 deletion planner/core/logical_plan_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -5948,7 +5948,7 @@ func (b *PlanBuilder) buildUpdateLists(ctx context.Context, tableList []*ast.Tab
tableInfo := tn.TableInfo
tableVal, found := b.is.TableByID(tableInfo.ID)
if !found {
return nil, nil, false, infoschema.ErrTableNotExists.GenWithStackByArgs(tn.DBInfo.Name.O, tableInfo.Name.O)
return nil, nil, false, infoschema.ErrTableNotExists.FastGenByArgs(tn.DBInfo.Name.O, tableInfo.Name.O)
}
for i, colInfo := range tableVal.Cols() {
if !colInfo.IsGenerated() {
Expand Down
8 changes: 4 additions & 4 deletions planner/core/planbuilder.go
Original file line number Diff line number Diff line change
Expand Up @@ -2003,7 +2003,7 @@ func (b *PlanBuilder) buildAdminCheckTable(ctx context.Context, as *ast.AdminStm
tableInfo := as.Tables[0].TableInfo
tbl, ok := b.is.TableByID(tableInfo.ID)
if !ok {
return nil, infoschema.ErrTableNotExists.GenWithStackByArgs(tblName.DBInfo.Name.O, tableInfo.Name.O)
return nil, infoschema.ErrTableNotExists.FastGenByArgs(tblName.DBInfo.Name.O, tableInfo.Name.O)
}
p := &CheckTable{
DBName: tblName.Schema.O,
Expand Down Expand Up @@ -3794,11 +3794,11 @@ func (b *PlanBuilder) resolveGeneratedColumns(ctx context.Context, columns []*ta
func (b *PlanBuilder) buildInsert(ctx context.Context, insert *ast.InsertStmt) (Plan, error) {
ts, ok := insert.Table.TableRefs.Left.(*ast.TableSource)
if !ok {
return nil, infoschema.ErrTableNotExists.GenWithStackByArgs()
return nil, infoschema.ErrTableNotExists.FastGenByArgs()
}
tn, ok := ts.Source.(*ast.TableName)
if !ok {
return nil, infoschema.ErrTableNotExists.GenWithStackByArgs()
return nil, infoschema.ErrTableNotExists.FastGenByArgs()
}
tableInfo := tn.TableInfo
if tableInfo.IsView() {
Expand Down Expand Up @@ -4360,7 +4360,7 @@ func (b *PlanBuilder) buildLoadData(ctx context.Context, ld *ast.LoadDataStmt) (
tableInPlan, ok := b.is.TableByID(tableInfo.ID)
if !ok {
db := b.ctx.GetSessionVars().CurrentDB
return nil, infoschema.ErrTableNotExists.GenWithStackByArgs(db, tableInfo.Name.O)
return nil, infoschema.ErrTableNotExists.FastGenByArgs(db, tableInfo.Name.O)
}
schema, names, err := expression.TableInfo2SchemaAndNames(b.ctx, model.NewCIStr(""), tableInfo)
if err != nil {
Expand Down

0 comments on commit 971fec0

Please sign in to comment.