Skip to content

Commit b9769f5

Browse files
cpowerscpowers
cpowers
authored and
cpowers
committed
WL#4896 "Performance Schema Net IO"
- Merge w/ mysql-trunk, including WL#4813 "Stages" and WL#2515 "Statements"
2 parents 005532e + 8f5a5c8 commit b9769f5

File tree

455 files changed

+17982
-3799
lines changed

Some content is hidden

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

455 files changed

+17982
-3799
lines changed

.bzrignore

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
*.core
1111
*.d
1212
*.da
13+
*.dir
1314
*.dll
1415
*.dylib
1516
*.exe
@@ -32,13 +33,16 @@
3233
*.pdb
3334
*.reject
3435
*.res
36+
*.rule
3537
*.sbr
3638
*.so
3739
*.so.*
3840
*.spec
3941
*.user
4042
*.vcproj
4143
*.vcproj.cmake
44+
*.vcxproj
45+
*.vcxproj.filters
4246
*/*.dir/*
4347
*/*_pure_*warnings
4448
*/.deps
@@ -47,7 +51,7 @@
4751
*/debug/*
4852
*/minsizerel/*
4953
*/release/*
50-
*/relwithdebinfo/*
54+
RelWithDebInfo
5155
*~
5256
.*.swp
5357
./CMakeCache.txt

client/mysqlbinlog.cc

+11-3
Original file line numberDiff line numberDiff line change
@@ -683,10 +683,18 @@ Exit_status process_event(PRINT_EVENT_INFO *print_event_info, Log_event *ev,
683683
*/
684684
start_datetime= 0;
685685
offset= 0; // print everything and protect against cycling rec_count
686+
/*
687+
Skip events according to the --server-id flag. However, don't
688+
skip format_description or rotate events, because they they
689+
are really "global" events that are relevant for the entire
690+
binlog, even if they have a server_id. Also, we have to read
691+
the format_description event so that we can parse subsequent
692+
events.
693+
*/
694+
if (ev_type != ROTATE_EVENT &&
695+
server_id && (server_id != ev->server_id))
696+
goto end;
686697
}
687-
if (server_id && (server_id != ev->server_id))
688-
/* skip just this event, continue processing the log. */
689-
goto end;
690698
if (((my_time_t)(ev->when) >= stop_datetime)
691699
|| (pos >= stop_position_mot))
692700
{

client/mysqltest.cc

+5-3
Original file line numberDiff line numberDiff line change
@@ -8343,14 +8343,16 @@ int main(int argc, char **argv)
83438343
}
83448344
var_set_string("MYSQLTEST_FILE", cur_file->file_name);
83458345
init_re();
8346+
8347+
/* Cursor protcol implies ps protocol */
8348+
if (cursor_protocol)
8349+
ps_protocol= 1;
8350+
83468351
ps_protocol_enabled= ps_protocol;
83478352
sp_protocol_enabled= sp_protocol;
83488353
view_protocol_enabled= view_protocol;
83498354
explain_protocol_enabled= explain_protocol;
83508355
cursor_protocol_enabled= cursor_protocol;
8351-
/* Cursor protcol implies ps protocol */
8352-
if (cursor_protocol_enabled)
8353-
ps_protocol_enabled= 1;
83548356

83558357
st_connection *con= connections;
83568358
#ifdef EMBEDDED_LIBRARY

client/sql_string.cc

-4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@
1515

1616
/* This file is originally from the mysql distribution. Coded by monty */
1717

18-
#ifdef USE_PRAGMA_IMPLEMENTATION
19-
#pragma implementation // gcc: Class implementation
20-
#endif
21-
2218
#include <my_global.h>
2319
#include <my_sys.h>
2420
#include <m_string.h>

client/sql_string.h

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818

1919
/* This file is originally from the mysql distribution. Coded by monty */
2020

21-
#ifdef USE_PRAGMA_INTERFACE
22-
#pragma interface /* gcc class implementation */
23-
#endif
24-
2521
class String;
2622
int sortcmp(const String *a,const String *b, const CHARSET_INFO *cs);
2723
String *copy_if_not_alloced(String *a,String *b,uint32 arg_length);

