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

View file

@ -1,7 +1,4 @@
drop table if exists t1; CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
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;
set global innodb_limit_optimistic_insert_debug = 2; set global innodb_limit_optimistic_insert_debug = 2;
insert into t1 values (1); insert into t1 values (1);
insert into t1 values (5); 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 --disable_query_log
set @old_innodb_limit_optimistic_insert_debug = @@innodb_limit_optimistic_insert_debug; 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; set @old_innodb_undo_logs = @@innodb_undo_logs;
# Limit undo segments for stable progress of purge. # Limit undo segments for stable progress of purge.
set global innodb_undo_logs = 1; set global innodb_undo_logs = 1;
--enable_query_log --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*"); CREATE TABLE t1 (a INT PRIMARY KEY) ENGINE=InnoDB STATS_PERSISTENT=0;
set global innodb_stats_persistent = false;
CREATE TABLE t1 (a int not null primary key) engine=InnoDB;
# #
# make 4 leveled straight tree # make 4 leveled straight tree
@ -139,6 +131,5 @@ drop table t1;
--disable_query_log --disable_query_log
set global innodb_limit_optimistic_insert_debug = @old_innodb_limit_optimistic_insert_debug; 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; set global innodb_undo_logs = @old_innodb_undo_logs;
--enable_query_log --enable_query_log

View file

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

View file

@ -2,9 +2,7 @@
--source include/master-slave.inc --source include/master-slave.inc
--connection master --connection master
# ToDo: Remove this FLUSH LOGS when MDEV-6403 is fixed.
ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB; ALTER TABLE mysql.gtid_slave_pos ENGINE = InnoDB;
FLUSH LOGS;
CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB; CREATE TABLE t1 (a INT PRIMARY KEY, b INT) Engine=InnoDB;
--sync_slave_with_master --sync_slave_with_master
@ -31,6 +29,7 @@ INSERT INTO t2 VALUE (4, 1);
INSERT INTO t2 VALUE (5, 1); INSERT INTO t2 VALUE (5, 1);
INSERT INTO t1 SELECT * FROM t2; INSERT INTO t1 SELECT * FROM t2;
DROP TEMPORARY TABLE t2; DROP TEMPORARY TABLE t2;
INSERT INTO t1 VALUE (6, 3);
--source include/save_master_gtid.inc --source include/save_master_gtid.inc
--echo Contents on master: --echo Contents on master:
SELECT * FROM t1 ORDER BY a; 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 /* Flags that tell the buffer pool dump/load thread which action should it
take after being waked up. */ take after being waked up. */
static ibool buf_dump_should_start = FALSE; static volatile bool buf_dump_should_start;
static ibool buf_load_should_start = FALSE; static volatile bool buf_load_should_start;
static ibool buf_load_abort_flag = FALSE; static ibool buf_load_abort_flag = FALSE;
@ -79,7 +79,7 @@ void
buf_dump_start() buf_dump_start()
/*============*/ /*============*/
{ {
buf_dump_should_start = TRUE; buf_dump_should_start = true;
os_event_set(srv_buf_dump_event); os_event_set(srv_buf_dump_event);
} }
@ -93,7 +93,7 @@ void
buf_load_start() buf_load_start()
/*============*/ /*============*/
{ {
buf_load_should_start = TRUE; buf_load_should_start = true;
os_event_set(srv_buf_dump_event); os_event_set(srv_buf_dump_event);
} }
@ -699,15 +699,18 @@ DECLARE_THREAD(buf_dump_thread)(void*)
os_event_wait(srv_buf_dump_event); os_event_wait(srv_buf_dump_event);
if (buf_dump_should_start) { if (buf_dump_should_start) {
buf_dump_should_start = FALSE; buf_dump_should_start = false;
buf_dump(TRUE /* quit on shutdown */); buf_dump(TRUE /* quit on shutdown */);
} }
if (buf_load_should_start) { if (buf_load_should_start) {
buf_load_should_start = FALSE; buf_load_should_start = false;
buf_load(); buf_load();
} }
if (buf_dump_should_start || buf_load_should_start) {
continue;
}
os_event_reset(srv_buf_dump_event); os_event_reset(srv_buf_dump_event);
} }

