74 changed files with 1195 additions and 265 deletions
-
2client/mysqltest.cc
-
2configure.in
-
2include/Makefile.am
-
2include/mysql/plugin.h
-
21include/mysql/plugin_audit.h.pp
-
21include/mysql/plugin_ftparser.h.pp
-
83include/mysql/service_thd_wait.h
-
65include/mysql/service_thread_scheduler.h
-
2include/mysql/services.h
-
3include/service_versions.h
-
2include/thr_lock.h
-
1include/violite.h
-
6libservices/CMakeLists.txt
-
4libservices/Makefile.am
-
21libservices/my_thread_scheduler_service.c
-
19libservices/thd_wait_service.c
-
5mysql-test/include/not_blackhole.inc
-
9mysql-test/r/delete.result
-
20mysql-test/r/func_gconcat.result
-
11mysql-test/r/func_group.result
-
15mysql-test/r/func_misc.result
-
8mysql-test/r/func_time.result
-
2mysql-test/r/mysqld--help-notwin.result
-
2mysql-test/r/mysqld--help-win.result
-
16mysql-test/r/partition_not_blackhole.result
-
13mysql-test/r/range.result
-
BINmysql-test/std_data/parts/t1_blackhole.frm
-
BINmysql-test/std_data/parts/t1_blackhole.par
-
58mysql-test/suite/innodb/r/innodb_mysql.result
-
25mysql-test/suite/innodb/t/innodb_mysql.test
-
12mysql-test/suite/rpl/r/rpl_flush_logs.result
-
1mysql-test/suite/rpl/t/rpl_drop.test
-
25mysql-test/suite/rpl/t/rpl_flush_logs.test
-
13mysql-test/t/delete.test
-
21mysql-test/t/func_gconcat.test
-
14mysql-test/t/func_group.test
-
14mysql-test/t/func_misc.test
-
11mysql-test/t/func_time.test
-
1mysql-test/t/partition_not_blackhole-master.opt
-
26mysql-test/t/partition_not_blackhole.test
-
12mysql-test/t/range.test
-
2mysys/my_init.c
-
31mysys/thr_lock.c
-
1sql/authors.h
-
7sql/ha_partition.cc
-
2sql/item_func.cc
-
45sql/item_sum.cc
-
1sql/item_sum.h
-
109sql/log.cc
-
4sql/log.h
-
68sql/mysqld.cc
-
6sql/mysqld.h
-
4sql/opt_range.cc
-
167sql/scheduler.cc
-
61sql/scheduler.h
-
43sql/sql_callback.h
-
75sql/sql_class.cc
-
7sql/sql_class.h
-
15sql/sql_connect.cc
-
4sql/sql_connect.h
-
16sql/sql_plugin_services.h
-
104sql/sql_select.cc
-
2sql/sql_select.h
-
11sql/sql_show.cc
-
18sql/sql_yacc.yy
-
10sql/sys_vars.cc
-
1sql/table.h
-
6storage/innobase/buf/buf0flu.c
-
4storage/innobase/buf/buf0rea.c
-
6storage/innobase/srv/srv0srv.c
-
10vio/vio.c
-
3vio/vio_priv.h
-
4vio/viosocket.c
-
5vio/viossl.c
@ -0,0 +1,83 @@ |
|||
/* Copyright (C) 2010, Oracle and/or its affiliates. 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 Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ |
|||
|
|||
#ifndef MYSQL_SERVICE_THD_WAIT_INCLUDED |
|||
#define MYSQL_SERVICE_THD_WAIT_INCLUDED |
|||
|
|||
/** |
|||
@file include/mysql/service_thd_wait.h |
|||
This service provides functions for plugins and storage engines to report |
|||
when they are going to sleep/stall. |
|||
|
|||
SYNOPSIS |
|||
thd_wait_begin() - call just before a wait begins |
|||
thd Thread object |
|||
Use NULL if the thd is NOT known. |
|||
wait_type Type of wait |
|||
1 -- short wait (e.g. for mutex) |
|||
2 -- medium wait (e.g. for disk io) |
|||
3 -- large wait (e.g. for locked row/table) |
|||
NOTES |
|||
This is used by the threadpool to have better knowledge of which |
|||
threads that currently are actively running on CPUs. When a thread |
|||
reports that it's going to sleep/stall, the threadpool scheduler is |
|||
free to start another thread in the pool most likely. The expected wait |
|||
time is simply an indication of how long the wait is expected to |
|||
become, the real wait time could be very different. |
|||
|
|||
thd_wait_end() called immediately after the wait is complete |
|||
|
|||
thd_wait_end() MUST be called if thd_wait_begin() was called. |
|||
|
|||
Using thd_wait_...() service is optional but recommended. Using it will |
|||
improve performance as the thread pool will be more active at managing the |
|||
thread workload. |
|||
*/ |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
typedef enum _thd_wait_type_e { |
|||
THD_WAIT_MUTEX= 1, |
|||
THD_WAIT_DISKIO= 2, |
|||
THD_WAIT_ROW_TABLE_LOCK= 3, |
|||
THD_WAIT_GLOBAL_LOCK= 4 |
|||
} thd_wait_type; |
|||
|
|||
extern struct thd_wait_service_st { |
|||
void (*thd_wait_begin_func)(MYSQL_THD, thd_wait_type); |
|||
void (*thd_wait_end_func)(MYSQL_THD); |
|||
} *thd_wait_service; |
|||
|
|||
#ifdef MYSQL_DYNAMIC_PLUGIN |
|||
|
|||
#define thd_wait_begin(_THD, _WAIT_TYPE) \ |
|||
thd_wait_service->thd_wait_begin_func(_THD, _WAIT_TYPE) |
|||
#define thd_wait_end(_THD) thd_wait_service->thd_wait_end_func(_THD) |
|||
|
|||
#else |
|||
|
|||
void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type); |
|||
void thd_wait_end(MYSQL_THD thd); |
|||
|
|||
#endif |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif |
|||
|
|||
@ -0,0 +1,65 @@ |
|||
/* |
|||
Copyright (C) 2010, Oracle and/or its affiliates. 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 Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|||
*/ |
|||
|
|||
#ifndef SERVICE_THREAD_SCHEDULER_INCLUDED |
|||
#define SERVICE_THREAD_SCHEDULER_INCLUDED |
|||
|
|||
#ifdef __cplusplus |
|||
extern "C" { |
|||
#endif |
|||
|
|||
struct scheduler_functions; |
|||
|
|||
extern struct my_thread_scheduler_service { |
|||
int (*set)(struct scheduler_functions *scheduler); |
|||
int (*reset)(); |
|||
} *my_thread_scheduler_service; |
|||
|
|||
#ifdef MYSQL_DYNAMIC_PLUGIN |
|||
|
|||
#define my_thread_scheduler_set(F) my_thread_scheduler_service->set((F)) |
|||
#define my_thread_scheduler_reset() my_thread_scheduler_service->reset() |
|||
|
|||
#else |
|||
|
|||
/** |
|||
Set the thread scheduler to use for the server. |
|||
|
|||
@param scheduler Pointer to scheduler callbacks to use. |
|||
@retval 0 Scheduler installed correctly. |
|||
@retval 1 Invalid value (NULL) used for scheduler. |
|||
*/ |
|||
int my_thread_scheduler_set(struct scheduler_functions *scheduler); |
|||
|
|||
/** |
|||
Restore the previous thread scheduler. |
|||
|
|||
@note If no thread scheduler was installed previously with |
|||
thd_set_thread_scheduler, this function will report an error. |
|||
|
|||
@retval 0 Scheduler installed correctly. |
|||
@retval 1 No scheduler installed. |
|||
*/ |
|||
int my_thread_scheduler_reset(); |
|||
|
|||
#endif |
|||
|
|||
#ifdef __cplusplus |
|||
} |
|||
#endif |
|||
|
|||
#endif /* SERVICE_THREAD_SCHEDULER_INCLUDED */ |
|||
@ -0,0 +1,21 @@ |
|||
/* |
|||
Copyright (C) 2010, Oracle and/or its affiliates. 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 Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, but |
|||
WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 |
|||
USA |
|||
*/ |
|||
|
|||
#include <service_versions.h> |
|||
SERVICE_VERSION my_thread_scheduler_service= |
|||
(void*)VERSION_my_thread_scheduler; |
|||
@ -0,0 +1,19 @@ |
|||
/* |
|||
Copyright (C) 2010, Oracle and/or its affiliates. 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 Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, but |
|||
WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
|||
General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|||
*/ |
|||
|
|||
#include <service_versions.h> |
|||
SERVICE_VERSION *thd_wait_service= (void*)VERSION_thd_wait; |
|||
@ -0,0 +1,5 @@ |
|||
if (`SELECT count(*) FROM information_schema.engines WHERE |
|||
(support = 'YES' OR support = 'DEFAULT') AND |
|||
engine = 'blackhole'`){ |
|||
skip Blackhole engine enabled; |
|||
} |
|||
@ -0,0 +1,16 @@ |
|||
DROP TABLE IF EXISTS t1; |
|||
# |
|||
# Bug#46086: crash when dropping a partitioned table and |
|||
# the original engine is disabled |
|||
# Copy a .frm and .par file which was created with: |
|||
# create table `t1` (`id` int primary key) engine=blackhole |
|||
# partition by key () partitions 1; |
|||
SHOW TABLES; |
|||
Tables_in_test |
|||
t1 |
|||
SHOW CREATE TABLE t1; |
|||
ERROR HY000: Incorrect information in file: './test/t1.frm' |
|||
DROP TABLE t1; |
|||
ERROR 42S02: Unknown table 't1' |
|||
t1.frm |
|||
t1.par |
|||
@ -0,0 +1 @@ |
|||
--loose-skip-blackhole |
|||
@ -0,0 +1,26 @@ |
|||
--source include/have_partition.inc |
|||
--source include/not_blackhole.inc |
|||
|
|||
--disable_warnings |
|||
DROP TABLE IF EXISTS t1; |
|||
--enable_warnings |
|||
|
|||
let $MYSQLD_DATADIR= `SELECT @@datadir`; |
|||
|
|||
--echo # |
|||
--echo # Bug#46086: crash when dropping a partitioned table and |
|||
--echo # the original engine is disabled |
|||
--echo # Copy a .frm and .par file which was created with: |
|||
--echo # create table `t1` (`id` int primary key) engine=blackhole |
|||
--echo # partition by key () partitions 1; |
|||
--copy_file std_data/parts/t1_blackhole.frm $MYSQLD_DATADIR/test/t1.frm |
|||
--copy_file std_data/parts/t1_blackhole.par $MYSQLD_DATADIR/test/t1.par |
|||
SHOW TABLES; |
|||
--replace_result $MYSQLD_DATADIR ./ |
|||
--error ER_NOT_FORM_FILE |
|||
SHOW CREATE TABLE t1; |
|||
--error ER_BAD_TABLE_ERROR |
|||
DROP TABLE t1; |
|||
--list_files $MYSQLD_DATADIR/test t1* |
|||
--remove_file $MYSQLD_DATADIR/test/t1.frm |
|||
--remove_file $MYSQLD_DATADIR/test/t1.par |
|||
@ -0,0 +1,43 @@ |
|||
/* |
|||
Copyright (C) 2010, Oracle and/or its affiliates. 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 Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|||
*/ |
|||
|
|||
#ifndef SQL_CALLBACK_INCLUDED |
|||
#define SQL_CALLBACK_INCLUDED |
|||
|
|||
/** |
|||
Macro used for an internal callback. |
|||
|
|||
The macro will check that the object exists and that the function |
|||
is defined. If that is the case, it will call the function with the |
|||
given parameters. |
|||
|
|||
If the object or the function is not defined, the callback will be |
|||
considered successful (nothing needed to be done) and will |
|||
therefore return no error. |
|||
*/ |
|||
|
|||
#define MYSQL_CALLBACK(OBJ, FUNC, PARAMS) \ |
|||
do { \ |
|||
if ((OBJ) && ((OBJ)->FUNC)) \ |
|||
(OBJ)->FUNC PARAMS; \ |
|||
} while (0) |
|||
|
|||
#define MYSQL_CALLBACK_ELSE(OBJ, FUNC, PARAMS, ELSE) \ |
|||
(((OBJ) && ((OBJ)->FUNC)) ? (OBJ)->FUNC PARAMS : (ELSE)) |
|||
|
|||
|
|||
#endif /* SQL_CALLBACK_INCLUDED */ |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue