Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#54083
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
  • Loading branch information
qw4990 authored and ti-chi-bot committed Oct 28, 2024
1 parent cc04dd7 commit a33da4f
Show file tree
Hide file tree
Showing 3 changed files with 1,011 additions and 0 deletions.
26 changes: 26 additions & 0 deletions bindinfo/session_handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,9 +454,35 @@ func TestDropSingleBindings(t *testing.T) {
require.Len(t, rows, 1)
require.Equal(t, "SELECT * FROM `test`.`t` USE INDEX (`idx_b`)", rows[0][1])
tk.MustExec("drop table t")
<<<<<<< HEAD:bindinfo/session_handle_test.go
tk.MustExec("drop global binding for select * from t using select * from t use index(idx_b)")
rows = tk.MustQuery("show global bindings").Rows()
require.Len(t, rows, 0)
=======
}

func TestIssue53834(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec(`use test`)
tk.MustExec(`create table t (a varchar(1024))`)
tk.MustExec(`insert into t values (space(1024))`)
for i := 0; i < 12; i++ {
tk.MustExec(`insert into t select * from t`)
}
oomAction := tk.MustQuery(`select @@tidb_mem_oom_action`).Rows()[0][0].(string)
defer func() {
tk.MustExec(fmt.Sprintf(`set global tidb_mem_oom_action='%v'`, oomAction))
}()

tk.MustExec(`set global tidb_mem_oom_action='cancel'`)
err := tk.ExecToErr(`replace into t select /*+ memory_quota(1 mb) */ * from t`)
require.ErrorContains(t, err, "cancelled due to exceeding the allowed memory limit")

tk.MustExec(`create binding using replace into t select /*+ memory_quota(1 mb) */ * from t`)
err = tk.ExecToErr(`replace into t select * from t`)
require.ErrorContains(t, err, "cancelled due to exceeding the allowed memory limit")
>>>>>>> 9906339471d (planner: fix the issue that statement-level hints in sub-queries of Insert/Replace can not take effect (#54083)):pkg/bindinfo/session_handle_test.go
}

func TestPreparedStmt(t *testing.T) {
Expand Down
Loading

0 comments on commit a33da4f

Please sign in to comment.