mirror of
https://github.com/MariaDB/server.git
synced 2025-01-29 02:05:57 +01:00
cleanup: os_thread_sleep() -> std::this_thread::sleep_for()
std version has an advantage of a more convenient units implementation from std::chrono. Now it's no need to multipy/divide to bring anything to micro seconds.
This commit is contained in:
parent
40fd42f7f5
commit
62e4aaa240
32 changed files with 113 additions and 122 deletions
|
@ -317,7 +317,6 @@ SET(HAVE_BZLIB2_DECOMPRESS CACHE INTERNAL "")
|
|||
SET(HAVE_BZLIB2_H CACHE INTERNAL "")
|
||||
SET(HAVE_SNAPPY_H CACHE INTERNAL "")
|
||||
SET(HAVE_SCHED_GETCPU CACHE INTERNAL "")
|
||||
SET(HAVE_NANOSLEEP CACHE INTERNAL "")
|
||||
SET(HAVE_PTHREAD_THREADID_NP CACHE INTERNAL "")
|
||||
SET(HAVE_SYS_GETTID CACHE INTERNAL "")
|
||||
SET(HAVE_INTEGER_PTHREAD_SELF CACHE INTERNAL "")
|
||||
|
|
|
@ -970,7 +970,7 @@ run_data_threads(datadir_iter_t *it, os_thread_func_t func, uint n)
|
|||
|
||||
/* Wait for threads to exit */
|
||||
while (1) {
|
||||
os_thread_sleep(100000);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
pthread_mutex_lock(&count_mutex);
|
||||
if (count == 0) {
|
||||
pthread_mutex_unlock(&count_mutex);
|
||||
|
|
|
@ -791,7 +791,7 @@ wait_for_no_updates(MYSQL *connection, uint timeout, uint threshold)
|
|||
if (!have_queries_to_wait_for(connection, threshold)) {
|
||||
return(true);
|
||||
}
|
||||
os_thread_sleep(1000000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
|
||||
msg("Unable to obtain lock. Please try again later.");
|
||||
|
@ -963,8 +963,9 @@ unlock_all(MYSQL *connection)
|
|||
if (opt_debug_sleep_before_unlock) {
|
||||
msg("Debug sleep for %u seconds",
|
||||
opt_debug_sleep_before_unlock);
|
||||
os_thread_sleep(opt_debug_sleep_before_unlock * 1000);
|
||||
}
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(opt_debug_sleep_before_unlock));
|
||||
}
|
||||
|
||||
msg("Executing BACKUP STAGE END");
|
||||
xb_mysql_query(connection, "BACKUP STAGE END", false);
|
||||
|
@ -1042,7 +1043,7 @@ wait_for_safe_slave(MYSQL *connection)
|
|||
"remaining)...", sleep_time, n_attempts);
|
||||
|
||||
xb_mysql_query(connection, "START SLAVE SQL_THREAD", false);
|
||||
os_thread_sleep(sleep_time * 1000000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(sleep_time));
|
||||
xb_mysql_query(connection, "STOP SLAVE SQL_THREAD", false);
|
||||
|
||||
open_temp_tables = get_open_temp_tables(connection);
|
||||
|
|
|
@ -457,7 +457,8 @@ read_retry:
|
|||
msg(cursor->thread_n, "Database page corruption detected at page "
|
||||
UINT32PF ", retrying...",
|
||||
page_no);
|
||||
os_thread_sleep(100000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(100));
|
||||
goto read_retry;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3561,7 +3561,8 @@ retry:
|
|||
/* TRX_SYS page can't be compressed or encrypted. */
|
||||
if (buf_page_is_corrupted(false, page, fsp_flags)) {
|
||||
if (n_retries--) {
|
||||
os_thread_sleep(1000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(1));
|
||||
goto retry;
|
||||
} else {
|
||||
msg("mariabackup: TRX_SYS page corrupted.\n");
|
||||
|
@ -4085,7 +4086,7 @@ static void stop_backup_threads(bool running)
|
|||
{
|
||||
putc('.', stderr);
|
||||
fflush(stderr);
|
||||
os_thread_sleep(200000); /*0.2 sec*/
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(200));
|
||||
}
|
||||
putc('\n', stderr);
|
||||
mysql_cond_destroy(&log_copying_stop);
|
||||
|
@ -4471,7 +4472,7 @@ fail_before_log_copying_thread_start:
|
|||
|
||||
/* Wait for threads to exit */
|
||||
while (1) {
|
||||
os_thread_sleep(1000000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
pthread_mutex_lock(&count_mutex);
|
||||
bool stop = count == 0;
|
||||
pthread_mutex_unlock(&count_mutex);
|
||||
|
|
|
@ -310,8 +310,7 @@ void page_hash_latch::write_lock_wait()
|
|||
while (!write_lock_poll());
|
||||
}
|
||||
|
||||
/** Value in microseconds */
|
||||
constexpr int WAIT_FOR_READ= 100;
|
||||
constexpr std::chrono::microseconds WAIT_FOR_READ(100);
|
||||
constexpr int WAIT_FOR_WRITE= 100;
|
||||
/** Number of attempts made to read in a page in the buffer pool */
|
||||
constexpr ulint BUF_PAGE_READ_MAX_RETRIES= 100;
|
||||
|
@ -1810,7 +1809,8 @@ withdraw_retry:
|
|||
if (should_retry_withdraw) {
|
||||
ib::info() << "Will retry to withdraw " << retry_interval
|
||||
<< " seconds later.";
|
||||
os_thread_sleep(retry_interval * 1000000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::seconds(retry_interval));
|
||||
|
||||
if (retry_interval > 5) {
|
||||
retry_interval = 10;
|
||||
|
@ -1831,7 +1831,9 @@ withdraw_retry:
|
|||
should_wait = false;
|
||||
DBUG_EXECUTE_IF(
|
||||
"ib_buf_pool_resize_wait_before_resize",
|
||||
should_wait = true; os_thread_sleep(10000););
|
||||
should_wait = true;
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(10)););
|
||||
}
|
||||
}
|
||||
#endif /* !DBUG_OFF */
|
||||
|
@ -2375,7 +2377,7 @@ got_block:
|
|||
if (must_read)
|
||||
/* Let us wait until the read operation completes */
|
||||
while (bpage->io_fix() == BUF_IO_READ)
|
||||
os_thread_sleep(WAIT_FOR_READ);
|
||||
std::this_thread::sleep_for(WAIT_FOR_READ);
|
||||
|
||||
return bpage;
|
||||
}
|
||||
|
@ -2763,7 +2765,8 @@ got_block:
|
|||
Avoid returning reference to this page.
|
||||
Instead wait for the flush action to complete. */
|
||||
fix_block->unfix();
|
||||
os_thread_sleep(WAIT_FOR_WRITE);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::microseconds(WAIT_FOR_WRITE));
|
||||
goto loop;
|
||||
}
|
||||
|
||||
|
@ -2814,7 +2817,7 @@ evict_from_pool:
|
|||
|
||||
/* The block is buffer-fixed or I/O-fixed.
|
||||
Try again later. */
|
||||
os_thread_sleep(WAIT_FOR_READ);
|
||||
std::this_thread::sleep_for(WAIT_FOR_READ);
|
||||
|
||||
goto loop;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2011, 2017, 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
|
||||
|
@ -472,7 +472,8 @@ buf_load_throttle_if_needed(
|
|||
ut_time_ms() that often may turn out to be too expensive. */
|
||||
|
||||
if (elapsed_time < 1000 /* 1 sec (1000 milli secs) */) {
|
||||
os_thread_sleep((1000 - elapsed_time) * 1000 /* micro secs */);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(1000 - elapsed_time));
|
||||
}
|
||||
|
||||
*last_check_time = ut_time_ms();
|
||||
|
|
|
@ -2219,7 +2219,7 @@ do_checkpoint:
|
|||
#ifdef UNIV_DEBUG
|
||||
while (innodb_page_cleaner_disabled_debug && !buf_flush_sync_lsn &&
|
||||
srv_shutdown_state == SRV_SHUTDOWN_NONE)
|
||||
os_thread_sleep(100000);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2017, 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
|
||||
|
@ -748,7 +748,8 @@ void buf_read_recv_pages(ulint space_id, const uint32_t* page_nos, ulint n)
|
|||
}
|
||||
|
||||
for (ulint count = 0; buf_pool.n_pend_reads >= limit; ) {
|
||||
os_thread_sleep(10000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(10));
|
||||
|
||||
if (!(++count % 1000)) {
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2009, 2019, 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
|
||||
|
@ -37,6 +37,7 @@ Created Jan 06, 2010 Vasil Dimov
|
|||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
|
||||
/* Sampling algorithm description @{
|
||||
|
||||
|
@ -3775,7 +3776,8 @@ dict_stats_rename_table(
|
|||
|
||||
if (ret != DB_SUCCESS) {
|
||||
dict_sys_unlock();
|
||||
os_thread_sleep(200000 /* 0.2 sec */);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(200));
|
||||
dict_sys_lock();
|
||||
}
|
||||
} while ((ret == DB_DEADLOCK
|
||||
|
@ -3828,7 +3830,8 @@ dict_stats_rename_table(
|
|||
|
||||
if (ret != DB_SUCCESS) {
|
||||
dict_sys_unlock();
|
||||
os_thread_sleep(200000 /* 0.2 sec */);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(200));
|
||||
dict_sys_lock();
|
||||
}
|
||||
} while ((ret == DB_DEADLOCK
|
||||
|
|
|
@ -2349,7 +2349,7 @@ fil_space_crypt_close_tablespace(
|
|||
pthread_cond_broadcast(&fil_crypt_threads_cond);
|
||||
mysql_mutex_unlock(&fil_crypt_threads_mutex);
|
||||
|
||||
os_thread_sleep(20000);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
dict_sys.mutex_lock();
|
||||
mysql_mutex_lock(&crypt_data->mutex);
|
||||
|
||||
|
|
|
@ -435,7 +435,7 @@ static bool fil_node_open_file(fil_node_t *node)
|
|||
else
|
||||
{
|
||||
mysql_mutex_unlock(&fil_system.mutex);
|
||||
os_thread_sleep(20000);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
/* Flush tablespaces so that we can close modified files. */
|
||||
fil_flush_file_spaces();
|
||||
mysql_mutex_lock(&fil_system.mutex);
|
||||
|
@ -557,7 +557,7 @@ fil_space_extend_must_retry(
|
|||
It'd have been better to use event driven mechanism but
|
||||
the entire module is peppered with polling stuff. */
|
||||
mysql_mutex_unlock(&fil_system.mutex);
|
||||
os_thread_sleep(100000);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
return(true);
|
||||
}
|
||||
|
||||
|
@ -731,7 +731,7 @@ inline pfs_os_file_t fil_node_t::close_to_free(bool detach_handle)
|
|||
{
|
||||
mysql_mutex_unlock(&fil_system.mutex);
|
||||
while (space->referenced())
|
||||
os_thread_sleep(100);
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(100));
|
||||
mysql_mutex_lock(&fil_system.mutex);
|
||||
}
|
||||
|
||||
|
@ -826,7 +826,7 @@ fil_space_free_low(
|
|||
fil_system_t::detach(), the tablespace cannot be found, so
|
||||
fil_space_t::get() would return NULL */
|
||||
while (space->referenced()) {
|
||||
os_thread_sleep(100);
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(100));
|
||||
}
|
||||
|
||||
for (fil_node_t* node = UT_LIST_GET_FIRST(space->chain);
|
||||
|
@ -1355,7 +1355,8 @@ next:
|
|||
goto next;
|
||||
}
|
||||
mysql_mutex_unlock(&fil_system.mutex);
|
||||
os_thread_sleep(100);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::microseconds(100));
|
||||
mysql_mutex_lock(&fil_system.mutex);
|
||||
if (!node->is_open()) {
|
||||
goto next;
|
||||
|
@ -1673,7 +1674,8 @@ fil_check_pending_operations(
|
|||
mysql_mutex_unlock(&fil_system.mutex);
|
||||
|
||||
if (count) {
|
||||
os_thread_sleep(20000); // Wait 0.02 seconds
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(20));
|
||||
} else if (!sp) {
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -1704,7 +1706,7 @@ fil_check_pending_operations(
|
|||
break;
|
||||
}
|
||||
|
||||
os_thread_sleep(20000); // Wait 0.02 seconds
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(20));
|
||||
mysql_mutex_lock(&fil_system.mutex);
|
||||
sp = fil_space_get_by_id(id);
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ static const ulint FTS_CACHE_SIZE_UPPER_LIMIT_IN_MB = 1024;
|
|||
#endif
|
||||
|
||||
/** Time to sleep after DEADLOCK error before retrying operation. */
|
||||
static const ulint FTS_DEADLOCK_RETRY_WAIT = 100000;
|
||||
static const std::chrono::milliseconds FTS_DEADLOCK_RETRY_WAIT(100);
|
||||
|
||||
/** InnoDB default stopword list:
|
||||
There are different versions of stopwords, the stop words listed
|
||||
|
@ -2684,7 +2684,7 @@ func_exit:
|
|||
fts_sql_rollback(trx);
|
||||
|
||||
if (error == DB_DEADLOCK) {
|
||||
os_thread_sleep(FTS_DEADLOCK_RETRY_WAIT);
|
||||
std::this_thread::sleep_for(FTS_DEADLOCK_RETRY_WAIT);
|
||||
goto retry;
|
||||
}
|
||||
}
|
||||
|
@ -3938,8 +3938,10 @@ fts_sync_write_words(
|
|||
|
||||
word = rbt_value(fts_tokenizer_word_t, rbt_node);
|
||||
|
||||
DBUG_EXECUTE_IF("fts_instrument_write_words_before_select_index",
|
||||
os_thread_sleep(300000););
|
||||
DBUG_EXECUTE_IF(
|
||||
"fts_instrument_write_words_before_select_index",
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(300)););
|
||||
|
||||
selected = fts_select_index(
|
||||
index_cache->charset, word->text.f_str,
|
||||
|
@ -3975,9 +3977,10 @@ fts_sync_write_words(
|
|||
DBUG_EXECUTE_IF("fts_write_node_crash",
|
||||
DBUG_SUICIDE(););
|
||||
|
||||
DBUG_EXECUTE_IF("fts_instrument_sync_sleep",
|
||||
os_thread_sleep(1000000);
|
||||
);
|
||||
DBUG_EXECUTE_IF(
|
||||
"fts_instrument_sync_sleep",
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::seconds(1)););
|
||||
|
||||
if (unlock_cache) {
|
||||
mysql_mutex_lock(
|
||||
|
@ -4279,7 +4282,8 @@ begin_sync:
|
|||
}
|
||||
|
||||
DBUG_EXECUTE_IF("fts_instrument_sync_before_syncing",
|
||||
os_thread_sleep(300000););
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(300)););
|
||||
error = fts_sync_index(sync, index_cache);
|
||||
|
||||
if (error != DB_SUCCESS) {
|
||||
|
|
|
@ -2583,7 +2583,7 @@ fts_optimize_remove_table(
|
|||
ib::info() << "Try to remove table " << table->name
|
||||
<< " after FTS optimize thread exiting.";
|
||||
while (fts_optimize_wq)
|
||||
os_thread_sleep(10000);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -2784,7 +2784,8 @@ static void fts_optimize_sync_table(dict_table_t *table,
|
|||
}
|
||||
}
|
||||
|
||||
DBUG_EXECUTE_IF("ib_optimize_wq_hang", os_thread_sleep(6000000););
|
||||
DBUG_EXECUTE_IF("ib_optimize_wq_hang",
|
||||
std::this_thread::sleep_for(std::chrono::seconds(6)););
|
||||
|
||||
if (mdl_ticket)
|
||||
dict_table_close(sync_table, false, false, fts_opt_thd, mdl_ticket);
|
||||
|
@ -2870,7 +2871,9 @@ static void fts_optimize_callback(void *)
|
|||
case FTS_MSG_SYNC_TABLE:
|
||||
DBUG_EXECUTE_IF(
|
||||
"fts_instrument_msg_sync_sleep",
|
||||
os_thread_sleep(300000););
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(
|
||||
300)););
|
||||
|
||||
fts_optimize_sync_table(
|
||||
static_cast<dict_table_t*>(msg->ptr),
|
||||
|
|
|
@ -241,7 +241,7 @@ static void innodb_max_purge_lag_wait_update(THD *thd, st_mysql_sys_var *,
|
|||
if (thd_kill_level(thd))
|
||||
break;
|
||||
srv_wake_purge_thread_if_not_active();
|
||||
os_thread_sleep(100000);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
mysql_mutex_lock(&LOCK_global_system_variables);
|
||||
}
|
||||
|
@ -17445,7 +17445,8 @@ innodb_buffer_pool_evict_update(THD*, st_mysql_sys_var*, void*,
|
|||
return;
|
||||
}
|
||||
|
||||
os_thread_sleep(10000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(10));
|
||||
}
|
||||
|
||||
/* We failed to evict all uncompressed pages. */
|
||||
|
|
|
@ -934,9 +934,9 @@ is still a good change of success a little later. Try this many
|
|||
times. */
|
||||
#define BTR_CUR_RETRY_DELETE_N_TIMES 100
|
||||
/** If pessimistic delete fails because of lack of file space, there
|
||||
is still a good change of success a little later. Sleep this many
|
||||
microseconds between retries. */
|
||||
#define BTR_CUR_RETRY_SLEEP_TIME 50000
|
||||
is still a good change of success a little later. Sleep this time
|
||||
between retries. */
|
||||
static const std::chrono::milliseconds BTR_CUR_RETRY_SLEEP_TIME(50);
|
||||
|
||||
/** The reference in a field for which data is stored on a different page.
|
||||
The reference is at the end of the 'locally' stored part of the field.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2012, 2017, 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
|
||||
|
@ -52,7 +52,7 @@ for the background thread to stop accessing a table.
|
|||
@param trx transaction holding the data dictionary locks */
|
||||
#define DICT_BG_YIELD(trx) do { \
|
||||
row_mysql_unlock_data_dictionary(trx); \
|
||||
os_thread_sleep(250000); \
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(250)); \
|
||||
row_mysql_lock_data_dictionary(trx); \
|
||||
} while (0)
|
||||
|
||||
|
|
|
@ -32,6 +32,7 @@ Created 9/20/1997 Heikki Tuuri
|
|||
#include "mtr0types.h"
|
||||
|
||||
#include <deque>
|
||||
#include <map>
|
||||
|
||||
/** @return whether recovery is currently running. */
|
||||
#define recv_recovery_is_on() UNIV_UNLIKELY(recv_sys.recovery_on)
|
||||
|
|
|
@ -74,10 +74,3 @@ os_thread_t os_thread_create(os_thread_func_t func, void *arg= nullptr);
|
|||
|
||||
/** Detach and terminate the current thread. */
|
||||
ATTRIBUTE_NORETURN void os_thread_exit();
|
||||
|
||||
#ifdef _WIN32
|
||||
# define os_thread_sleep(usec) Sleep((DWORD) usec / 1000)
|
||||
#else
|
||||
/** Sleep for some time */
|
||||
void os_thread_sleep(ulint usec);
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2014, 2015, 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
|
||||
|
@ -120,9 +120,8 @@ InnoDB:
|
|||
#ifndef ut0new_h
|
||||
#define ut0new_h
|
||||
|
||||
#include <algorithm> /* std::min() */
|
||||
#include <limits> /* std::numeric_limits */
|
||||
#include <map> /* std::map */
|
||||
#include <thread>
|
||||
|
||||
#include <stddef.h>
|
||||
#include <stdlib.h> /* malloc() */
|
||||
|
@ -136,7 +135,6 @@ InnoDB:
|
|||
|
||||
#include "mysql/psi/psi_memory.h" /* PSI_memory_key, PSI_memory_info */
|
||||
|
||||
#include "os0thread.h" /* os_thread_sleep() */
|
||||
#include "ut0ut.h" /* ut_strcmp_functor, ut_basename_noext() */
|
||||
|
||||
#define OUT_OF_MEMORY_MSG \
|
||||
|
@ -381,7 +379,7 @@ public:
|
|||
break;
|
||||
}
|
||||
|
||||
os_thread_sleep(1000000 /* 1 second */);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
|
||||
if (ptr == NULL) {
|
||||
|
@ -516,7 +514,7 @@ public:
|
|||
break;
|
||||
}
|
||||
|
||||
os_thread_sleep(1000000 /* 1 second */);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
|
||||
if (pfx_new == NULL) {
|
||||
|
|
|
@ -254,7 +254,8 @@ struct PoolManager {
|
|||
except crash and burn, however lets
|
||||
be a little optimistic and wait for
|
||||
a resource to be freed. */
|
||||
os_thread_sleep(delay * 1000000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::seconds(delay));
|
||||
|
||||
if (delay < 32) {
|
||||
delay <<= 1;
|
||||
|
|
|
@ -108,11 +108,6 @@ IF(HAVE_SCHED_GETCPU)
|
|||
ADD_DEFINITIONS(-DHAVE_SCHED_GETCPU=1)
|
||||
ENDIF()
|
||||
|
||||
CHECK_FUNCTION_EXISTS(nanosleep HAVE_NANOSLEEP)
|
||||
IF(HAVE_NANOSLEEP)
|
||||
ADD_DEFINITIONS(-DHAVE_NANOSLEEP=1)
|
||||
ENDIF()
|
||||
|
||||
IF(HAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE)
|
||||
ADD_DEFINITIONS(-DHAVE_FALLOC_PUNCH_HOLE_AND_KEEP_SIZE=1)
|
||||
ENDIF()
|
||||
|
|
|
@ -963,7 +963,8 @@ func_exit:
|
|||
|
||||
/* We must wait to prevent the tail of the log overwriting the head. */
|
||||
buf_flush_wait_flushed(std::min(sync_lsn, checkpoint + (1U << 20)));
|
||||
os_thread_sleep(10000); /* Sleep 10ms to avoid a thundering herd */
|
||||
/* Sleep to avoid a thundering herd */
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1027,7 +1028,7 @@ loop:
|
|||
|
||||
#define COUNT_INTERVAL 600U
|
||||
#define CHECK_INTERVAL 100000U
|
||||
os_thread_sleep(CHECK_INTERVAL);
|
||||
std::this_thread::sleep_for(std::chrono::microseconds(CHECK_INTERVAL));
|
||||
|
||||
count++;
|
||||
|
||||
|
|
|
@ -1438,7 +1438,8 @@ os_file_create_func(
|
|||
<< "Retrying to lock the first data file";
|
||||
|
||||
for (int i = 0; i < 100; i++) {
|
||||
os_thread_sleep(1000000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::seconds(1));
|
||||
|
||||
if (!os_file_lock(file, name)) {
|
||||
*success = true;
|
||||
|
@ -2747,8 +2748,7 @@ os_file_delete_if_exists_func(
|
|||
ib::warn() << "Delete of file '" << name << "' failed.";
|
||||
}
|
||||
|
||||
/* Sleep for a second */
|
||||
os_thread_sleep(1000000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
||||
if (count > 2000) {
|
||||
|
||||
|
@ -2796,8 +2796,7 @@ os_file_delete_func(
|
|||
<< "another program accessing it?";
|
||||
}
|
||||
|
||||
/* sleep for a second */
|
||||
os_thread_sleep(1000000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
||||
if (count > 2000) {
|
||||
|
||||
|
@ -3435,13 +3434,13 @@ os_file_handle_error_cond_exit(
|
|||
|
||||
case OS_FILE_SHARING_VIOLATION:
|
||||
|
||||
os_thread_sleep(10000000); /* 10 sec */
|
||||
std::this_thread::sleep_for(std::chrono::seconds(10));
|
||||
return(true);
|
||||
|
||||
case OS_FILE_OPERATION_ABORTED:
|
||||
case OS_FILE_INSUFFICIENT_RESOURCE:
|
||||
|
||||
os_thread_sleep(100000); /* 100 ms */
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
return(true);
|
||||
|
||||
default:
|
||||
|
|
|
@ -97,25 +97,3 @@ ATTRIBUTE_NORETURN void os_thread_exit()
|
|||
pthread_exit(NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
/** Sleep for some time */
|
||||
void os_thread_sleep(ulint tm)
|
||||
{
|
||||
# ifdef HAVE_NANOSLEEP
|
||||
struct timespec t;
|
||||
|
||||
t.tv_sec = tm / 1000000;
|
||||
t.tv_nsec = (tm % 1000000) * 1000;
|
||||
|
||||
::nanosleep(&t, NULL);
|
||||
# else
|
||||
struct timeval t;
|
||||
|
||||
t.tv_sec = tm / 1000000;
|
||||
t.tv_usec = tm % 1000000;
|
||||
|
||||
select(0, NULL, NULL, NULL, &t);
|
||||
# endif
|
||||
}
|
||||
#endif /* !_WIN32 */
|
||||
|
|
|
@ -674,7 +674,8 @@ row_merge_buf_add(
|
|||
while (psort_info[bucket].memory_used
|
||||
> FTS_PENDING_DOC_MEMORY_LIMIT
|
||||
&& trial_count++ < max_trial_count) {
|
||||
os_thread_sleep(1000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
n_row_added = 1;
|
||||
|
@ -4629,9 +4630,9 @@ row_merge_build_indexes(
|
|||
buf, i + 1, n_indexes);
|
||||
}
|
||||
|
||||
DBUG_EXECUTE_IF(
|
||||
"ib_merge_wait_after_sort",
|
||||
os_thread_sleep(20000000);); /* 20 sec */
|
||||
DBUG_EXECUTE_IF("ib_merge_wait_after_sort",
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::seconds(20)););
|
||||
|
||||
if (error == DB_SUCCESS) {
|
||||
BtrBulk btr_bulk(sort_idx, trx);
|
||||
|
|
|
@ -65,8 +65,8 @@ Created 9/17/2000 Heikki Tuuri
|
|||
#include "srv0start.h"
|
||||
|
||||
#include <algorithm>
|
||||
#include <deque>
|
||||
#include <vector>
|
||||
#include <thread>
|
||||
|
||||
#ifdef WITH_WSREP
|
||||
#include "mysql/service_wsrep.h"
|
||||
|
@ -127,7 +127,7 @@ row_wait_for_background_drop_list_empty()
|
|||
mysql_mutex_lock(&row_drop_list_mutex);
|
||||
empty = (UT_LIST_GET_LEN(row_mysql_drop_list) == 0);
|
||||
mysql_mutex_unlock(&row_drop_list_mutex);
|
||||
os_thread_sleep(100000);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||
}
|
||||
}
|
||||
#endif /* UNIV_DEBUG */
|
||||
|
@ -140,7 +140,8 @@ row_mysql_delay_if_needed(void)
|
|||
/*===========================*/
|
||||
{
|
||||
if (srv_dml_needed_delay) {
|
||||
os_thread_sleep(srv_dml_needed_delay);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::microseconds(srv_dml_needed_delay));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3946,7 +3947,8 @@ loop:
|
|||
if (!dict_stats_stop_bg(table)) {
|
||||
row_mysql_unlock_data_dictionary(trx);
|
||||
|
||||
os_thread_sleep(250000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(250));
|
||||
|
||||
ut_free(table_name);
|
||||
|
||||
|
@ -3964,7 +3966,7 @@ loop:
|
|||
" there are still open handles to table "
|
||||
<< table->name << ".";
|
||||
|
||||
os_thread_sleep(1000000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
||||
ut_free(table_name);
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ Created 3/14/1997 Heikki Tuuri
|
|||
*******************************************************/
|
||||
|
||||
#include "row0purge.h"
|
||||
#include "btr0cur.h"
|
||||
#include "fsp0fsp.h"
|
||||
#include "mach0data.h"
|
||||
#include "dict0stats.h"
|
||||
|
@ -194,7 +195,7 @@ row_purge_remove_clust_if_poss(
|
|||
return(true);
|
||||
}
|
||||
|
||||
os_thread_sleep(BTR_CUR_RETRY_SLEEP_TIME);
|
||||
std::this_thread::sleep_for(BTR_CUR_RETRY_SLEEP_TIME);
|
||||
}
|
||||
|
||||
return(false);
|
||||
|
@ -576,7 +577,7 @@ retry:
|
|||
|
||||
n_tries++;
|
||||
|
||||
os_thread_sleep(BTR_CUR_RETRY_SLEEP_TIME);
|
||||
std::this_thread::sleep_for(BTR_CUR_RETRY_SLEEP_TIME);
|
||||
|
||||
goto retry;
|
||||
}
|
||||
|
@ -955,7 +956,7 @@ already_locked:
|
|||
if (srv_shutdown_state > SRV_SHUTDOWN_INITIATED) {
|
||||
return(false);
|
||||
}
|
||||
os_thread_sleep(1000000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
goto try_again;
|
||||
}
|
||||
}
|
||||
|
@ -1116,7 +1117,7 @@ row_purge(
|
|||
}
|
||||
|
||||
/* Retry the purge in a second. */
|
||||
os_thread_sleep(1000000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2012, 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
|
||||
|
@ -587,8 +587,7 @@ row_quiesce_table_complete(
|
|||
<< " to complete";
|
||||
}
|
||||
|
||||
/* Sleep for a second. */
|
||||
os_thread_sleep(1000000);
|
||||
std::this_thread::sleep_for(std::chrono::seconds(1));
|
||||
|
||||
++count;
|
||||
}
|
||||
|
|
|
@ -198,7 +198,7 @@ retry:
|
|||
|
||||
n_tries++;
|
||||
|
||||
os_thread_sleep(BTR_CUR_RETRY_SLEEP_TIME);
|
||||
std::this_thread::sleep_for(BTR_CUR_RETRY_SLEEP_TIME);
|
||||
|
||||
goto retry;
|
||||
}
|
||||
|
@ -334,7 +334,7 @@ retry:
|
|||
|
||||
n_tries++;
|
||||
|
||||
os_thread_sleep(BTR_CUR_RETRY_SLEEP_TIME);
|
||||
std::this_thread::sleep_for(BTR_CUR_RETRY_SLEEP_TIME);
|
||||
|
||||
goto retry;
|
||||
}
|
||||
|
|
|
@ -2069,7 +2069,8 @@ void srv_purge_shutdown()
|
|||
while(!srv_purge_should_exit()) {
|
||||
ut_a(!purge_sys.paused());
|
||||
srv_wake_purge_thread_if_not_active();
|
||||
os_thread_sleep(1000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(1));
|
||||
}
|
||||
purge_sys.coordinator_shutdown();
|
||||
srv_shutdown_purge_tasks();
|
||||
|
|
|
@ -967,7 +967,8 @@ static lsn_t srv_prepare_to_delete_redo_log_file(bool old_exists)
|
|||
count = 0;
|
||||
}
|
||||
|
||||
os_thread_sleep(100000);
|
||||
std::this_thread::sleep_for(
|
||||
std::chrono::milliseconds(100));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
@ -1953,7 +1954,7 @@ void innodb_preshutdown()
|
|||
|
||||
if (trx_sys.is_initialised())
|
||||
while (trx_sys.any_active_transactions())
|
||||
os_thread_sleep(1000);
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
srv_shutdown_bg_undo_sources();
|
||||
srv_purge_shutdown();
|
||||
|
|
Loading…
Add table
Reference in a new issue