[MDEV-15132] Avoid accessing the TRX_SYS page Created: 2018-01-30 Updated: 2022-02-28 Due: 2018-01-31 Resolved: 2018-01-31 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB |
| Fix Version/s: | 10.3.5 |
| Type: | Task | Priority: | Major |
| Reporter: | Marko Mäkelä | Assignee: | Marko Mäkelä |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | performance | ||
| Issue Links: |
|
||||||||||||||||||||||||||||||||||||||||
| Epic Link: | arm64 optimization | ||||||||||||||||||||||||||||||||||||||||
| Description |
|
InnoDB maintains an internal persistent sequence of transaction identifiers. This sequence is used for assigning both transaction start identifiers (DB_TRX_ID=trx->id) and end identifiers (trx->no) as well as end identifiers for the mysql.transaction_registry table that was introduced in Every 256th update of the sequence would cause a write to the TRX_SYS page. We can completely avoid accessing the TRX_SYS page if we modify the InnoDB startup so that resurrecting the sequence from other pages of the transaction system. It turns out that startup is not reading the undo log pages of of committed transactions. In order not to cause additional page accesses on startup, we must persist trx_sys.get_max_trx_id() in the rollback segment header pages. On startup, we will simply pick up the maximum value. This page format change will be identified by repurposing an existing field TRX_RSEG_MAX_SIZE and writing it as zero. This change has the convenient side effect that after a downgrade to an older version of MariaDB and MySQL, no transactions can be created. On transaction commit, we will still write some binlog and Galera WSREP XID information to the TRX_SYS page. If these features are disabled, the TRX_SYS page will not be accessed at all outside server startup or undo log tablespace truncation. |
| Comments |
| Comment by Marko Mäkelä [ 2018-01-30 ] | |||||||||||||||||||||||
|
An initial set of patches is available at bb-10.3-armed. | |||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-01-31 ] | |||||||||||||||||||||||
|
Pushed to 10.3. Buildbot showed one related test failure, which I repeated locally:
The fix was to restore some code that I did have at some point of the development but had inadvertently removed:
In the above output, the message InnoDB: Rollback of trx with id 0 completed is unrelated to my changes (I tested with an earlier revision). It should be fixed to disclose the actual transaction ID. | |||||||||||||||||||||||
| Comment by Marko Mäkelä [ 2018-01-31 ] | |||||||||||||||||||||||
|
Filed and fixed: |