mariadb/storage/xtradb
Marko Mäkelä ff16609374 MDEV-12674 Innodb_row_lock_current_waits has overflow
There is a race condition related to the variable
srv_stats.n_lock_wait_current_count, which is only
incremented and decremented by the function lock_wait_suspend_thread(),

The incrementing is protected by lock_sys->wait_mutex, but the
decrementing does not appear to be protected by anything.
This mismatch could allow the counter to be corrupted when a
transactional InnoDB table or record lock wait is terminating
roughly at the same time with the start of a wait on a
(possibly different) lock.

ib_counter_t: Remove some unused methods. Prevent instantiation for N=1.
Add an inc() method that takes a slot index as a parameter.

single_indexer_t: Remove.

simple_counter<typename Type, bool atomic=false>: A new counter wrapper.
Optionally use atomic memory operations for modifying the counter.
Aligned to the cache line size.

lsn_ctr_1_t, ulint_ctr_1_t, int64_ctr_1_t: Define as simple_counter<Type>.
These counters are either only incremented (and we do not care about
losing some increment operations), or the increment/decrement operations
are protected by some mutex.

srv_stats_t::os_log_pending_writes: Document that the number is protected
by log_sys->mutex.

srv_stats_t::n_lock_wait_current_count: Use simple_counter<ulint, true>,
that is, atomic inc() and dec() operations.

lock_wait_suspend_thread(): Release the mutexes before incrementing
the counters. Avoid acquiring the lock mutex if the lock wait has
already been resolved. Atomically increment and decrement
srv_stats.n_lock_wait_current_count.

row_insert_for_mysql(), row_update_for_mysql(),
row_update_cascade_for_mysql(): Use the inc() method with the trx->id
as the slot index. This is a non-functional change, just using
inc() instead of add(1).

buf_LRU_get_free_block(): Replace the method add(index, n) with inc().
There is no slot index in the simple_counter.
2017-05-12 12:24:53 +03:00
..
api Merge branch 'merge-xtradb-5.6' into 10.0 2015-10-09 18:16:27 +02:00
btr Windows : Fix compiling with VS2013 2017-04-03 15:18:46 +00:00
buf MDEV-12674 Innodb_row_lock_current_waits has overflow 2017-05-12 12:24:53 +03:00
data 5.6.31-77.0 2016-08-10 19:24:58 +02:00
dict Merge branch 'merge-xtradb-5.6' into 10.0 2017-03-05 00:59:57 +02:00
dyn Merge branch '5.5' into 10.0 2017-03-03 01:37:54 +02:00
eval move to storage/xtradb 2015-05-04 19:15:28 +02:00
fil MDEV-11520: Retry posix_fallocate() after EINTR. 2017-03-03 12:03:33 +02:00
fsp Merge branch 'merge-xtradb-5.6' into 10.0 2017-03-05 00:59:57 +02:00
fts Merge branch 'merge-xtradb-5.6' into 10.0 2017-03-05 00:59:57 +02:00
fut move to storage/xtradb 2015-05-04 19:15:28 +02:00
ha 5.6.30-76.3 2016-06-21 14:20:09 +02:00
handler Import two ALTER TABLE…ALGORITHM=INPLACE tests from MySQL 5.6. 2017-04-05 14:46:35 +03:00
ibuf Merge branch 'merge/merge-xtradb-5.6' into 10.0 2016-09-27 18:58:57 +02:00
include MDEV-12674 Innodb_row_lock_current_waits has overflow 2017-05-12 12:24:53 +03:00
lock MDEV-12674 Innodb_row_lock_current_waits has overflow 2017-05-12 12:24:53 +03:00
log MDEV-12488 Remove type mismatch in InnoDB printf-like calls 2017-04-21 12:06:29 +03:00
mach 5.6.35-80.0 2017-03-04 20:50:02 +02:00
mem 5.6.31-77.0 2016-08-10 19:24:58 +02:00
mtr Merge branch '5.5' into 10.0 2017-03-03 01:37:54 +02:00
mysql-test/storage_engine Changes in storage_engine test suite: 2014-09-15 20:33:11 +04:00
os Follow-up to MDEV-12534: Fix warnings on 32-bit systems 2017-04-21 16:22:46 +03:00
page 5.6.35-80.0 2017-03-04 20:50:02 +02:00
pars Merge branch 'merge/merge-xtradb-5.6' into 10.0 2016-08-10 19:55:45 +02:00
que 5.6.24-72.2 2015-06-16 11:04:40 +02:00
read move to storage/xtradb 2015-05-04 19:15:28 +02:00
rem Merge branch 'merge-xtradb-5.6' into 10.0 2017-03-05 00:59:57 +02:00
row MDEV-12674 Innodb_row_lock_current_waits has overflow 2017-05-12 12:24:53 +03:00
srv Follow-up to MDEV-12534: Fix warnings on 32-bit systems 2017-04-21 16:22:46 +03:00
sync MDEV-12534 Use atomic operations whenever available 2017-04-20 16:29:12 +03:00
trx MDEV-12091 Shutdown fails to wait for rollback of recovered transactions to finish 2017-03-10 18:54:29 +02:00
usr move to storage/xtradb 2015-05-04 19:15:28 +02:00
ut MDEV-9276: MySQL Bug #78754: FK definitions missing from SHOW CREATE TABLE in "innodb_read_only" mode 2015-12-14 22:10:37 +02:00
CMakeLists.txt Merge branch 'merge/merge-xtradb-5.6' into 10.0 2015-12-13 16:23:02 +01:00
COPYING.Google move to storage/xtradb 2015-05-04 19:15:28 +02:00
COPYING.Percona move to storage/xtradb 2015-05-04 19:15:28 +02:00
Doxyfile move to storage/xtradb 2015-05-04 19:15:28 +02:00
ha_innodb.def move to storage/xtradb 2015-05-04 19:15:28 +02:00