mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 20:12:31 +01:00
Cleanup: Replace mysql_cond_t with pthread_cond_t
Let us avoid the memory overhead and the dead duplicated code for each use of never-instrumented condition variables in InnoDB.
This commit is contained in:
parent
520c76bfb4
commit
786bc312b8
13 changed files with 102 additions and 100 deletions
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (C) 2012, 2014 Facebook, Inc. All Rights Reserved.
|
||||
Copyright (C) 2014, 2020, MariaDB Corporation.
|
||||
Copyright (C) 2014, 2021, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -56,11 +56,11 @@ struct btr_defragment_item_t
|
|||
/** persistent cursor where btr_defragment_n_pages should start */
|
||||
btr_pcur_t * const pcur;
|
||||
/** completion signal */
|
||||
mysql_cond_t *cond;
|
||||
pthread_cond_t *cond;
|
||||
/** timestamp of last time this index is processed by defragment thread */
|
||||
ulonglong last_processed= 0;
|
||||
|
||||
btr_defragment_item_t(btr_pcur_t *pcur, mysql_cond_t *cond)
|
||||
btr_defragment_item_t(btr_pcur_t *pcur, pthread_cond_t *cond)
|
||||
: pcur(pcur), cond(cond) {}
|
||||
};
|
||||
|
||||
|
@ -126,7 +126,7 @@ btr_defragment_shutdown()
|
|||
btr_defragment_item_t* item = *iter;
|
||||
iter = btr_defragment_wq.erase(iter);
|
||||
if (item->cond) {
|
||||
mysql_cond_signal(item->cond);
|
||||
pthread_cond_signal(item->cond);
|
||||
}
|
||||
}
|
||||
mysql_mutex_unlock(&btr_defragment_mutex);
|
||||
|
@ -169,8 +169,8 @@ btr_defragment_find_index(
|
|||
bool btr_defragment_add_index(btr_pcur_t *pcur, THD *thd)
|
||||
{
|
||||
dict_stats_empty_defrag_summary(pcur->btr_cur.index);
|
||||
mysql_cond_t cond;
|
||||
mysql_cond_init(0, &cond, nullptr);
|
||||
pthread_cond_t cond;
|
||||
pthread_cond_init(&cond, nullptr);
|
||||
btr_defragment_item_t item(pcur, &cond);
|
||||
mysql_mutex_lock(&btr_defragment_mutex);
|
||||
btr_defragment_wq.push_back(&item);
|
||||
|
@ -182,7 +182,7 @@ bool btr_defragment_add_index(btr_pcur_t *pcur, THD *thd)
|
|||
{
|
||||
timespec abstime;
|
||||
set_timespec(abstime, 1);
|
||||
if (!mysql_cond_timedwait(&cond, &btr_defragment_mutex, &abstime))
|
||||
if (!my_cond_timedwait(&cond, &btr_defragment_mutex.m_mutex, &abstime))
|
||||
break;
|
||||
if (thd_killed(thd))
|
||||
{
|
||||
|
@ -192,7 +192,7 @@ bool btr_defragment_add_index(btr_pcur_t *pcur, THD *thd)
|
|||
}
|
||||
}
|
||||
|
||||
mysql_cond_destroy(&cond);
|
||||
pthread_cond_destroy(&cond);
|
||||
mysql_mutex_unlock(&btr_defragment_mutex);
|
||||
return interrupted;
|
||||
}
|
||||
|
@ -210,7 +210,7 @@ btr_defragment_remove_table(
|
|||
{
|
||||
if (item->cond && table == item->pcur->btr_cur.index->table)
|
||||
{
|
||||
mysql_cond_signal(item->cond);
|
||||
pthread_cond_signal(item->cond);
|
||||
item->cond= nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -704,7 +704,7 @@ processed:
|
|||
|
||||
mysql_mutex_lock(&btr_defragment_mutex);
|
||||
if (item->cond) {
|
||||
mysql_cond_signal(item->cond);
|
||||
pthread_cond_signal(item->cond);
|
||||
}
|
||||
goto processed;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*****************************************************************************
|
||||
Copyright (C) 2013, 2015, Google Inc. All Rights Reserved.
|
||||
Copyright (c) 2014, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2014, 2021, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -56,14 +56,14 @@ UNIV_INTERN uint srv_n_fil_crypt_threads_started = 0;
|
|||
UNIV_INTERN uint srv_fil_crypt_rotate_key_age;
|
||||
|
||||
/** Condition variable for srv_n_fil_crypt_threads_started */
|
||||
static mysql_cond_t fil_crypt_cond;
|
||||
static pthread_cond_t fil_crypt_cond;
|
||||
|
||||
/** Condition variable to to signal the key rotation threads */
|
||||
static mysql_cond_t fil_crypt_threads_cond;
|
||||
static pthread_cond_t fil_crypt_threads_cond;
|
||||
|
||||
/** Condition variable for interrupting sleeptime_ms sleep at the end
|
||||
of fil_crypt_rotate_page() */
|
||||
static mysql_cond_t fil_crypt_throttle_sleep_cond;
|
||||
static pthread_cond_t fil_crypt_throttle_sleep_cond;
|
||||
|
||||
/** Mutex for key rotation threads. Acquired before fil_system.mutex! */
|
||||
static mysql_mutex_t fil_crypt_threads_mutex;
|
||||
|
@ -87,9 +87,9 @@ void fil_crypt_threads_signal(bool broadcast)
|
|||
{
|
||||
mysql_mutex_lock(&fil_crypt_threads_mutex);
|
||||
if (broadcast)
|
||||
mysql_cond_broadcast(&fil_crypt_threads_cond);
|
||||
pthread_cond_broadcast(&fil_crypt_threads_cond);
|
||||
else
|
||||
mysql_cond_signal(&fil_crypt_threads_cond);
|
||||
pthread_cond_signal(&fil_crypt_threads_cond);
|
||||
mysql_mutex_unlock(&fil_crypt_threads_mutex);
|
||||
}
|
||||
|
||||
|
@ -112,7 +112,7 @@ fil_crypt_needs_rotation(
|
|||
Init space crypt */
|
||||
void fil_space_crypt_init()
|
||||
{
|
||||
mysql_cond_init(0, &fil_crypt_throttle_sleep_cond, nullptr);
|
||||
pthread_cond_init(&fil_crypt_throttle_sleep_cond, nullptr);
|
||||
mysql_mutex_init(0, &crypt_stat_mutex, nullptr);
|
||||
memset(&crypt_stat, 0, sizeof crypt_stat);
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ void fil_space_crypt_init()
|
|||
Cleanup space crypt */
|
||||
void fil_space_crypt_cleanup()
|
||||
{
|
||||
mysql_cond_destroy(&fil_crypt_throttle_sleep_cond);
|
||||
pthread_cond_destroy(&fil_crypt_throttle_sleep_cond);
|
||||
mysql_mutex_destroy(&crypt_stat_mutex);
|
||||
}
|
||||
|
||||
|
@ -1281,8 +1281,8 @@ static bool fil_crypt_alloc_iops(rotate_thread_t *state)
|
|||
|
||||
if (n_fil_crypt_iops_allocated >= srv_n_fil_crypt_iops) {
|
||||
wait:
|
||||
mysql_cond_wait(&fil_crypt_threads_cond,
|
||||
&fil_crypt_threads_mutex);
|
||||
my_cond_wait(&fil_crypt_threads_cond,
|
||||
&fil_crypt_threads_mutex.m_mutex);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -1354,7 +1354,7 @@ static bool fil_crypt_realloc_iops(rotate_thread_t *state)
|
|||
state->allocated_iops = state->estimated_max_iops;
|
||||
ut_ad(n_fil_crypt_iops_allocated >= extra);
|
||||
n_fil_crypt_iops_allocated -= extra;
|
||||
mysql_cond_broadcast(&fil_crypt_threads_cond);
|
||||
pthread_cond_broadcast(&fil_crypt_threads_cond);
|
||||
} else if (srv_n_fil_crypt_iops > n_fil_crypt_iops_allocated) {
|
||||
/* there are extra iops free */
|
||||
uint add = srv_n_fil_crypt_iops - n_fil_crypt_iops_allocated;
|
||||
|
@ -1390,7 +1390,7 @@ static void fil_crypt_return_iops(rotate_thread_t *state, bool wake= true)
|
|||
n_fil_crypt_iops_allocated-= iops;
|
||||
state->allocated_iops= 0;
|
||||
if (wake)
|
||||
mysql_cond_broadcast(&fil_crypt_threads_cond);
|
||||
pthread_cond_broadcast(&fil_crypt_threads_cond);
|
||||
}
|
||||
|
||||
fil_crypt_update_total_stat(state);
|
||||
|
@ -1879,8 +1879,8 @@ fil_crypt_rotate_page(
|
|||
mysql_mutex_lock(&fil_crypt_threads_mutex);
|
||||
timespec abstime;
|
||||
set_timespec_nsec(abstime, 1000000ULL * sleeptime_ms);
|
||||
mysql_cond_timedwait(&fil_crypt_throttle_sleep_cond,
|
||||
&fil_crypt_threads_mutex, &abstime);
|
||||
my_cond_timedwait(&fil_crypt_throttle_sleep_cond,
|
||||
&fil_crypt_threads_mutex.m_mutex, &abstime);
|
||||
mysql_mutex_unlock(&fil_crypt_threads_mutex);
|
||||
}
|
||||
}
|
||||
|
@ -2057,7 +2057,7 @@ static os_thread_ret_t DECLARE_THREAD(fil_crypt_thread)(void*)
|
|||
{
|
||||
mysql_mutex_lock(&fil_crypt_threads_mutex);
|
||||
rotate_thread_t thr(srv_n_fil_crypt_threads_started++);
|
||||
mysql_cond_signal(&fil_crypt_cond); /* signal that we started */
|
||||
pthread_cond_signal(&fil_crypt_cond); /* signal that we started */
|
||||
|
||||
if (!thr.should_shutdown()) {
|
||||
/* if we find a tablespace that is starting, skip over it
|
||||
|
@ -2069,8 +2069,8 @@ wait_for_work:
|
|||
/* wait for key state changes
|
||||
* i.e either new key version of change or
|
||||
* new rotate_key_age */
|
||||
mysql_cond_wait(&fil_crypt_threads_cond,
|
||||
&fil_crypt_threads_mutex);
|
||||
my_cond_wait(&fil_crypt_threads_cond,
|
||||
&fil_crypt_threads_mutex.m_mutex);
|
||||
}
|
||||
|
||||
recheck = false;
|
||||
|
@ -2129,7 +2129,7 @@ wait_for_work:
|
|||
|
||||
fil_crypt_return_iops(&thr);
|
||||
srv_n_fil_crypt_threads_started--;
|
||||
mysql_cond_signal(&fil_crypt_cond); /* signal that we stopped */
|
||||
pthread_cond_signal(&fil_crypt_cond); /* signal that we stopped */
|
||||
mysql_mutex_unlock(&fil_crypt_threads_mutex);
|
||||
|
||||
/* We count the number of threads in os_thread_exit(). A created
|
||||
|
@ -2169,13 +2169,14 @@ fil_crypt_set_thread_cnt(
|
|||
srv_n_fil_crypt_threads = new_cnt;
|
||||
}
|
||||
|
||||
mysql_cond_broadcast(&fil_crypt_threads_cond);
|
||||
pthread_cond_broadcast(&fil_crypt_threads_cond);
|
||||
|
||||
while (srv_n_fil_crypt_threads_started != srv_n_fil_crypt_threads) {
|
||||
mysql_cond_wait(&fil_crypt_cond, &fil_crypt_threads_mutex);
|
||||
my_cond_wait(&fil_crypt_cond,
|
||||
&fil_crypt_threads_mutex.m_mutex);
|
||||
}
|
||||
|
||||
mysql_cond_broadcast(&fil_crypt_threads_cond);
|
||||
pthread_cond_broadcast(&fil_crypt_threads_cond);
|
||||
mysql_mutex_unlock(&fil_crypt_threads_mutex);
|
||||
}
|
||||
|
||||
|
@ -2238,7 +2239,7 @@ void fil_crypt_set_rotate_key_age(uint val)
|
|||
if (val == 0)
|
||||
fil_crypt_rotation_list_fill();
|
||||
mysql_mutex_unlock(&fil_system.mutex);
|
||||
mysql_cond_broadcast(&fil_crypt_threads_cond);
|
||||
pthread_cond_broadcast(&fil_crypt_threads_cond);
|
||||
mysql_mutex_unlock(&fil_crypt_threads_mutex);
|
||||
}
|
||||
|
||||
|
@ -2249,7 +2250,7 @@ void fil_crypt_set_rotation_iops(uint val)
|
|||
{
|
||||
mysql_mutex_lock(&fil_crypt_threads_mutex);
|
||||
srv_n_fil_crypt_iops= val;
|
||||
mysql_cond_broadcast(&fil_crypt_threads_cond);
|
||||
pthread_cond_broadcast(&fil_crypt_threads_cond);
|
||||
mysql_mutex_unlock(&fil_crypt_threads_mutex);
|
||||
}
|
||||
|
||||
|
@ -2268,7 +2269,7 @@ void fil_crypt_set_encrypt_tables(ulong val)
|
|||
|
||||
mysql_mutex_unlock(&fil_system.mutex);
|
||||
|
||||
mysql_cond_broadcast(&fil_crypt_threads_cond);
|
||||
pthread_cond_broadcast(&fil_crypt_threads_cond);
|
||||
mysql_mutex_unlock(&fil_crypt_threads_mutex);
|
||||
}
|
||||
|
||||
|
@ -2277,8 +2278,8 @@ Init threads for key rotation */
|
|||
void fil_crypt_threads_init()
|
||||
{
|
||||
if (!fil_crypt_threads_inited) {
|
||||
mysql_cond_init(0, &fil_crypt_cond, nullptr);
|
||||
mysql_cond_init(0, &fil_crypt_threads_cond, nullptr);
|
||||
pthread_cond_init(&fil_crypt_cond, nullptr);
|
||||
pthread_cond_init(&fil_crypt_threads_cond, nullptr);
|
||||
mysql_mutex_init(0, &fil_crypt_threads_mutex, nullptr);
|
||||
uint cnt = srv_n_fil_crypt_threads;
|
||||
srv_n_fil_crypt_threads = 0;
|
||||
|
@ -2297,8 +2298,8 @@ fil_crypt_threads_cleanup()
|
|||
return;
|
||||
}
|
||||
ut_a(!srv_n_fil_crypt_threads_started);
|
||||
mysql_cond_destroy(&fil_crypt_cond);
|
||||
mysql_cond_destroy(&fil_crypt_threads_cond);
|
||||
pthread_cond_destroy(&fil_crypt_cond);
|
||||
pthread_cond_destroy(&fil_crypt_threads_cond);
|
||||
mysql_mutex_destroy(&fil_crypt_threads_mutex);
|
||||
fil_crypt_threads_inited = false;
|
||||
}
|
||||
|
@ -2332,8 +2333,8 @@ fil_space_crypt_close_tablespace(
|
|||
|
||||
/* wakeup throttle (all) sleepers */
|
||||
mysql_mutex_lock(&fil_crypt_threads_mutex);
|
||||
mysql_cond_broadcast(&fil_crypt_throttle_sleep_cond);
|
||||
mysql_cond_broadcast(&fil_crypt_threads_cond);
|
||||
pthread_cond_broadcast(&fil_crypt_throttle_sleep_cond);
|
||||
pthread_cond_broadcast(&fil_crypt_threads_cond);
|
||||
mysql_mutex_unlock(&fil_crypt_threads_mutex);
|
||||
|
||||
os_thread_sleep(20000);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2011, 2018, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2016, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2016, 2021, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -295,7 +295,7 @@ fts_cache_destroy(fts_cache_t* cache)
|
|||
mysql_mutex_destroy(&cache->init_lock);
|
||||
mysql_mutex_destroy(&cache->deleted_lock);
|
||||
mysql_mutex_destroy(&cache->doc_id_lock);
|
||||
mysql_cond_destroy(&cache->sync->cond);
|
||||
pthread_cond_destroy(&cache->sync->cond);
|
||||
|
||||
if (cache->stopword_info.cached_stopword) {
|
||||
rbt_free(cache->stopword_info.cached_stopword);
|
||||
|
@ -636,7 +636,7 @@ fts_cache_create(
|
|||
mem_heap_zalloc(heap, sizeof(fts_sync_t)));
|
||||
|
||||
cache->sync->table = table;
|
||||
mysql_cond_init(0, &cache->sync->cond, nullptr);
|
||||
pthread_cond_init(&cache->sync->cond, nullptr);
|
||||
|
||||
/* Create the index cache vector that will hold the inverted indexes. */
|
||||
cache->indexes = ib_vector_create(
|
||||
|
@ -3522,9 +3522,9 @@ fts_add_doc_by_id(
|
|||
fts_optimize_request_sync_table(table);
|
||||
mysql_mutex_lock(&cache->lock);
|
||||
if (cache->sync->in_progress)
|
||||
mysql_cond_wait(
|
||||
my_cond_wait(
|
||||
&cache->sync->cond,
|
||||
&cache->lock);
|
||||
&cache->lock.m_mutex);
|
||||
mysql_mutex_unlock(&cache->lock);
|
||||
);
|
||||
|
||||
|
@ -4249,7 +4249,7 @@ fts_sync(
|
|||
return(DB_SUCCESS);
|
||||
}
|
||||
do {
|
||||
mysql_cond_wait(&sync->cond, &cache->lock);
|
||||
my_cond_wait(&sync->cond, &cache->lock.m_mutex);
|
||||
} while (sync->in_progress);
|
||||
}
|
||||
|
||||
|
@ -4320,7 +4320,7 @@ end_sync:
|
|||
ut_ad(sync->in_progress);
|
||||
sync->interrupted = false;
|
||||
sync->in_progress = false;
|
||||
mysql_cond_broadcast(&sync->cond);
|
||||
pthread_cond_broadcast(&sync->cond);
|
||||
mysql_mutex_unlock(&cache->lock);
|
||||
|
||||
/* We need to check whether an optimize is required, for that
|
||||
|
|
|
@ -60,7 +60,7 @@ static bool fts_opt_start_shutdown = false;
|
|||
|
||||
/** Condition variable for shutting down the optimize thread.
|
||||
Protected by fts_optimize_wq->mutex. */
|
||||
static mysql_cond_t fts_opt_shutdown_cond;
|
||||
static pthread_cond_t fts_opt_shutdown_cond;
|
||||
|
||||
/** Initial size of nodes in fts_word_t. */
|
||||
static const ulint FTS_WORD_NODES_INIT_SIZE = 64;
|
||||
|
@ -201,7 +201,7 @@ struct fts_msg_del_t
|
|||
/** the table to remove */
|
||||
dict_table_t *table;
|
||||
/** condition variable to signal message consumption */
|
||||
mysql_cond_t *cond;
|
||||
pthread_cond_t *cond;
|
||||
};
|
||||
|
||||
/** The FTS optimize message work queue message type. */
|
||||
|
@ -2593,13 +2593,13 @@ fts_optimize_remove_table(
|
|||
{
|
||||
dict_sys.assert_not_locked();
|
||||
fts_msg_t *msg= fts_optimize_create_msg(FTS_MSG_DEL_TABLE, nullptr);
|
||||
mysql_cond_t cond;
|
||||
mysql_cond_init(0, &cond, nullptr);
|
||||
pthread_cond_t cond;
|
||||
pthread_cond_init(&cond, nullptr);
|
||||
msg->ptr= new(mem_heap_alloc(msg->heap, sizeof(fts_msg_del_t)))
|
||||
fts_msg_del_t{table, &cond};
|
||||
add_msg(msg);
|
||||
mysql_cond_wait(&cond, &fts_optimize_wq->mutex);
|
||||
mysql_cond_destroy(&cond);
|
||||
my_cond_wait(&cond, &fts_optimize_wq->mutex.m_mutex);
|
||||
pthread_cond_destroy(&cond);
|
||||
ut_ad(!table->fts->in_queue);
|
||||
}
|
||||
|
||||
|
@ -2684,7 +2684,7 @@ static bool fts_optimize_del_table(fts_msg_del_t *remove)
|
|||
|
||||
mysql_mutex_lock(&fts_optimize_wq->mutex);
|
||||
table->fts->in_queue = false;
|
||||
mysql_cond_signal(remove->cond);
|
||||
pthread_cond_signal(remove->cond);
|
||||
mysql_mutex_unlock(&fts_optimize_wq->mutex);
|
||||
slot->table = NULL;
|
||||
return true;
|
||||
|
@ -2692,7 +2692,7 @@ static bool fts_optimize_del_table(fts_msg_del_t *remove)
|
|||
}
|
||||
|
||||
mysql_mutex_lock(&fts_optimize_wq->mutex);
|
||||
mysql_cond_signal(remove->cond);
|
||||
pthread_cond_signal(remove->cond);
|
||||
mysql_mutex_unlock(&fts_optimize_wq->mutex);
|
||||
return false;
|
||||
}
|
||||
|
@ -2902,7 +2902,7 @@ static void fts_optimize_callback(void *)
|
|||
ib_vector_free(fts_slots);
|
||||
mysql_mutex_lock(&fts_optimize_wq->mutex);
|
||||
fts_slots = NULL;
|
||||
mysql_cond_broadcast(&fts_opt_shutdown_cond);
|
||||
pthread_cond_broadcast(&fts_opt_shutdown_cond);
|
||||
mysql_mutex_unlock(&fts_optimize_wq->mutex);
|
||||
|
||||
ib::info() << "FTS optimize thread exiting.";
|
||||
|
@ -2953,7 +2953,7 @@ fts_optimize_init(void)
|
|||
}
|
||||
dict_sys.mutex_unlock();
|
||||
|
||||
mysql_cond_init(0, &fts_opt_shutdown_cond, nullptr);
|
||||
pthread_cond_init(&fts_opt_shutdown_cond, nullptr);
|
||||
last_check_sync_time = time(NULL);
|
||||
}
|
||||
|
||||
|
@ -2982,12 +2982,13 @@ fts_optimize_shutdown()
|
|||
add_msg(fts_optimize_create_msg(FTS_MSG_STOP, nullptr));
|
||||
|
||||
while (fts_slots) {
|
||||
mysql_cond_wait(&fts_opt_shutdown_cond, &fts_optimize_wq->mutex);
|
||||
my_cond_wait(&fts_opt_shutdown_cond,
|
||||
&fts_optimize_wq->mutex.m_mutex);
|
||||
}
|
||||
|
||||
innobase_destroy_background_thd(fts_opt_thd);
|
||||
fts_opt_thd = NULL;
|
||||
mysql_cond_destroy(&fts_opt_shutdown_cond);
|
||||
pthread_cond_destroy(&fts_opt_shutdown_cond);
|
||||
mysql_mutex_unlock(&fts_optimize_wq->mutex);
|
||||
|
||||
ib_wqueue_free(fts_optimize_wq);
|
||||
|
|
|
@ -3118,7 +3118,7 @@ ha_innobase::init_table_handle_for_HANDLER(void)
|
|||
|
||||
#ifdef WITH_INNODB_DISALLOW_WRITES
|
||||
/** Condition variable for innodb_disallow_writes */
|
||||
static mysql_cond_t allow_writes_cond;
|
||||
static pthread_cond_t allow_writes_cond;
|
||||
#endif /* WITH_INNODB_DISALLOW_WRITES */
|
||||
|
||||
/*********************************************************************//**
|
||||
|
@ -3139,7 +3139,7 @@ static int innodb_init_abort()
|
|||
srv_tmp_space.shutdown();
|
||||
|
||||
#ifdef WITH_INNODB_DISALLOW_WRITES
|
||||
mysql_cond_destroy(&allow_writes_cond);
|
||||
pthread_cond_destroy(&allow_writes_cond);
|
||||
#endif /* WITH_INNODB_DISALLOW_WRITES */
|
||||
DBUG_RETURN(1);
|
||||
}
|
||||
|
@ -3661,7 +3661,7 @@ static int innodb_init(void* p)
|
|||
innodb_init_abort(). */
|
||||
|
||||
#ifdef WITH_INNODB_DISALLOW_WRITES
|
||||
mysql_cond_init(0, &allow_writes_cond, nullptr);
|
||||
pthread_cond_init(&allow_writes_cond, nullptr);
|
||||
#endif /* WITH_INNODB_DISALLOW_WRITES */
|
||||
|
||||
#ifdef HAVE_PSI_INTERFACE
|
||||
|
@ -3780,7 +3780,7 @@ innobase_end(handlerton*, ha_panic_function)
|
|||
|
||||
innodb_shutdown();
|
||||
#ifdef WITH_INNODB_DISALLOW_WRITES
|
||||
mysql_cond_destroy(&allow_writes_cond);
|
||||
pthread_cond_destroy(&allow_writes_cond);
|
||||
#endif /* WITH_INNODB_DISALLOW_WRITES */
|
||||
mysql_mutex_destroy(&pending_checkpoint_mutex);
|
||||
}
|
||||
|
@ -18868,7 +18868,7 @@ void innodb_wait_allow_writes()
|
|||
{
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
while (innodb_disallow_writes)
|
||||
mysql_cond_wait(&allow_writes_cond, &LOCK_global_system_variables);
|
||||
my_cond_wait(&allow_writes_cond, &LOCK_global_system_variables.m_mutex);
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
}
|
||||
}
|
||||
|
@ -18884,7 +18884,7 @@ innobase_disallow_writes_update(THD*, st_mysql_sys_var*,
|
|||
*static_cast<my_bool*>(var_ptr) = val;
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
if (!val) {
|
||||
mysql_cond_broadcast(&allow_writes_cond);
|
||||
pthread_cond_broadcast(&allow_writes_cond);
|
||||
}
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2007, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2021, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -115,7 +115,7 @@ struct fts_sync_t {
|
|||
bool unlock_cache; /*!< flag whether unlock cache when
|
||||
write fts node */
|
||||
/** condition variable for in_progress; used with table->fts->cache->lock */
|
||||
mysql_cond_t cond;
|
||||
pthread_cond_t cond;
|
||||
};
|
||||
|
||||
/** The cache for the FTS system. It is a memory-based inverted index
|
||||
|
|
|
@ -668,8 +668,8 @@ public:
|
|||
void mutex_assert_unlocked() const { mysql_mutex_assert_not_owner(&mutex); }
|
||||
|
||||
/** Wait for a lock to be granted */
|
||||
void wait_lock(lock_t **lock, mysql_cond_t *cond)
|
||||
{ while (*lock) mysql_cond_wait(cond, &mutex); }
|
||||
void wait_lock(lock_t **lock, pthread_cond_t *cond)
|
||||
{ while (*lock) my_cond_wait(cond, &mutex.m_mutex); }
|
||||
|
||||
/**
|
||||
Creates the lock system at database start.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1997, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2017, 2021, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -212,7 +212,7 @@ struct recv_sys_t
|
|||
private:
|
||||
/** condition variable for
|
||||
!apply_batch_on || pages.empty() || found_corrupt_log || found_corrupt_fs */
|
||||
mysql_cond_t cond;
|
||||
pthread_cond_t cond;
|
||||
/** whether recv_apply_hashed_log_recs() is running */
|
||||
bool apply_batch_on;
|
||||
/** set when finding a corrupt log block or record, or there is a
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2015, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2015, 2021, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -65,7 +65,7 @@ struct fts_psort_common_t {
|
|||
ulint old_zip_size;
|
||||
trx_t* trx; /*!< transaction */
|
||||
fts_psort_t* all_info; /*!< all parallel sort info */
|
||||
mysql_cond_t sort_cond; /*!< sort completion */
|
||||
pthread_cond_t sort_cond; /*!< sort completion */
|
||||
ibool opt_doc_id_size;/*!< whether to use 4 bytes
|
||||
instead of 8 bytes integer to
|
||||
store Doc ID during sort, if
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
Copyright (c) 1997, 2017, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2012, Facebook Inc.
|
||||
Copyright (c) 2013, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2013, 2021, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -939,7 +939,7 @@ void recv_sys_t::close()
|
|||
|
||||
last_stored_lsn= 0;
|
||||
mysql_mutex_destroy(&mutex);
|
||||
mysql_cond_destroy(&cond);
|
||||
pthread_cond_destroy(&cond);
|
||||
}
|
||||
|
||||
recv_spaces.clear();
|
||||
|
@ -954,7 +954,7 @@ void recv_sys_t::create()
|
|||
ut_ad(this == &recv_sys);
|
||||
ut_ad(!is_initialised());
|
||||
mysql_mutex_init(recv_sys_mutex_key, &mutex, nullptr);
|
||||
mysql_cond_init(0, &cond, nullptr);
|
||||
pthread_cond_init(&cond, nullptr);
|
||||
|
||||
apply_log_recs = false;
|
||||
apply_batch_on = false;
|
||||
|
@ -998,7 +998,7 @@ inline void recv_sys_t::clear()
|
|||
block= prev_block;
|
||||
}
|
||||
|
||||
mysql_cond_broadcast(&cond);
|
||||
pthread_cond_broadcast(&cond);
|
||||
}
|
||||
|
||||
/** Free most recovery data structures. */
|
||||
|
@ -2465,7 +2465,7 @@ ATTRIBUTE_COLD void recv_sys_t::free_corrupted_page(page_id_t page_id)
|
|||
pages.erase(p);
|
||||
}
|
||||
if (pages.empty())
|
||||
mysql_cond_broadcast(&cond);
|
||||
pthread_cond_broadcast(&cond);
|
||||
mysql_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
|
@ -2475,14 +2475,14 @@ inline void recv_sys_t::maybe_finish_batch()
|
|||
mysql_mutex_assert_owner(&mutex);
|
||||
ut_ad(recovery_on);
|
||||
if (!apply_batch_on || pages.empty() || is_corrupt_log() || is_corrupt_fs())
|
||||
mysql_cond_broadcast(&cond);
|
||||
pthread_cond_broadcast(&cond);
|
||||
}
|
||||
|
||||
ATTRIBUTE_COLD void recv_sys_t::set_corrupt_log()
|
||||
{
|
||||
mysql_mutex_lock(&mutex);
|
||||
found_corrupt_log= true;
|
||||
mysql_cond_broadcast(&cond);
|
||||
pthread_cond_broadcast(&cond);
|
||||
mysql_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
|
@ -2490,7 +2490,7 @@ ATTRIBUTE_COLD void recv_sys_t::set_corrupt_fs()
|
|||
{
|
||||
mysql_mutex_lock(&mutex);
|
||||
found_corrupt_fs= true;
|
||||
mysql_cond_broadcast(&cond);
|
||||
pthread_cond_broadcast(&cond);
|
||||
mysql_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
|
@ -2611,7 +2611,7 @@ inline buf_block_t *recv_sys_t::recover_low(const page_id_t page_id,
|
|||
map::iterator r= p++;
|
||||
pages.erase(r);
|
||||
if (pages.empty())
|
||||
mysql_cond_signal(&cond);
|
||||
pthread_cond_signal(&cond);
|
||||
}
|
||||
space->release();
|
||||
}
|
||||
|
@ -2668,13 +2668,13 @@ void recv_sys_t::apply(bool last_batch)
|
|||
if (last_batch)
|
||||
{
|
||||
mysql_mutex_assert_not_owner(&log_sys.mutex);
|
||||
mysql_cond_wait(&cond, &mutex);
|
||||
my_cond_wait(&cond, &mutex.m_mutex);
|
||||
}
|
||||
else
|
||||
{
|
||||
mysql_mutex_unlock(&mutex);
|
||||
set_timespec_nsec(abstime, 500000000ULL); /* 0.5s */
|
||||
mysql_cond_timedwait(&cond, &log_sys.mutex, &abstime);
|
||||
my_cond_timedwait(&cond, &log_sys.mutex.m_mutex, &abstime);
|
||||
mysql_mutex_lock(&mutex);
|
||||
}
|
||||
}
|
||||
|
@ -2769,7 +2769,7 @@ next_page:
|
|||
{
|
||||
mysql_mutex_assert_not_owner(&log_sys.mutex);
|
||||
if (!empty)
|
||||
mysql_cond_wait(&cond, &mutex);
|
||||
my_cond_wait(&cond, &mutex.m_mutex);
|
||||
else
|
||||
{
|
||||
mysql_mutex_unlock(&mutex);
|
||||
|
@ -2783,7 +2783,7 @@ next_page:
|
|||
{
|
||||
mysql_mutex_unlock(&mutex);
|
||||
set_timespec_nsec(abstime, 500000000ULL); /* 0.5s */
|
||||
mysql_cond_timedwait(&cond, &log_sys.mutex, &abstime);
|
||||
my_cond_timedwait(&cond, &log_sys.mutex.m_mutex, &abstime);
|
||||
mysql_mutex_lock(&mutex);
|
||||
}
|
||||
continue;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2010, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2015, 2020, MariaDB Corporation.
|
||||
Copyright (c) 2015, 2021, MariaDB Corporation.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it under
|
||||
the terms of the GNU General Public License as published by the Free Software
|
||||
|
@ -216,7 +216,7 @@ row_fts_psort_info_init(
|
|||
common_info->old_zip_size = old_zip_size;
|
||||
common_info->trx = trx;
|
||||
common_info->all_info = psort_info;
|
||||
mysql_cond_init(0, &common_info->sort_cond, nullptr);
|
||||
pthread_cond_init(&common_info->sort_cond, nullptr);
|
||||
common_info->opt_doc_id_size = opt_doc_id_size;
|
||||
|
||||
if (log_tmp_is_encrypted()) {
|
||||
|
@ -336,7 +336,7 @@ row_fts_psort_info_destroy(
|
|||
mysql_mutex_destroy(&psort_info[j].mutex);
|
||||
}
|
||||
|
||||
mysql_cond_destroy(&merge_info[0].psort_common->sort_cond);
|
||||
pthread_cond_destroy(&merge_info[0].psort_common->sort_cond);
|
||||
ut_free(merge_info[0].psort_common->dup);
|
||||
ut_free(merge_info[0].psort_common);
|
||||
ut_free(psort_info);
|
||||
|
@ -1052,7 +1052,7 @@ func_exit:
|
|||
|
||||
mysql_mutex_lock(&psort_info->mutex);
|
||||
psort_info->child_status = FTS_CHILD_COMPLETE;
|
||||
mysql_cond_signal(&psort_info->psort_common->sort_cond);
|
||||
pthread_cond_signal(&psort_info->psort_common->sort_cond);
|
||||
mysql_mutex_unlock(&psort_info->mutex);
|
||||
}
|
||||
|
||||
|
|
|
@ -1697,7 +1697,7 @@ row_merge_read_clustered_index(
|
|||
doc_id_t doc_id = 0;
|
||||
doc_id_t max_doc_id = 0;
|
||||
ibool add_doc_id = FALSE;
|
||||
mysql_cond_t* fts_parallel_sort_cond = nullptr;
|
||||
pthread_cond_t* fts_parallel_sort_cond = nullptr;
|
||||
index_tuple_info_t** sp_tuples = NULL;
|
||||
mem_heap_t* sp_heap = NULL;
|
||||
ulint num_spatial = 0;
|
||||
|
@ -2785,8 +2785,8 @@ wait_again:
|
|||
timespec abstime;
|
||||
set_timespec(abstime, 1);
|
||||
mysql_mutex_lock(&psort_info[0].mutex);
|
||||
mysql_cond_timedwait(fts_parallel_sort_cond,
|
||||
&psort_info[0].mutex, &abstime);
|
||||
my_cond_timedwait(fts_parallel_sort_cond,
|
||||
&psort_info[0].mutex.m_mutex, &abstime);
|
||||
mysql_mutex_unlock(&psort_info[0].mutex);
|
||||
|
||||
for (ulint i = 0; i < fts_sort_pll_degree; i++) {
|
||||
|
|
|
@ -151,7 +151,7 @@ ulong innodb_compression_algorithm;
|
|||
/** Used by SET GLOBAL innodb_master_thread_disabled_debug = X. */
|
||||
my_bool srv_master_thread_disabled_debug;
|
||||
/** Event used to inform that master thread is disabled. */
|
||||
static mysql_cond_t srv_master_thread_disabled_cond;
|
||||
static pthread_cond_t srv_master_thread_disabled_cond;
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
/*------------------------- LOG FILES ------------------------ */
|
||||
|
@ -648,7 +648,7 @@ static void srv_init()
|
|||
UT_LIST_INIT(srv_sys.tasks, &que_thr_t::queue);
|
||||
|
||||
need_srv_free = true;
|
||||
ut_d(mysql_cond_init(0, &srv_master_thread_disabled_cond, nullptr));
|
||||
ut_d(pthread_cond_init(&srv_master_thread_disabled_cond, nullptr));
|
||||
|
||||
mysql_mutex_init(page_zip_stat_per_index_mutex_key,
|
||||
&page_zip_stat_per_index_mutex, nullptr);
|
||||
|
@ -672,7 +672,7 @@ srv_free(void)
|
|||
mysql_mutex_destroy(&page_zip_stat_per_index_mutex);
|
||||
mysql_mutex_destroy(&srv_sys.tasks_mutex);
|
||||
|
||||
ut_d(mysql_cond_destroy(&srv_master_thread_disabled_cond));
|
||||
ut_d(pthread_cond_destroy(&srv_master_thread_disabled_cond));
|
||||
|
||||
trx_i_s_cache_free(trx_i_s_cache);
|
||||
srv_thread_pool_end();
|
||||
|
@ -1544,8 +1544,8 @@ static void srv_master_do_disabled_loop()
|
|||
srv_main_thread_op_info = "disabled";
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
while (srv_master_thread_disabled_debug)
|
||||
mysql_cond_wait(&srv_master_thread_disabled_cond,
|
||||
&LOCK_global_system_variables);
|
||||
my_cond_wait(&srv_master_thread_disabled_cond,
|
||||
&LOCK_global_system_variables.m_mutex);
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
srv_main_thread_op_info = "";
|
||||
}
|
||||
|
@ -1561,7 +1561,7 @@ srv_master_thread_disabled_debug_update(THD*, st_mysql_sys_var*, void*,
|
|||
const bool disable= *static_cast<const my_bool*>(save);
|
||||
srv_master_thread_disabled_debug= disable;
|
||||
if (!disable)
|
||||
mysql_cond_signal(&srv_master_thread_disabled_cond);
|
||||
pthread_cond_signal(&srv_master_thread_disabled_cond);
|
||||
}
|
||||
|
||||
/** Enable the master thread on shutdown. */
|
||||
|
@ -1571,7 +1571,7 @@ void srv_master_thread_enable()
|
|||
{
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
srv_master_thread_disabled_debug= FALSE;
|
||||
mysql_cond_signal(&srv_master_thread_disabled_cond);
|
||||
pthread_cond_signal(&srv_master_thread_disabled_cond);
|
||||
mysql_mutex_unlock(&LOCK_global_system_variables);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue