We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Please answer these questions before submitting your issue. Thanks!
> curl "http://127.0.0.1:10080/db-table/-123"
> curl "http://127.0.0.1:10080/db-table/-123" [schema:1146]Table which ID = -123 does not exist.
> curl "http://127.0.0.1:10081/db-table/-123" curl: (52) Empty reply from server
And a panic log in tidb
2024/03/22 10:42:52 http: panic serving 127.0.0.1:53256: runtime error: index out of range [-123] goroutine 5202 [running]: net/http.(*conn).serve.func1() /Users/wangchao/.gvm/gos/go1.21.0/src/net/http/server.go:1868 +0x118 panic({0x1081c98c0?, 0x140189ca198?}) /Users/wangchao/.gvm/gos/go1.21.0/src/runtime/panic.go:920 +0x254 github.com/pingcap/tidb/pkg/infoschema.(*infoSchema).TableByID(0x140059bba00, 0xffffffffffffff85) /Users/wangchao/Code/pingcap/tidb/pkg/infoschema/infoschema.go:235 +0xfc github.com/pingcap/tidb/pkg/server/handler/tikvhandler.DBTableHandler.ServeHTTP({0x1401179e5d0}, {0x10850bac0, 0x140189b6000}, 0x14017be9c00) /Users/wangchao/Code/pingcap/tidb/pkg/server/handler/tikvhandler/tikv_handler.go:1805 +0x238 github.com/gorilla/mux.(*Router).ServeHTTP(0x1401142cf00, {0x10850bac0, 0x140189b6000}, 0x14017be9c00) /Users/wangchao/.gvm/pkgsets/go1.21.0/global/pkg/mod/github.com/gorilla/mux@v1.8.0/mux.go:210 +0x254 net/http.(*ServeMux).ServeHTTP(0x140118b5900, {0x10850bac0, 0x140189b6000}, 0x14017be9a00) /Users/wangchao/.gvm/gos/go1.21.0/src/net/http/server.go:2514 +0x160 github.com/pingcap/tidb/pkg/server/internal/util.CorsHandler.ServeHTTP({{0x1084ed0e0, 0x140118b5900}, 0x140007de900}, {0x10850bac0, 0x140189b6000}, 0x14017be9a00) /Users/wangchao/Code/pingcap/tidb/pkg/server/internal/util/util.go:219 +0xe0 net/http.serverHandler.ServeHTTP({0x1401142f1d0}, {0x10850bac0, 0x140189b6000}, 0x14017be9a00) /Users/wangchao/.gvm/gos/go1.21.0/src/net/http/server.go:2938 +0x2a0 net/http.(*conn).serve(0x140189a4000, {0x108520c18, 0x140189a6050}) /Users/wangchao/.gvm/gos/go1.21.0/src/net/http/server.go:2009 +0x155c created by net/http.(*Server).Serve in goroutine 573 /Users/wangchao/.gvm/gos/go1.21.0/src/net/http/server.go:3086 +0x7f8
The text was updated successfully, but these errors were encountered:
The reason is that we use % to compute the bucket index.
%
tidb/pkg/infoschema/builder.go
Line 973 in 5e19822
However, if the table id is negative, a negative index will be returned:
func main() { // will return -123 fmt.Println(-123 % 512) }
https://go.dev/play/p/XtiDd-ZyhWy
Sorry, something went wrong.
TableByID
infoschema: fix panic for TableByID when table id is negative (#52016)
b96f081
close #52012
lcwangchao
Successfully merging a pull request may close this issue.
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
And a panic log in tidb
4. What is your TiDB version? (Required)
The text was updated successfully, but these errors were encountered: