[MDEV-22930] Unnecessary contention on rw_lock_list_mutex in ibuf_dummy_index_create() Created: 2020-06-18  Updated: 2023-08-10  Resolved: 2020-07-08

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.5.5

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Eugene Kosov (Inactive)
Resolution: Fixed Votes: 1
Labels: performance

Attachments: PNG File 2020-06-18 (2).png     PNG File 2020-06-18 (4).png    
Issue Links:
Relates
relates to MDEV-11634 Improve the InnoDB change buffer Closed
relates to MDEV-31886 Server fails to shut down storage eng... Confirmed

 Description   

The function ibuf_dummy_index_create() is creating dummy dict_index_t objects for applying buffered changes. The rw_lock_create() call in this function should be totally unnecessary, because there should be no need to access dict_index_t::lock in those dummy objects at all. We should avoid registering the dummy objects in any global lists.

When MDEV-11634 implements a more compact change buffer format, that entire code should be removed, or only kept for the purpose of upgrading.



 Comments   
Comment by Vladislav Vaintroub [ 2020-06-18 ]

https://jira.mariadb.org/secure/attachment/52240/2020-06-18%20%282%29.png shows profile snippet of a memory-constrained benchmark (update_index) for which doublewrite was disabled, but change buffer was on.

rw_lock_create_func()/rw_lock_free_func() account for more than 2/3 of all mutex contentions, and more than 10% of CPU samples.

Comment by Vladislav Vaintroub [ 2020-06-18 ]

Also, CreateTracker::register_latch is very expensive , see https://jira.mariadb.org/secure/attachment/52241/2020-06-18%20%284%29.png

This comes from mutex_create(LATCH_ID_ZIP_PAD_MUTEX, &index->zip_pad.mutex);

Comment by Marko Mäkelä [ 2020-06-18 ]

I do not think that the dummy index object should really need any synchronization primitives. It should only be used in rec_get_offsets() calculations when applying the buffered changes to the secondary index leaf page.

Generated at Thu Feb 08 09:18:33 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.