[MDEV-14511] Use fewer transactions for updating InnoDB persistent statistics Created: 2017-11-27 Updated: 2018-01-22 Resolved: 2017-12-06 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Storage Engine - XtraDB |
| Affects Version/s: | 10.0, 10.1, 10.2, 10.3 |
| Fix Version/s: | 10.2.12, 10.3.3 |
| Type: | Bug | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | crash, statistics, transactions, upstream | ||
| Attachments: |
|
||||||||||||||||||||
| Issue Links: |
|
||||||||||||||||||||
| Description |
|
The function dict_stats_save() is problematic. If it ever goes to 'goto err' it will attempt to free an active transaction object, without trying to roll it back first. Furthermore, the first call to dict_stats_exec_sql() will use a different transaction object, that is, the update of table statistics is not a single atomic transaction with the update of index statistics. |
| Comments |
| Comment by Marko Mäkelä [ 2017-11-27 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
When porting the fix from 10.2 to 10.0, I noticed that more work is needed so that the test would pass.
The function dict_stats_exec_sql() must be rewritten so that it always takes a trx_t* parameter, and never calls commit or rollback. The caller should invoke row_mysql_lock_data_dictionary(trx) and row_mysql_unlock_data_dictionary(trx) in addition to deciding whether to commit or rollback. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-12-01 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
The debug instrumentation test case alone is not enough to trigger a crash in the unmodified 10.0 or 10.1. Therefore, it is not necessary to perform this refactoring in those versions. That said, I prepared a 10.0 patch 0001-MDEV-14511-Use-fewer-transactions-for-updating-InnoD.patch | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2017-12-06 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Because the 10.2 and 10.3 code bases are very similar in this respect, and because | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-01-22 ] | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Due to the regression |