MDEV-11802 innodb.innodb_bug14676111 fails
The function trx_purge_stop() was calling os_event_reset(purge_sys->event) before calling rw_lock_x_lock(&purge_sys->latch). The os_event_set() call in srv_purge_coordinator_suspend() is protected by that X-latch. It would seem a good idea to consistently protect both os_event_set() and os_event_reset() calls with a common mutex or rw-lock in those cases where os_event_set() and os_event_reset() are used like condition variables, tied to changes of shared state. For each os_event_t, we try to document the mutex or rw-lock that is being used. For some events, frequent calls to os_event_set() seem to try to avoid hangs. Some events are never waited for infinitely, only timed waits, and os_event_set() is used for early termination of these waits. os_aio_simulated_put_read_threads_to_sleep(): Define as a null macro on other systems than Windows. TODO: remove this altogether and disable innodb_use_native_aio on Windows. os_aio_segment_wait_events[]: Initialize only if innodb_use_native_aio=0.
This commit is contained in:
parent
72994d6442
commit
13493078e9
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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,8 +53,8 @@ enum status_severity {
|
||||
|
||||
/* Flags that tell the buffer pool dump/load thread which action should it
|
||||
take after being waked up. */
|
||||
static ibool buf_dump_should_start = FALSE;
|
||||
static ibool buf_load_should_start = FALSE;
|
||||
static volatile bool buf_dump_should_start;
|
||||
static volatile bool buf_load_should_start;
|
||||
|
||||
static ibool buf_load_abort_flag = FALSE;
|
||||
|
||||
@ -78,7 +79,7 @@ void
|
||||
buf_dump_start()
|
||||
/*============*/
|
||||
{
|
||||
buf_dump_should_start = TRUE;
|
||||
buf_dump_should_start = true;
|
||||
os_event_set(srv_buf_dump_event);
|
||||
}
|
||||
|
||||
@ -92,7 +93,7 @@ void
|
||||
buf_load_start()
|
||||
/*============*/
|
||||
{
|
||||
buf_load_should_start = TRUE;
|
||||
buf_load_should_start = true;
|
||||
os_event_set(srv_buf_dump_event);
|
||||
}
|
||||
|
||||
@ -695,15 +696,18 @@ DECLARE_THREAD(buf_dump_thread)(
|
||||
os_event_wait(srv_buf_dump_event);
|
||||
|
||||
if (buf_dump_should_start) {
|
||||
buf_dump_should_start = FALSE;
|
||||
buf_dump_should_start = false;
|
||||
buf_dump(TRUE /* quit on shutdown */);
|
||||
}
|
||||
|
||||
if (buf_load_should_start) {
|
||||
buf_load_should_start = FALSE;
|
||||
buf_load_should_start = false;
|
||||
buf_load();
|
||||
}
|
||||
|
||||
if (buf_dump_should_start || buf_load_should_start) {
|
||||
continue;
|
||||
}
|
||||
os_event_reset(srv_buf_dump_event);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -732,8 +733,7 @@ buf_flush_write_complete(
|
||||
flush_type = buf_page_get_flush_type(bpage);
|
||||
buf_pool->n_flush[flush_type]--;
|
||||
|
||||
/* fprintf(stderr, "n pending flush %lu\n",
|
||||
buf_pool->n_flush[flush_type]); */
|
||||
ut_ad(buf_pool_mutex_own(buf_pool));
|
||||
|
||||
if (buf_pool->n_flush[flush_type] == 0
|
||||
&& buf_pool->init_flush[flush_type] == FALSE) {
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -39,8 +40,9 @@ Created Apr 25, 2012 Vasil Dimov
|
||||
|
||||
#define SHUTTING_DOWN() (srv_shutdown_state != SRV_SHUTDOWN_NONE)
|
||||
|
||||
/** Event to wake up the stats thread */
|
||||
UNIV_INTERN os_event_t dict_stats_event = NULL;
|
||||
/** Event to wake up dict_stats_thread on dict_stats_recalc_pool_add()
|
||||
or shutdown. Not protected by any mutex. */
|
||||
UNIV_INTERN os_event_t dict_stats_event;
|
||||
|
||||
/** This mutex protects the "recalc_pool" variable. */
|
||||
static ib_mutex_t recalc_pool_mutex;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -1905,7 +1906,9 @@ struct buf_pool_t{
|
||||
os_event_t no_flush[BUF_FLUSH_N_TYPES];
|
||||
/*!< this is in the set state
|
||||
when there is no flush batch
|
||||
of the given type running */
|
||||
of the given type running;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by buf_pool_t::mutex */
|
||||
ib_rbt_t* flush_rbt; /*!< a red-black tree is used
|
||||
exclusively during recovery to
|
||||
speed up insertions in the
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -134,11 +135,13 @@ struct buf_dblwr_t{
|
||||
ulint b_reserved;/*!< number of slots currently reserved
|
||||
for batch flush. */
|
||||
os_event_t b_event;/*!< event where threads wait for a
|
||||
batch flush to end. */
|
||||
batch flush to end;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by buf_dblwr_t::mutex */
|
||||
ulint s_reserved;/*!< number of slots currently
|
||||
reserved for single page flushes. */
|
||||
os_event_t s_event;/*!< event where threads wait for a
|
||||
single page flush slot. */
|
||||
single page flush slot. Protected by mutex. */
|
||||
bool* in_use; /*!< flag used to indicate if a slot is
|
||||
in use. Only used for single page
|
||||
flushes. */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -32,7 +33,8 @@ Created Apr 26, 2012 Vasil Dimov
|
||||
#include "os0sync.h" /* os_event_t */
|
||||
#include "os0thread.h" /* DECLARE_THREAD */
|
||||
|
||||
/** Event to wake up the stats thread */
|
||||
/** Event to wake up dict_stats_thread on dict_stats_recalc_pool_add()
|
||||
or shutdown. Not protected by any mutex. */
|
||||
extern os_event_t dict_stats_event;
|
||||
|
||||
/*****************************************************************//**
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -206,7 +207,9 @@ struct fil_node_t {
|
||||
ibool open; /*!< TRUE if file open */
|
||||
os_file_t handle; /*!< OS handle to the file, if file open */
|
||||
os_event_t sync_event;/*!< Condition event to group and
|
||||
serialize calls to fsync */
|
||||
serialize calls to fsync;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by fil_system_t::mutex */
|
||||
ibool is_raw_disk;/*!< TRUE if the 'file' is actually a raw
|
||||
device or a raw disk partition */
|
||||
ulint size; /*!< size of the file in database pages, 0 if
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2009, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
|
@ -126,7 +126,9 @@ struct fts_sync_t {
|
||||
bool in_progress; /*!< flag whether sync is in progress.*/
|
||||
bool unlock_cache; /*!< flag whether unlock cache when
|
||||
write fts node */
|
||||
os_event_t event; /*!< sync finish event */
|
||||
os_event_t event; /*!< sync finish event;
|
||||
only os_event_set() and os_event_wait()
|
||||
are used */
|
||||
};
|
||||
|
||||
/** The cache for the FTS system. It is a memory-based inverted index
|
||||
|
@ -918,7 +918,12 @@ struct lock_sys_t{
|
||||
srv_slot_t* waiting_threads; /*!< Array of user threads
|
||||
suspended while waiting for
|
||||
locks within InnoDB, protected
|
||||
by the lock_sys->wait_mutex */
|
||||
by the lock_sys->wait_mutex;
|
||||
os_event_set() and
|
||||
os_event_reset() on
|
||||
waiting_threads[]->event
|
||||
are protected by
|
||||
trx_t::mutex */
|
||||
srv_slot_t* last_slot; /*!< highest slot ever used
|
||||
in the waiting_threads array,
|
||||
protected by
|
||||
@ -931,10 +936,11 @@ struct lock_sys_t{
|
||||
|
||||
ulint n_lock_max_wait_time; /*!< Max wait time */
|
||||
|
||||
os_event_t timeout_event; /*!< Set to the event that is
|
||||
created in the lock wait monitor
|
||||
thread. A value of 0 means the
|
||||
thread is not active */
|
||||
os_event_t timeout_event; /*!< An event waited for by
|
||||
lock_wait_timeout_thread.
|
||||
Not protected by a mutex,
|
||||
but the waits are timed.
|
||||
Signaled on shutdown only. */
|
||||
|
||||
bool timeout_thread_active; /*!< True if the timeout thread
|
||||
is running */
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, Google Inc.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -875,10 +876,8 @@ struct log_t{
|
||||
be 'flush_or_write'! */
|
||||
os_event_t no_flush_event; /*!< this event is in the reset state
|
||||
when a flush or a write is running;
|
||||
a thread should wait for this without
|
||||
owning the log mutex, but NOTE that
|
||||
to set or reset this event, the
|
||||
thread MUST own the log mutex! */
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by log_sys_t::mutex */
|
||||
ibool one_flushed; /*!< during a flush, this is
|
||||
first FALSE and becomes TRUE
|
||||
when one log group has been
|
||||
@ -887,11 +886,9 @@ struct log_t{
|
||||
flush or write has not yet completed
|
||||
for any log group; e.g., this means
|
||||
that a transaction has been committed
|
||||
when this is set; a thread should wait
|
||||
for this without owning the log mutex,
|
||||
but NOTE that to set or reset this
|
||||
event, the thread MUST own the log
|
||||
mutex! */
|
||||
when this is set;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by log_sys_t::mutex */
|
||||
ulint n_log_ios; /*!< number of log i/os initiated thus
|
||||
far */
|
||||
ulint n_log_ios_old; /*!< number of log i/o's at the
|
||||
@ -976,9 +973,9 @@ struct log_t{
|
||||
ulint archive_buf_size;/*!< size of archive_buf */
|
||||
byte* archive_buf; /*!< log segment is written to the
|
||||
archive from this buffer */
|
||||
os_event_t archiving_on; /*!< if archiving has been stopped,
|
||||
a thread can wait for this event to
|
||||
become signaled */
|
||||
os_event_t archiving_on; /*!< if archiving has been stopped;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by log_sys_t::mutex */
|
||||
/* @} */
|
||||
#endif /* UNIV_LOG_ARCHIVE */
|
||||
};
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted
|
||||
by Percona Inc.. Those modifications are
|
||||
@ -1143,6 +1144,7 @@ UNIV_INTERN
|
||||
void
|
||||
os_aio_simulated_wake_handler_threads(void);
|
||||
/*=======================================*/
|
||||
#ifdef _WIN32
|
||||
/**********************************************************************//**
|
||||
This function can be called if one wants to post a batch of reads and
|
||||
prefers an i/o-handler thread to handle them all at once later. You must
|
||||
@ -1150,8 +1152,10 @@ call os_aio_simulated_wake_handler_threads later to ensure the threads
|
||||
are not left sleeping! */
|
||||
UNIV_INTERN
|
||||
void
|
||||
os_aio_simulated_put_read_threads_to_sleep(void);
|
||||
/*============================================*/
|
||||
os_aio_simulated_put_read_threads_to_sleep();
|
||||
#else /* _WIN32 */
|
||||
# define os_aio_simulated_put_read_threads_to_sleep()
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef WIN_ASYNC_IO
|
||||
/**********************************************************************//**
|
||||
|
@ -145,13 +145,16 @@ extern const char* srv_main_thread_op_info;
|
||||
/** Prefix used by MySQL to indicate pre-5.1 table name encoding */
|
||||
extern const char srv_mysql50_table_name_prefix[10];
|
||||
|
||||
/* The monitor thread waits on this event. */
|
||||
/** Event to signal srv_monitor_thread. Not protected by a mutex.
|
||||
Set after setting srv_print_innodb_monitor. */
|
||||
extern os_event_t srv_monitor_event;
|
||||
|
||||
/* The error monitor thread waits on this event. */
|
||||
/** Event to signal the shutdown of srv_error_monitor_thread.
|
||||
Not protected by a mutex. */
|
||||
extern os_event_t srv_error_event;
|
||||
|
||||
/** The buffer pool dump/load thread waits on this event. */
|
||||
/** Event for waking up buf_dump_thread. Not protected by a mutex.
|
||||
Set on shutdown or by buf_dump_start() or buf_load_start(). */
|
||||
extern os_event_t srv_buf_dump_event;
|
||||
|
||||
/** The buffer pool dump/load file name */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -145,7 +146,10 @@ struct trx_purge_t{
|
||||
log operation can prevent this by
|
||||
obtaining an s-latch here. It also
|
||||
protects state and running */
|
||||
os_event_t event; /*!< State signal event */
|
||||
os_event_t event; /*!< State signal event;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by trx_purge_t::latch
|
||||
X-lock */
|
||||
ulint n_stop; /*!< Counter to track number stops */
|
||||
volatile bool running; /*!< true, if purge is active,
|
||||
we check this without the latch too */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2006, 2009, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -99,7 +100,9 @@ ib_wqueue_timedwait(
|
||||
struct ib_wqueue_t {
|
||||
ib_mutex_t mutex; /*!< mutex protecting everything */
|
||||
ib_list_t* items; /*!< work item list */
|
||||
os_event_t event; /*!< event we use to signal additions to list */
|
||||
os_event_t event; /*!< event we use to signal additions to list;
|
||||
os_event_set() and os_event_reset() are
|
||||
protected by ib_wqueue_t::mutex */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -3205,7 +3205,6 @@ logs_empty_and_mark_files_at_shutdown(void)
|
||||
lsn_t lsn;
|
||||
ulint arch_log_no;
|
||||
ulint count = 0;
|
||||
ulint total_trx;
|
||||
ulint pending_io;
|
||||
enum srv_thread_type active_thd;
|
||||
const char* thread_name;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted
|
||||
by Percona Inc.. Those modifications are
|
||||
@ -193,11 +194,15 @@ struct os_aio_array_t{
|
||||
os_event_t not_full;
|
||||
/*!< The event which is set to the
|
||||
signaled state when there is space in
|
||||
the aio outside the ibuf segment */
|
||||
the aio outside the ibuf segment;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by os_aio_array_t::mutex */
|
||||
os_event_t is_empty;
|
||||
/*!< The event which is set to the
|
||||
signaled state when there are no
|
||||
pending i/os in this array */
|
||||
pending i/os in this array;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by os_aio_array_t::mutex */
|
||||
ulint n_slots;/*!< Total number of slots in the aio
|
||||
array. This must be divisible by
|
||||
n_threads. */
|
||||
@ -248,8 +253,8 @@ struct os_aio_array_t{
|
||||
#define OS_AIO_IO_SETUP_RETRY_ATTEMPTS 5
|
||||
#endif
|
||||
|
||||
/** Array of events used in simulated aio */
|
||||
static os_event_t* os_aio_segment_wait_events = NULL;
|
||||
/** Array of events used in simulated aio. */
|
||||
static os_event_t* os_aio_segment_wait_events;
|
||||
|
||||
/** The aio arrays for non-ibuf i/o and ibuf i/o, as well as sync aio. These
|
||||
are NULL when the module has not yet been initialized. @{ */
|
||||
@ -4008,6 +4013,12 @@ os_aio_init(
|
||||
|
||||
os_aio_validate();
|
||||
|
||||
os_last_printout = ut_time();
|
||||
|
||||
if (srv_use_native_aio) {
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
os_aio_segment_wait_events = static_cast<os_event_t*>(
|
||||
ut_malloc(n_segments * sizeof *os_aio_segment_wait_events));
|
||||
|
||||
@ -4015,10 +4026,7 @@ os_aio_init(
|
||||
os_aio_segment_wait_events[i] = os_event_create();
|
||||
}
|
||||
|
||||
os_last_printout = ut_time();
|
||||
|
||||
return(TRUE);
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -4046,8 +4054,10 @@ os_aio_free(void)
|
||||
|
||||
os_aio_array_free(os_aio_read_array);
|
||||
|
||||
for (ulint i = 0; i < os_aio_n_segments; i++) {
|
||||
os_event_free(os_aio_segment_wait_events[i]);
|
||||
if (!srv_use_native_aio) {
|
||||
for (ulint i = 0; i < os_aio_n_segments; i++) {
|
||||
os_event_free(os_aio_segment_wait_events[i]);
|
||||
}
|
||||
}
|
||||
|
||||
ut_free(os_aio_segment_wait_events);
|
||||
@ -4096,22 +4106,17 @@ os_aio_wake_all_threads_at_shutdown(void)
|
||||
if (os_aio_log_array != 0) {
|
||||
os_aio_array_wake_win_aio_at_shutdown(os_aio_log_array);
|
||||
}
|
||||
|
||||
#elif defined(LINUX_NATIVE_AIO)
|
||||
|
||||
/* When using native AIO interface the io helper threads
|
||||
wait on io_getevents with a timeout value of 500ms. At
|
||||
each wake up these threads check the server status.
|
||||
No need to do anything to wake them up. */
|
||||
#endif /* !WIN_ASYNC_AIO */
|
||||
|
||||
if (srv_use_native_aio) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fall through to simulated AIO handler wakeup if we are
|
||||
not using native AIO. */
|
||||
#endif /* !WIN_ASYNC_AIO */
|
||||
|
||||
/* This loop wakes up all simulated ai/o threads */
|
||||
|
||||
for (ulint i = 0; i < os_aio_n_segments; i++) {
|
||||
@ -4480,6 +4485,7 @@ os_aio_simulated_wake_handler_threads(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
/**********************************************************************//**
|
||||
This function can be called if one wants to post a batch of reads and
|
||||
prefers an i/o-handler thread to handle them all at once later. You must
|
||||
@ -4487,15 +4493,14 @@ call os_aio_simulated_wake_handler_threads later to ensure the threads
|
||||
are not left sleeping! */
|
||||
UNIV_INTERN
|
||||
void
|
||||
os_aio_simulated_put_read_threads_to_sleep(void)
|
||||
/*============================================*/
|
||||
os_aio_simulated_put_read_threads_to_sleep()
|
||||
{
|
||||
|
||||
/* The idea of putting background IO threads to sleep is only for
|
||||
Windows when using simulated AIO. Windows XP seems to schedule
|
||||
background threads too eagerly to allow for coalescing during
|
||||
readahead requests. */
|
||||
#ifdef __WIN__
|
||||
|
||||
os_aio_array_t* array;
|
||||
|
||||
if (srv_use_native_aio) {
|
||||
@ -4514,8 +4519,8 @@ readahead requests. */
|
||||
os_event_reset(os_aio_segment_wait_events[i]);
|
||||
}
|
||||
}
|
||||
#endif /* __WIN__ */
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#if defined(LINUX_NATIVE_AIO)
|
||||
/*******************************************************************//**
|
||||
@ -5725,11 +5730,12 @@ os_aio_print(
|
||||
srv_io_thread_op_info[i],
|
||||
srv_io_thread_function[i]);
|
||||
|
||||
#ifndef __WIN__
|
||||
if (os_aio_segment_wait_events[i]->is_set) {
|
||||
#ifndef _WIN32
|
||||
if (!srv_use_native_aio
|
||||
&& os_aio_segment_wait_events[i]->is_set) {
|
||||
fprintf(file, " ev set");
|
||||
}
|
||||
#endif /* __WIN__ */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
fprintf(file, "\n");
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2011, 2012, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -77,7 +78,9 @@ typedef UT_LIST_NODE_T(struct srv_conc_slot_t) srv_conc_node_t;
|
||||
|
||||
/** Slot for a thread waiting in the concurrency control queue. */
|
||||
struct srv_conc_slot_t{
|
||||
os_event_t event; /*!< event to wait */
|
||||
os_event_t event; /*!< event to wait for;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by srv_conc_mutex */
|
||||
ibool reserved; /*!< TRUE if slot
|
||||
reserved */
|
||||
ibool wait_ended; /*!< TRUE when another thread has
|
||||
@ -339,11 +342,11 @@ srv_conc_exit_innodb_without_atomics(
|
||||
}
|
||||
}
|
||||
|
||||
os_fast_mutex_unlock(&srv_conc_mutex);
|
||||
|
||||
if (slot != NULL) {
|
||||
os_event_set(slot->event);
|
||||
}
|
||||
|
||||
os_fast_mutex_unlock(&srv_conc_mutex);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
|
@ -591,7 +591,11 @@ struct srv_sys_t{
|
||||
ulint n_sys_threads; /*!< size of the sys_threads
|
||||
array */
|
||||
|
||||
srv_slot_t* sys_threads; /*!< server thread table */
|
||||
srv_slot_t* sys_threads; /*!< server thread table;
|
||||
os_event_set() and
|
||||
os_event_reset() on
|
||||
sys_threads[]->event are
|
||||
covered by srv_sys_t::mutex */
|
||||
|
||||
ulint n_threads_active[SRV_MASTER + 1];
|
||||
/*!< number of threads active
|
||||
@ -609,13 +613,16 @@ UNIV_INTERN ib_mutex_t server_mutex;
|
||||
|
||||
static srv_sys_t* srv_sys = NULL;
|
||||
|
||||
/** Event to signal the monitor thread. */
|
||||
/** Event to signal srv_monitor_thread. Not protected by a mutex.
|
||||
Set after setting srv_print_innodb_monitor. */
|
||||
UNIV_INTERN os_event_t srv_monitor_event;
|
||||
|
||||
/** Event to signal the error thread */
|
||||
/** Event to signal the shutdown of srv_error_monitor_thread.
|
||||
Not protected by a mutex. */
|
||||
UNIV_INTERN os_event_t srv_error_event;
|
||||
|
||||
/** Event to signal the buffer pool dump/load thread */
|
||||
/** Event for waking up buf_dump_thread. Not protected by a mutex.
|
||||
Set on shutdown or by buf_dump_start() or buf_load_start(). */
|
||||
UNIV_INTERN os_event_t srv_buf_dump_event;
|
||||
|
||||
/** The buffer pool dump/load file name */
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -1235,7 +1236,7 @@ sync_thread_add_level(
|
||||
case SYNC_TRX_UNDO_PAGE:
|
||||
/* Purge is allowed to read in as many UNDO pages as it likes,
|
||||
there was a bogus rule here earlier that forced the caller to
|
||||
acquire the purge_sys_t::mutex. The purge mutex did not really
|
||||
acquire the trx_purge_t::mutex. The purge mutex did not really
|
||||
protect anything because it was only ever acquired by the
|
||||
single purge thread. The purge thread can read the UNDO pages
|
||||
without any covering mutex. */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -171,10 +172,6 @@ trx_purge_sys_close(void)
|
||||
|
||||
sess_close(purge_sys->sess);
|
||||
|
||||
purge_sys->sess = NULL;
|
||||
|
||||
purge_sys->view = NULL;
|
||||
|
||||
rw_lock_free(&purge_sys->latch);
|
||||
mutex_free(&purge_sys->bh_mutex);
|
||||
|
||||
@ -183,9 +180,6 @@ trx_purge_sys_close(void)
|
||||
ib_bh_free(purge_sys->ib_bh);
|
||||
|
||||
os_event_free(purge_sys->event);
|
||||
|
||||
purge_sys->event = NULL;
|
||||
|
||||
mem_free(purge_sys);
|
||||
|
||||
purge_sys = NULL;
|
||||
@ -1301,21 +1295,17 @@ void
|
||||
trx_purge_stop(void)
|
||||
/*================*/
|
||||
{
|
||||
purge_state_t state;
|
||||
ib_int64_t sig_count = os_event_reset(purge_sys->event);
|
||||
|
||||
ut_a(srv_n_purge_threads > 0);
|
||||
|
||||
rw_lock_x_lock(&purge_sys->latch);
|
||||
|
||||
ut_a(purge_sys->state != PURGE_STATE_INIT);
|
||||
ut_a(purge_sys->state != PURGE_STATE_EXIT);
|
||||
ut_a(purge_sys->state != PURGE_STATE_DISABLED);
|
||||
const ib_int64_t sig_count = os_event_reset(purge_sys->event);
|
||||
const purge_state_t state = purge_sys->state;
|
||||
|
||||
ut_a(state == PURGE_STATE_RUN || state == PURGE_STATE_STOP);
|
||||
|
||||
++purge_sys->n_stop;
|
||||
|
||||
state = purge_sys->state;
|
||||
|
||||
if (state == PURGE_STATE_RUN) {
|
||||
ib_logf(IB_LOG_LEVEL_INFO, "Stopping purge");
|
||||
|
||||
@ -1327,18 +1317,14 @@ trx_purge_stop(void)
|
||||
|
||||
purge_sys->state = PURGE_STATE_STOP;
|
||||
|
||||
rw_lock_x_unlock(&purge_sys->latch);
|
||||
|
||||
if (state != PURGE_STATE_STOP) {
|
||||
|
||||
rw_lock_x_unlock(&purge_sys->latch);
|
||||
/* Wait for purge coordinator to signal that it
|
||||
is suspended. */
|
||||
os_event_wait_low(purge_sys->event, sig_count);
|
||||
} else {
|
||||
bool once = true;
|
||||
|
||||
rw_lock_x_lock(&purge_sys->latch);
|
||||
|
||||
/* Wait for purge to signal that it has actually stopped. */
|
||||
while (purge_sys->running) {
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2011, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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,8 +53,8 @@ enum status_severity {
|
||||
|
||||
/* Flags that tell the buffer pool dump/load thread which action should it
|
||||
take after being waked up. */
|
||||
static ibool buf_dump_should_start = FALSE;
|
||||
static ibool buf_load_should_start = FALSE;
|
||||
static volatile bool buf_dump_should_start;
|
||||
static volatile bool buf_load_should_start;
|
||||
|
||||
static ibool buf_load_abort_flag = FALSE;
|
||||
|
||||
@ -78,7 +79,7 @@ void
|
||||
buf_dump_start()
|
||||
/*============*/
|
||||
{
|
||||
buf_dump_should_start = TRUE;
|
||||
buf_dump_should_start = true;
|
||||
os_event_set(srv_buf_dump_event);
|
||||
}
|
||||
|
||||
@ -92,7 +93,7 @@ void
|
||||
buf_load_start()
|
||||
/*============*/
|
||||
{
|
||||
buf_load_should_start = TRUE;
|
||||
buf_load_should_start = true;
|
||||
os_event_set(srv_buf_dump_event);
|
||||
}
|
||||
|
||||
@ -695,15 +696,18 @@ DECLARE_THREAD(buf_dump_thread)(
|
||||
os_event_wait(srv_buf_dump_event);
|
||||
|
||||
if (buf_dump_should_start) {
|
||||
buf_dump_should_start = FALSE;
|
||||
buf_dump_should_start = false;
|
||||
buf_dump(TRUE /* quit on shutdown */);
|
||||
}
|
||||
|
||||
if (buf_load_should_start) {
|
||||
buf_load_should_start = FALSE;
|
||||
buf_load_should_start = false;
|
||||
buf_load();
|
||||
}
|
||||
|
||||
if (buf_dump_should_start || buf_load_should_start) {
|
||||
continue;
|
||||
}
|
||||
os_event_reset(srv_buf_dump_event);
|
||||
}
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -720,9 +721,6 @@ buf_flush_write_complete(
|
||||
|
||||
buf_pool->n_flush[flush_type]--;
|
||||
|
||||
/* fprintf(stderr, "n pending flush %lu\n",
|
||||
buf_pool->n_flush[flush_type]); */
|
||||
|
||||
if (buf_pool->n_flush[flush_type] == 0
|
||||
&& buf_pool->init_flush[flush_type] == FALSE) {
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -39,8 +40,9 @@ Created Apr 25, 2012 Vasil Dimov
|
||||
|
||||
#define SHUTTING_DOWN() (srv_shutdown_state != SRV_SHUTDOWN_NONE)
|
||||
|
||||
/** Event to wake up the stats thread */
|
||||
UNIV_INTERN os_event_t dict_stats_event = NULL;
|
||||
/** Event to wake up dict_stats_thread on dict_stats_recalc_pool_add()
|
||||
or shutdown. Not protected by any mutex. */
|
||||
UNIV_INTERN os_event_t dict_stats_event;
|
||||
|
||||
/** This mutex protects the "recalc_pool" variable. */
|
||||
static ib_mutex_t recalc_pool_mutex;
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -1949,7 +1950,10 @@ struct buf_pool_t{
|
||||
os_event_t no_flush[BUF_FLUSH_N_TYPES];
|
||||
/*!< this is in the set state
|
||||
when there is no flush batch
|
||||
of the given type running */
|
||||
of the given type running;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by
|
||||
buf_pool_t::flush_state_mutex */
|
||||
ib_rbt_t* flush_rbt; /*!< a red-black tree is used
|
||||
exclusively during recovery to
|
||||
speed up insertions in the
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2014, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -134,11 +135,13 @@ struct buf_dblwr_t{
|
||||
ulint b_reserved;/*!< number of slots currently reserved
|
||||
for batch flush. */
|
||||
os_event_t b_event;/*!< event where threads wait for a
|
||||
batch flush to end. */
|
||||
batch flush to end;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by buf_dblwr_t::mutex */
|
||||
ulint s_reserved;/*!< number of slots currently
|
||||
reserved for single page flushes. */
|
||||
os_event_t s_event;/*!< event where threads wait for a
|
||||
single page flush slot. */
|
||||
single page flush slot. Protected by mutex. */
|
||||
bool* in_use; /*!< flag used to indicate if a slot is
|
||||
in use. Only used for single page
|
||||
flushes. */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -32,7 +33,8 @@ Created Apr 26, 2012 Vasil Dimov
|
||||
#include "os0sync.h" /* os_event_t */
|
||||
#include "os0thread.h" /* DECLARE_THREAD */
|
||||
|
||||
/** Event to wake up the stats thread */
|
||||
/** Event to wake up dict_stats_thread on dict_stats_recalc_pool_add()
|
||||
or shutdown. Not protected by any mutex. */
|
||||
extern os_event_t dict_stats_event;
|
||||
|
||||
/*****************************************************************//**
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -199,7 +200,9 @@ struct fil_node_t {
|
||||
ibool open; /*!< TRUE if file open */
|
||||
os_file_t handle; /*!< OS handle to the file, if file open */
|
||||
os_event_t sync_event;/*!< Condition event to group and
|
||||
serialize calls to fsync */
|
||||
serialize calls to fsync;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by fil_system_t::mutex */
|
||||
ibool is_raw_disk;/*!< TRUE if the 'file' is actually a raw
|
||||
device or a raw disk partition */
|
||||
ulint size; /*!< size of the file in database pages, 0 if
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2009, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
|
@ -126,7 +126,9 @@ struct fts_sync_t {
|
||||
bool in_progress; /*!< flag whether sync is in progress.*/
|
||||
bool unlock_cache; /*!< flag whether unlock cache when
|
||||
write fts node */
|
||||
os_event_t event; /*!< sync finish event */
|
||||
os_event_t event; /*!< sync finish event;
|
||||
only os_event_set() and os_event_wait()
|
||||
are used */
|
||||
};
|
||||
|
||||
/** The cache for the FTS system. It is a memory-based inverted index
|
||||
|
@ -931,7 +931,12 @@ struct lock_sys_t{
|
||||
srv_slot_t* waiting_threads; /*!< Array of user threads
|
||||
suspended while waiting for
|
||||
locks within InnoDB, protected
|
||||
by the lock_sys->wait_mutex */
|
||||
by the lock_sys->wait_mutex;
|
||||
os_event_set() and
|
||||
os_event_reset() on
|
||||
waiting_threads[]->event
|
||||
are protected by
|
||||
trx_t::mutex */
|
||||
srv_slot_t* last_slot; /*!< highest slot ever used
|
||||
in the waiting_threads array,
|
||||
protected by
|
||||
@ -944,10 +949,11 @@ struct lock_sys_t{
|
||||
|
||||
ulint n_lock_max_wait_time; /*!< Max wait time */
|
||||
|
||||
os_event_t timeout_event; /*!< Set to the event that is
|
||||
created in the lock wait monitor
|
||||
thread. A value of 0 means the
|
||||
thread is not active */
|
||||
os_event_t timeout_event; /*!< An event waited for by
|
||||
lock_wait_timeout_thread.
|
||||
Not protected by a mutex,
|
||||
but the waits are timed.
|
||||
Signaled on shutdown only. */
|
||||
|
||||
bool timeout_thread_active; /*!< True if the timeout thread
|
||||
is running */
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
|
||||
Copyright (c) 2009, Google Inc.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -924,10 +925,8 @@ struct log_t{
|
||||
be 'flush_or_write'! */
|
||||
os_event_t no_flush_event; /*!< this event is in the reset state
|
||||
when a flush or a write is running;
|
||||
a thread should wait for this without
|
||||
owning the log mutex, but NOTE that
|
||||
to set or reset this event, the
|
||||
thread MUST own the log mutex! */
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by log_sys_t::mutex */
|
||||
ibool one_flushed; /*!< during a flush, this is
|
||||
first FALSE and becomes TRUE
|
||||
when one log group has been
|
||||
@ -936,11 +935,9 @@ struct log_t{
|
||||
flush or write has not yet completed
|
||||
for any log group; e.g., this means
|
||||
that a transaction has been committed
|
||||
when this is set; a thread should wait
|
||||
for this without owning the log mutex,
|
||||
but NOTE that to set or reset this
|
||||
event, the thread MUST own the log
|
||||
mutex! */
|
||||
when this is set;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by log_sys_t::mutex */
|
||||
ulint n_log_ios; /*!< number of log i/os initiated thus
|
||||
far */
|
||||
ulint n_log_ios_old; /*!< number of log i/o's at the
|
||||
@ -1026,9 +1023,9 @@ struct log_t{
|
||||
byte* archive_buf_ptr;/*!< unaligned archived_buf */
|
||||
byte* archive_buf; /*!< log segment is written to the
|
||||
archive from this buffer */
|
||||
os_event_t archiving_on; /*!< if archiving has been stopped,
|
||||
a thread can wait for this event to
|
||||
become signaled */
|
||||
os_event_t archiving_on; /*!< if archiving has been stopped;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by log_sys_t::mutex */
|
||||
/* @} */
|
||||
#endif /* UNIV_LOG_ARCHIVE */
|
||||
lsn_t tracked_lsn; /*!< log tracking has advanced to this
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted
|
||||
by Percona Inc.. Those modifications are
|
||||
@ -1175,6 +1176,7 @@ UNIV_INTERN
|
||||
void
|
||||
os_aio_simulated_wake_handler_threads(void);
|
||||
/*=======================================*/
|
||||
#ifdef _WIN32
|
||||
/**********************************************************************//**
|
||||
This function can be called if one wants to post a batch of reads and
|
||||
prefers an i/o-handler thread to handle them all at once later. You must
|
||||
@ -1182,8 +1184,10 @@ call os_aio_simulated_wake_handler_threads later to ensure the threads
|
||||
are not left sleeping! */
|
||||
UNIV_INTERN
|
||||
void
|
||||
os_aio_simulated_put_read_threads_to_sleep(void);
|
||||
/*============================================*/
|
||||
os_aio_simulated_put_read_threads_to_sleep();
|
||||
#else /* _WIN32 */
|
||||
# define os_aio_simulated_put_read_threads_to_sleep()
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#ifdef WIN_ASYNC_IO
|
||||
/**********************************************************************//**
|
||||
|
@ -152,13 +152,16 @@ extern const char* srv_main_thread_op_info;
|
||||
/** Prefix used by MySQL to indicate pre-5.1 table name encoding */
|
||||
extern const char srv_mysql50_table_name_prefix[10];
|
||||
|
||||
/* The monitor thread waits on this event. */
|
||||
/** Event to signal srv_monitor_thread. Not protected by a mutex.
|
||||
Set after setting srv_print_innodb_monitor. */
|
||||
extern os_event_t srv_monitor_event;
|
||||
|
||||
/* The error monitor thread waits on this event. */
|
||||
/** Event to signal the shutdown of srv_error_monitor_thread.
|
||||
Not protected by a mutex. */
|
||||
extern os_event_t srv_error_event;
|
||||
|
||||
/** The buffer pool dump/load thread waits on this event. */
|
||||
/** Event for waking up buf_dump_thread. Not protected by a mutex.
|
||||
Set on shutdown or by buf_dump_start() or buf_load_start(). */
|
||||
extern os_event_t srv_buf_dump_event;
|
||||
|
||||
/** The buffer pool dump/load file name */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -145,7 +146,10 @@ struct trx_purge_t{
|
||||
log operation can prevent this by
|
||||
obtaining an s-latch here. It also
|
||||
protects state and running */
|
||||
os_event_t event; /*!< State signal event */
|
||||
os_event_t event; /*!< State signal event;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by trx_purge_t::latch
|
||||
X-lock */
|
||||
ulint n_stop; /*!< Counter to track number stops */
|
||||
volatile bool running; /*!< true, if purge is active,
|
||||
we check this without the latch too */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2006, 2009, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -99,7 +100,9 @@ ib_wqueue_timedwait(
|
||||
struct ib_wqueue_t {
|
||||
ib_mutex_t mutex; /*!< mutex protecting everything */
|
||||
ib_list_t* items; /*!< work item list */
|
||||
os_event_t event; /*!< event we use to signal additions to list */
|
||||
os_event_t event; /*!< event we use to signal additions to list;
|
||||
os_event_set() and os_event_reset() are
|
||||
protected by ib_wqueue_t::mutex */
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -3506,7 +3506,6 @@ logs_empty_and_mark_files_at_shutdown(void)
|
||||
lsn_t lsn;
|
||||
lsn_t tracked_lsn;
|
||||
ulint count = 0;
|
||||
ulint total_trx;
|
||||
ulint pending_io;
|
||||
enum srv_thread_type active_thd;
|
||||
const char* thread_name;
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2009, Percona Inc.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted
|
||||
by Percona Inc.. Those modifications are
|
||||
@ -209,11 +210,15 @@ struct os_aio_array_t{
|
||||
os_event_t not_full;
|
||||
/*!< The event which is set to the
|
||||
signaled state when there is space in
|
||||
the aio outside the ibuf segment */
|
||||
the aio outside the ibuf segment;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by os_aio_array_t::mutex */
|
||||
os_event_t is_empty;
|
||||
/*!< The event which is set to the
|
||||
signaled state when there are no
|
||||
pending i/os in this array */
|
||||
pending i/os in this array;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by os_aio_array_t::mutex */
|
||||
ulint n_slots;/*!< Total number of slots in the aio
|
||||
array. This must be divisible by
|
||||
n_threads. */
|
||||
@ -255,8 +260,8 @@ struct os_aio_array_t{
|
||||
#define OS_AIO_IO_SETUP_RETRY_ATTEMPTS 5
|
||||
#endif
|
||||
|
||||
/** Array of events used in simulated aio */
|
||||
static os_event_t* os_aio_segment_wait_events = NULL;
|
||||
/** Array of events used in simulated aio. */
|
||||
static os_event_t* os_aio_segment_wait_events;
|
||||
|
||||
/** The aio arrays for non-ibuf i/o and ibuf i/o, as well as sync aio. These
|
||||
are NULL when the module has not yet been initialized. @{ */
|
||||
@ -4216,13 +4221,6 @@ os_aio_init(
|
||||
|
||||
os_aio_validate();
|
||||
|
||||
os_aio_segment_wait_events = static_cast<os_event_t*>(
|
||||
ut_malloc(n_segments * sizeof *os_aio_segment_wait_events));
|
||||
|
||||
for (ulint i = 0; i < n_segments; ++i) {
|
||||
os_aio_segment_wait_events[i] = os_event_create();
|
||||
}
|
||||
|
||||
os_last_printout = ut_time();
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -4232,8 +4230,18 @@ os_aio_init(
|
||||
ut_a(completion_port && read_completion_port);
|
||||
#endif
|
||||
|
||||
return(TRUE);
|
||||
if (srv_use_native_aio) {
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
os_aio_segment_wait_events = static_cast<os_event_t*>(
|
||||
ut_malloc(n_segments * sizeof *os_aio_segment_wait_events));
|
||||
|
||||
for (ulint i = 0; i < n_segments; ++i) {
|
||||
os_aio_segment_wait_events[i] = os_event_create();
|
||||
}
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
@ -4261,8 +4269,10 @@ os_aio_free(void)
|
||||
|
||||
os_aio_array_free(os_aio_read_array);
|
||||
|
||||
for (ulint i = 0; i < os_aio_n_segments; i++) {
|
||||
os_event_free(os_aio_segment_wait_events[i]);
|
||||
if (!srv_use_native_aio) {
|
||||
for (ulint i = 0; i < os_aio_n_segments; i++) {
|
||||
os_event_free(os_aio_segment_wait_events[i]);
|
||||
}
|
||||
}
|
||||
|
||||
#if !defined(HAVE_ATOMIC_BUILTINS) || UNIV_WORD_SIZE < 8
|
||||
@ -4322,22 +4332,17 @@ os_aio_wake_all_threads_at_shutdown(void)
|
||||
if (os_aio_log_array != 0) {
|
||||
os_aio_array_wake_win_aio_at_shutdown(os_aio_log_array);
|
||||
}
|
||||
|
||||
#elif defined(LINUX_NATIVE_AIO)
|
||||
|
||||
/* When using native AIO interface the io helper threads
|
||||
wait on io_getevents with a timeout value of 500ms. At
|
||||
each wake up these threads check the server status.
|
||||
No need to do anything to wake them up. */
|
||||
#endif /* !WIN_ASYNC_AIO */
|
||||
|
||||
if (srv_use_native_aio) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Fall through to simulated AIO handler wakeup if we are
|
||||
not using native AIO. */
|
||||
#endif /* !WIN_ASYNC_AIO */
|
||||
|
||||
/* This loop wakes up all simulated ai/o threads */
|
||||
|
||||
for (ulint i = 0; i < os_aio_n_segments; i++) {
|
||||
@ -4705,6 +4710,7 @@ os_aio_simulated_wake_handler_threads(void)
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
/**********************************************************************//**
|
||||
This function can be called if one wants to post a batch of reads and
|
||||
prefers an i/o-handler thread to handle them all at once later. You must
|
||||
@ -4712,15 +4718,14 @@ call os_aio_simulated_wake_handler_threads later to ensure the threads
|
||||
are not left sleeping! */
|
||||
UNIV_INTERN
|
||||
void
|
||||
os_aio_simulated_put_read_threads_to_sleep(void)
|
||||
/*============================================*/
|
||||
os_aio_simulated_put_read_threads_to_sleep()
|
||||
{
|
||||
|
||||
/* The idea of putting background IO threads to sleep is only for
|
||||
Windows when using simulated AIO. Windows XP seems to schedule
|
||||
background threads too eagerly to allow for coalescing during
|
||||
readahead requests. */
|
||||
#ifdef __WIN__
|
||||
|
||||
os_aio_array_t* array;
|
||||
|
||||
if (srv_use_native_aio) {
|
||||
@ -4739,8 +4744,8 @@ readahead requests. */
|
||||
os_event_reset(os_aio_segment_wait_events[i]);
|
||||
}
|
||||
}
|
||||
#endif /* __WIN__ */
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#if defined(LINUX_NATIVE_AIO)
|
||||
/*******************************************************************//**
|
||||
@ -5910,11 +5915,12 @@ os_aio_print(
|
||||
srv_io_thread_op_info[i],
|
||||
srv_io_thread_function[i]);
|
||||
|
||||
#ifndef __WIN__
|
||||
if (os_aio_segment_wait_events[i]->is_set()) {
|
||||
#ifndef _WIN32
|
||||
if (!srv_use_native_aio
|
||||
&& os_aio_segment_wait_events[i]->is_set()) {
|
||||
fprintf(file, " ev set");
|
||||
}
|
||||
#endif /* __WIN__ */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
fprintf(file, "\n");
|
||||
}
|
||||
|
@ -623,7 +623,6 @@ fts_parallel_tokenization(
|
||||
mem_heap_t* blob_heap = NULL;
|
||||
fts_doc_t doc;
|
||||
dict_table_t* table = psort_info->psort_common->new_table;
|
||||
dict_field_t* idx_field;
|
||||
fts_tokenize_ctx_t t_ctx;
|
||||
ulint retried = 0;
|
||||
dberr_t error = DB_SUCCESS;
|
||||
@ -645,9 +644,6 @@ fts_parallel_tokenization(
|
||||
doc.charset = fts_index_get_charset(
|
||||
psort_info->psort_common->dup->index);
|
||||
|
||||
idx_field = dict_index_get_nth_field(
|
||||
psort_info->psort_common->dup->index, 0);
|
||||
|
||||
block = psort_info->merge_block;
|
||||
zip_size = dict_table_zip_size(table);
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2011, 2012, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -78,7 +79,9 @@ typedef UT_LIST_NODE_T(struct srv_conc_slot_t) srv_conc_node_t;
|
||||
|
||||
/** Slot for a thread waiting in the concurrency control queue. */
|
||||
struct srv_conc_slot_t{
|
||||
os_event_t event; /*!< event to wait */
|
||||
os_event_t event; /*!< event to wait for;
|
||||
os_event_set() and os_event_reset()
|
||||
are protected by srv_conc_mutex */
|
||||
ibool reserved; /*!< TRUE if slot
|
||||
reserved */
|
||||
ibool wait_ended; /*!< TRUE when another thread has
|
||||
@ -345,11 +348,11 @@ srv_conc_exit_innodb_without_atomics(
|
||||
}
|
||||
}
|
||||
|
||||
os_fast_mutex_unlock(&srv_conc_mutex);
|
||||
|
||||
if (slot != NULL) {
|
||||
os_event_set(slot->event);
|
||||
}
|
||||
|
||||
os_fast_mutex_unlock(&srv_conc_mutex);
|
||||
}
|
||||
|
||||
/*********************************************************************//**
|
||||
|
@ -728,7 +728,11 @@ struct srv_sys_t{
|
||||
ulint n_sys_threads; /*!< size of the sys_threads
|
||||
array */
|
||||
|
||||
srv_slot_t* sys_threads; /*!< server thread table */
|
||||
srv_slot_t* sys_threads; /*!< server thread table;
|
||||
os_event_set() and
|
||||
os_event_reset() on
|
||||
sys_threads[]->event are
|
||||
covered by srv_sys_t::mutex */
|
||||
|
||||
ulint n_threads_active[SRV_MASTER + 1];
|
||||
/*!< number of threads active
|
||||
@ -750,13 +754,16 @@ UNIV_INTERN ib_mutex_t server_mutex;
|
||||
|
||||
static srv_sys_t* srv_sys = NULL;
|
||||
|
||||
/** Event to signal the monitor thread. */
|
||||
/** Event to signal srv_monitor_thread. Not protected by a mutex.
|
||||
Set after setting srv_print_innodb_monitor. */
|
||||
UNIV_INTERN os_event_t srv_monitor_event;
|
||||
|
||||
/** Event to signal the error thread */
|
||||
/** Event to signal the shutdown of srv_error_monitor_thread.
|
||||
Not protected by a mutex. */
|
||||
UNIV_INTERN os_event_t srv_error_event;
|
||||
|
||||
/** Event to signal the buffer pool dump/load thread */
|
||||
/** Event for waking up buf_dump_thread. Not protected by a mutex.
|
||||
Set on shutdown or by buf_dump_start() or buf_load_start(). */
|
||||
UNIV_INTERN os_event_t srv_buf_dump_event;
|
||||
|
||||
/** The buffer pool dump/load file name */
|
||||
|
@ -2,6 +2,7 @@
|
||||
|
||||
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2008, Google Inc.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
Portions of this file contain modifications contributed and copyrighted by
|
||||
Google, Inc. Those modifications are gratefully acknowledged and are described
|
||||
@ -1349,7 +1350,7 @@ sync_thread_add_level(
|
||||
case SYNC_TRX_UNDO_PAGE:
|
||||
/* Purge is allowed to read in as many UNDO pages as it likes,
|
||||
there was a bogus rule here earlier that forced the caller to
|
||||
acquire the purge_sys_t::mutex. The purge mutex did not really
|
||||
acquire the trx_purge_t::mutex. The purge mutex did not really
|
||||
protect anything because it was only ever acquired by the
|
||||
single purge thread. The purge thread can read the UNDO pages
|
||||
without any covering mutex. */
|
||||
|
@ -1,6 +1,7 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
|
||||
|
||||
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
|
||||
@ -172,13 +173,9 @@ trx_purge_sys_close(void)
|
||||
|
||||
sess_close(purge_sys->sess);
|
||||
|
||||
purge_sys->sess = NULL;
|
||||
|
||||
read_view_free(purge_sys->prebuilt_view);
|
||||
read_view_free(purge_sys->prebuilt_clone);
|
||||
|
||||
purge_sys->view = NULL;
|
||||
|
||||
rw_lock_free(&purge_sys->latch);
|
||||
mutex_free(&purge_sys->bh_mutex);
|
||||
|
||||
@ -187,9 +184,6 @@ trx_purge_sys_close(void)
|
||||
ib_bh_free(purge_sys->ib_bh);
|
||||
|
||||
os_event_free(purge_sys->event);
|
||||
|
||||
purge_sys->event = NULL;
|
||||
|
||||
mem_free(purge_sys);
|
||||
|
||||
purge_sys = NULL;
|
||||
@ -1306,21 +1300,17 @@ void
|
||||
trx_purge_stop(void)
|
||||
/*================*/
|
||||
{
|
||||
purge_state_t state;
|
||||
ib_int64_t sig_count = os_event_reset(purge_sys->event);
|
||||
|
||||
ut_a(srv_n_purge_threads > 0);
|
||||
|
||||
rw_lock_x_lock(&purge_sys->latch);
|
||||
|
||||
ut_a(purge_sys->state != PURGE_STATE_INIT);
|
||||
ut_a(purge_sys->state != PURGE_STATE_EXIT);
|
||||
ut_a(purge_sys->state != PURGE_STATE_DISABLED);
|
||||
const ib_int64_t sig_count = os_event_reset(purge_sys->event);
|
||||
const purge_state_t state = purge_sys->state;
|
||||
|
||||
ut_a(state == PURGE_STATE_RUN || state == PURGE_STATE_STOP);
|
||||
|
||||
++purge_sys->n_stop;
|
||||
|
||||
state = purge_sys->state;
|
||||
|
||||
if (state == PURGE_STATE_RUN) {
|
||||
ib_logf(IB_LOG_LEVEL_INFO, "Stopping purge");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user