[MXS-4895] QC cache memory accounting on CentOS 7 is wrong Created: 2023-12-13 Updated: 2023-12-15 Resolved: 2023-12-15 |
|
| Status: | Closed |
| Project: | MariaDB MaxScale |
| Component/s: | QueryClassifier |
| Affects Version/s: | 6.4.13 |
| Fix Version/s: | 6.4.14 |
| Type: | Bug | Priority: | Major |
| Reporter: | markus makela | Assignee: | markus makela |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Environment: |
RHEL/CentOS 7 |
||
| Attachments: |
|
| Description |
|
On RHEL/CentOS 7 systems the memory accounting done for the query classifier cache does not correctly shrink the SQL statement to fit into memory before storing it in the cache. The result of this is that the size calculation, which is correct on modern operating systems, is wrong and the actual amount of memory is much larger. This happens as the size of the string, not the capacity, is used to calculate the resulting memory usage. Since it's correct on all systems that do not implement the CoW std::string, the fix is to make sure that the CoW mechanism is not used. I've attached a test case that reproduces the problem. To use it, modify the connection information and compile it with:
|
| Comments |
| Comment by markus makela [ 2023-12-15 ] |
|
This only affects MaxScale 6 on RHEL/CentOS 7 where the hashtable key still used a std::string. In 22.08 and newer versions, the hashtable uses a std::string_view and the canonical form of the query is stored in the element itself that was already shrunk to size before being stored. |