Skip to content

Commit aeac6eb

Browse files
author
Mikael Ronstrom
committed
merge
2 parents b2677a5 + b444c4f commit aeac6eb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+724
-136
lines changed

BUILD/build_mccge.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ extended_usage()
293293
version string suffix: [none]
294294
295295
All packages except Classic include support for user-defined
296-
partitioning.
296+
partitioning. All packages include support for Performance
297+
Schema.
297298
298299
If --with-debug is used, an additional "-debug" is appended to the
299300
version string.

include/my_compiler.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,14 @@ struct my_aligned_storage
140140

141141
#endif /* __cplusplus */
142142

143+
# ifndef MY_ALIGNED
144+
/*
145+
Make sure MY_ALIGNED can be used also on platforms where we don't
146+
have a way of aligning data structures.
147+
*/
148+
#define MY_ALIGNED(size)
149+
#endif
150+
143151
#include <my_attribute.h>
144152

145153
#endif /* MY_COMPILER_INCLUDED */

include/my_sys.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -625,6 +625,8 @@ extern FILE *my_freopen(const char *path, const char *mode, FILE *stream);
625625
extern int my_fclose(FILE *fd,myf MyFlags);
626626
extern File my_fileno(FILE *fd);
627627
extern int my_chsize(File fd,my_off_t newlength, int filler, myf MyFlags);
628+
extern void thr_set_sync_wait_callback(void (*before_sync)(void),
629+
void (*after_sync)(void));
628630
extern int my_sync(File fd, myf my_flags);
629631
extern int my_sync_dir(const char *dir_name, myf my_flags);
630632
extern int my_sync_dir_by_file(const char *file_name, myf my_flags);

include/mysql/plugin_audit.h.pp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,23 @@
3434
int allocate_lex_string);
3535
#include <mysql/service_thd_wait.h>
3636
typedef enum _thd_wait_type_e {
37-
THD_WAIT_MUTEX= 1,
37+
THD_WAIT_SLEEP= 1,
3838
THD_WAIT_DISKIO= 2,
39-
THD_WAIT_ROW_TABLE_LOCK= 3,
40-
THD_WAIT_GLOBAL_LOCK= 4
39+
THD_WAIT_ROW_LOCK= 3,
40+
THD_WAIT_GLOBAL_LOCK= 4,
41+
THD_WAIT_META_DATA_LOCK= 5,
42+
THD_WAIT_TABLE_LOCK= 6,
43+
THD_WAIT_USER_LOCK= 7,
44+
THD_WAIT_BINLOG= 8,
45+
THD_WAIT_GROUP_COMMIT= 9,
46+
THD_WAIT_SYNC= 10,
47+
THD_WAIT_LAST= 11
4148
} thd_wait_type;
4249
extern struct thd_wait_service_st {
43-
void (*thd_wait_begin_func)(void*, thd_wait_type);
50+
void (*thd_wait_begin_func)(void*, int);
4451
void (*thd_wait_end_func)(void*);
4552
} *thd_wait_service;
46-
void thd_wait_begin(void* thd, thd_wait_type wait_type);
53+
void thd_wait_begin(void* thd, int wait_type);
4754
void thd_wait_end(void* thd);
4855
#include <mysql/service_thread_scheduler.h>
4956
struct scheduler_functions;

include/mysql/plugin_auth.h.pp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,23 @@
3434
int allocate_lex_string);
3535
#include <mysql/service_thd_wait.h>
3636
typedef enum _thd_wait_type_e {
37-
THD_WAIT_MUTEX= 1,
37+
THD_WAIT_SLEEP= 1,
3838
THD_WAIT_DISKIO= 2,
39-
THD_WAIT_ROW_TABLE_LOCK= 3,
40-
THD_WAIT_GLOBAL_LOCK= 4
39+
THD_WAIT_ROW_LOCK= 3,
40+
THD_WAIT_GLOBAL_LOCK= 4,
41+
THD_WAIT_META_DATA_LOCK= 5,
42+
THD_WAIT_TABLE_LOCK= 6,
43+
THD_WAIT_USER_LOCK= 7,
44+
THD_WAIT_BINLOG= 8,
45+
THD_WAIT_GROUP_COMMIT= 9,
46+
THD_WAIT_SYNC= 10,
47+
THD_WAIT_LAST= 11
4148
} thd_wait_type;
4249
extern struct thd_wait_service_st {
43-
void (*thd_wait_begin_func)(void*, thd_wait_type);
50+
void (*thd_wait_begin_func)(void*, int);
4451
void (*thd_wait_end_func)(void*);
4552
} *thd_wait_service;
46-
void thd_wait_begin(void* thd, thd_wait_type wait_type);
53+
void thd_wait_begin(void* thd, int wait_type);
4754
void thd_wait_end(void* thd);
4855
#include <mysql/service_thread_scheduler.h>
4956
struct scheduler_functions;