include/my_global.h

-5
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@
4646
#define HAVE_ERRNO_AS_DEFINE
4747
#endif /* __CYGWIN__ */
4848

49-
/* to make command line shorter we'll define USE_PRAGMA_INTERFACE here */
50-
#ifdef USE_PRAGMA_IMPLEMENTATION
51-
#define USE_PRAGMA_INTERFACE
52-
#endif
53-
5449
#if defined(__OpenBSD__) && (OpenBSD >= 200411)
5550
#define HAVE_ERRNO_AS_DEFINE
5651
#endif

include/mysql/psi/mysql_stage.h

+53
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
2+
3+
This program is free software; you can redistribute it and/or modify
4+
it under the terms of the GNU General Public License as published by
5+
the Free Software Foundation; version 2 of the License.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
GNU General Public License for more details.
11+
12+
You should have received a copy of the GNU General Public License
13+
along with this program; if not, write to the Free Software
14+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
15+
16+
#ifndef MYSQL_STAGE_H
17+
#define MYSQL_STAGE_H
18+
19+
/**
20+
@file mysql/psi/mysql_stage.h
21+
Instrumentation helpers for stages.
22+
*/
23+
24+
#include "mysql/psi/psi.h"
25+
26+
/**
27+
@defgroup Stage_instrumentation Stage Instrumentation
28+
@ingroup Instrumentation_interface
29+
@{
30+
*/
31+
32+
#ifdef HAVE_PSI_INTERFACE
33+
#define MYSQL_SET_STAGE(K, F, L) \
34+
inline_mysql_set_stage(K, F, L)
35+
#else
36+
#define MYSQL_SET_STAGE(K, F, L) \
37+
do {} while (0)
38+
#endif
39+
40+
#ifdef HAVE_PSI_INTERFACE
41+
static inline void
42+
inline_mysql_set_stage(PSI_stage_key key,
43+
const char *src_file, int src_line)
44+
{
45+
if (likely(PSI_server != NULL))
46+
PSI_server->start_stage(key, src_file, src_line);
47+
}
48+
#endif
49+
50+
/** @} (end of group Stage_instrumentation) */
51+
52+
#endif
53+

include/mysql/psi/mysql_statement.h

