-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
query information_schema.tables
will report table not exists
#42003
Labels
affects-5.1
This bug affects 5.1.x versions.
affects-5.2
This bug affects 5.2.x versions.
affects-5.3
This bug affects 5.3.x versions.
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-6.2
affects-6.3
affects-6.4
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-6.6
severity/major
sig/sql-infra
SIG: SQL Infra
type/bug
The issue is confirmed as a bug.
Comments
information_schema.tables
will reprot table not existsinformation_schema.tables
will report table not exists
A test script to reproduce, package main
import (
"database/sql"
"flag"
"fmt"
_ "github.com/go-sql-driver/mysql"
)
func main() {
var (
host string
port int
user string
passwd string
dbname string
)
flag.StringVar(&host, "host", "127.0.0.1", "")
flag.IntVar(&port, "port", 4000, "")
flag.StringVar(&user, "user", "root", "")
flag.StringVar(&passwd, "password", "", "")
flag.StringVar(&dbname, "dbname", "test", "")
flag.Parse()
db, err := sql.Open("mysql", fmt.Sprintf("%s:%s@tcp(%s:%d)/%s", user, passwd, host, port, dbname))
if err != nil {
panic(err)
}
if err := db.Ping(); err != nil {
panic(err)
}
defer db.Close()
go func() {
for {
res, err := db.Query("SELECT 1 FROM information_schema.tables")
if err != nil {
fmt.Println(err)
}
if res != nil {
res.Close()
}
}
}()
for {
_, err := db.Exec("create table xxx (id int key auto_increment)")
if err != nil {
panic("create table failed")
}
_, err = db.Exec("drop table xxx")
if err != nil {
panic("drop table failed")
}
}
} |
12 tasks
Introduced by http://github.com/pingcap/tidb/pull/24820 |
maybe also the same root cause of #42007 |
ti-chi-bot
pushed a commit
that referenced
this issue
Mar 15, 2023
This was referenced Mar 15, 2023
ti-chi-bot
added a commit
that referenced
this issue
Mar 28, 2023
ti-chi-bot
added a commit
that referenced
this issue
Apr 11, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
affects-5.1
This bug affects 5.1.x versions.
affects-5.2
This bug affects 5.2.x versions.
affects-5.3
This bug affects 5.3.x versions.
affects-5.4
This bug affects the 5.4.x(LTS) versions.
affects-6.1
This bug affects the 6.1.x(LTS) versions.
affects-6.2
affects-6.3
affects-6.4
affects-6.5
This bug affects the 6.5.x(LTS) versions.
affects-6.6
severity/major
sig/sql-infra
SIG: SQL Infra
type/bug
The issue is confirmed as a bug.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
SELECT 1 FROM information_schema.tables
parallel run these two steps several times, you may get an error
Table xxx doesn't exist
this is because
tidb/executor/infoschema_reader.go
Lines 687 to 692 in 5ff5b34
getAutoIncrementID
will use the newest schema that the table has been dropped.sleep seconds at L687 will easier to reproduce this bug
similar with #41622
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: