-
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.affects-7.2affects-7.3affects-7.4affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.report/customerCustomers have encountered this bug.Customers have encountered this bug.severity/majorsig/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)
package main
import (
"context"
"database/sql"
_ "github.com/go-sql-driver/mysql"
)
func main() {
db, err := sql.Open("mysql", "root@tcp(127.0.0.1:4000)/test")
mustNil(err)
defer db.Close()
ctx := context.Background()
conn, err := db.Conn(ctx)
mustNil(err)
defer conn.Close()
_, err = conn.ExecContext(ctx, "SET tidb_multi_statement_mode='ON';")
mustNil(err)
_, err = conn.ExecContext(ctx, "drop table if exists t;")
mustNil(err)
_, err = conn.ExecContext(ctx, `CREATE TABLE t (
a bigint(20),
b int(10),
PRIMARY KEY (b, a),
UNIQUE KEY uk_a (a)
);
`)
mustNil(err)
_, err = conn.ExecContext(ctx, `insert into t values (1, 1);`)
mustNil(err)
_, err = conn.ExecContext(ctx, "BEGIN;")
mustNil(err)
_, err = conn.QueryContext(ctx, "delete from t where a = 1; select 1;")
mustNil(err)
}
func mustNil(err error) {
if err != nil {
panic(err)
}
}
2. What did you expect to see? (Required)
1
3. What did you see instead (Required)
Error 1105 (HY000): runtime error: index out of range [7] with length 0
[ERROR] [conn.go:1072] ["connection running loop panic"] [conn=8503385434707984879] [lastSQL="delete from t where a = 1; select 1;"] [err="runtime error: index out of range [7] with length 0"] [stack="github.com/pingcap/tidb/server.(*clientConn).Run.func1\n\t/home/tangenta/tidb/server/conn.go:1075\nruntime.gopanic\n\t/usr/local/go/src/runtime/panic.go:920\nruntime.goPanicIndex\n\t/usr/local/go/src/runtime/panic.go:114\nencoding/binary.bigEndian.Uint64\n\t/usr/local/go/src/encoding/binary/binary.go:179\ngithub.com/pingcap/tidb/tablecodec.DecodeHandleInUniqueIndexValue\n\t/home/tangenta/tidb/tablecodec/tablecodec.go:1650\ngithub.com/pingcap/tidb/server.(*clientConn).prefetchPointPlanKeys\n\t/home/tangenta/tidb/server/conn.go:2063\ngithub.com/pingcap/tidb/server.(*clientConn).handleQuery\n\t/home/tangenta/tidb/server/conn.go:1855\ngithub.com/pingcap/tidb/server.(*clientConn).dispatch\n\t/home/tangenta/tidb/server/conn.go:1372\ngithub.com/pingcap/tidb/server.(*clientConn).Run\n\t/home/tangenta/tidb/server/conn.go:1153\ngithub.com/pingcap/tidb/server.(*Server).onConn\n\t/home/tangenta/tidb/server/server.go:677"]
4. What is your TiDB version? (Required)
v7.1.0, master(33480e8)
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.affects-7.2affects-7.3affects-7.4affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.report/customerCustomers have encountered this bug.Customers have encountered this bug.severity/majorsig/plannerSIG: PlannerSIG: Plannertype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.