Skip to content

Commit d71d411

Browse files
committed
5.6.24
1 parent 05c002d commit d71d411

File tree

128 files changed

+731
-1663
lines changed

Some content is hidden

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

128 files changed

+731
-1663
lines changed

include/mysql/psi/mysql_statement.h

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -41,25 +41,20 @@
4141
do {} while (0)
4242
#endif
4343

44-
#ifdef HAVE_PSI_STATEMENT_INTERFACE
4544
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
4645
#define MYSQL_DIGEST_START(LOCKER) \
4746
inline_mysql_digest_start(LOCKER)
4847
#else
4948
#define MYSQL_DIGEST_START(LOCKER) \
5049
NULL
5150
#endif
52-
#else
53-
#define MYSQL_DIGEST_START(LOCKER) \
54-
NULL
55-
#endif
5651

5752
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
58-
#define MYSQL_ADD_TOKEN(LOCKER, T, Y) \
59-
inline_mysql_add_token(LOCKER, T, Y)
53+
#define MYSQL_DIGEST_END(LOCKER, DIGEST) \
54+
inline_mysql_digest_end(LOCKER, DIGEST)
6055
#else
61-
#define MYSQL_ADD_TOKEN(LOCKER, T, Y) \
62-
NULL
56+
#define MYSQL_DIGEST_END(LOCKER, DIGEST) \
57+
do {} while (0)
6358
#endif
6459

6560
#ifdef HAVE_PSI_STATEMENT_INTERFACE
@@ -132,20 +127,17 @@ inline_mysql_digest_start(PSI_statement_locker *locker)
132127
PSI_digest_locker* digest_locker= NULL;
133128

134129
if (likely(locker != NULL))
135-
digest_locker= PSI_STATEMENT_CALL(digest_start)(locker);
130+
digest_locker= PSI_DIGEST_CALL(digest_start)(locker);
136131
return digest_locker;
137132
}
138133
#endif
139134

140135
#ifdef HAVE_PSI_STATEMENT_DIGEST_INTERFACE
141-
static inline struct PSI_digest_locker *
142-
inline_mysql_add_token(PSI_digest_locker *locker, uint token,
143-
void *yylval)
136+
static inline void
137+
inline_mysql_digest_end(PSI_digest_locker *locker, const sql_digest_storage *digest)
144138
{
145139
if (likely(locker != NULL))
146-
locker= PSI_STATEMENT_CALL(digest_add_token)(locker, token,
147-
(OPAQUE_LEX_YYSTYPE*)yylval);
148-
return locker;
140+
PSI_DIGEST_CALL(digest_end)(locker, digest);
149141
}
150142
#endif
151143

include/mysql/psi/psi.h

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
1+
/* Copyright (c) 2008, 2015, Oracle and/or its affiliates. All rights reserved.
22
33
This program is free software; you can redistribute it and/or modify
44
it under the terms of the GNU General Public License as published by
@@ -43,18 +43,8 @@
4343
C_MODE_START
4444

4545
struct TABLE_SHARE;
46-
/*
47-
There are 3 known bison parsers in the server:
48-
- (1) the SQL parser itself, sql/sql_yacc.yy
49-
- (2) storage/innobase/fts/fts0pars.y
50-
- (3) storage/innobase/pars/pars0grm.y
51-
What is instrumented here are the tokens from the SQL query text (1),
52-
to make digests.
53-
Now, to avoid name pollution and conflicts with different YYSTYPE definitions,
54-
an opaque structure is used here.
55-
The real type to use when invoking the digest api is LEX_YYSTYPE.
56-
*/
57-
struct OPAQUE_LEX_YYSTYPE;
46+
47+
struct sql_digest_storage;
5848

5949
/**
6050
@file mysql/psi/psi.h
@@ -952,29 +942,6 @@ struct PSI_table_locker_state_v1
952942
uint m_index;
953943
};
954944

955-
#define PSI_MAX_DIGEST_STORAGE_SIZE 1024
956-
957-
/**
958-
Structure to store token count/array for a statement
959-
on which digest is to be calculated.
960-
*/
961-
struct PSI_digest_storage
962-
{
963-
my_bool m_full;
964-
int m_byte_count;
965-
/** Character set number. */
966-
uint m_charset_number;
967-
unsigned char m_token_array[PSI_MAX_DIGEST_STORAGE_SIZE];
968-
};
969-
typedef struct PSI_digest_storage PSI_digest_storage;
970-
971-
struct PSI_digest_locker_state
972-
{
973-
int m_last_id_index;
974-
PSI_digest_storage m_digest_storage;
975-
};
976-
typedef struct PSI_digest_locker_state PSI_digest_locker_state;
977-
978945
/* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */
979946
#define PSI_SCHEMA_NAME_LEN (64 * 3)
980947

@@ -1037,7 +1004,7 @@ struct PSI_statement_locker_state_v1
10371004
/** Metric, number of sort scans. */
10381005
ulong m_sort_scan;
10391006
/** Statement digest. */
1040-
PSI_digest_locker_state m_digest_state;
1007+
const struct sql_digest_storage *m_digest;
10411008
/** Current schema name. */
10421009
char m_schema_name[PSI_SCHEMA_NAME_LEN];
10431010
/** Length in bytes of @c m_schema_name. */
@@ -1902,11 +1869,15 @@ typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket,
19021869
*/
19031870
typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket);
19041871

1872+
/**
1873+
Get a digest locker for the current statement.
1874+
@param locker a statement locker for the running thread
1875+
*/
19051876
typedef struct PSI_digest_locker * (*digest_start_v1_t)
19061877
(struct PSI_statement_locker *locker);
19071878

1908-
typedef struct PSI_digest_locker* (*digest_add_token_v1_t)
1909-
(struct PSI_digest_locker *locker, uint token, struct OPAQUE_LEX_YYSTYPE *yylval);
1879+
typedef void (*digest_end_v1_t)
1880+
(struct PSI_digest_locker *locker, const struct sql_digest_storage *digest);
19101881

19111882
/**
19121883
Stores an array of connection attributes
@@ -2118,8 +2089,8 @@ struct PSI_v1
21182089
set_socket_thread_owner_v1_t set_socket_thread_owner;
21192090
/** @sa digest_start_v1_t. */
21202091
digest_start_v1_t digest_start;
2121-
/** @sa digest_add_token_v1_t. */
2122-
digest_add_token_v1_t digest_add_token;
2092+
/** @sa digest_end_v1_t. */
2093+
digest_end_v1_t digest_end;
21232094
/** @sa set_thread_connect_attrs_v1_t. */
21242095
set_thread_connect_attrs_v1_t set_thread_connect_attrs;
21252096
};
@@ -2414,6 +2385,10 @@ extern MYSQL_PLUGIN_IMPORT PSI *PSI_server;
24142385
#define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M)
24152386
#endif
24162387

2388+
#ifndef PSI_DIGEST_CALL
2389+
#define PSI_DIGEST_CALL(M) PSI_DYNAMIC_CALL(M)
2390+
#endif
2391+
24172392
#ifndef PSI_TABLE_CALL
24182393
#define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M)
24192394
#endif

include/mysql/psi/psi_abi_v0.h.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "mysql/psi/psi.h"
22
C_MODE_START
33
struct TABLE_SHARE;
4-
struct OPAQUE_LEX_YYSTYPE;
4+
struct sql_digest_storage;
55
struct PSI_mutex;
66
typedef struct PSI_mutex PSI_mutex;
77
struct PSI_rwlock;

include/mysql/psi/psi_abi_v1.h.pp

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "mysql/psi/psi.h"
22
C_MODE_START
33
struct TABLE_SHARE;
4-
struct OPAQUE_LEX_YYSTYPE;
4+
struct sql_digest_storage;
55
struct PSI_mutex;
66
typedef struct PSI_mutex PSI_mutex;
77
struct PSI_rwlock;
@@ -241,20 +241,6 @@
241241
void *m_wait;
242242
uint m_index;
243243
};
244-
struct PSI_digest_storage
245-
{
246-
my_bool m_full;
247-
int m_byte_count;
248-
uint m_charset_number;
249-
unsigned char m_token_array[1024];
250-
};
251-
typedef struct PSI_digest_storage PSI_digest_storage;
252-
struct PSI_digest_locker_state
253-
{
254-
int m_last_id_index;
255-
PSI_digest_storage m_digest_storage;
256-
};
257-
typedef struct PSI_digest_locker_state PSI_digest_locker_state;
258244
struct PSI_statement_locker_state_v1
259245
{
260246
my_bool m_discarded;
@@ -280,7 +266,7 @@
280266
ulong m_sort_range;
281267
ulong m_sort_rows;
282268
ulong m_sort_scan;
283-
PSI_digest_locker_state m_digest_state;
269+
const struct sql_digest_storage *m_digest;
284270
char m_schema_name[(64 * 3)];
285271
uint m_schema_name_length;
286272
};
@@ -508,8 +494,8 @@
508494
typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket);
509495
typedef struct PSI_digest_locker * (*digest_start_v1_t)
510496
(struct PSI_statement_locker *locker);
511-
typedef struct PSI_digest_locker* (*digest_add_token_v1_t)
512-
(struct PSI_digest_locker *locker, uint token, struct OPAQUE_LEX_YYSTYPE *yylval);
497+
typedef void (*digest_end_v1_t)
498+
(struct PSI_digest_locker *locker, const struct sql_digest_storage *digest);
513499
typedef int (*set_thread_connect_attrs_v1_t)(const char *buffer, uint length,
514500
const void *from_cs);
515501
struct PSI_v1
@@ -610,7 +596,7 @@
610596
set_socket_info_v1_t set_socket_info;
611597
set_socket_thread_owner_v1_t set_socket_thread_owner;
612598
digest_start_v1_t digest_start;
613-
digest_add_token_v1_t digest_add_token;
599+
digest_end_v1_t digest_end;
614600
set_thread_connect_attrs_v1_t set_thread_connect_attrs;
615601
};
616602
typedef struct PSI_v1 PSI;

