[MDEV-9873] Do not allocate trx id for read-only transactions Created: 2016-04-06 Updated: 2016-10-12 Resolved: 2016-10-12 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - InnoDB, Storage Engine - XtraDB |
| Fix Version/s: | N/A |
| Type: | Task | Priority: | Major |
| Reporter: | Daniel Black | Assignee: | Daniel Black |
| Resolution: | Won't Fix | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||
| Description |
|
In The top calls on high CPU for mutex_spin_wait, _raw_spin_lock(kernel), ut_delay are all due to a single global lock trx_sys->mutex. All these go back to the mutex use in:
Every read only select query hits this global mutex 3 times. The first two are called from row_search_for_mysql and the trx_commit_low is the clean up of JOIN::optimize_inner within the same SELECT handler. trx_start_low needs the mutex for trx_sys_get_new_trx_id() and addition on trx_sys->ro_trx_list (or trx_sys->rw_trx_list) and trx_reserve_descriptor read_view_open_now(,_low) needs the lock for trx_find_descriptor and for inserting into trx_sys->view_list. This is called shortly via trx_assign_read_view after trx_start_if_not_started(ends up in trx_start_low) in the Phase 3 in row_search_for_mysql. trx_commit_low needs the mutex for removing from the above lists and also from trx->global_read_view. It might be possible to group trx_start_low and read_view_open_now update the same mutex. MySQL-5.7 has mitigated this with http://dev.mysql.com/worklog/task/?id=6047 It has fairly invasive patches like https://github.com/mysql/mysql-server/commit/ed460aae81f9897984157bfe7759075182efb2b7 I'll attempt to do this porting. |
| Comments |
| Comment by Daniel Black [ 2016-10-12 ] |
|
Already ported in 10.2. Don't have time to do a 10.1 version and it would be too invasive anyway. |