Commit 8389b45b authored by Sergey Vojtovich's avatar Sergey Vojtovich

MDEV-15059 - Misc small InnoDB scalability fixes

Moved mutex locking inside lock_rec_lock().
Moved monitor increment out of mutex.
Moved assertions that don't require protection out of mutex.
Removed duplicate assertions.
Moved duplicate debug injections into lock_rec_lock().
Let monitor updates use relaxed memory order.
Return directly without maintaining variables in lock_rec_lock_slow().
Moved lock_rec_lock_fast() body into lock_rec_lock(): saves at least one
trx_mutex_enter(), one switch() plus some code was moved out of mutex.
parent ce047900
......@@ -745,7 +745,7 @@ class RecLock {
#ifdef WITH_WSREP
,lock_t* c_lock = NULL
#endif /* WITH_WSREP */
);
) const;
/**
Check of the lock is on m_rec_id.
......@@ -838,7 +838,7 @@ class RecLock {
@param[in,out] lock Newly created record lock to add to the
rec hash and the transaction lock list
@param[in] add_to_hash If the lock should be added to the hash table */
void lock_add(lock_t* lock, bool add_to_hash);
void lock_add(lock_t* lock, bool add_to_hash) const;
/**
Check and resolve any deadlocks
......
......@@ -608,8 +608,9 @@ Use MONITOR_INC if appropriate mutex protection exists.
#define MONITOR_ATOMIC_INC_LOW(monitor, enabled) \
if (enabled) { \
ib_uint64_t value; \
value = my_atomic_add64( \
(int64*) &MONITOR_VALUE(monitor), 1) + 1; \
value = my_atomic_add64_explicit( \
(int64*) &MONITOR_VALUE(monitor), 1, \
MY_MEMORY_ORDER_RELAXED) + 1; \
/* Note: This is not 100% accurate because of the \
inherent race, we ignore it due to performance. */ \
if (value > (ib_uint64_t) MONITOR_MAX_VALUE(monitor)) { \
......@@ -624,8 +625,9 @@ Use MONITOR_DEC if appropriate mutex protection exists.
#define MONITOR_ATOMIC_DEC_LOW(monitor, enabled) \
if (enabled) { \
ib_uint64_t value; \
value = my_atomic_add64( \
(int64*) &MONITOR_VALUE(monitor), -1) - 1; \
value = my_atomic_add64_explicit( \
(int64*) &MONITOR_VALUE(monitor), -1, \
MY_MEMORY_ORDER_RELAXED) - 1; \
/* Note: This is not 100% accurate because of the \
inherent race, we ignore it due to performance. */ \
if (value < (ib_uint64_t) MONITOR_MIN_VALUE(monitor)) { \
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment