Commit 3e5c7d0c authored by Vadim Tkachenko's avatar Vadim Tkachenko

sync with rev43

parent 4ba507ef
...@@ -2544,6 +2544,8 @@ i_s_innodb_rseg_fill( ...@@ -2544,6 +2544,8 @@ i_s_innodb_rseg_fill(
int status = 0; int status = 0;
trx_rseg_t* rseg; trx_rseg_t* rseg;
DBUG_ENTER("i_s_innodb_rseg_fill");
/* deny access to non-superusers */ /* deny access to non-superusers */
if (check_global_access(thd, PROCESS_ACL)) { if (check_global_access(thd, PROCESS_ACL)) {
......
...@@ -352,6 +352,13 @@ rw_lock_s_lock_spin( ...@@ -352,6 +352,13 @@ rw_lock_s_lock_spin(
return; /* Success */ return; /* Success */
} }
} }
/* If wait_ex_waiter stalls, wakes it. */
if (lock->wait_ex_waiters && lock->lock_word == RW_LOCK_BIAS) {
rw_lock_set_wx_waiters(lock, 0);
os_event_set(lock->wait_ex_event);
sync_array_object_signalled(sync_primary_wait_array);
}
#else #else
mutex_exit(rw_lock_get_mutex(lock)); mutex_exit(rw_lock_get_mutex(lock));
#endif #endif
...@@ -447,32 +454,32 @@ rw_lock_x_lock_low( ...@@ -447,32 +454,32 @@ rw_lock_x_lock_low(
switch(rw_lock_get_writer(lock)) { switch(rw_lock_get_writer(lock)) {
case RW_LOCK_WAIT_EX: case RW_LOCK_WAIT_EX:
/* have right to try x-lock */ /* have right to try x-lock */
if (lock->lock_word == RW_LOCK_BIAS) { retry_x_lock:
/* try x-lock */ /* try x-lock */
if(__sync_sub_and_fetch(&(lock->lock_word), if(__sync_sub_and_fetch(&(lock->lock_word),
RW_LOCK_BIAS) == 0) { RW_LOCK_BIAS) == 0) {
/* success */ /* success */
lock->pass = pass; lock->pass = pass;
lock->writer_is_wait_ex = FALSE; lock->writer_is_wait_ex = FALSE;
__sync_fetch_and_add(&(lock->writer_count),1); __sync_fetch_and_add(&(lock->writer_count),1);
#ifdef UNIV_SYNC_DEBUG #ifdef UNIV_SYNC_DEBUG
rw_lock_remove_debug_info(lock, pass, RW_LOCK_WAIT_EX); rw_lock_remove_debug_info(lock, pass, RW_LOCK_WAIT_EX);
rw_lock_add_debug_info(lock, pass, RW_LOCK_EX, rw_lock_add_debug_info(lock, pass, RW_LOCK_EX,
file_name, line); file_name, line);
#endif #endif
lock->last_x_file_name = file_name; lock->last_x_file_name = file_name;
lock->last_x_line = line; lock->last_x_line = line;
/* Locking succeeded, we may return */ /* Locking succeeded, we may return */
return(RW_LOCK_EX); return(RW_LOCK_EX);
} else { } else if(__sync_fetch_and_add(&(lock->lock_word),
/* fail */ RW_LOCK_BIAS) == 0) {
__sync_fetch_and_add(&(lock->lock_word), /* retry x-lock */
RW_LOCK_BIAS); goto retry_x_lock;
}
} }
/* There are readers, we have to wait */ /* There are readers, we have to wait */
return(RW_LOCK_WAIT_EX); return(RW_LOCK_WAIT_EX);
......
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