Merge lp:~laurynas-biveinis/percona-server/bug1236696 into lp:percona-server/5.6
Status: | Merged |
---|---|
Approved by: | Alexey Kopytov |
Approved revision: | no longer in the source branch. |
Merged at revision: | 483 |
Proposed branch: | lp:~laurynas-biveinis/percona-server/bug1236696 |
Merge into: | lp:percona-server/5.6 |
Diff against target: |
345 lines (+82/-49) 7 files modified
Percona-Server/storage/innobase/include/sync0rw.h (+4/-4) Percona-Server/storage/innobase/include/sync0rw.ic (+7/-25) Percona-Server/storage/innobase/include/sync0sync.h (+5/-6) Percona-Server/storage/innobase/include/sync0sync.ic (+0/-1) Percona-Server/storage/innobase/sync/sync0arr.cc (+3/-3) Percona-Server/storage/innobase/sync/sync0rw.cc (+45/-8) Percona-Server/storage/innobase/sync/sync0sync.cc (+18/-2) |
To merge this branch: | bzr merge lp:~laurynas-biveinis/percona-server/bug1236696 |
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexey Kopytov (community) | Approve | ||
Laurynas Biveinis | Pending | ||
Vlad Lesin | g2 | Pending | |
Review via email: mp+191207@code.launchpad.net |
This proposal supersedes a proposal from 2013-10-09.
Description of the change
3rd MP:
- replaced waiters counts reset to 0 by the unlocking thread with decrements by the woken up waiters themselves.
- fixed bug 1240044.
http://
2nd MP:
fixed (spurious) compiler warnings
http://
1st MP:
http://
Fix bug 1236696.
The issue is a number of race conditions between successful priority
mutex or RW lock locks that happen after having set the waiters flag
(the last locking attempts before waiting), and unlocks.
If a lock (both priority mutex, or a priority RW lock) is successfully
locked this way, the corresponding waiters flag remains set, although
other waiters for this flag do not necessarily exist. Then on unlock,
the flag being set causes the corresponding event to be set (which may
have no waiters), and prevent lower-priority waiters from waking up,
leaving the lock unlocked but its waiters sleeping.
Fix by making ib_prio_
prio_rw_
prio_rw_
count instead of 0/1 flag. The counts are atomically incremented by
1 where the flag used to be set to 1, and atomically decremented if
locking after setting the waiters flag has succeeded, instead of doing
nothing. Also fix prio_rw_
handling. Since there can be at most one wait_ex waiter, there is no
need to use atomic inc and dec operations, and it is enough to simply
reset the flag on successful lock. Assert that a high priority
wait_ex waiter does not exist before an X unlock.
Also adjust rw_lock_
for waiters presence as this function should return only 0 or 1.
[ 78%] Building CXX object storage/ innobase/ CMakeFiles/ innobase. dir/trx/ trx0sys. cc.o alexey. s/repo/ trunk-free- backoff. clean/Percona- Server/ storage/ innobase/ sync/sync0rw. cc: In function ‘void rw_lock_ s_lock_ spin(void* , ulint, bool, bool, const char*, ulint)’: alexey. s/repo/ trunk-free- backoff. clean/Percona- Server/ storage/ innobase/ sync/sync0rw. cc:492: warning: ‘prio_rw_lock’ may be used uninitialized in this function innobase/ CMakeFiles/ innobase. dir/trx/ trx0trx. cc.o perfschema/ unittest/ CMakeFiles/ pfs-t.dir/ pfs-t.cc. o perfschema/ unittest/ CMakeFiles/ pfs_account- oom-t.dir/ pfs_account- oom-t.cc. o innobase/ CMakeFiles/ innobase. dir/trx/ trx0undo. cc.o alexey. s/repo/ trunk-free- backoff. clean/Percona- Server/ storage/ innobase/ sync/sync0rw. cc: In function ‘void rw_lock_ x_lock_ func(prio_ rw_lock_ t*, ulint, const char*, ulint)’: alexey. s/repo/ trunk-free- backoff. clean/Percona- Server/ storage/ innobase/ sync/sync0rw. cc:756: warning: ‘prio_lock’ may be used uninitialized in this function alexey. s/repo/ trunk-free- backoff. clean/Percona- Server/ storage/ innobase/ sync/sync0rw. cc:756: note: ‘prio_lock’ was declared here alexey. s/repo/ trunk-free- backoff. clean/Percona- Server/ storage/ innobase/ sync/sync0sync. cc: In function ‘void mutex_spin_ wait(void* , bool, const char*, ulint)’: alexey. s/repo/ trunk-free- backoff. clean/Percona- Server/ storage/ innobase/ sync/sync0sync. cc:554: warning: ‘prio_mutex’ may be used uninitialized in this function innobase/ CMakeFiles/ innobase. dir/usr/ usr0sess. cc.o alexey. s/repo/ trunk-free- backoff. clean/Percona- Server/ storage/ innobase/ sync/sync0rw. cc: In function ‘void rw_lock_ x_lock_ func(rw_ lock_t* , ulint, const char*, ulint, bool, bool)’: alexey. s/repo/ trunk-free- backoff. clean/Percona- Server/ storage/ innobase/ sync/sync0rw. cc:756: warning: ‘prio_lock’ may be used uninitialized in this function
/data/bench/
/data/bench/
[ 78%] [ 78%] Building CXX object storage/
Building CXX object storage/
[ 78%] Building CXX object storage/
[ 78%] Building CXX object storage/
/data/bench/
/data/bench/
/data/bench/
/data/bench/
/data/bench/
[ 78%] Building CXX object storage/
/data/bench/
/data/bench/