Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions pkg/server/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2314,25 +2314,27 @@ func TestConnAddMetrics(t *testing.T) {

func TestIssue54335(t *testing.T) {
store, dom := testkit.CreateMockStoreAndDomain(t)
se, err := session.CreateSession4Test(store)
require.NoError(t, err)

// There is no underlying netCon, use failpoint to avoid panic
require.NoError(t, failpoint.Enable("github.com/pingcap/tidb/pkg/server/FakeClientConn", "return(1)"))
defer func() {
require.NoError(t, failpoint.Disable("github.com/pingcap/tidb/pkg/server/FakeClientConn"))
}()
tk := testkit.NewTestKit(t, store)

connID := uint64(1)
tk.Session().SetConnectionID(connID)
se.SetConnectionID(connID)
tc := &TiDBContext{
Session: tk.Session(),
Session: se,
stmts: make(map[int]*TiDBStatement),
}
cc := &clientConn{
connectionID: connID,
server: &Server{
capability: defaultCapability,
},
pkt: internal.NewPacketIOForTest(bufio.NewWriter(io.Discard)),
alloc: arena.NewAllocator(32 * 1024),
chunkAlloc: chunk.NewAllocator(),
}
Expand All @@ -2346,12 +2348,12 @@ func TestIssue54335(t *testing.T) {
handle := dom.ExpensiveQueryHandle().SetSessionManager(srv)
go handle.Run()

tk.MustExec("use test;")
tk.MustExec("CREATE TABLE testTable2 (id bigint, age int)")
session.MustExec(t, se, "use test;")
session.MustExec(t, se, "CREATE TABLE testTable2 (id bigint, age int)")
str := fmt.Sprintf("insert into testTable2 values(%d, %d)", 1, 1)
tk.MustExec(str)
session.MustExec(t, se, str)
for range 14 {
tk.MustExec("insert into testTable2 select * from testTable2")
session.MustExec(t, se, "insert into testTable2 select * from testTable2")
}

times := 100
Expand Down
Loading