MDEV-10813 - Clean-up InnoDB atomics, memory barriers and mutexes

Clean-up periodic mutex/rwlock waiters wake up. This was a hack needed to
workaround broken mutexes/rwlocks implementation. We must have sane
implementations now and don't need these anymore: release thread is
guaranteed to wake up waiters.

Removed redundant ifdef that has equivalent code in both branches.

Removed os0atomic.h and os0atomic.ic: not used anymore.

Clean-up unused cmake checks.
This commit is contained in:
Sergey Vojtovich 2016-09-14 15:12:54 +04:00
commit 2b47f8ff03
11 changed files with 0 additions and 1079 deletions

View file

@ -961,81 +961,6 @@ sync_array_detect_deadlock(
}
#endif /* UNIV_DEBUG */
/******************************************************************//**
Determines if we can wake up the thread waiting for a sempahore. */
static
bool
sync_arr_cell_can_wake_up(
/*======================*/
sync_cell_t* cell) /*!< in: cell to search */
{
rw_lock_t* lock;
switch (cell->request_type) {
WaitMutex* mutex;
BlockWaitMutex* bpmutex;
case SYNC_MUTEX:
mutex = cell->latch.mutex;
os_rmb;
if (mutex->state() == MUTEX_STATE_UNLOCKED) {
return(true);
}
break;
case SYNC_BUF_BLOCK:
bpmutex = cell->latch.bpmutex;
os_rmb;
if (bpmutex->state() == MUTEX_STATE_UNLOCKED) {
return(true);
}
break;
case RW_LOCK_X:
case RW_LOCK_SX:
lock = cell->latch.lock;
os_rmb;
if (lock->lock_word > X_LOCK_HALF_DECR) {
/* Either unlocked or only read locked. */
return(true);
}
break;
case RW_LOCK_X_WAIT:
lock = cell->latch.lock;
/* lock_word == 0 means all readers or sx have left */
os_rmb;
if (lock->lock_word == 0) {
return(true);
}
break;
case RW_LOCK_S:
lock = cell->latch.lock;
/* lock_word > 0 means no writer or reserved writer */
os_rmb;
if (lock->lock_word > 0) {
return(true);
}
}
return(false);
}
/**********************************************************************//**
Increments the signalled count. */
void
@ -1045,58 +970,6 @@ sync_array_object_signalled()
++sg_count;
}
/**********************************************************************//**
If the wakeup algorithm does not work perfectly at semaphore relases,
this function will do the waking (see the comment in mutex_exit). This
function should be called about every 1 second in the server.
Note that there's a race condition between this thread and mutex_exit
changing the lock_word and calling signal_object, so sometimes this finds
threads to wake up even when nothing has gone wrong. */
static
void
sync_array_wake_threads_if_sema_free_low(
/*=====================================*/
sync_array_t* arr) /* in/out: wait array */
{
sync_array_enter(arr);
for (ulint i = 0; i < arr->next_free_slot; ++i) {
sync_cell_t* cell;
cell = sync_array_get_nth_cell(arr, i);
if (cell->latch.mutex != 0 && sync_arr_cell_can_wake_up(cell)) {
os_event_t event;
event = sync_cell_get_event(cell);
os_event_set(event);
}
}
sync_array_exit(arr);
}
/**********************************************************************//**
If the wakeup algorithm does not work perfectly at semaphore relases,
this function will do the waking (see the comment in mutex_exit). This
function should be called about every 1 second in the server.
Note that there's a race condition between this thread and mutex_exit
changing the lock_word and calling signal_object, so sometimes this finds
threads to wake up even when nothing has gone wrong. */
void
sync_arr_wake_threads_if_sema_free(void)
/*====================================*/
{
for (ulint i = 0; i < sync_array_size; ++i) {
sync_array_wake_threads_if_sema_free_low(
sync_wait_array[i]);
}
}
/**********************************************************************//**
Prints warnings of long semaphore waits to stderr.
@return TRUE if fatal semaphore wait threshold was exceeded */