include/mysql/plugin_ftparser.h.pp

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,23 @@
3434
int allocate_lex_string);
3535
#include <mysql/service_thd_wait.h>
3636
typedef enum _thd_wait_type_e {
37-
THD_WAIT_MUTEX= 1,
37+
THD_WAIT_SLEEP= 1,
3838
THD_WAIT_DISKIO= 2,
39-
THD_WAIT_ROW_TABLE_LOCK= 3,
40-
THD_WAIT_GLOBAL_LOCK= 4
39+
THD_WAIT_ROW_LOCK= 3,
40+
THD_WAIT_GLOBAL_LOCK= 4,
41+
THD_WAIT_META_DATA_LOCK= 5,
42+
THD_WAIT_TABLE_LOCK= 6,
43+
THD_WAIT_USER_LOCK= 7,
44+
THD_WAIT_BINLOG= 8,
45+
THD_WAIT_GROUP_COMMIT= 9,
46+
THD_WAIT_SYNC= 10,
47+
THD_WAIT_LAST= 11
4148
} thd_wait_type;
4249
extern struct thd_wait_service_st {
43-
void (*thd_wait_begin_func)(void*, thd_wait_type);
50+
void (*thd_wait_begin_func)(void*, int);
4451
void (*thd_wait_end_func)(void*);
4552
} *thd_wait_service;
46-
void thd_wait_begin(void* thd, thd_wait_type wait_type);
53+
void thd_wait_begin(void* thd, int wait_type);
4754
void thd_wait_end(void* thd);
4855
#include <mysql/service_thread_scheduler.h>
4956
struct scheduler_functions;

