Skip to content

Commit 12c55b9

Browse files
qw4990ti-chi-bot
authored andcommitted
This is an automated cherry-pick of pingcap#54048
Signed-off-by: ti-chi-bot <[email protected]>
1 parent 9184366 commit 12c55b9

File tree

4 files changed

+1710
-4
lines changed

4 files changed

+1710
-4
lines changed

bindinfo/session_handle_test.go

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ package bindinfo_test
1616

1717
import (
1818
"context"
19+
"fmt"
1920
"strconv"
2021
"testing"
2122
"time"
@@ -459,6 +460,25 @@ func TestDropSingleBindings(t *testing.T) {
459460
require.Len(t, rows, 0)
460461
}
461462

463+
func TestIssue53834(t *testing.T) {
464+
store := testkit.CreateMockStore(t)
465+
tk := testkit.NewTestKit(t, store)
466+
tk.MustExec(`use test`)
467+
tk.MustExec(`create table t (a varchar(1024))`)
468+
tk.MustExec(`insert into t values (space(1024))`)
469+
for i := 0; i < 12; i++ {
470+
tk.MustExec(`insert into t select * from t`)
471+
}
472+
oomAction := tk.MustQuery(`select @@tidb_mem_oom_action`).Rows()[0][0].(string)
473+
defer func() {
474+
tk.MustExec(fmt.Sprintf(`set global tidb_mem_oom_action='%v'`, oomAction))
475+
}()
476+
tk.MustExec(`set global tidb_mem_oom_action='cancel'`)
477+
tk.MustExec(`create binding using replace into t select /*+ memory_quota(1 mb) */ * from t`)
478+
err := tk.ExecToErr(`replace into t select * from t`)
479+
require.ErrorContains(t, err, "cancelled due to exceeding the allowed memory limit")
480+
}
481+
462482
func TestPreparedStmt(t *testing.T) {
463483
store := testkit.CreateMockStore(t)
464484
tk := testkit.NewTestKit(t, store)

0 commit comments

Comments
 (0)