View file

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2016, MariaDB Corporation Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2013, 2014, Fusion-io Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under 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); flush_type = buf_page_get_flush_type(bpage);
buf_pool->n_flush[flush_type]--; buf_pool->n_flush[flush_type]--;
#ifdef UNIV_DEBUG ut_ad(buf_pool_mutex_own(buf_pool));
/* fprintf(stderr, "n pending flush %lu\n",
buf_pool->n_flush[flush_type]); */
#endif
if (buf_pool->n_flush[flush_type] == 0 if (buf_pool->n_flush[flush_type] == 0
&& buf_pool->init_flush[flush_type] == FALSE) { && 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) #define SHUTTING_DOWN() (srv_shutdown_state != SRV_SHUTDOWN_NONE)
/** Event to wake up the stats thread */ /** Event to wake up dict_stats_thread on dict_stats_recalc_pool_add()
UNIV_INTERN os_event_t dict_stats_event = NULL; or shutdown. Not protected by any mutex. */
UNIV_INTERN os_event_t dict_stats_event;
/** This mutex protects the "recalc_pool" variable. */ /** This mutex protects the "recalc_pool" variable. */
static ib_mutex_t recalc_pool_mutex; static ib_mutex_t recalc_pool_mutex;

View file

@ -2808,6 +2808,7 @@ try_again:
} }
} else { } else {
ut_a(alloc_type == FSP_CLEANING); ut_a(alloc_type == FSP_CLEANING);
reserve = 0;
} }
success = fil_space_reserve_free_extents(space, n_free, n_ext); 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) 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 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 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]; os_event_t no_flush[BUF_FLUSH_N_TYPES];
/*!< this is in the set state /*!< this is in the set state
when there is no flush batch 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 ib_rbt_t* flush_rbt; /*!< a red-black tree is used
exclusively during recovery to exclusively during recovery to
speed up insertions in the 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) 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 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 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 ulint b_reserved;/*!< number of slots currently reserved
for batch flush. */ for batch flush. */
os_event_t b_event;/*!< event where threads wait for a 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 ulint s_reserved;/*!< number of slots currently
reserved for single page flushes. */ reserved for single page flushes. */
os_event_t s_event;/*!< event where threads wait for a 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 bool* in_use; /*!< flag used to indicate if a slot is
in use. Only used for single page in use. Only used for single page
flushes. */ flushes. */

View file

