diff options
author | Sergey Vojtovich <svoj@mariadb.org> | 2019-10-16 19:00:43 +0400 |
---|---|---|
committer | Sergey Vojtovich <svoj@mariadb.org> | 2020-05-29 21:53:54 +0400 |
commit | c2798784931a59f996275e14220b74f450828b4b (patch) | |
tree | 09a17f66e2c1d4d46cea518692e70272d2cd4015 /sql/sql_help.cc | |
parent | 609a0d3db3fecc12c2d63b52bec3e3a305e6c702 (diff) | |
download | mariadb-git-c2798784931a59f996275e14220b74f450828b4b.tar.gz |
Thread safe histograms loading
Previously multiple threads were allowed to load histograms concurrently.
There were no known problems caused by this. But given amount of data
races in this code, it'd happen sooner or later.
To avoid scalability bottleneck, histograms loading is protected by
per-TABLE_SHARE atomic variable.
Whenever histograms were loaded by preceding statement (hot-path), a
scalable load-acquire check is performed.
Whenever histograms have to be loaded anew, mutual exclusion for loaders
is established by atomic variable. If histograms are being loaded
concurrently, statement waits until load is completed.
- Table_statistics::total_hist_size moved to TABLE_STATISTICS_CB: only
meaningful within TABLE_SHARE (not used for collected stats).
- TABLE_STATISTICS_CB::histograms_can_be_read and
TABLE_STATISTICS_CB::histograms_are_read are replaced with a tri state
atomic variable.
- Simplified away alloc_histograms_for_table_share().
Note: there's still likely a data race if a thread attempts accessing
histograms data after it failed to load it (because of concurrent load).
It was there previously and goes out of the scope of this effort. One way
of fixing it could be reviving TABLE::histograms_are_read and adding
appropriate checks whenever it is needed.
Part of MDEV-19061 - table_share used for reading statistical tables is
not protected
Diffstat (limited to 'sql/sql_help.cc')
0 files changed, 0 insertions, 0 deletions