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 control overestimates memory usage when executing SQL with LEAST(...) or GREATEST(...) #8604

Closed
lilinghai opened this issue Dec 27, 2023 · 2 comments · Fixed by #8613

Comments

@lilinghai
Copy link

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

table with 1000 rows join with table with 75 rows and join with table with 10 rows
Query failed for the the overestimated memory usage 4.00 EiB

explain analyze SELECT count(*) FROM table_1000_utf8mb4collate_utf8mb4_bin_undef t1 left join table_75_utf8mb4collate_utf8mb4_general_ci_undef t2 on t1. `col_timestamp_undef_signed` != t2. `col_int_key_unsigned` or not greatest(t1. `col_double_key_unsigned`,t1. `col_char(20)_key_signed`,null) inner join table_10_utf8mb4collate_utf8mb4_general_ci_undef t3 on t2. `col_int_undef_unsigned` != t3. `col_varchar(20)_key_signed`;
ERROR 1105 (HY000): other error for mpp stream: Code: 0, e.displayText() = DB::TiFlashException: Memory limit (total) exceeded caused by 'out of memory quota for data computing' : would use 4.00 EiB for data computing (attempt to allocate chunk of 4611686018427715620 bytes), limit of memory for data computing: 12.80 GiB. Memory Usage of Storage: non-query: peak=153.41 MiB, amount=371.88 KiB; kvstore: peak=196.10 KiB, amount=0.00 B; query-storage-task: peak=882.19 KiB, amount=0.00 B; fetch-pages: peak=0.00 B, amount=0.00 B

image

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

3. What did you see instead (Required)

4. What is your TiFlash version? (Required)

master

@JaySon-Huang
Copy link
Contributor

Executing SQLs with LEAST(...) or GREATEST(...) with constants will trigger this issue.

The typical error after tiflash happens to this issue is that queries to tiflash will report

  • Memory limit (total) exceeded caused by 'out of memory quota for data computing' : would use 4.00 EiB for data computing - try to allocate 4 EiB extreme large memory
  • "DeltaMerge return wrong result ..." Because memory is corrupt after this issue occur, there could be some data be broken

@JaySon-Huang JaySon-Huang changed the title Memory control overestimates memory usage Memory control overestimates memory usage when executing SQL with LEAST(...) or GREATEST(...) May 27, 2024
@seiya-annie
Copy link

/found customer

@ti-chi-bot ti-chi-bot bot added the report/customer Customers have encountered this bug. label Jun 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants