[MDEV-16520] Out-Of-Memory running big aggregate query on Spider Engine Created: 2018-06-19 Updated: 2020-08-25 Resolved: 2019-02-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Spider |
| Affects Version/s: | 10.3 |
| Fix Version/s: | 10.4.3, 10.3.13 |
| Type: | Bug | Priority: | Major |
| Reporter: | Mattias Jonsson | Assignee: | Kentoku Shiba (Inactive) |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Environment: |
Linux |
||
| Issue Links: |
|
||||||||||||||||
| Description |
|
When running 6 concurrent queries (2 queries per 3 tables) the mysqld process gets killed by the OOM killer. The queries was:
|
| Comments |
| Comment by Mattias Jonsson [ 2018-06-19 ] | ||
|
Same issue as | ||
| Comment by Jacob Mathew (Inactive) [ 2018-11-12 ] | ||
|
I have been unable to reproduce this problem. However, I have been able to figure out what is causing the out-of-memory condition. If you are not explicitly setting the spider_quick_mode setting, then you are getting spider_quick_mode = 0. This means that result rows are buffered by the libmysqlclient used by Spider to interface with its data nodes. The memory used for the result rows is freed only at the end of the query. So if the aggregate query is not pushed to the data nodes (when pushdown of one of the aggregate functions is not supported) and the number of result rows returned by the data nodes is enormous, then the Spider node can run out of memory. To prevent the out-of-memory condition, try setting the following variables:
spider_quick_mode = 3 will cause the result rows to be written to disk when the number of result rows exceeds the value of spider_quick_page_size. You will need to tune the value of spider_quick_page_size so that it is large enough to not have a negative effect on performance and small enough to prevent the out-of-memory condition. I am closing the bug with this recommended action. If this does not work for you, please reopen the bug. | ||
| Comment by Jacob Mathew (Inactive) [ 2018-11-12 ] | ||
|
Please take the action recommended in the previous comment. If it does not resolve your problem, please reopen the bug. | ||
| Comment by Mattias Jonsson [ 2018-11-13 ] | ||
|
Since spider_quick_mode = 3 crashes the spider server with CHECKSUM TABLE, see | ||
| Comment by Michael Widenius [ 2018-11-13 ] | ||
|
Eric Herman has more comments on this task | ||
| Comment by Kentoku Shiba (Inactive) [ 2018-11-30 ] | ||
|
I changed default value of the followings for avoiding "out of memory" error. I added the following variabless for limiting result page size by byte
Spider Table System Variable
| ||
| Comment by Kentoku Shiba (Inactive) [ 2018-12-24 ] | ||
|
Sachin, please review this. | ||
| Comment by Kentoku Shiba (Inactive) [ 2019-01-31 ] | ||
|
Sachin, please review the following changes. | ||
| Comment by Sachin Setiya (Inactive) [ 2019-02-03 ] | ||
|
okay to push | ||
| Comment by Kentoku Shiba (Inactive) [ 2019-02-05 ] | ||
|
Merged to 10.3 and 10.4 tree. |