-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.epic/plan-cacheseverity/minorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
- If calling
TableByName
encounters an error, we need to adjust the log level and supplement the error log. Because this error does not affect execution results.
tidb/planner/core/plan_cacheable_checker.go
Lines 557 to 609 in 41d1ec0
func hasGeneratedCol(schema infoschema.InfoSchema, tn *ast.TableName) bool { | |
tb, err := schema.TableByName(tn.Schema, tn.Name) | |
if err != nil { | |
logutil.BgLogger().Error("Error occur in checking cacheable", zap.Error(err)) | |
return false | |
} | |
for _, col := range tb.Cols() { | |
if col.IsGenerated() { | |
return true | |
} | |
} | |
return false | |
} | |
func getColType(schema infoschema.InfoSchema, tbl *ast.TableName, col *ast.ColumnName) (colType byte, found bool) { | |
if tbl == nil { | |
return 0, false | |
} | |
tb, err := schema.TableByName(tbl.Schema, tbl.Name) | |
if err != nil { | |
return 0, false | |
} | |
for _, c := range tb.Cols() { | |
if c.Name.L == col.Name.L { | |
return c.GetType(), true | |
} | |
} | |
return 0, false | |
} | |
func isTempTable(schema infoschema.InfoSchema, tn *ast.TableName) bool { | |
tb, err := schema.TableByName(tn.Schema, tn.Name) | |
if err != nil { | |
logutil.BgLogger().Error("Error occur in checking cacheable", zap.Error(err)) | |
return false | |
} | |
if tb.Meta().TempTableType != model.TempTableNone { | |
return true | |
} | |
return false | |
} | |
func isPartitionTable(schema infoschema.InfoSchema, tn *ast.TableName) bool { | |
tb, err := schema.TableByName(tn.Schema, tn.Name) | |
if err != nil { | |
logutil.BgLogger().Error("Error occur in checking cacheable", zap.Error(err)) | |
return false | |
} | |
if tb.Meta().GetPartitionInfo() != nil { | |
return true | |
} | |
return false | |
} |
- Besides, if we encounter this error when calling
TableByName
, I think it makes sense to return true
2. What did you expect to see? (Required)
Change this log to a warning and add some info to check the cause of this error later.
3. What did you see instead (Required)
logutil.BgLogger().Error("Error occur in checking cacheable", zap.Error(err))
4. What is your TiDB version? (Required)
Release Version: v7.4.0-alpha-292-g5cbcc86e50
Edition: Community
Git Commit Hash: 5cbcc86
Metadata
Metadata
Assignees
Labels
affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.epic/plan-cacheseverity/minorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.