maria:bb-10.5-svoj-MDEV-19061

Last commit made on 2020-05-07
Get this branch:
git clone -b bb-10.5-svoj-MDEV-19061 https://git.launchpad.net/maria

Branch merges

Branch information

Name:
bb-10.5-svoj-MDEV-19061
Repository:
lp:maria

Recent commits

5e52d89... by Sergey Vojtovich

Wait for stats in the LOADING state

Fixes both stats and histograms.

To be fixed up into "ae6a37e Thread safe statistics loading".

6c7eb74... by Sergey Vojtovich

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 continues without histograms.

- Table_statistics::total_hist_size moved to TABLE_STATISTICS_CB: only
  meaningful within TABLE_SHARE (not used for collected stats).
- Table_statistics::histograms removed as it is not used anymore.
- 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

ae6a37e... by Sergey Vojtovich

Thread safe statistics loading

Previously multiple threads were allowed to load statistics 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, statistics loading is protected by
per-TABLE_SHARE atomic variable.

Whenever statistics were loaded by preceding statement (hot-path), a
scalable load-acquire check is performed.

Whenever statistics have to be loaded anew, mutual exclusion for loaders
is established by atomic variable. If statistics are being loaded
concurrently, statement continues without statistics.

TABLE_STATISTICS_CB::stats_can_be_read and
TABLE_STATISTICS_CB::stats_is_read are replaced with a tri state atomic
variable.

Part of MDEV-19061 - table_share used for reading statistical tables is
                     not protected

af62cf8... by Sergey Vojtovich

Moved stats_cb.mem_root initialisation/freeing

Part of MDEV-19061 - table_share used for reading statistical tables is
                     not protected

05147a1... by Sergey Vojtovich

Allocate idx_avg_frequency along with table_stats

Simplified away Table_statistics::idx_avg_frequency: didn't serve any
purpose.

Part of MDEV-19061 - table_share used for reading statistical tables is
                     not protected

83b72d5... by Sergey Vojtovich

Allocate Index_stats along with table_stats

Simplified away Table_statistics::index_stats: didn't serve any
purpose.

Part of MDEV-19061 - table_share used for reading statistical tables is
                     not protected

17b422f... by Sergey Vojtovich

Allocate min_max_record_buffers along with table_stats

Simplified away Table_statistics::min_max_record_buffers: didn't serve
any purpose.

Part of MDEV-19061 - table_share used for reading statistical tables is
                     not protected

4b9341c... by Sergey Vojtovich

Allocate column_stats along with table_stats

Simplified away Table_statistics::column_stats: didn't serve any
purpose.

Part of MDEV-19061 - table_share used for reading statistical tables is
                     not protected

b8be804... by Sergey Vojtovich

Unified condition in read_statistics_for_tables()

Use same condition in both loops, less "table_share != NULL" checks,
no more potential "table_share == NULL" dereferencing.

Part of MDEV-19061 - table_share used for reading statistical tables is
                     not protected

a11ef54... by Sergey Vojtovich

Simplified away statistics_for_tables_is_needed()

Simplified away another loop, integrated logics into the caller instead.

Part of MDEV-19061 - table_share used for reading statistical tables is
                     not protected