Skip to content
New issue

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

memory_quota hint doesn't work well with global binding #53834

Closed
Rustin170506 opened this issue Jun 5, 2024 · 3 comments · Fixed by #54048 or #54083
Closed

memory_quota hint doesn't work well with global binding #53834

Rustin170506 opened this issue Jun 5, 2024 · 3 comments · Fixed by #54048 or #54083
Assignees
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.1 affects-6.5 affects-7.1 affects-7.5 affects-8.1 report/customer Customers have encountered this bug. severity/major sig/planner SIG: Planner type/bug The issue is confirmed as a bug.

Comments

@Rustin170506
Copy link
Member

Rustin170506 commented Jun 5, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

  1. Start the TiDB cluster: tiup playground v8.1.0
  2. Use sysbench to create a table and insert 100000 rows:
sysbench oltp_insert --table-size=100000 --mysql-db=test --mysql-user=root --mysql-port=4000 --mysql-host=127.0.0.1 prepare
sysbench oltp_insert --table-size=100000 --mysql-db=test --mysql-user=root --mysql-port=4000 --mysql-host=127.0.0.1 run
  1. Try following SQLs:
use test;
create table sbtest2 like sbtest1;
insert into sbtest2 select * from sbtest1;
create table sbtest3 like sbtest1;
  1. Try this SQLs with hint:
replace into  sbtest3 select /*+ memory_quota(2 GB) */ a.* from sbtest1 a, sbtest2 b where a.pad=b.pad  limit 0,10000;

create global binding for replace into sbtest3 select a.* from sbtest1 a, sbtest2 b where a.pad=b.pad  limit 0,10000 using replace into  sbtest3 select /*+ memory_quota(2 GB) */ a.* from sbtest1 a, sbtest2 b where a.pad=b.pad  limit 0,10000;


replace into sbtest3 select  a.* from sbtest1 a, sbtest2 b where a.pad=b.pad  limit 0,10000;

2. What did you expect to see? (Required)

All queries canceled by memory controller.

3. What did you see instead (Required)

mysql> replace into  sbtest3 select /*+ memory_quota(2 GB) */ a.* from sbtest1 a, sbtest2 b where a.pad=b.pad  limit 0,10000;
ERROR 8175 (HY000): Your query has been cancelled due to exceeding the allowed memory limit for a single SQL query. Please try narrowing your query scope or increase the tidb_mem_quota_query limit and try again.[conn=4011851786]

mysql> create global binding for replace into sbtest3 select a.* from sbtest1 a, sbtest2 b where a.pad=b.pad  limit 0,10000 using replace into  sbtest3 select /*+ memory_quota(2 GB) */ a.* from sbtest1 a, sbtest2 b where a.pad=b.pad  limit 0,10000;
Query OK, 0 rows affected (0.01 sec)

mysql> replace into sbtest3 select  a.* from sbtest1 a, sbtest2 b where a.pad=b.pad  limit 0,10000;
Query OK, 10000 rows affected (0.34 sec)
Records: 10000  Duplicates: 0  Warnings: 0

4. What is your TiDB version? (Required)

v8.1.0

@qw4990
Copy link
Contributor

qw4990 commented Jun 17, 2024

I'll fix this soon

@qw4990
Copy link
Contributor

qw4990 commented Jun 18, 2024

Not completely fixed.

@seiya-annie
Copy link

/found customer

@ti-chi-bot ti-chi-bot bot added the report/customer Customers have encountered this bug. label Jun 19, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jul 15, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jul 15, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jul 31, 2024
ti-chi-bot bot pushed a commit that referenced this issue Aug 1, 2024
ti-chi-bot bot pushed a commit that referenced this issue Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment