Remove sync_arr_wake_threads_if_sema_free hack

Bug #1521564 reported by Laurynas Biveinis on 2015-12-01
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MySQL Server
Unknown
Unknown
Percona Server moved to https://jira.percona.com/projects/PS
Status tracked in 5.7
5.5
Triaged
Wishlist
Unassigned
5.6
Triaged
Wishlist
Unassigned
5.7
Fix Released
Wishlist
Laurynas Biveinis

Bug Description

Copy of https://bugs.mysql.com/bug.php?id=79477:

[1 Dec 10:36] Laurynas Biveinis
Description:
InnoDB error monitor thread has code to wake up missed mutex/rwlock waiters. This code is commented to be necessary in case of lock word reset not being ordered with waiters flag read properly:

  /* A problem: we assume that mutex_reset_lock word
  is a memory barrier, that is when we read the waiters
  field next, the read must be serialized in memory
  after the reset. A speculative processor might
  perform the read first, which could leave a waiting
  thread hanging indefinitely. */

This code should go away if event-based mutex stays, because:
- all the barriers can be implemented properly using proper means such as compiler intrincs;
- in case the scenario being protected against happens and this thread saves the day, it's still possibly a ~0.5 second stall;
- the scenario might happen when the thread is not running (--innodb-read-only, server startup);
- the scenario might happen on e.g. log sys mutex, and the error monitor thread itself will block on that mutex at the start of the loop (BTW that code for checking that LSN is not going backwards could be removed as well);
- less code.

How to repeat:
Code analysis

Suggested fix:
Remove sync_arr_wake_threads_if_sema_free(), sync_arr_cell_can_wake_up(), sync_array_wake_threads_if_sema_free_low(). Review that the mutex lock_word / waiters are properly synchronised by barriers.

tags: added: innodb upstream

Percona now uses JIRA for bug reports so this bug report is migrated to: https://jira.percona.com/browse/PS-2475

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.