@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 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 "os0sync.h" /* os_event_t */
#include "os0thread.h" /* DECLARE_THREAD */ #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; extern os_event_t dict_stats_event;
/*****************************************************************//** /*****************************************************************//**

View file

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates. 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 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 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 */ ibool open; /*!< TRUE if file open */
os_file_t handle; /*!< OS handle to the file, 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 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 ibool is_raw_disk;/*!< TRUE if the 'file' is actually a raw
device or a raw disk partition */ device or a raw disk partition */
ulint size; /*!< size of the file in database pages, 0 if 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) 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 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 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 in_progress; /*!< flag whether sync is in progress.*/
bool unlock_cache; /*!< flag whether unlock cache when bool unlock_cache; /*!< flag whether unlock cache when
write fts node */ 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 /** 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 srv_slot_t* waiting_threads; /*!< Array of user threads
suspended while waiting for suspended while waiting for
locks within InnoDB, protected 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 srv_slot_t* last_slot; /*!< highest slot ever used
in the waiting_threads array, in the waiting_threads array,
protected by protected by
@ -960,10 +965,11 @@ struct lock_sys_t{
ulint n_lock_max_wait_time; /*!< Max wait time */ ulint n_lock_max_wait_time; /*!< Max wait time */
os_event_t timeout_event; /*!< Set to the event that is os_event_t timeout_event; /*!< An event waited for by
created in the lock wait monitor lock_wait_timeout_thread.
thread. A value of 0 means the Not protected by a mutex,
thread is not active */ but the waits are timed.
Signaled on shutdown only. */
bool timeout_thread_active; /*!< True if the timeout thread bool timeout_thread_active; /*!< True if the timeout thread
is running */ is running */

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2009, Google Inc. 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 Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@ -883,10 +883,8 @@ struct log_t{
be 'flush_or_write'! */ be 'flush_or_write'! */
os_event_t no_flush_event; /*!< this event is in the reset state os_event_t no_flush_event; /*!< this event is in the reset state
when a flush or a write is running; when a flush or a write is running;
a thread should wait for this without os_event_set() and os_event_reset()
owning the log mutex, but NOTE that are protected by log_sys_t::mutex */
to set or reset this event, the
thread MUST own the log mutex! */
ibool one_flushed; /*!< during a flush, this is ibool one_flushed; /*!< during a flush, this is
first FALSE and becomes TRUE first FALSE and becomes TRUE
when one log group has been when one log group has been
@ -895,11 +893,9 @@ struct log_t{
flush or write has not yet completed flush or write has not yet completed
for any log group; e.g., this means for any log group; e.g., this means
that a transaction has been committed that a transaction has been committed
when this is set; a thread should wait when this is set;
for this without owning the log mutex, os_event_set() and os_event_reset()
but NOTE that to set or reset this are protected by log_sys_t::mutex */
event, the thread MUST own the log
mutex! */
ulint n_log_ios; /*!< number of log i/os initiated thus ulint n_log_ios; /*!< number of log i/os initiated thus
far */ far */
ulint n_log_ios_old; /*!< number of log i/o's at the 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 */ ulint archive_buf_size;/*!< size of archive_buf */
byte* archive_buf; /*!< log segment is written to the byte* archive_buf; /*!< log segment is written to the
archive from this buffer */ archive from this buffer */
os_event_t archiving_on; /*!< if archiving has been stopped, os_event_t archiving_on; /*!< if archiving has been stopped;
a thread can wait for this event to os_event_set() and os_event_reset()
become signaled */ are protected by log_sys_t::mutex */
/* @} */ /* @} */
#endif /* UNIV_LOG_ARCHIVE */ #endif /* UNIV_LOG_ARCHIVE */
}; };

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc. 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 Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are by Percona Inc.. Those modifications are
@ -1169,6 +1169,7 @@ UNIV_INTERN
void void
os_aio_simulated_wake_handler_threads(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 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 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! */ are not left sleeping! */
UNIV_INTERN UNIV_INTERN
void 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 #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 */ /** Prefix used by MySQL to indicate pre-5.1 table name encoding */
extern const char srv_mysql50_table_name_prefix[10]; 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; 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; 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; extern os_event_t srv_buf_dump_event;
/** The buffer pool dump/load file name */ /** 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) 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 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 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 log operation can prevent this by
obtaining an s-latch here. It also obtaining an s-latch here. It also
protects state and running */ 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 */ ulint n_stop; /*!< Counter to track number stops */
volatile bool running; /*!< true, if purge is active, volatile bool running; /*!< true, if purge is active,
we check this without the latch too */ 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) 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 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 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 { struct ib_wqueue_t {
ib_mutex_t mutex; /*!< mutex protecting everything */ ib_mutex_t mutex; /*!< mutex protecting everything */
ib_list_t* items; /*!< work item list */ 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 #endif

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc. 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 Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are by Percona Inc.. Those modifications are
@ -249,11 +249,15 @@ struct os_aio_array_t{
os_event_t not_full; os_event_t not_full;
/*!< The event which is set to the /*!< The event which is set to the
signaled state when there is space in 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; os_event_t is_empty;
/*!< The event which is set to the /*!< The event which is set to the
signaled state when there are no 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 ulint n_slots;/*!< Total number of slots in the aio
array. This must be divisible by array. This must be divisible by
n_threads. */ n_threads. */
@ -304,8 +308,8 @@ struct os_aio_array_t{
#define OS_AIO_IO_SETUP_RETRY_ATTEMPTS 5 #define OS_AIO_IO_SETUP_RETRY_ATTEMPTS 5
#endif #endif
/** Array of events used in simulated aio */ /** Array of events used in simulated aio. */
static os_event_t* os_aio_segment_wait_events = NULL; 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 /** 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. @{ */ are NULL when the module has not yet been initialized. @{ */
@ -4258,6 +4262,12 @@ os_aio_init(
os_aio_validate(); 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*>( os_aio_segment_wait_events = static_cast<os_event_t*>(
ut_malloc(n_segments * sizeof *os_aio_segment_wait_events)); 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_aio_segment_wait_events[i] = os_event_create();
} }
os_last_printout = ut_time();
return(TRUE); return(TRUE);
} }
/*********************************************************************** /***********************************************************************
@ -4296,9 +4303,11 @@ os_aio_free(void)
os_aio_array_free(os_aio_read_array); os_aio_array_free(os_aio_read_array);
if (!srv_use_native_aio) {
for (ulint i = 0; i < os_aio_n_segments; i++) { for (ulint i = 0; i < os_aio_n_segments; i++) {
os_event_free(os_aio_segment_wait_events[i]); os_event_free(os_aio_segment_wait_events[i]);
} }
}
ut_free(os_aio_segment_wait_events); ut_free(os_aio_segment_wait_events);
os_aio_segment_wait_events = 0; os_aio_segment_wait_events = 0;
@ -4346,22 +4355,17 @@ os_aio_wake_all_threads_at_shutdown(void)
if (os_aio_log_array != 0) { if (os_aio_log_array != 0) {
os_aio_array_wake_win_aio_at_shutdown(os_aio_log_array); os_aio_array_wake_win_aio_at_shutdown(os_aio_log_array);
} }
#elif defined(LINUX_NATIVE_AIO) #elif defined(LINUX_NATIVE_AIO)
/* When using native AIO interface the io helper threads /* When using native AIO interface the io helper threads
wait on io_getevents with a timeout value of 500ms. At wait on io_getevents with a timeout value of 500ms. At
each wake up these threads check the server status. each wake up these threads check the server status.
No need to do anything to wake them up. */ No need to do anything to wake them up. */
#endif /* !WIN_ASYNC_AIO */
if (srv_use_native_aio) { if (srv_use_native_aio) {
return; 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 */ /* This loop wakes up all simulated ai/o threads */
for (ulint i = 0; i < os_aio_n_segments; i++) { 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 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 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! */ are not left sleeping! */
UNIV_INTERN UNIV_INTERN
void 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 /* The idea of putting background IO threads to sleep is only for
Windows when using simulated AIO. Windows XP seems to schedule Windows when using simulated AIO. Windows XP seems to schedule
background threads too eagerly to allow for coalescing during background threads too eagerly to allow for coalescing during
readahead requests. */ readahead requests. */
#ifdef __WIN__
os_aio_array_t* array; os_aio_array_t* array;
if (srv_use_native_aio) { if (srv_use_native_aio) {
@ -4779,8 +4783,8 @@ readahead requests. */
os_event_reset(os_aio_segment_wait_events[i]); os_event_reset(os_aio_segment_wait_events[i]);
} }
} }
#endif /* __WIN__ */
} }
#endif /* _WIN32 */
#if defined(LINUX_NATIVE_AIO) #if defined(LINUX_NATIVE_AIO)
/*******************************************************************//** /*******************************************************************//**
@ -6035,11 +6039,12 @@ os_aio_print(
srv_io_thread_op_info[i], srv_io_thread_op_info[i],
srv_io_thread_function[i]); srv_io_thread_function[i]);
#ifndef __WIN__ #ifndef _WIN32
if (os_aio_segment_wait_events[i]->is_set) { if (!srv_use_native_aio
&& os_aio_segment_wait_events[i]->is_set) {
fprintf(file, " ev set"); fprintf(file, " ev set");
} }
#endif /* __WIN__ */ #endif /* _WIN32 */
fprintf(file, "\n"); fprintf(file, "\n");
} }

