|
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. |
2 | 2 |
|
3 | 3 | This program is free software; you can redistribute it and/or modify |
4 | 4 | it under the terms of the GNU General Public License as published by |
|
43 | 43 | C_MODE_START |
44 | 44 |
|
45 | 45 | 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; |
58 | 48 |
|
59 | 49 | /** |
60 | 50 | @file mysql/psi/psi.h |
@@ -952,29 +942,6 @@ struct PSI_table_locker_state_v1 |
952 | 942 | uint m_index; |
953 | 943 | }; |
954 | 944 |
|
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 | | - |
978 | 945 | /* Duplicate of NAME_LEN, to avoid dependency on mysql_com.h */ |
979 | 946 | #define PSI_SCHEMA_NAME_LEN (64 * 3) |
980 | 947 |
|
@@ -1037,7 +1004,7 @@ struct PSI_statement_locker_state_v1 |
1037 | 1004 | /** Metric, number of sort scans. */ |
1038 | 1005 | ulong m_sort_scan; |
1039 | 1006 | /** Statement digest. */ |
1040 | | - PSI_digest_locker_state m_digest_state; |
| 1007 | + const struct sql_digest_storage *m_digest; |
1041 | 1008 | /** Current schema name. */ |
1042 | 1009 | char m_schema_name[PSI_SCHEMA_NAME_LEN]; |
1043 | 1010 | /** Length in bytes of @c m_schema_name. */ |
@@ -1902,11 +1869,15 @@ typedef void (*set_socket_info_v1_t)(struct PSI_socket *socket, |
1902 | 1869 | */ |
1903 | 1870 | typedef void (*set_socket_thread_owner_v1_t)(struct PSI_socket *socket); |
1904 | 1871 |
|
| 1872 | +/** |
| 1873 | + Get a digest locker for the current statement. |
| 1874 | + @param locker a statement locker for the running thread |
| 1875 | +*/ |
1905 | 1876 | typedef struct PSI_digest_locker * (*digest_start_v1_t) |
1906 | 1877 | (struct PSI_statement_locker *locker); |
1907 | 1878 |
|
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); |
1910 | 1881 |
|
1911 | 1882 | /** |
1912 | 1883 | Stores an array of connection attributes |
@@ -2118,8 +2089,8 @@ struct PSI_v1 |
2118 | 2089 | set_socket_thread_owner_v1_t set_socket_thread_owner; |
2119 | 2090 | /** @sa digest_start_v1_t. */ |
2120 | 2091 | 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; |
2123 | 2094 | /** @sa set_thread_connect_attrs_v1_t. */ |
2124 | 2095 | set_thread_connect_attrs_v1_t set_thread_connect_attrs; |
2125 | 2096 | }; |
@@ -2414,6 +2385,10 @@ extern MYSQL_PLUGIN_IMPORT PSI *PSI_server; |
2414 | 2385 | #define PSI_STATEMENT_CALL(M) PSI_DYNAMIC_CALL(M) |
2415 | 2386 | #endif |
2416 | 2387 |
|
| 2388 | +#ifndef PSI_DIGEST_CALL |
| 2389 | +#define PSI_DIGEST_CALL(M) PSI_DYNAMIC_CALL(M) |
| 2390 | +#endif |
| 2391 | + |
2417 | 2392 | #ifndef PSI_TABLE_CALL |
2418 | 2393 | #define PSI_TABLE_CALL(M) PSI_DYNAMIC_CALL(M) |
2419 | 2394 | #endif |
|
0 commit comments