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

Adjust the log level and returned value when cacheableChecker check *ast.TableName nodes #46760

Closed
zimulala opened this issue Sep 7, 2023 · 0 comments · Fixed by #46831
Closed
Assignees

Comments

@zimulala
Copy link
Contributor

zimulala commented Sep 7, 2023

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. 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.

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
}

  1. 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

@zimulala zimulala added type/bug The issue is confirmed as a bug. sig/planner SIG: Planner severity/minor affects-6.5 labels Sep 7, 2023
@zimulala zimulala changed the title Adjust the log level and supplement log when cacheableChecker check *ast.TableName nodes Adjust the log level and returned value when cacheableChecker check *ast.TableName nodes Sep 7, 2023
ti-chi-bot bot pushed a commit that referenced this issue Sep 11, 2023
ti-chi-bot bot pushed a commit that referenced this issue Sep 12, 2023
@jayl1e jayl1e mentioned this issue Sep 21, 2023
11 tasks
ti-chi-bot bot pushed a commit that referenced this issue Oct 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants