Merge 10.0 into 10.1

This commit is contained in:
Marko Mäkelä 2017-02-20 14:02:40 +02:00
commit 3c47ed4849
49 changed files with 293 additions and 236 deletions

View file

@ -1032,7 +1032,7 @@ sub print_global_resfile {
resfile_global("gprof", $opt_gprof ? 1 : 0);
resfile_global("valgrind", $opt_valgrind ? 1 : 0);
resfile_global("callgrind", $opt_callgrind ? 1 : 0);
resfile_global("mem", $opt_mem ? 1 : 0);
resfile_global("mem", $opt_mem);
resfile_global("tmpdir", $opt_tmpdir);
resfile_global("vardir", $opt_vardir);
resfile_global("fast", $opt_fast ? 1 : 0);
@ -1170,7 +1170,7 @@ sub command_line_setup {
# Directories
'tmpdir=s' => \$opt_tmpdir,
'vardir=s' => \$opt_vardir,
'mem' => \$opt_mem,
'mem:s' => \$opt_mem,
'clean-vardir' => \$opt_clean_vardir,
'client-bindir=s' => \$path_client_bindir,
'client-libdir=s' => \$path_client_libdir,
@ -1428,12 +1428,17 @@ sub command_line_setup {
# Search through list of locations that are known
# to be "fast disks" to find a suitable location
# Use --mem=<dir> as first location to look.
my @tmpfs_locations= ($opt_mem,"/run/shm", "/dev/shm", "/tmp");
my @tmpfs_locations= ("/run/shm", "/dev/shm", "/tmp");
# Use $ENV{'MTR_MEM'} as first location to look (if defined)
unshift(@tmpfs_locations, $ENV{'MTR_MEM'}) if defined $ENV{'MTR_MEM'};
# however if the opt_mem was given a value, use this first
unshift(@tmpfs_locations, $opt_mem) if $opt_mem ne '';
foreach my $fs (@tmpfs_locations)
{
if ( -d $fs )
if ( -d $fs && ! -l $fs )
{
my $template= "var_${opt_build_thread}_XXXX";
$opt_mem= tempdir( $template, DIR => $fs, CLEANUP => 0);
@ -4372,11 +4377,9 @@ sub extract_warning_lines ($$) {
qr/InnoDB: Error: table `test`.`t[12]` .*does not exist in the InnoDB internal/,
qr/InnoDB: Warning: Setting innodb_use_sys_malloc/,
qr/InnoDB: Warning: a long semaphore wait:/,
qr/InnoDB: Disabling redo log encryption/,
qr/InnoDB: Redo log crypto: Can't initialize to key version -1u/,
qr/InnoDB: Dumping buffer pool.*/,
qr/InnoDB: Buffer pool.*/,
qr/InnoDB: Warning: Writer thread is waiting this semaphore/,
qr/InnoDB: Warning: Writer thread is waiting this semaphore:/,
qr/Slave: Unknown table 't1' .* 1051/,
qr/Slave SQL:.*(Internal MariaDB error code: [[:digit:]]+|Query:.*)/,
qr/slave SQL thread aborted/,
@ -6000,9 +6003,9 @@ Options to control directories to use
vardir=DIR The directory where files generated from the test run
is stored (default: ./var). Specifying a ramdisk or
tmpfs will speed up tests.
mem Run testsuite in "memory" using tmpfs or ramdisk
Attempts to find a suitable location
using a builtin list of standard locations
mem[=DIR] Run testsuite in "memory" using tmpfs or ramdisk
Attempts to use DIR first if specified else
uses a builtin list of standard locations
for tmpfs (/run/shm, /dev/shm, /tmp)
The option can also be set using environment
variable MTR_MEM=[DIR]

View file

@ -1,7 +1,4 @@
drop table if exists t1;
call mtr.add_suppression("option 'innodb-purge-threads': unsigned value 0 adjusted to*");
set global innodb_stats_persistent = false;
CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
set global innodb_limit_optimistic_insert_debug = 2;
insert into t1 values (1);
insert into t1 values (5);

View file

@ -1 +0,0 @@
--loose-innodb-purge-threads=0

View file

@ -10,20 +10,12 @@ if (`select count(*)=0 from information_schema.global_variables where variable_n
--disable_query_log
set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug;
set @old_innodb_stats_persistent = @@innodb_stats_persistent;
set @old_innodb_undo_logs = @@innodb_undo_logs;
# Limit undo segments for stable progress of purge.
set global innodb_undo_logs = 1;
--enable_query_log
--disable_warnings
drop table if exists t1;
--enable_warnings
call mtr.add_suppression("option 'innodb-purge-threads': unsigned value 0 adjusted to*");
set global innodb_stats_persistent = false;
CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
#
# make 4 leveled straight tree
@ -139,6 +131,5 @@ drop table t1;
--disable_query_log
set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug;
set global innodb_stats_persistent = @old_innodb_stats_persistent;
set global innodb_undo_logs = @old_innodb_undo_logs;
--enable_query_log

View file

@ -1,7 +1,6 @@
include/master-slave.inc
[connection master]
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
include/stop_slave.inc
SET sql_log_bin= 0;
@ -22,6 +21,7 @@ INSERT INTO t2 VALUE (4, 1);
INSERT INTO t2 VALUE (5, 1);
INSERT INTO t1 SELECT * FROM t2;
DROP TEMPORARY TABLE t2;
INSERT INTO t1 VALUE (6, 3);
include/save_master_gtid.inc
Contents on master:
SELECT * FROM t1 ORDER BY a;
@ -31,6 +31,7 @@ a b
3 1
4 1
5 1
6 3
START SLAVE;
include/wait_for_slave_sql_error.inc [errno=1062]
STOP SLAVE IO_THREAD;
@ -51,6 +52,7 @@ a b
3 1
4 1
5 1
6 3
DROP TABLE t1;
include/stop_slave.inc
SET GLOBAL slave_parallel_threads= @old_parallel;

View file

@ -2,9 +2,7 @@
--source include/master-slave.inc
--connection master
# ToDo: Remove this FLUSH LOGS when MDEV-6403 is fixed.
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
--sync_slave_with_master
@ -31,6 +29,7 @@ INSERT INTO t2 VALUE (4, 1);
INSERT INTO t2 VALUE (5, 1);
INSERT INTO t1 SELECT * FROM t2;
DROP TEMPORARY TABLE t2;
INSERT INTO t1 VALUE (6, 3);
--source include/save_master_gtid.inc
--echo Contents on master:
SELECT * FROM t1 ORDER BY a;

View file

@ -53,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;
@ -79,7 +79,7 @@ void
buf_dump_start()
/*============*/
{
buf_dump_should_start = TRUE;
buf_dump_should_start = true;
os_event_set(srv_buf_dump_event);
}
@ -93,7 +93,7 @@ void
buf_load_start()
/*============*/
{
buf_load_should_start = TRUE;
buf_load_should_start = true;
os_event_set(srv_buf_dump_event);
}
@ -699,15 +699,18 @@ DECLARE_THREAD(buf_dump_thread)(void*)
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);
}

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates
Copyright (c) 2013, 2016, MariaDB Corporation
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under
@ -679,10 +679,7 @@ buf_flush_write_complete(
flush_type = buf_page_get_flush_type(bpage);
buf_pool->n_flush[flush_type]--;
#ifdef UNIV_DEBUG
/* fprintf(stderr, "n pending flush %lu\n",
buf_pool->n_flush[flush_type]); */
#endif
ut_ad(buf_pool_mutex_own(buf_pool));
if (buf_pool->n_flush[flush_type] == 0
&& buf_pool->init_flush[flush_type] == FALSE) {

View file

@ -41,8 +41,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;

View file

@ -2808,6 +2808,7 @@ try_again:
}
} else {
ut_a(alloc_type == FSP_CLEANING);
reserve = 0;
}
success = fil_space_reserve_free_extents(space, n_free, n_ext);

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2017, MariaDB Corporation.
Copyright (c) 2013, 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
@ -2199,7 +2199,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

View file

@ -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. */

View file

@ -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;
/*****************************************************************//**

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates.
Copyright (c) 2013, 2017, MariaDB Corporation.
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 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
@ -226,7 +226,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

View file

@ -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

View file

@ -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

View file

@ -947,7 +947,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
@ -960,10 +965,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 */

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2009, Google Inc.
Copyright (c) 2017, MariaDB Corporation
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
@ -883,10 +883,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
@ -895,11 +893,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
@ -984,9 +980,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 */
};

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@ -1169,6 +1169,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
@ -1176,8 +1177,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
/**********************************************************************//**

View file

@ -192,13 +192,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 */

View file

@ -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 */

View file

@ -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
@ -116,7 +117,9 @@ ib_wqueue_len(
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

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2016, MariaDB Corporation.
Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@ -249,11 +249,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. */
@ -304,8 +308,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. @{ */
@ -4258,6 +4262,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));
@ -4265,10 +4275,7 @@ os_aio_init(
os_aio_segment_wait_events[i] = os_event_create();
}
os_last_printout = ut_time();
return(TRUE);
}
/***********************************************************************
@ -4296,8 +4303,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);
@ -4346,22 +4355,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++) {
@ -4745,6 +4749,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
@ -4752,15 +4757,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) {
@ -4779,8 +4783,8 @@ readahead requests. */
os_event_reset(os_aio_segment_wait_events[i]);
}
}
#endif /* __WIN__ */
}
#endif /* _WIN32 */
#if defined(LINUX_NATIVE_AIO)
/*******************************************************************//**
@ -6035,11 +6039,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");
}

View file

@ -665,7 +665,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;
@ -688,9 +687,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;
crypt_block = psort_info->crypt_block;
crypt_data = psort_info->psort_common->crypt_data;

View file

@ -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
@ -372,11 +375,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);
}
/*********************************************************************//**

View file

@ -650,7 +650,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
@ -668,13 +672,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 */

View file

@ -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
@ -1254,7 +1255,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. */

View file

@ -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;
@ -1300,21 +1294,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");
@ -1326,33 +1316,29 @@ 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;
} 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) {
/* Wait for purge to signal that it has actually stopped. */
while (purge_sys->running) {
if (once) {
if (once) {
ib_logf(IB_LOG_LEVEL_INFO,
"Waiting for purge to stop");
once = false;
once = false;
}
rw_lock_x_unlock(&purge_sys->latch);
os_thread_sleep(10000);
os_thread_sleep(10000);
rw_lock_x_lock(&purge_sys->latch);
}
}
rw_lock_x_unlock(&purge_sys->latch);
}

View file

@ -53,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;
@ -79,7 +79,7 @@ void
buf_dump_start()
/*============*/
{
buf_dump_should_start = TRUE;
buf_dump_should_start = true;
os_event_set(srv_buf_dump_event);
}
@ -93,7 +93,7 @@ void
buf_load_start()
/*============*/
{
buf_load_should_start = TRUE;
buf_load_should_start = true;
os_event_set(srv_buf_dump_event);
}
@ -699,15 +699,18 @@ DECLARE_THREAD(buf_dump_thread)(void*)
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);
}

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates
Copyright (c) 2013, 2016, MariaDB
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under

View file

@ -41,8 +41,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;

View file

@ -2817,6 +2817,7 @@ try_again:
}
} else {
ut_a(alloc_type == FSP_CLEANING);
reserve = 0;
}
success = fil_space_reserve_free_extents(space, n_free, n_ext);

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2017, MariaDB Corporation.
Copyright (c) 2013, 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
@ -2112,7 +2112,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

View file

@ -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. */

View file

@ -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;
/*****************************************************************//**

View file

@ -1,7 +1,7 @@
/*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2017, MariaDB Corporation.
Copyright (c) 2013, 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
@ -219,7 +219,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

View file

@ -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

View file

@ -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

View file

@ -962,7 +962,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
@ -975,10 +980,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 */

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2009, Google Inc.
Copyright (c) 2017, MariaDB Corporation
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
@ -934,10 +934,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
@ -946,11 +944,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
@ -1036,9 +1032,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

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2015, MariaDB Corporation.
Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@ -1203,6 +1203,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
@ -1210,8 +1211,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
/**********************************************************************//**

View file

@ -199,13 +199,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 */

View file

@ -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 */

View file

@ -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
@ -116,7 +117,9 @@ ib_wqueue_len(
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

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc.
Copyright (c) 2013, 2016, MariaDB Corporation.
Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are
@ -258,11 +258,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. */
@ -304,8 +308,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. @{ */
@ -4435,13 +4439,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
@ -4451,8 +4448,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);
}
/***********************************************************************
@ -4480,8 +4487,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
@ -4541,22 +4550,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++) {
@ -4939,6 +4943,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
@ -4946,15 +4951,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) {
@ -4973,8 +4977,8 @@ readahead requests. */
os_event_reset(os_aio_segment_wait_events[i]);
}
}
#endif /* __WIN__ */
}
#endif /* _WIN32 */
#if defined(LINUX_NATIVE_AIO)
/*******************************************************************//**
@ -6178,11 +6182,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");
}

View file

@ -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
@ -79,7 +80,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
@ -378,11 +381,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);
}
/*********************************************************************//**

View file

@ -795,7 +795,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
@ -817,13 +821,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 */

View file

@ -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
@ -1363,7 +1364,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. */

View file

@ -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;
@ -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");