include/mysql/service_thd_wait.h

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,15 +50,35 @@
5050
extern "C" {
5151
#endif
5252

53+
/*
54+
One should only report wait events that could potentially block for a
55+
long time. A mutex wait is too short of an event to report. The reason
56+
is that an event which is reported leads to a new thread starts
57+
executing a query and this has a negative impact of usage of CPU caches
58+
and thus the expected gain of starting a new thread must be higher than
59+
the expected cost of lost performance due to starting a new thread.
60+
61+
Good examples of events that should be reported are waiting for row locks
62+
that could easily be for many milliseconds or even seconds and the same
63+
holds true for global read locks, table locks and other meta data locks.
64+
Another event of interest is going to sleep for an extended time.
65+
*/
5366
typedef enum _thd_wait_type_e {
54-
THD_WAIT_MUTEX= 1,
67+
THD_WAIT_SLEEP= 1,
5568
THD_WAIT_DISKIO= 2,
56-
THD_WAIT_ROW_TABLE_LOCK= 3,
57-
THD_WAIT_GLOBAL_LOCK= 4
69+
THD_WAIT_ROW_LOCK= 3,
70+
THD_WAIT_GLOBAL_LOCK= 4,
71+
THD_WAIT_META_DATA_LOCK= 5,
72+
THD_WAIT_TABLE_LOCK= 6,
73+
THD_WAIT_USER_LOCK= 7,
74+
THD_WAIT_BINLOG= 8,
75+
THD_WAIT_GROUP_COMMIT= 9,
76+
THD_WAIT_SYNC= 10,
77+
THD_WAIT_LAST= 11
5878
} thd_wait_type;
5979

6080
extern struct thd_wait_service_st {
61-
void (*thd_wait_begin_func)(MYSQL_THD, thd_wait_type);
81+
void (*thd_wait_begin_func)(MYSQL_THD, int);
6282
void (*thd_wait_end_func)(MYSQL_THD);
6383
} *thd_wait_service;
6484

@@ -70,7 +90,7 @@ extern struct thd_wait_service_st {
7090

7191
#else
7292

73-
void thd_wait_begin(MYSQL_THD thd, thd_wait_type wait_type);
93+
void thd_wait_begin(MYSQL_THD thd, int wait_type);
7494
void thd_wait_end(MYSQL_THD thd);
7595

7696
#endif

include/mysql/thread_pool_priv.h

Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
/*
2+
Copyright (C) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
3+
4+
This program is free software; you can redistribute it and/or modify
5+
it under the terms of the GNU General Public License as published by
6+
the Free Software Foundation; version 2 of the License.
7+
8+
This program is distributed in the hope that it will be useful,
9+
but WITHOUT ANY WARRANTY; without even the implied warranty of
10+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11+
GNU General Public License for more details.
12+
13+
You should have received a copy of the GNU General Public License
14+
along with this program; if not, write to the Free Software
15+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16+
*/
17+
18+
#ifndef THREAD_POOL_PRIV_INCLUDED
19+
#define THREAD_POOL_PRIV_INCLUDED
20+
21+
/*
22+
The thread pool requires access to some MySQL server error codes, this is
23+
accessed from mysqld_error.h.
24+
We need access to the struct that defines the thread pool plugin interface
25+
which is accessed through scheduler.h.
26+
All accesses to THD variables and functions are defined in this header file.
27+
A thread pool can also use DEBUG_SYNC and must thus include
28+
debug_sync.h
29+
To handle definitions of Information Schema plugins it is also required
30+
to include sql_profile.h and table.h.
31+
*/
32+
#include <mysqld_error.h> /* To get ER_ERROR_ON_READ */
33+
#define MYSQL_SERVER 1
34+
#include <scheduler.h>
35+
#include <debug_sync.h>
36+
#include <sql_profile.h>
37+
#include <table.h>
38+
39+
/* Needed to get access to scheduler variables */
40+
void* thd_get_scheduler_data(THD *thd);
41+
void thd_set_scheduler_data(THD *thd, void *data);
42+
PSI_thread* thd_get_psi(THD *thd);
43+
void thd_set_psi(THD *thd, PSI_thread *psi);
44+
45+
/* Interface to THD variables and functions */
46+
void thd_set_killed(THD *thd);
47+
void thd_clear_errors(THD *thd);
48+
void thd_set_thread_stack(THD *thd, char *stack_start);
49+
void thd_lock_thread_count(THD *thd);
50+
void thd_unlock_thread_count(THD *thd);
51+
void thd_close_connection(THD *thd);
52+
THD *thd_get_current_thd();
53+
void thd_new_connection_setup(THD *thd, char *stack_start);
54+
void thd_lock_data(THD *thd);
55+
void thd_unlock_data(THD *thd);
56+
bool thd_is_transaction_active(THD *thd);
57+
int thd_connection_has_data(THD *thd);
58+
void thd_set_net_read_write(THD *thd, uint val);
59+
void thd_set_mysys_var(THD *thd, st_my_thread_var *mysys_var);
60+
my_socket thd_get_fd(THD *thd);
61+
62+
/* Print to the MySQL error log */
63+
void sql_print_error(const char *format, ...);
64+
65+
/* Store a table record */
66+
bool schema_table_store_record(THD *thd, TABLE *table);
67+
68+
/*
69+
The thread pool must be able to execute statements using the connection
70+
state in THD object. This is the main objective of the thread pool to
71+
schedule the start of these commands.
72+
*/
73+
bool do_command(THD *thd);
74+
75+
/*
76+
The thread pool requires an interface to the connection logic in the
77+
MySQL Server since the thread pool will maintain the event logic on
78+
the TCP connection of the MySQL Server. Thus new connections, dropped
79+
connections will be discovered by the thread pool and it needs to
80+
ensure that the proper MySQL Server logic attached to these events is
81+
executed.
82+
*/
83+
/* Initialise a new connection handler thread */
84+
bool init_new_connection_handler_thread();
85+
/* Set up connection thread before use as execution thread */
86+
bool setup_connection_thread_globals(THD *thd);
87+
/* Prepare connection as part of connection set-up */
88+
bool thd_prepare_connection(THD *thd);
89+
/* Release auditing before executing statement */
90+
void mysql_audit_release(THD *thd);
91+
/* Check if connection is still alive */
92+
bool thd_is_connection_alive(THD *thd);
93+
/* Close connection with possible error code */
94+
void close_connection(THD *thd, uint errcode);
95+
/* End the connection before closing it */
96+
void end_connection(THD *thd);
97+
/* Destroy THD object */
98+
void unlink_thd(THD *thd);
99+
100+
/*
101+
thread_created is maintained by thread pool when activated since
102+
user threads are created by the thread pool (and also special
103+
threads to maintain the thread pool). This is done through
104+
inc_thread_created.
105+
106+
max_connections is needed to calculate the maximum number of threads
107+
that is allowed to be started by the thread pool. The method
108+
get_max_connections() gets reference to this variable.
109+
110+
connection_attrib is the thread attributes for connection threads,
111+
the method get_connection_attrib provides a reference to these
112+
attributes.
113+
*/
114+
void inc_thread_created(void);
115+
ulong get_max_connections(void);
116+
pthread_attr_t *get_connection_attrib(void);
117+
#endif
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
disable_query_log;
12
if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%archive%'`)
23
{
34
--skip archive plugin not available
45
}
56

7+
if (`SELECT @@plugin_dir != '$ARCHIVE_PLUGIN_DIR'`) {
8+
--skip Archive plugin requires that --plugin-dir is set to the archive plugin dir (either the .opt file does not contain \$ARCHIVE_PLUGIN_OPT or another plugin is in use)
9+
}
10+
enable_query_log;
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1+
disable_query_log;
12
if (`select plugin_library IS NULL from information_schema.plugins where plugin_name LIKE '%blackhole%'`)
23
{
34
--skip blackhole plugin not available;
45
}
56

7+
if (`SELECT @@plugin_dir != '$BLACKHOLE_PLUGIN_DIR'`) {
8+
--skip Blackhole plugin requires that --plugin-dir is set to the blackhole plugin dir (either the .opt file does not contain \$BLACKHOLE_PLUGIN_OPT or another plugin is in use)
9+
}
10+
enable_query_log;
11+

0 commit comments

Comments
 (0)