View file

@ -665,7 +665,6 @@ fts_parallel_tokenization(
mem_heap_t* blob_heap = NULL; mem_heap_t* blob_heap = NULL;
fts_doc_t doc; fts_doc_t doc;
dict_table_t* table = psort_info->psort_common->new_table; dict_table_t* table = psort_info->psort_common->new_table;
dict_field_t* idx_field;
fts_tokenize_ctx_t t_ctx; fts_tokenize_ctx_t t_ctx;
ulint retried = 0; ulint retried = 0;
dberr_t error = DB_SUCCESS; dberr_t error = DB_SUCCESS;
@ -688,9 +687,6 @@ fts_parallel_tokenization(
doc.charset = fts_index_get_charset( doc.charset = fts_index_get_charset(
psort_info->psort_common->dup->index); 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; block = psort_info->merge_block;
crypt_block = psort_info->crypt_block; crypt_block = psort_info->crypt_block;
crypt_data = psort_info->psort_common->crypt_data; 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) 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 Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described 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. */ /** Slot for a thread waiting in the concurrency control queue. */
struct srv_conc_slot_t{ 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 ibool reserved; /*!< TRUE if slot
reserved */ reserved */
ibool wait_ended; /*!< TRUE when another thread has 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) { if (slot != NULL) {
os_event_set(slot->event); 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 ulint n_sys_threads; /*!< size of the sys_threads
array */ 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]; ulint n_threads_active[SRV_MASTER + 1];
/*!< number of threads active /*!< number of threads active
@ -668,13 +672,16 @@ UNIV_INTERN ib_mutex_t server_mutex;
static srv_sys_t* srv_sys = NULL; 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; 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; 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; UNIV_INTERN os_event_t srv_buf_dump_event;
/** The buffer pool dump/load file name */ /** 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) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@ -1254,7 +1255,7 @@ sync_thread_add_level(
case SYNC_TRX_UNDO_PAGE: case SYNC_TRX_UNDO_PAGE:
/* Purge is allowed to read in as many UNDO pages as it likes, /* 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 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 protect anything because it was only ever acquired by the
single purge thread. The purge thread can read the UNDO pages single purge thread. The purge thread can read the UNDO pages
without any covering mutex. */ without any covering mutex. */

View file

@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 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); sess_close(purge_sys->sess);
purge_sys->sess = NULL;
purge_sys->view = NULL;
rw_lock_free(&purge_sys->latch); rw_lock_free(&purge_sys->latch);
mutex_free(&purge_sys->bh_mutex); mutex_free(&purge_sys->bh_mutex);
@ -183,9 +180,6 @@ trx_purge_sys_close(void)
ib_bh_free(purge_sys->ib_bh); ib_bh_free(purge_sys->ib_bh);
os_event_free(purge_sys->event); os_event_free(purge_sys->event);
purge_sys->event = NULL;
mem_free(purge_sys); mem_free(purge_sys);
purge_sys = NULL; purge_sys = NULL;
@ -1300,21 +1294,17 @@ void
trx_purge_stop(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); ut_a(srv_n_purge_threads > 0);
rw_lock_x_lock(&purge_sys->latch); rw_lock_x_lock(&purge_sys->latch);
ut_a(purge_sys->state != PURGE_STATE_INIT); const ib_int64_t sig_count = os_event_reset(purge_sys->event);
ut_a(purge_sys->state != PURGE_STATE_EXIT); const purge_state_t state = purge_sys->state;
ut_a(purge_sys->state != PURGE_STATE_DISABLED);
ut_a(state == PURGE_STATE_RUN || state == PURGE_STATE_STOP);
++purge_sys->n_stop; ++purge_sys->n_stop;
state = purge_sys->state;
if (state == PURGE_STATE_RUN) { if (state == PURGE_STATE_RUN) {
ib_logf(IB_LOG_LEVEL_INFO, "Stopping purge"); ib_logf(IB_LOG_LEVEL_INFO, "Stopping purge");
@ -1326,18 +1316,14 @@ trx_purge_stop(void)
purge_sys->state = PURGE_STATE_STOP; purge_sys->state = PURGE_STATE_STOP;
rw_lock_x_unlock(&purge_sys->latch);
if (state != PURGE_STATE_STOP) { if (state != PURGE_STATE_STOP) {
rw_lock_x_unlock(&purge_sys->latch);
/* Wait for purge coordinator to signal that it /* Wait for purge coordinator to signal that it
is suspended. */ is suspended. */
os_event_wait_low(purge_sys->event, sig_count); os_event_wait_low(purge_sys->event, sig_count);
} else { } else {
bool once = true; bool once = true;
rw_lock_x_lock(&purge_sys->latch);
/* Wait for purge to signal that it has actually stopped. */ /* Wait for purge to signal that it has actually stopped. */
while (purge_sys->running) { while (purge_sys->running) {

View file

@ -53,8 +53,8 @@ enum status_severity {
/* Flags that tell the buffer pool dump/load thread which action should it /* Flags that tell the buffer pool dump/load thread which action should it
take after being waked up. */ take after being waked up. */
static ibool buf_dump_should_start = FALSE; static volatile bool buf_dump_should_start;
static ibool buf_load_should_start = FALSE; static volatile bool buf_load_should_start;
static ibool buf_load_abort_flag = FALSE; static ibool buf_load_abort_flag = FALSE;
@ -79,7 +79,7 @@ void
buf_dump_start() buf_dump_start()
/*============*/ /*============*/
{ {
buf_dump_should_start = TRUE; buf_dump_should_start = true;
os_event_set(srv_buf_dump_event); os_event_set(srv_buf_dump_event);
} }
@ -93,7 +93,7 @@ void
buf_load_start() buf_load_start()
/*============*/ /*============*/
{ {
buf_load_should_start = TRUE; buf_load_should_start = true;
os_event_set(srv_buf_dump_event); os_event_set(srv_buf_dump_event);
} }
@ -699,15 +699,18 @@ DECLARE_THREAD(buf_dump_thread)(void*)
os_event_wait(srv_buf_dump_event); os_event_wait(srv_buf_dump_event);
if (buf_dump_should_start) { if (buf_dump_should_start) {
buf_dump_should_start = FALSE; buf_dump_should_start = false;
buf_dump(TRUE /* quit on shutdown */); buf_dump(TRUE /* quit on shutdown */);
} }
if (buf_load_should_start) { if (buf_load_should_start) {
buf_load_should_start = FALSE; buf_load_should_start = false;
buf_load(); buf_load();
} }
if (buf_dump_should_start || buf_load_should_start) {
continue;
}
os_event_reset(srv_buf_dump_event); os_event_reset(srv_buf_dump_event);
} }

View file

@ -1,7 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1995, 2016, Oracle and/or its affiliates Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2013, 2016, MariaDB Copyright (c) 2013, 2017, MariaDB Corporation. All Rights Reserved.
Copyright (c) 2013, 2014, Fusion-io Copyright (c) 2013, 2014, Fusion-io
This program is free software; you can redistribute it and/or modify it under 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) #define SHUTTING_DOWN() (srv_shutdown_state != SRV_SHUTDOWN_NONE)
/** Event to wake up the stats thread */ /** Event to wake up dict_stats_thread on dict_stats_recalc_pool_add()
UNIV_INTERN os_event_t dict_stats_event = NULL; or shutdown. Not protected by any mutex. */
UNIV_INTERN os_event_t dict_stats_event;
/** This mutex protects the "recalc_pool" variable. */ /** This mutex protects the "recalc_pool" variable. */
static ib_mutex_t recalc_pool_mutex; static ib_mutex_t recalc_pool_mutex;

View file

@ -2817,6 +2817,7 @@ try_again:
} }
} else { } else {
ut_a(alloc_type == FSP_CLEANING); ut_a(alloc_type == FSP_CLEANING);
reserve = 0;
} }
success = fil_space_reserve_free_extents(space, n_free, n_ext); 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) 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 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 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]; os_event_t no_flush[BUF_FLUSH_N_TYPES];
/*!< this is in the set state /*!< this is in the set state
when there is no flush batch 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 ib_rbt_t* flush_rbt; /*!< a red-black tree is used
exclusively during recovery to exclusively during recovery to
speed up insertions in the 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) 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 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 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 ulint b_reserved;/*!< number of slots currently reserved
for batch flush. */ for batch flush. */
os_event_t b_event;/*!< event where threads wait for a 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 ulint s_reserved;/*!< number of slots currently
reserved for single page flushes. */ reserved for single page flushes. */
os_event_t s_event;/*!< event where threads wait for a 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 bool* in_use; /*!< flag used to indicate if a slot is
in use. Only used for single page in use. Only used for single page
flushes. */ flushes. */

