[MDEV-24271] rw_lock::read_lock_yield() may cause writer starvation Created: 2020-11-24  Updated: 2020-11-24  Resolved: 2020-11-24

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.5.4
Fix Version/s: 10.5.9

Type: Bug Priority: Major
Reporter: Marko Mäkelä Assignee: Marko Mäkelä
Resolution: Fixed Votes: 0
Labels: performance

Issue Links:
Blocks
blocks MDEV-24167 InnoDB unnecessarily uses complex rw-... Closed
Problem/Incident
is caused by MDEV-22871 Contention on the buf_pool.page_hash Closed

 Description   

During the testing of MDEV-24167, it was noticed that the optimistic rw_lock::read_trylock() approach of using fetch_add(1) and then backing off with fetch_sub(1) will cause starvation of a write lock request. This was more prominent when running under rr replay, but it could occur also otherwise.

It is better to remove rw_lock::read_lock_yield() and use a compare-and-exchange loop for incrementing the lock word during shared lock acquisition. That seems to be the common practice.

No actual hangs have been observed in 10.5, because before MDEV-24167, the rw_lock is never used in connection with any blocking system calls.


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