include/mysql/psi/psi_abi_v2.h.pp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "mysql/psi/psi.h"
22
C_MODE_START
33
struct TABLE_SHARE;
4-
struct OPAQUE_LEX_YYSTYPE;
4+
struct sql_digest_storage;
55
struct PSI_mutex;
66
typedef struct PSI_mutex PSI_mutex;
77
struct PSI_rwlock;

mysql-test/suite/perfschema/include/sizing_auto.inc

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,21 @@ show variables like "table_open_cache";
44
show variables like "max_connections";
55
# open_files_limit depends on OS configuration (ulimit -n)
66
#show variables like "open_files_limit";
7-
show variables like "%performance_schema%";
7+
show variables where
8+
`Variable_name` != "performance_schema_max_statement_classes" and
9+
`Variable_name` like "performance_schema%";
810
show status like "%performance_schema%";
911

1012
# Each test script should provide a different test.cnf file,
1113
# with different settings.
1214
# This output will show the sizes computed automatically.
1315
# Note that this output is very dependent on the platform.
16+
# The output of SHOW ENGINE PERFORMANCE_SCHEMA STATUS
17+
# is very dependent on the platform,
18+
# so it is not printed here to ensure stability of the .results files.
19+
# To troubleshoot the performance schema memory consumption at different
20+
# configuration settings, comment the following line.
21+
# Debug only:
1422

15-
show engine performance_schema status;
23+
# show engine performance_schema status;
1624

mysql-test/suite/perfschema/include/socket_event.inc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ if($is_connect)
126126
# Connect is visible.
127127
# We hope that sleep 1 is long enough so that PERFORMANCE_SCHEMA
128128
# can remove this row before we collect the after action state.
129-
let $wait_timeou= 5;
129+
let $wait_timeout= 5;
130130
let $wait_condition=
131131
SELECT COUNT(*) = 0
132132
$part;

mysql-test/suite/perfschema/include/start_server_common.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,9 @@ select * from performance_schema.users;
6868
--enable_result_log
6969

7070
# This has a stable output, printing the result:
71-
show variables like "performance_schema%";
71+
show variables where
72+
`Variable_name` != "performance_schema_max_statement_classes" and
73+
`Variable_name` like "performance_schema%";
7274

7375
# This has an unrepeatable output, it does depends too much on
7476
# - the platform hardware (sizeof structures, padding)

mysql-test/suite/perfschema/include/table_aggregate_load.inc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,9 @@ truncate performance_schema.events_waits_summary_global_by_event_name;
2929
truncate performance_schema.events_waits_history_long;
3030

3131
# Check the configuration is ok
32-
show variables like "performance_schema%";
32+
show variables where
33+
`Variable_name` != "performance_schema_max_statement_classes" and
34+
`Variable_name` like "performance_schema%";
3335
show status like "performance_schema%";
3436

3537
echo "================== Step 1 ==================";
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
TRUNCATE TABLE performance_schema.events_statements_summary_by_digest;
2+
NULL
3+
NULL
4+
NULL
5+
NULL
6+
NULL NULL
7+
NULL NULL
8+
NULL NULL NULL 1 2 3 NULL NULL
9+
NULL NULL NULL 1 2 3 NULL NULL
10+
1 IS NULL
11+
0
12+
2 IS NOT NULL
13+
1
14+
1 IS NULL 2 IS NULL 3 IS NOT NULL 4 IS NOT NULL
15+
0 0 1 1
16+
SELECT SCHEMA_NAME, DIGEST_TEXT, COUNT_STAR
17+
FROM performance_schema.events_statements_summary_by_digest;
18+
SCHEMA_NAME DIGEST_TEXT COUNT_STAR
19+
test TRUNCATE TABLE performance_schema . events_statements_summary_by_digest 1
20+
test SELECT ? 1
21+
test SELECT ? FROM DUAL 1
22+
test SELECT ?, ... 2
23+
test SELECT ? IS NULL 1
24+
test SELECT ? IS NOT NULL 1
25+
test SELECT ? IS NULL , ? IS NULL , ? IS NOT NULL , ? IS NOT NULL 1
26+
test CREATE TABLE foo ( a INTEGER DEFAULT ? , b INTEGER NOT NULL DEFAULT ? , c INTEGER NOT NULL ) 1
27+
test DROP TABLE foo 1

0 commit comments

Comments
 (0)