[MDEV-19061] table_share used for reading statistical tables is not protected Created: 2019-03-27 Updated: 2023-07-31 Resolved: 2020-05-29 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Optimizer |
| Affects Version/s: | 10.1, 10.2, 10.3, 10.4 |
| Fix Version/s: | 10.5.4, 10.1.46, 10.2.33, 10.3.24, 10.4.14 |
| Type: | Bug | Priority: | Major |
| Reporter: | Varun Gupta (Inactive) | Assignee: | Sergey Vojtovich |
| Resolution: | Fixed | Votes: | 1 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
While reading statistics for a table in function read_statistics_for_table_is_needed we don't protect the table_share fields and there is a chance that multiple threads would try to access it at the same time. To see this
and the server output is
so different threads are entering the function at the same time. |
| Comments |
| Comment by Varun Gupta (Inactive) [ 2019-03-27 ] | |||||||||||||||||||||||||||||||
|
The test case
| |||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2019-03-27 ] | |||||||||||||||||||||||||||||||
|
Atomics based solution prototype:
Also the following looks quite wrong:
Shouldn't second if check histograms_are_read instead? | |||||||||||||||||||||||||||||||
| Comment by Alexander Barkov [ 2019-03-28 ] | |||||||||||||||||||||||||||||||
|
The problem was found while working on | |||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2020-04-21 ] | |||||||||||||||||||||||||||||||
|
igor, please review top 11 patches at https://github.com/MariaDB/server/commits/bb-10.5-svoj-MDEV-19061 | |||||||||||||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2020-05-28 ] | |||||||||||||||||||||||||||||||
|
Patches backported to 10.1, also removed some cleanups. | |||||||||||||||||||||||||||||||
| Comment by Igor Babaev [ 2020-05-29 ] | |||||||||||||||||||||||||||||||
|
Ok to push into 10.1 |