+172
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
/* Copyright (c) 2010, 2011 Oracle and/or its affiliates. All rights reserved.
2+
3+
This program is free software; you can redistribute it and/or modify
4+
it under the terms of the GNU General Public License as published by
5+
the Free Software Foundation; version 2 of the License.
6+
7+
This program is distributed in the hope that it will be useful,
8+
but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10+
GNU General Public License for more details.
11+
12+
You should have received a copy of the GNU General Public License
13+
along with this program; if not, write to the Free Software
14+
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
15+
16+
#ifndef MYSQL_STATEMENT_H
17+
#define MYSQL_STATEMENT_H
18+
19+
/**
20+
@file mysql/psi/mysql_statement.h
21+
Instrumentation helpers for statements.
22+
*/
23+
24+
#include "mysql/psi/psi.h"
25+
26+
/**
27+
@defgroup Statement_instrumentation Statement Instrumentation
28+
@ingroup Instrumentation_interface
29+
@{
30+
*/
31+
32+
#ifdef HAVE_PSI_INTERFACE
33+
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN) \
34+
inline_mysql_start_statement(STATE, K, DB, DB_LEN, __FILE__, __LINE__)
35+
#else
36+
#define MYSQL_START_STATEMENT(STATE, K, DB, DB_LEN) \
37+
NULL
38+
#endif
39+
40+
#ifdef HAVE_PSI_INTERFACE
41+
#define MYSQL_REFINE_STATEMENT(LOCKER, K) \
42+
inline_mysql_refine_statement(LOCKER, K)
43+
#else
44+
#define MYSQL_REFINE_STATEMENT(LOCKER, K) \
45+
NULL
46+
#endif
47+
48+
#ifdef HAVE_PSI_INTERFACE
49+
#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
50+
inline_mysql_set_statement_text(LOCKER, P1, P2)
51+
#else
52+
#define MYSQL_SET_STATEMENT_TEXT(LOCKER, P1, P2) \
53+
do {} while (0)
54+
#endif
55+
56+
#ifdef HAVE_PSI_INTERFACE
57+
#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
58+
inline_mysql_set_statement_lock_time(LOCKER, P1)
59+
#else
60+
#define MYSQL_SET_STATEMENT_LOCK_TIME(LOCKER, P1) \
61+
do {} while (0)
62+
#endif
63+
64+
#ifdef HAVE_PSI_INTERFACE
65+
#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
66+
inline_mysql_set_statement_rows_sent(LOCKER, P1)
67+
#else
68+
#define MYSQL_SET_STATEMENT_ROWS_SENT(LOCKER, P1) \
69+
do {} while (0)
70+
#endif
71+
72+
#ifdef HAVE_PSI_INTERFACE
73+
#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
74+
inline_mysql_set_statement_rows_examined(LOCKER, P1)
75+
#else
76+
#define MYSQL_SET_STATEMENT_ROWS_EXAMINED(LOCKER, P1) \
77+
do {} while (0)
78+
#endif
79+
80+
#ifdef HAVE_PSI_INTERFACE
81+
#define MYSQL_END_STATEMENT(LOCKER, DA) \
82+
inline_mysql_end_statement(LOCKER, DA)
83+
#else
84+
#define MYSQL_END_STATEMENT(LOCKER, DA) \
85+
do {} while (0)
86+
#endif
87+
88+
#ifdef HAVE_PSI_INTERFACE
89+
static inline struct PSI_statement_locker *
90+
inline_mysql_start_statement(PSI_statement_locker_state *state,
91+
PSI_statement_key key,
92+
const char *db, uint db_len,
93+
const char *src_file, int src_line)
94+
{
95+
PSI_statement_locker *locker= NULL;
96+
if (likely(PSI_server != NULL))
97+
{
98+
locker= PSI_server->get_thread_statement_locker(state, key);
99+
if (likely(locker != NULL))
100+
PSI_server->start_statement(locker, db, db_len, src_file, src_line);
101+
}
102+
return locker;
103+
}
104+
105+
static inline struct PSI_statement_locker *
106+
inline_mysql_refine_statement(PSI_statement_locker *locker,
107+
PSI_statement_key key)
108+
{
109+
if (likely(PSI_server && locker))
110+
{
111+
locker= PSI_server->refine_statement(locker, key);
112+
}
113+
return locker;
114+
}
115+
116+
static inline void
117+
inline_mysql_set_statement_text(PSI_statement_locker *locker,
118+
const char *text, uint text_len)
119+
{
120+
if (likely(PSI_server && locker))
121+
{
122+
PSI_server->set_statement_text(locker, text, text_len);
123+
}
124+
}
125+
126+
static inline void
127+
inline_mysql_set_statement_lock_time(PSI_statement_locker *locker,
128+
ulonglong count)
129+
{
130+
if (likely(PSI_server && locker))
131+
{
132+
PSI_server->set_statement_lock_time(locker, count);
133+
}
134+
}
135+
136+
static inline void
137+
inline_mysql_set_statement_rows_sent(PSI_statement_locker *locker,
138+
ulonglong count)
139+
{
140+
if (likely(PSI_server && locker))
141+
{
142+
PSI_server->set_statement_rows_sent(locker, count);
143+
}
144+
}
145+
146+
static inline void
147+
inline_mysql_set_statement_rows_examined(PSI_statement_locker *locker,
148+
ulonglong count)
149+
{
150+
if (likely(PSI_server && locker))
151+
{
152+
PSI_server->set_statement_rows_examined(locker, count);
153+
}
154+
}
155+
156+
static inline void
157+
inline_mysql_end_statement(struct PSI_statement_locker *locker,
158+
Diagnostics_area *stmt_da)
159+
{
160+
if (likely(PSI_server != NULL))
161+
{
162+
PSI_server->end_stage();
163+
if (likely(locker != NULL))
164+
PSI_server->end_statement(locker, stmt_da);
165+
}
166+
}
167+
#endif
168+
169+
/** @} (end of group Statement_instrumentation) */
170+
171+
#endif
172+

0 commit comments

Comments
 (0)