View file

@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2012, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 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 "os0sync.h" /* os_event_t */
#include "os0thread.h" /* DECLARE_THREAD */ #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; 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) 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 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 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 */ ibool open; /*!< TRUE if file open */
os_file_t handle; /*!< OS handle to the file, 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 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 ibool is_raw_disk;/*!< TRUE if the 'file' is actually a raw
device or a raw disk partition */ device or a raw disk partition */
ulint size; /*!< size of the file in database pages, 0 if 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) 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 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 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 in_progress; /*!< flag whether sync is in progress.*/
bool unlock_cache; /*!< flag whether unlock cache when bool unlock_cache; /*!< flag whether unlock cache when
write fts node */ 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 /** 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 srv_slot_t* waiting_threads; /*!< Array of user threads
suspended while waiting for suspended while waiting for
locks within InnoDB, protected 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 srv_slot_t* last_slot; /*!< highest slot ever used
in the waiting_threads array, in the waiting_threads array,
protected by protected by
@ -975,10 +980,11 @@ struct lock_sys_t{
ulint n_lock_max_wait_time; /*!< Max wait time */ ulint n_lock_max_wait_time; /*!< Max wait time */
os_event_t timeout_event; /*!< Set to the event that is os_event_t timeout_event; /*!< An event waited for by
created in the lock wait monitor lock_wait_timeout_thread.
thread. A value of 0 means the Not protected by a mutex,
thread is not active */ but the waits are timed.
Signaled on shutdown only. */
bool timeout_thread_active; /*!< True if the timeout thread bool timeout_thread_active; /*!< True if the timeout thread
is running */ is running */

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved. Copyright (c) 1995, 2013, Oracle and/or its affiliates. All rights reserved.
Copyright (c) 2009, Google Inc. 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 Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@ -934,10 +934,8 @@ struct log_t{
be 'flush_or_write'! */ be 'flush_or_write'! */
os_event_t no_flush_event; /*!< this event is in the reset state os_event_t no_flush_event; /*!< this event is in the reset state
when a flush or a write is running; when a flush or a write is running;
a thread should wait for this without os_event_set() and os_event_reset()
owning the log mutex, but NOTE that are protected by log_sys_t::mutex */
to set or reset this event, the
thread MUST own the log mutex! */
ibool one_flushed; /*!< during a flush, this is ibool one_flushed; /*!< during a flush, this is
first FALSE and becomes TRUE first FALSE and becomes TRUE
when one log group has been when one log group has been
@ -946,11 +944,9 @@ struct log_t{
flush or write has not yet completed flush or write has not yet completed
for any log group; e.g., this means for any log group; e.g., this means
that a transaction has been committed that a transaction has been committed
when this is set; a thread should wait when this is set;
for this without owning the log mutex, os_event_set() and os_event_reset()
but NOTE that to set or reset this are protected by log_sys_t::mutex */
event, the thread MUST own the log
mutex! */
ulint n_log_ios; /*!< number of log i/os initiated thus ulint n_log_ios; /*!< number of log i/os initiated thus
far */ far */
ulint n_log_ios_old; /*!< number of log i/o's at the 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_ptr;/*!< unaligned archived_buf */
byte* archive_buf; /*!< log segment is written to the byte* archive_buf; /*!< log segment is written to the
archive from this buffer */ archive from this buffer */
os_event_t archiving_on; /*!< if archiving has been stopped, os_event_t archiving_on; /*!< if archiving has been stopped;
a thread can wait for this event to os_event_set() and os_event_reset()
become signaled */ are protected by log_sys_t::mutex */
/* @} */ /* @} */
#endif /* UNIV_LOG_ARCHIVE */ #endif /* UNIV_LOG_ARCHIVE */
lsn_t tracked_lsn; /*!< log tracking has advanced to this 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) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc. 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 Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are by Percona Inc.. Those modifications are
@ -1203,6 +1203,7 @@ UNIV_INTERN
void void
os_aio_simulated_wake_handler_threads(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 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 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! */ are not left sleeping! */
UNIV_INTERN UNIV_INTERN
void 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 #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 */ /** Prefix used by MySQL to indicate pre-5.1 table name encoding */
extern const char srv_mysql50_table_name_prefix[10]; 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; 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; 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; extern os_event_t srv_buf_dump_event;
/** The buffer pool dump/load file name */ /** 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) 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 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 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 log operation can prevent this by
obtaining an s-latch here. It also obtaining an s-latch here. It also
protects state and running */ 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 */ ulint n_stop; /*!< Counter to track number stops */
volatile bool running; /*!< true, if purge is active, volatile bool running; /*!< true, if purge is active,
we check this without the latch too */ 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) 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 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 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 { struct ib_wqueue_t {
ib_mutex_t mutex; /*!< mutex protecting everything */ ib_mutex_t mutex; /*!< mutex protecting everything */
ib_list_t* items; /*!< work item list */ 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 #endif

View file

@ -2,7 +2,7 @@
Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2009, Percona Inc. 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 Portions of this file contain modifications contributed and copyrighted
by Percona Inc.. Those modifications are by Percona Inc.. Those modifications are
@ -258,11 +258,15 @@ struct os_aio_array_t{
os_event_t not_full; os_event_t not_full;
/*!< The event which is set to the /*!< The event which is set to the
signaled state when there is space in 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; os_event_t is_empty;
/*!< The event which is set to the /*!< The event which is set to the
signaled state when there are no 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 ulint n_slots;/*!< Total number of slots in the aio
array. This must be divisible by array. This must be divisible by
n_threads. */ n_threads. */
@ -304,8 +308,8 @@ struct os_aio_array_t{
#define OS_AIO_IO_SETUP_RETRY_ATTEMPTS 5 #define OS_AIO_IO_SETUP_RETRY_ATTEMPTS 5
#endif #endif
/** Array of events used in simulated aio */ /** Array of events used in simulated aio. */
static os_event_t* os_aio_segment_wait_events = NULL; 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 /** 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. @{ */ are NULL when the module has not yet been initialized. @{ */
@ -4435,13 +4439,6 @@ os_aio_init(
os_aio_validate(); 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(); os_last_printout = ut_time();
#ifdef _WIN32 #ifdef _WIN32
@ -4451,8 +4448,18 @@ os_aio_init(
ut_a(completion_port && read_completion_port); ut_a(completion_port && read_completion_port);
#endif #endif
if (srv_use_native_aio) {
return(TRUE); 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,9 +4487,11 @@ os_aio_free(void)
os_aio_array_free(os_aio_read_array); os_aio_array_free(os_aio_read_array);
if (!srv_use_native_aio) {
for (ulint i = 0; i < os_aio_n_segments; i++) { for (ulint i = 0; i < os_aio_n_segments; i++) {
os_event_free(os_aio_segment_wait_events[i]); os_event_free(os_aio_segment_wait_events[i]);
} }
}
#if !defined(HAVE_ATOMIC_BUILTINS) || UNIV_WORD_SIZE < 8 #if !defined(HAVE_ATOMIC_BUILTINS) || UNIV_WORD_SIZE < 8
os_mutex_free(os_file_count_mutex); os_mutex_free(os_file_count_mutex);
@ -4541,22 +4550,17 @@ os_aio_wake_all_threads_at_shutdown(void)
if (os_aio_log_array != 0) { if (os_aio_log_array != 0) {
os_aio_array_wake_win_aio_at_shutdown(os_aio_log_array); os_aio_array_wake_win_aio_at_shutdown(os_aio_log_array);
} }
#elif defined(LINUX_NATIVE_AIO) #elif defined(LINUX_NATIVE_AIO)
/* When using native AIO interface the io helper threads /* When using native AIO interface the io helper threads
wait on io_getevents with a timeout value of 500ms. At wait on io_getevents with a timeout value of 500ms. At
each wake up these threads check the server status. each wake up these threads check the server status.
No need to do anything to wake them up. */ No need to do anything to wake them up. */
#endif /* !WIN_ASYNC_AIO */
if (srv_use_native_aio) { if (srv_use_native_aio) {
return; 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 */ /* This loop wakes up all simulated ai/o threads */
for (ulint i = 0; i < os_aio_n_segments; i++) { 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 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 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! */ are not left sleeping! */
UNIV_INTERN UNIV_INTERN
void 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 /* The idea of putting background IO threads to sleep is only for
Windows when using simulated AIO. Windows XP seems to schedule Windows when using simulated AIO. Windows XP seems to schedule
background threads too eagerly to allow for coalescing during background threads too eagerly to allow for coalescing during
readahead requests. */ readahead requests. */
#ifdef __WIN__
os_aio_array_t* array; os_aio_array_t* array;
if (srv_use_native_aio) { if (srv_use_native_aio) {
@ -4973,8 +4977,8 @@ readahead requests. */
os_event_reset(os_aio_segment_wait_events[i]); os_event_reset(os_aio_segment_wait_events[i]);
} }
} }
#endif /* __WIN__ */
} }
#endif /* _WIN32 */
#if defined(LINUX_NATIVE_AIO) #if defined(LINUX_NATIVE_AIO)
/*******************************************************************//** /*******************************************************************//**
@ -6178,11 +6182,12 @@ os_aio_print(
srv_io_thread_op_info[i], srv_io_thread_op_info[i],
srv_io_thread_function[i]); srv_io_thread_function[i]);
#ifndef __WIN__ #ifndef _WIN32
if (os_aio_segment_wait_events[i]->is_set()) { if (!srv_use_native_aio
&& os_aio_segment_wait_events[i]->is_set()) {
fprintf(file, " ev set"); fprintf(file, " ev set");
} }
#endif /* __WIN__ */ #endif /* _WIN32 */
fprintf(file, "\n"); fprintf(file, "\n");
} }

View file

@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 2011, 2012, Oracle and/or its affiliates. All Rights Reserved. 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 Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described 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. */ /** Slot for a thread waiting in the concurrency control queue. */
struct srv_conc_slot_t{ 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 ibool reserved; /*!< TRUE if slot
reserved */ reserved */
ibool wait_ended; /*!< TRUE when another thread has 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) { if (slot != NULL) {
os_event_set(slot->event); 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 ulint n_sys_threads; /*!< size of the sys_threads
array */ 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]; ulint n_threads_active[SRV_MASTER + 1];
/*!< number of threads active /*!< number of threads active
@ -817,13 +821,16 @@ UNIV_INTERN ib_mutex_t server_mutex;
static srv_sys_t* srv_sys = NULL; 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; 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; 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; UNIV_INTERN os_event_t srv_buf_dump_event;
/** The buffer pool dump/load file name */ /** 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) 1995, 2016, Oracle and/or its affiliates. All Rights Reserved.
Copyright (c) 2008, Google Inc. Copyright (c) 2008, Google Inc.
Copyright (c) 2017, MariaDB Corporation. All Rights Reserved.
Portions of this file contain modifications contributed and copyrighted by Portions of this file contain modifications contributed and copyrighted by
Google, Inc. Those modifications are gratefully acknowledged and are described Google, Inc. Those modifications are gratefully acknowledged and are described
@ -1363,7 +1364,7 @@ sync_thread_add_level(
case SYNC_TRX_UNDO_PAGE: case SYNC_TRX_UNDO_PAGE:
/* Purge is allowed to read in as many UNDO pages as it likes, /* 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 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 protect anything because it was only ever acquired by the
single purge thread. The purge thread can read the UNDO pages single purge thread. The purge thread can read the UNDO pages
without any covering mutex. */ without any covering mutex. */

View file

@ -1,6 +1,7 @@
/***************************************************************************** /*****************************************************************************
Copyright (c) 1996, 2016, Oracle and/or its affiliates. All Rights Reserved. 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 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 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); sess_close(purge_sys->sess);
purge_sys->sess = NULL;
read_view_free(purge_sys->prebuilt_view); read_view_free(purge_sys->prebuilt_view);
read_view_free(purge_sys->prebuilt_clone); read_view_free(purge_sys->prebuilt_clone);
purge_sys->view = NULL;
rw_lock_free(&purge_sys->latch); rw_lock_free(&purge_sys->latch);
mutex_free(&purge_sys->bh_mutex); mutex_free(&purge_sys->bh_mutex);
@ -187,9 +184,6 @@ trx_purge_sys_close(void)
ib_bh_free(purge_sys->ib_bh); ib_bh_free(purge_sys->ib_bh);
os_event_free(purge_sys->event); os_event_free(purge_sys->event);
purge_sys->event = NULL;
mem_free(purge_sys); mem_free(purge_sys);
purge_sys = NULL; purge_sys = NULL;
@ -1301,21 +1295,17 @@ void
trx_purge_stop(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); ut_a(srv_n_purge_threads > 0);
rw_lock_x_lock(&purge_sys->latch); rw_lock_x_lock(&purge_sys->latch);
ut_a(purge_sys->state != PURGE_STATE_INIT); const ib_int64_t sig_count = os_event_reset(purge_sys->event);
ut_a(purge_sys->state != PURGE_STATE_EXIT); const purge_state_t state = purge_sys->state;
ut_a(purge_sys->state != PURGE_STATE_DISABLED);
ut_a(state == PURGE_STATE_RUN || state == PURGE_STATE_STOP);
++purge_sys->n_stop; ++purge_sys->n_stop;
state = purge_sys->state;
if (state == PURGE_STATE_RUN) { if (state == PURGE_STATE_RUN) {
ib_logf(IB_LOG_LEVEL_INFO, "Stopping purge"); ib_logf(IB_LOG_LEVEL_INFO, "Stopping purge");