[MDEV-26710] Histogram field in mysql.column_stats is too short, JSON histograms get corrupt Created: 2021-09-28 Updated: 2022-06-20 Resolved: 2021-10-01 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | N/A |
| Fix Version/s: | 10.8.1 |
| Type: | Bug | Priority: | Critical |
| Reporter: | Elena Stepanova | Assignee: | Sergei Petrunia |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
mysql.column_stats.histogram field is a standard BLOB. A few long values will overfill it easily, the JSON will get truncated and become invalid.
|
| Comments |
| Comment by Sergei Petrunia [ 2021-10-01 ] | |
|
This is because mysql.column_stats.histogram is defined as
which has a maximum length of 64K. If the maximum number of buckets is 255, this gives 257 bytes to represent one bucket. In utf8mb4, this is 64 4-byte characters. One could argue that JSON syntax parts like field names, quotes, etc. are not 4-byte characters. Still, the size limit is close enough. I don't see any arguments why we should not raise it. |