Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
MariaDB
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
4156b1a2
Commit
4156b1a2
authored
Jun 16, 2019
by
Alexander Barkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
MDEV-19772 Add helper classes for ST_FIELD_INFO
parent
984d7100
Changes
23
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
1143 additions
and
978 deletions
+1143
-978
mysql-test/main/thread_pool_info.result
mysql-test/main/thread_pool_info.result
+1
-1
plugin/disks/information_schema_disks.cc
plugin/disks/information_schema_disks.cc
+14
-11
plugin/feedback/feedback.cc
plugin/feedback/feedback.cc
+3
-3
plugin/locale_info/locale_info.cc
plugin/locale_info/locale_info.cc
+16
-12
plugin/metadata_lock_info/metadata_lock_info.cc
plugin/metadata_lock_info/metadata_lock_info.cc
+14
-15
plugin/qc_info/qc_info.cc
plugin/qc_info/qc_info.cc
+32
-27
plugin/query_response_time/plugin.cc
plugin/query_response_time/plugin.cc
+9
-6
plugin/user_variables/user_variables.cc
plugin/user_variables/user_variables.cc
+10
-8
plugin/userstat/client_stats.cc
plugin/userstat/client_stats.cc
+31
-27
plugin/userstat/index_stats.cc
plugin/userstat/index_stats.cc
+10
-6
plugin/userstat/table_stats.cc
plugin/userstat/table_stats.cc
+11
-7
plugin/userstat/user_stats.cc
plugin/userstat/user_stats.cc
+31
-27
plugin/wsrep_info/plugin.cc
plugin/wsrep_info/plugin.cc
+20
-23
sql/opt_trace.cc
sql/opt_trace.cc
+12
-9
sql/set_var.cc
sql/set_var.cc
+1
-1
sql/sql_basic_types.h
sql/sql_basic_types.h
+2
-0
sql/sql_i_s.h
sql/sql_i_s.h
+318
-0
sql/sql_profile.cc
sql/sql_profile.cc
+23
-21
sql/sql_profile.h
sql/sql_profile.h
+3
-0
sql/sql_show.cc
sql/sql_show.cc
+529
-657
sql/sql_show.h
sql/sql_show.h
+0
-2
sql/table.h
sql/table.h
+1
-80
sql/thread_pool_info.cc
sql/thread_pool_info.cc
+52
-35
No files found.
mysql-test/main/thread_pool_info.result
View file @
4156b1a2
...
...
@@ -31,7 +31,7 @@ Field Type Null Key Default Extra
GROUP_ID int(6) NO 0
POSITION int(6) NO 0
PRIORITY int(1) NO 0
CONNECTION_ID bigint(19) NO 0
CONNECTION_ID bigint(19)
unsigned
NO 0
QUEUEING_TIME_MICROSECONDS bigint(19) NO 0
DESC INFORMATION_SCHEMA.THREAD_POOL_STATS;
Field Type Null Key Default Extra
...
...
plugin/disks/information_schema_disks.cc
View file @
4156b1a2
...
...
@@ -19,25 +19,28 @@
#include <sys/types.h>
#include <mntent.h>
#include <sql_class.h>
#include <
table
.h>
#include <
sql_i_s
.h>
bool
schema_table_store_record
(
THD
*
thd
,
TABLE
*
table
);
namespace
{
struct
st_mysql_information_schema
disks_table_info
=
{
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
};
namespace
Show
{
ST_FIELD_INFO
disks_table_fields
[]
=
{
{
"Disk"
,
PATH_MAX
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"Path"
,
PATH_MAX
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"Total"
,
32
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
// Total amount available
{
"Used"
,
32
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
// Amount of space used
{
"Available"
,
32
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
// Amount available to users other than root.
{
0
,
0
,
MYSQL_TYPE_NULL
,
0
,
0
,
0
,
0
}
Column
(
"Disk"
,
Varchar
(
PATH_MAX
),
NOT_NULL
)
,
Column
(
"Path"
,
Varchar
(
PATH_MAX
),
NOT_NULL
)
,
Column
(
"Total"
,
SLong
(
32
),
NOT_NULL
)
,
// Total amount available
Column
(
"Used"
,
SLong
(
32
),
NOT_NULL
)
,
// Amount of space used
Column
(
"Available"
,
SLong
(
32
),
NOT_NULL
)
,
// Amount available to users other than root.
CEnd
()
};
int
disks_table_add_row
(
THD
*
pThd
,
TABLE
*
pTable
,
const
char
*
zDisk
,
...
...
@@ -130,7 +133,7 @@ int disks_table_init(void *ptr)
return
0
;
}
}
}
// namespace Show
extern
"C"
{
...
...
@@ -143,7 +146,7 @@ maria_declare_plugin(disks)
"Johan Wikman"
,
/* author */
"Disk space information"
,
/* description */
PLUGIN_LICENSE_GPL
,
/* license type */
disks_table_init
,
/* init function */
Show
::
disks_table_init
,
/* init function */
NULL
,
/* deinit function */
0x0100
,
/* version = 1.0 */
NULL
,
/* no status variables */
...
...
plugin/feedback/feedback.cc
View file @
4156b1a2
...
...
@@ -67,9 +67,9 @@ ST_SCHEMA_TABLE *i_s_feedback; ///< table descriptor for our I_S table
*/
static
ST_FIELD_INFO
feedback_fields
[]
=
{
{
"VARIABLE_NAME"
,
255
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"VARIABLE_VALUE"
,
1024
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
0
,
0
,
MYSQL_TYPE_NULL
,
0
,
0
,
0
,
0
}
Show
::
Column
(
"VARIABLE_NAME"
,
Show
::
Varchar
(
255
),
NOT_NULL
)
,
Show
::
Column
(
"VARIABLE_VALUE"
,
Show
::
Varchar
(
1024
),
NOT_NULL
)
,
Show
::
CEnd
()
};
static
COND
*
const
OOM
=
(
COND
*
)
1
;
...
...
plugin/locale_info/locale_info.cc
View file @
4156b1a2
...
...
@@ -28,27 +28,31 @@
#include <my_global.h>
#include <sql_class.h> // THD
#include <
table
.h> // ST_SCHEMA_TABLE
#include <
sql_i_s
.h> // ST_SCHEMA_TABLE
#include <mysql/plugin.h>
#include <m_ctype.h>
#include "sql_locale.h"
bool
schema_table_store_record
(
THD
*
thd
,
TABLE
*
table
);
static
MY_LOCALE
**
locale_list
;
namespace
Show
{
/* LOCALES */
static
ST_FIELD_INFO
locale_info_locale_fields_info
[]
=
{
{
"ID"
,
4
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Id"
,
0
}
,
{
"NAME"
,
255
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Name"
,
0
}
,
{
"DESCRIPTION"
,
255
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Description"
,
0
}
,
{
"MAX_MONTH_NAME_LENGTH"
,
4
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"MAX_DAY_NAME_LENGTH"
,
4
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"DECIMAL_POINT"
,
2
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"THOUSAND_SEP"
,
2
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"ERROR_MESSAGE_LANGUAGE"
,
64
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Error_Message_Language"
,
0
}
,
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"ID"
,
SLonglong
(
4
),
NOT_NULL
,
"Id"
)
,
Column
(
"NAME"
,
Varchar
(
255
),
NOT_NULL
,
"Name"
)
,
Column
(
"DESCRIPTION"
,
Varchar
(
255
),
NOT_NULL
,
"Description"
)
,
Column
(
"MAX_MONTH_NAME_LENGTH"
,
SLonglong
(
4
),
NOT_NULL
)
,
Column
(
"MAX_DAY_NAME_LENGTH"
,
SLonglong
(
4
),
NOT_NULL
)
,
Column
(
"DECIMAL_POINT"
,
Varchar
(
2
),
NOT_NULL
)
,
Column
(
"THOUSAND_SEP"
,
Varchar
(
2
),
NOT_NULL
)
,
Column
(
"ERROR_MESSAGE_LANGUAGE"
,
Varchar
(
64
),
NOT_NULL
,
"Error_Message_Language"
)
,
CEnd
()
};
}
// namespace Show
static
int
locale_info_fill_table_locale
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
TABLE
*
table
=
tables
->
table
;
...
...
@@ -84,7 +88,7 @@ static int locale_info_fill_table_locale(THD* thd, TABLE_LIST* tables, COND* con
static
int
locale_info_plugin_init_locales
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
locale_info_locale_fields_info
;
schema
->
fields_info
=
Show
::
locale_info_locale_fields_info
;
schema
->
fill_table
=
locale_info_fill_table_locale
;
#if defined(_WIN64)
...
...
plugin/metadata_lock_info/metadata_lock_info.cc
View file @
4156b1a2
...
...
@@ -18,7 +18,7 @@
#include "mysql_version.h"
#include "mysql/plugin.h"
#include "sql_class.h"
#include "sql_
show
.h"
#include "sql_
i_s
.h"
static
const
LEX_STRING
metadata_lock_info_lock_name
[]
=
{
{
C_STRING_WITH_LEN
(
"Backup lock"
)
},
...
...
@@ -32,23 +32,22 @@ static const LEX_STRING metadata_lock_info_lock_name[] = {
{
C_STRING_WITH_LEN
(
"User lock"
)
},
};
namespace
Show
{
static
ST_FIELD_INFO
i_s_metadata_lock_info_fields_info
[]
=
{
{
"THREAD_ID"
,
20
,
MYSQL_TYPE_LONGLONG
,
0
,
MY_I_S_UNSIGNED
,
"thread_id"
,
SKIP_OPEN_TABLE
},
{
"LOCK_MODE"
,
24
,
MYSQL_TYPE_STRING
,
0
,
MY_I_S_MAYBE_NULL
,
"lock_mode"
,
SKIP_OPEN_TABLE
},
{
"LOCK_DURATION"
,
30
,
MYSQL_TYPE_STRING
,
0
,
MY_I_S_MAYBE_NULL
,
"lock_duration"
,
SKIP_OPEN_TABLE
},
{
"LOCK_TYPE"
,
33
,
MYSQL_TYPE_STRING
,
0
,
MY_I_S_MAYBE_NULL
,
"lock_type"
,
SKIP_OPEN_TABLE
},
{
"TABLE_SCHEMA"
,
64
,
MYSQL_TYPE_STRING
,
0
,
MY_I_S_MAYBE_NULL
,
"table_schema"
,
SKIP_OPEN_TABLE
},
{
"TABLE_NAME"
,
64
,
MYSQL_TYPE_STRING
,
0
,
MY_I_S_MAYBE_NULL
,
"table_name"
,
SKIP_OPEN_TABLE
},
{
NULL
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
NULL
,
0
}
Column
(
"THREAD_ID"
,
ULonglong
(
20
),
NOT_NULL
,
"thread_id"
),
Column
(
"LOCK_MODE"
,
Varchar
(
24
),
NULLABLE
,
"lock_mode"
),
Column
(
"LOCK_DURATION"
,
Varchar
(
30
),
NULLABLE
,
"lock_duration"
),
Column
(
"LOCK_TYPE"
,
Varchar
(
33
),
NULLABLE
,
"lock_type"
),
Column
(
"TABLE_SCHEMA"
,
Name
(),
NULLABLE
,
"table_schema"
),
Column
(
"TABLE_NAME"
,
Name
(),
NULLABLE
,
"table_name"
),
CEnd
()
};
}
// namespace Show
struct
st_i_s_metadata_param
{
THD
*
thd
;
...
...
@@ -110,7 +109,7 @@ static int i_s_metadata_lock_info_init(
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
DBUG_ENTER
(
"i_s_metadata_lock_info_init"
);
schema
->
fields_info
=
i_s_metadata_lock_info_fields_info
;
schema
->
fields_info
=
Show
::
i_s_metadata_lock_info_fields_info
;
schema
->
fill_table
=
i_s_metadata_lock_info_fill_table
;
schema
->
idx_field1
=
0
;
DBUG_RETURN
(
0
);
...
...
plugin/qc_info/qc_info.cc
View file @
4156b1a2
...
...
@@ -37,7 +37,7 @@
#include <sql_acl.h> // PROCESS_ACL
#include <sql_class.h> // THD
#include <sql_cache.h>
#include <
table.h>
// ST_SCHEMA_TABLE
#include <
sql_i_s.h>
// ST_SCHEMA_TABLE
#include <set_var.h> // sql_mode_string_representation
#include <tztime.h>
#include <mysql/plugin.h>
...
...
@@ -79,36 +79,41 @@ bool schema_table_store_record(THD *thd, TABLE *table);
#define COLUMN_PKT_NR 22
#define COLUMN_HITS 23
namespace
Show
{
/* ST_FIELD_INFO is defined in table.h */
static
ST_FIELD_INFO
qc_info_fields
[]
=
{
{
"STATEMENT_SCHEMA"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"STATEMENT_TEXT"
,
MAX_STATEMENT_TEXT_LENGTH
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"RESULT_BLOCKS_COUNT"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"RESULT_BLOCKS_SIZE"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"RESULT_BLOCKS_SIZE_USED"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"LIMIT"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"MAX_SORT_LENGTH"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"GROUP_CONCAT_MAX_LENGTH"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"CHARACTER_SET_CLIENT"
,
MY_CS_NAME_SIZE
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"CHARACTER_SET_RESULT"
,
MY_CS_NAME_SIZE
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"COLLATION"
,
MY_CS_NAME_SIZE
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"TIMEZONE"
,
50
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"DEFAULT_WEEK_FORMAT"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"DIV_PRECISION_INCREMENT"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"SQL_MODE"
,
250
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"LC_TIME_NAMES"
,
100
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"CLIENT_LONG_FLAG"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_TINY
,
0
,
0
,
0
,
0
}
,
{
"CLIENT_PROTOCOL_41"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_TINY
,
0
,
0
,
0
,
0
}
,
{
"PROTOCOL_TYPE"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_TINY
,
0
,
0
,
0
,
0
}
,
{
"MORE_RESULTS_EXISTS"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_TINY
,
0
,
0
,
0
,
0
}
,
{
"IN_TRANS"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_TINY
,
0
,
0
,
0
,
0
}
,
{
"AUTOCOMMIT"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_TINY
,
0
,
0
,
0
,
0
}
,
{
"PACKET_NUMBER"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_TINY
,
0
,
0
,
0
,
0
}
,
{
"HITS"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
MY_I_S_UNSIGNED
,
0
,
0
}
,
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"STATEMENT_SCHEMA"
,
Varchar
(
NAME_LEN
),
NOT_NULL
)
,
Column
(
"STATEMENT_TEXT"
,
Longtext
(
MAX_STATEMENT_TEXT_LENGTH
),
NOT_NULL
)
,
Column
(
"RESULT_BLOCKS_COUNT"
,
SLong
(),
NOT_NULL
)
,
Column
(
"RESULT_BLOCKS_SIZE"
,
SLonglong
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"RESULT_BLOCKS_SIZE_USED"
,
SLonglong
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"LIMIT"
,
SLonglong
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"MAX_SORT_LENGTH"
,
SLonglong
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"GROUP_CONCAT_MAX_LENGTH"
,
SLonglong
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"CHARACTER_SET_CLIENT"
,
CSName
(),
NOT_NULL
)
,
Column
(
"CHARACTER_SET_RESULT"
,
CSName
(),
NOT_NULL
)
,
Column
(
"COLLATION"
,
CSName
(),
NOT_NULL
)
,
Column
(
"TIMEZONE"
,
Varchar
(
50
),
NOT_NULL
)
,
Column
(
"DEFAULT_WEEK_FORMAT"
,
SLong
(),
NOT_NULL
)
,
Column
(
"DIV_PRECISION_INCREMENT"
,
SLong
(),
NOT_NULL
)
,
Column
(
"SQL_MODE"
,
Varchar
(
250
),
NOT_NULL
)
,
Column
(
"LC_TIME_NAMES"
,
Varchar
(
100
),
NOT_NULL
)
,
Column
(
"CLIENT_LONG_FLAG"
,
STiny
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"CLIENT_PROTOCOL_41"
,
STiny
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"PROTOCOL_TYPE"
,
STiny
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"MORE_RESULTS_EXISTS"
,
STiny
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"IN_TRANS"
,
STiny
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"AUTOCOMMIT"
,
STiny
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"PACKET_NUMBER"
,
STiny
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
Column
(
"HITS"
,
SLonglong
(
MY_INT32_NUM_DECIMAL_DIGITS
),
NOT_NULL
)
,
CEnd
()
};
}
// namespace Show
static
const
char
unknown
[]
=
"#UNKNOWN#"
;
...
...
@@ -276,7 +281,7 @@ static int qc_info_plugin_init(void *p)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
qc_info_fields
;
schema
->
fields_info
=
Show
::
qc_info_fields
;
schema
->
fill_table
=
qc_info_fill_table
;
#ifdef _WIN32
...
...
plugin/query_response_time/plugin.cc
View file @
4156b1a2
...
...
@@ -16,7 +16,7 @@
#define MYSQL_SERVER
#include <my_global.h>
#include <sql_class.h>
#include <
table
.h>
#include <
sql_i_s
.h>
#include <sql_show.h>
#include <mysql/plugin_audit.h>
#include "query_response_time.h"
...
...
@@ -71,19 +71,22 @@ static struct st_mysql_sys_var *query_response_time_info_vars[]=
};
namespace
Show
{
ST_FIELD_INFO
query_response_time_fields_info
[]
=
{
{
"TIME"
,
QRT_TIME_STRING_LENGTH
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Time"
,
0
}
,
{
"COUNT"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
MY_I_S_UNSIGNED
,
"Count"
,
0
}
,
{
"TOTAL"
,
QRT_TIME_STRING_LENGTH
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Total"
,
0
}
,
{
0
,
0
,
MYSQL_TYPE_NULL
,
0
,
0
,
0
,
0
}
Column
(
"TIME"
,
Varchar
(
QRT_TIME_STRING_LENGTH
),
NOT_NULL
,
"Time"
)
,
Column
(
"COUNT"
,
ULong
(),
NOT_NULL
,
"Count"
)
,
Column
(
"TOTAL"
,
Varchar
(
QRT_TIME_STRING_LENGTH
),
NOT_NULL
,
"Total"
)
,
CEnd
()
};
}
// namespace Show
static
int
query_response_time_info_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
i_s_query_response_time
=
(
ST_SCHEMA_TABLE
*
)
p
;
i_s_query_response_time
->
fields_info
=
query_response_time_fields_info
;
i_s_query_response_time
->
fields_info
=
Show
::
query_response_time_fields_info
;
i_s_query_response_time
->
fill_table
=
query_response_time_fill
;
i_s_query_response_time
->
reset_table
=
query_response_time_flush
;
query_response_time_init
();
...
...
plugin/user_variables/user_variables.cc
View file @
4156b1a2
...
...
@@ -16,7 +16,7 @@
#define MYSQL_SERVER
#include <my_global.h>
#include <sql_class.h>
#include <
table
.h>
#include <
sql_i_s
.h>
#include <sql_show.h>
...
...
@@ -42,16 +42,18 @@ static const LEX_CSTRING unsigned_result_types[]=
};
namespace
Show
{
static
ST_FIELD_INFO
user_variables_fields_info
[]
=
{
{
"VARIABLE_NAME"
,
NAME_CHAR_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Variable_name"
,
0
},
{
"VARIABLE_VALUE"
,
2048
,
MYSQL_TYPE_STRING
,
0
,
MY_I_S_MAYBE_NULL
,
"Value"
,
0
},
{
"VARIABLE_TYPE"
,
NAME_CHAR_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
},
{
"CHARACTER_SET_NAME"
,
MY_CS_NAME_SIZE
,
MYSQL_TYPE_STRING
,
0
,
MY_I_S_MAYBE_NULL
,
0
,
0
},
{
0
,
0
,
MYSQL_TYPE_NULL
,
0
,
0
,
0
,
0
}
Column
(
"VARIABLE_NAME"
,
Name
(),
NOT_NULL
,
"Variable_name"
),
Column
(
"VARIABLE_VALUE"
,
Varchar
(
2048
),
NULLABLE
,
"Value"
),
Column
(
"VARIABLE_TYPE"
,
Name
(),
NOT_NULL
),
Column
(
"CHARACTER_SET_NAME"
,
CSName
(),
NULLABLE
),
CEnd
()
};
}
// namespace Show
static
int
user_variables_fill
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
...
...
@@ -110,7 +112,7 @@ int user_variables_reset(void)
static
int
user_variables_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
is
=
(
ST_SCHEMA_TABLE
*
)
p
;
is
->
fields_info
=
user_variables_fields_info
;
is
->
fields_info
=
Show
::
user_variables_fields_info
;
is
->
fill_table
=
user_variables_fill
;
is
->
reset_table
=
user_variables_reset
;
return
0
;
...
...
plugin/userstat/client_stats.cc
View file @
4156b1a2
namespace
Show
{
static
ST_FIELD_INFO
client_stats_fields
[]
=
{
{
"CLIENT"
,
LIST_PROCESS_HOST_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Client"
,
0
}
,
{
"TOTAL_CONNECTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Total_connections"
,
0
}
,
{
"CONCURRENT_CONNECTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Concurrent_connections"
,
0
}
,
{
"CONNECTED_TIME"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Connected_time"
,
0
}
,
{
"BUSY_TIME"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
0
,
"Busy_time"
,
0
}
,
{
"CPU_TIME"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
0
,
"Cpu_time"
,
0
}
,
{
"BYTES_RECEIVED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Bytes_received"
,
0
}
,
{
"BYTES_SENT"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Bytes_sent"
,
0
}
,
{
"BINLOG_BYTES_WRITTEN"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Binlog_bytes_written"
,
0
}
,
{
"ROWS_READ"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_read"
,
0
}
,
{
"ROWS_SENT"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_sent"
,
0
}
,
{
"ROWS_DELETED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_deleted"
,
0
}
,
{
"ROWS_INSERTED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_inserted"
,
0
}
,
{
"ROWS_UPDATED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_updated"
,
0
}
,
{
"SELECT_COMMANDS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Select_commands"
,
0
}
,
{
"UPDATE_COMMANDS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Update_commands"
,
0
}
,
{
"OTHER_COMMANDS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Other_commands"
,
0
}
,
{
"COMMIT_TRANSACTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Commit_transactions"
,
0
}
,
{
"ROLLBACK_TRANSACTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rollback_transactions"
,
0
}
,
{
"DENIED_CONNECTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Denied_connections"
,
0
}
,
{
"LOST_CONNECTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Lost_connections"
,
0
}
,
{
"ACCESS_DENIED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Access_denied"
,
0
}
,
{
"EMPTY_QUERIES"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Empty_queries"
,
0
}
,
{
"TOTAL_SSL_CONNECTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
MY_I_S_UNSIGNED
,
"Total_ssl_connections"
,
0
}
,
{
"MAX_STATEMENT_TIME_EXCEEDED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Max_statement_time_exceeded"
,
SKIP_OPEN_TABLE
}
,
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"CLIENT"
,
Varchar
(
LIST_PROCESS_HOST_LEN
),
NOT_NULL
,
"Client"
)
,
Column
(
"TOTAL_CONNECTIONS"
,
SLonglong
(),
NOT_NULL
,
"Total_connections"
)
,
Column
(
"CONCURRENT_CONNECTIONS"
,
SLonglong
(),
NOT_NULL
,
"Concurrent_connections"
)
,
Column
(
"CONNECTED_TIME"
,
SLonglong
(),
NOT_NULL
,
"Connected_time"
)
,
Column
(
"BUSY_TIME"
,
Double
(
MY_INT64_NUM_DECIMAL_DIGITS
),
NOT_NULL
,
"Busy_time"
)
,
Column
(
"CPU_TIME"
,
Double
(
MY_INT64_NUM_DECIMAL_DIGITS
),
NOT_NULL
,
"Cpu_time"
)
,
Column
(
"BYTES_RECEIVED"
,
SLonglong
(),
NOT_NULL
,
"Bytes_received"
)
,
Column
(
"BYTES_SENT"
,
SLonglong
(),
NOT_NULL
,
"Bytes_sent"
)
,
Column
(
"BINLOG_BYTES_WRITTEN"
,
SLonglong
(),
NOT_NULL
,
"Binlog_bytes_written"
)
,
Column
(
"ROWS_READ"
,
SLonglong
(),
NOT_NULL
,
"Rows_read"
)
,
Column
(
"ROWS_SENT"
,
SLonglong
(),
NOT_NULL
,
"Rows_sent"
)
,
Column
(
"ROWS_DELETED"
,
SLonglong
(),
NOT_NULL
,
"Rows_deleted"
)
,
Column
(
"ROWS_INSERTED"
,
SLonglong
(),
NOT_NULL
,
"Rows_inserted"
)
,
Column
(
"ROWS_UPDATED"
,
SLonglong
(),
NOT_NULL
,
"Rows_updated"
)
,
Column
(
"SELECT_COMMANDS"
,
SLonglong
(),
NOT_NULL
,
"Select_commands"
)
,
Column
(
"UPDATE_COMMANDS"
,
SLonglong
(),
NOT_NULL
,
"Update_commands"
)
,
Column
(
"OTHER_COMMANDS"
,
SLonglong
(),
NOT_NULL
,
"Other_commands"
)
,
Column
(
"COMMIT_TRANSACTIONS"
,
SLonglong
(),
NOT_NULL
,
"Commit_transactions"
)
,
Column
(
"ROLLBACK_TRANSACTIONS"
,
SLonglong
(),
NOT_NULL
,
"Rollback_transactions"
)
,
Column
(
"DENIED_CONNECTIONS"
,
SLonglong
(),
NOT_NULL
,
"Denied_connections"
)
,
Column
(
"LOST_CONNECTIONS"
,
SLonglong
(),
NOT_NULL
,
"Lost_connections"
)
,
Column
(
"ACCESS_DENIED"
,
SLonglong
(),
NOT_NULL
,
"Access_denied"
)
,
Column
(
"EMPTY_QUERIES"
,
SLonglong
(),
NOT_NULL
,
"Empty_queries"
)
,
Column
(
"TOTAL_SSL_CONNECTIONS"
,
ULonglong
(),
NOT_NULL
,
"Total_ssl_connections"
)
,
Column
(
"MAX_STATEMENT_TIME_EXCEEDED"
,
SLonglong
(),
NOT_NULL
,
"Max_statement_time_exceeded"
)
,
CEnd
()
};
}
// namespace Show
static
int
send_user_stats
(
THD
*
thd
,
HASH
*
all_user_stats
,
TABLE
*
table
)
{
mysql_mutex_lock
(
&
LOCK_global_user_client_stats
);
...
...
@@ -92,7 +96,7 @@ static int client_stats_reset()
static
int
client_stats_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
client_stats_fields
;
schema
->
fields_info
=
Show
::
client_stats_fields
;
schema
->
fill_table
=
client_stats_fill
;
schema
->
reset_table
=
client_stats_reset
;
return
0
;
...
...
plugin/userstat/index_stats.cc
View file @
4156b1a2
namespace
Show
{
static
ST_FIELD_INFO
index_stats_fields
[]
=
{
{
"TABLE_SCHEMA"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Table_schema"
,
SKIP_OPEN_TABLE
}
,
{
"TABLE_NAME"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Table_name"
,
SKIP_OPEN_TABLE
}
,
{
"INDEX_NAME"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Index_name"
,
SKIP_OPEN_TABLE
}
,
{
"ROWS_READ"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_read"
,
SKIP_OPEN_TABLE
}
,
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"TABLE_SCHEMA"
,
Varchar
(
NAME_LEN
),
NOT_NULL
,
"Table_schema"
)
,
Column
(
"TABLE_NAME"
,
Varchar
(
NAME_LEN
),
NOT_NULL
,
"Table_name"
)
,
Column
(
"INDEX_NAME"
,
Varchar
(
NAME_LEN
),
NOT_NULL
,
"Index_name"
)
,
Column
(
"ROWS_READ"
,
SLonglong
(),
NOT_NULL
,
"Rows_read"
)
,
CEnd
()
};
}
// namespace Show
static
int
index_stats_fill
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
TABLE
*
table
=
tables
->
table
;
...
...
@@ -63,7 +67,7 @@ static int index_stats_reset()
static
int
index_stats_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
index_stats_fields
;
schema
->
fields_info
=
Show
::
index_stats_fields
;
schema
->
fill_table
=
index_stats_fill
;
schema
->
reset_table
=
index_stats_reset
;
return
0
;
...
...
plugin/userstat/table_stats.cc
View file @
4156b1a2
namespace
Show
{
static
ST_FIELD_INFO
table_stats_fields
[]
=
{
{
"TABLE_SCHEMA"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Table_schema"
,
SKIP_OPEN_TABLE
}
,
{
"TABLE_NAME"
,
NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Table_name"
,
SKIP_OPEN_TABLE
}
,
{
"ROWS_READ"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_read"
,
SKIP_OPEN_TABLE
}
,
{
"ROWS_CHANGED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_changed"
,
SKIP_OPEN_TABLE
}
,
{
"ROWS_CHANGED_X_INDEXES"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_changed_x_#indexes"
,
SKIP_OPEN_TABLE
}
,
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"TABLE_SCHEMA"
,
Varchar
(
NAME_LEN
),
NOT_NULL
,
"Table_schema"
)
,
Column
(
"TABLE_NAME"
,
Varchar
(
NAME_LEN
),
NOT_NULL
,
"Table_name"
)
,
Column
(
"ROWS_READ"
,
SLonglong
(),
NOT_NULL
,
"Rows_read"
)
,
Column
(
"ROWS_CHANGED"
,
SLonglong
(),
NOT_NULL
,
"Rows_changed"
)
,
Column
(
"ROWS_CHANGED_X_INDEXES"
,
SLonglong
(),
NOT_NULL
,
"Rows_changed_x_#indexes"
)
,
CEnd
()
};
}
// namespace Show
static
int
table_stats_fill
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
TABLE
*
table
=
tables
->
table
;
...
...
@@ -67,7 +71,7 @@ static int table_stats_reset()
static
int
table_stats_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
table_stats_fields
;
schema
->
fields_info
=
Show
::
table_stats_fields
;
schema
->
fill_table
=
table_stats_fill
;
schema
->
reset_table
=
table_stats_reset
;
return
0
;
...
...
plugin/userstat/user_stats.cc
View file @
4156b1a2
namespace
Show
{
static
ST_FIELD_INFO
user_stats_fields
[]
=
{
{
"USER"
,
USERNAME_CHAR_LENGTH
,
MYSQL_TYPE_STRING
,
0
,
0
,
"User"
,
0
}
,
{
"TOTAL_CONNECTIONS"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
0
,
"Total_connections"
,
0
}
,
{
"CONCURRENT_CONNECTIONS"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
0
,
"Concurrent_connections"
,
0
}
,
{
"CONNECTED_TIME"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
0
,
"Connected_time"
,
0
}
,
{
"BUSY_TIME"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
0
,
"Busy_time"
,
0
}
,
{
"CPU_TIME"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_DOUBLE
,
0
,
0
,
"Cpu_time"
,
0
}
,
{
"BYTES_RECEIVED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Bytes_received"
,
0
}
,
{
"BYTES_SENT"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Bytes_sent"
,
0
}
,
{
"BINLOG_BYTES_WRITTEN"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Binlog_bytes_written"
,
0
}
,
{
"ROWS_READ"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_read"
,
0
}
,
{
"ROWS_SENT"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_sent"
,
0
}
,
{
"ROWS_DELETED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_deleted"
,
0
}
,
{
"ROWS_INSERTED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_inserted"
,
0
}
,
{
"ROWS_UPDATED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rows_updated"
,
0
}
,
{
"SELECT_COMMANDS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Select_commands"
,
0
}
,
{
"UPDATE_COMMANDS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Update_commands"
,
0
}
,
{
"OTHER_COMMANDS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Other_commands"
,
0
}
,
{
"COMMIT_TRANSACTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Commit_transactions"
,
0
}
,
{
"ROLLBACK_TRANSACTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Rollback_transactions"
,
0
}
,
{
"DENIED_CONNECTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Denied_connections"
,
0
}
,
{
"LOST_CONNECTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Lost_connections"
,
0
}
,
{
"ACCESS_DENIED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Access_denied"
,
0
}
,
{
"EMPTY_QUERIES"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Empty_queries"
,
0
}
,
{
"TOTAL_SSL_CONNECTIONS"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
MY_I_S_UNSIGNED
,
"Total_ssl_connections"
,
0
}
,
{
"MAX_STATEMENT_TIME_EXCEEDED"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
"Max_statement_time_exceeded"
,
SKIP_OPEN_TABLE
}
,
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"USER"
,
Varchar
(
USERNAME_CHAR_LENGTH
),
NOT_NULL
,
"User"
)
,
Column
(
"TOTAL_CONNECTIONS"
,
SLong
(),
NOT_NULL
,
"Total_connections"
)
,
Column
(
"CONCURRENT_CONNECTIONS"
,
SLong
(),
NOT_NULL
,
"Concurrent_connections"
)
,
Column
(
"CONNECTED_TIME"
,
SLong
(),
NOT_NULL
,
"Connected_time"
)
,
Column
(
"BUSY_TIME"
,
Double
(
MY_INT64_NUM_DECIMAL_DIGITS
),
NOT_NULL
,
"Busy_time"
)
,
Column
(
"CPU_TIME"
,
Double
(
MY_INT64_NUM_DECIMAL_DIGITS
),
NOT_NULL
,
"Cpu_time"
)
,
Column
(
"BYTES_RECEIVED"
,
SLonglong
(),
NOT_NULL
,
"Bytes_received"
)
,
Column
(
"BYTES_SENT"
,
SLonglong
(),
NOT_NULL
,
"Bytes_sent"
)
,
Column
(
"BINLOG_BYTES_WRITTEN"
,
SLonglong
(),
NOT_NULL
,
"Binlog_bytes_written"
)
,
Column
(
"ROWS_READ"
,
SLonglong
(),
NOT_NULL
,
"Rows_read"
)
,
Column
(
"ROWS_SENT"
,
SLonglong
(),
NOT_NULL
,
"Rows_sent"
)
,
Column
(
"ROWS_DELETED"
,
SLonglong
(),
NOT_NULL
,
"Rows_deleted"
)
,
Column
(
"ROWS_INSERTED"
,
SLonglong
(),
NOT_NULL
,
"Rows_inserted"
)
,
Column
(
"ROWS_UPDATED"
,
SLonglong
(),
NOT_NULL
,
"Rows_updated"
)
,
Column
(
"SELECT_COMMANDS"
,
SLonglong
(),
NOT_NULL
,
"Select_commands"
)
,
Column
(
"UPDATE_COMMANDS"
,
SLonglong
(),
NOT_NULL
,
"Update_commands"
)
,
Column
(
"OTHER_COMMANDS"
,
SLonglong
(),
NOT_NULL
,
"Other_commands"
)
,
Column
(
"COMMIT_TRANSACTIONS"
,
SLonglong
(),
NOT_NULL
,
"Commit_transactions"
)
,
Column
(
"ROLLBACK_TRANSACTIONS"
,
SLonglong
(),
NOT_NULL
,
"Rollback_transactions"
)
,
Column
(
"DENIED_CONNECTIONS"
,
SLonglong
(),
NOT_NULL
,
"Denied_connections"
)
,
Column
(
"LOST_CONNECTIONS"
,
SLonglong
(),
NOT_NULL
,
"Lost_connections"
)
,
Column
(
"ACCESS_DENIED"
,
SLonglong
(),
NOT_NULL
,
"Access_denied"
)
,
Column
(
"EMPTY_QUERIES"
,
SLonglong
(),
NOT_NULL
,
"Empty_queries"
)
,
Column
(
"TOTAL_SSL_CONNECTIONS"
,
ULonglong
(),
NOT_NULL
,
"Total_ssl_connections"
)
,
Column
(
"MAX_STATEMENT_TIME_EXCEEDED"
,
SLonglong
(),
NOT_NULL
,
"Max_statement_time_exceeded"
)
,
CEnd
()
};
}
// namespace Show
static
int
user_stats_fill
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
if
(
check_global_access
(
thd
,
SUPER_ACL
|
PROCESS_ACL
,
true
))
...
...
@@ -48,7 +52,7 @@ static int user_stats_reset()
static
int
user_stats_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
user_stats_fields
;
schema
->
fields_info
=
Show
::
user_stats_fields
;
schema
->
fill_table
=
user_stats_fill
;
schema
->
reset_table
=
user_stats_reset
;
return
0
;
...
...
plugin/wsrep_info/plugin.cc
View file @
4156b1a2
...
...
@@ -19,7 +19,7 @@
#include <my_global.h>
#include <mysql/plugin.h>
#include <
table.h>
/* ST_SCHEMA_TABLE */
#include <
sql_i_s.h>
/* ST_SCHEMA_TABLE */
#include <sql_show.h>
#include <sql_acl.h>
/* check_global_access() */
#include <wsrep_mysqld.h>
...
...
@@ -55,35 +55,32 @@
/* Application protocol version */
#define COLUMN_WSREP_STATUS_PROTO_VERSION 7
namespace
Show
{
static
ST_FIELD_INFO
wsrep_memb_fields
[]
=
{
{
"INDEX"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
0
,
"Index"
,
0
}
,
{
"UUID"
,
WSREP_UUID_STR_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Uuid"
,
0
}
,
{
"NAME"
,
WSREP_MEMBER_NAME_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Name"
,
0
}
,
{
"ADDRESS"
,
WSREP_INCOMING_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Address"
,
0
}
,
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"INDEX"
,
SLong
(),
NOT_NULL
,
"Index"
)
,
Column
(
"UUID"
,
Varchar
(
WSREP_UUID_STR_LEN
),
NOT_NULL
,
"Uuid"
)
,
Column
(
"NAME"
,
Varchar
(
WSREP_MEMBER_NAME_LEN
),
NOT_NULL
,
"Name"
)
,
Column
(
"ADDRESS"
,
Varchar
(
WSREP_INCOMING_LEN
),
NOT_NULL
,
"Address"
)
,
CEnd
()
};
static
ST_FIELD_INFO
wsrep_status_fields
[]
=
{
{
"NODE_INDEX"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
0
,
"Node_Index"
,
0
},
{
"NODE_STATUS"
,
16
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Node_Status"
,
0
},
{
"CLUSTER_STATUS"
,
16
,
MYSQL_TYPE_STRING
,
0
,
0
,
"Cluster_Status"
,
0
},
{
"CLUSTER_SIZE"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
0
,
"Cluster_Size"
,
0
},
{
"CLUSTER_STATE_UUID"
,
WSREP_UUID_STR_LEN
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
},
{
"CLUSTER_STATE_SEQNO"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
},
{
"CLUSTER_CONF_ID"
,
MY_INT64_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
},
{
"PROTOCOL_VERSION"
,
MY_INT32_NUM_DECIMAL_DIGITS
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
},
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"NODE_INDEX"
,
SLong
(),
NOT_NULL
,
"Node_Index"
),
Column
(
"NODE_STATUS"
,
Varchar
(
16
),
NOT_NULL
,
"Node_Status"
),
Column
(
"CLUSTER_STATUS"
,
Varchar
(
16
),
NOT_NULL
,
"Cluster_Status"
),
Column
(
"CLUSTER_SIZE"
,
SLong
(),
NOT_NULL
,
"Cluster_Size"
),
Column
(
"CLUSTER_STATE_UUID"
,
Varchar
(
WSREP_UUID_STR_LEN
),
NOT_NULL
),
Column
(
"CLUSTER_STATE_SEQNO"
,
SLonglong
(),
NOT_NULL
),
Column
(
"CLUSTER_CONF_ID"
,
SLonglong
(),
NOT_NULL
),
Column
(
"PROTOCOL_VERSION"
,
SLong
(),
NOT_NULL
),
CEnd
()
};
}
// namespace Show
static
int
wsrep_memb_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
)
{
int
rc
=
0
;
...
...
@@ -131,7 +128,7 @@ static int wsrep_memb_plugin_init(void *p)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
wsrep_memb_fields
;
schema
->
fields_info
=
Show
::
wsrep_memb_fields
;
schema
->
fill_table
=
wsrep_memb_fill_table
;
return
0
;
...
...
@@ -189,7 +186,7 @@ static int wsrep_status_plugin_init(void *p)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
wsrep_status_fields
;
schema
->
fields_info
=
Show
::
wsrep_status_fields
;
schema
->
fill_table
=
wsrep_status_fill_table
;
return
0
;
...
...
sql/opt_trace.cc
View file @
4156b1a2
...
...
@@ -17,7 +17,7 @@
#include "sql_class.h"
#include "sql_show.h"
#include "field.h"
#include "
table
.h"
#include "
sql_i_s
.h"
#include "opt_trace.h"
#include "sql_parse.h"
#include "set_var.h"
...
...
@@ -66,18 +66,21 @@ bool sets_var_optimizer_trace(enum enum_sql_command sql_command,
}
namespace
Show
{
ST_FIELD_INFO
optimizer_trace_info
[]
=
{
/* name, length, type, value, maybe_null, old_name, open_method */
{
"QUERY"
,
65535
,
MYSQL_TYPE_STRING
,
0
,
false
,
NULL
,
SKIP_OPEN_TABLE
},
{
"TRACE"
,
65535
,
MYSQL_TYPE_STRING
,
0
,
false
,
NULL
,
SKIP_OPEN_TABLE
},
{
"MISSING_BYTES_BEYOND_MAX_MEM_SIZE"
,
20
,
MYSQL_TYPE_LONG
,
0
,
false
,
NULL
,
SKIP_OPEN_TABLE
},
{
"INSUFFICIENT_PRIVILEGES"
,
1
,
MYSQL_TYPE_TINY
,
0
,
false
,
NULL
,
SKIP_OPEN_TABLE
},
{
NULL
,
0
,
MYSQL_TYPE_STRING
,
0
,
true
,
NULL
,
0
}
Column
(
"QUERY"
,
Longtext
(
65535
),
NOT_NULL
),
Column
(
"TRACE"
,
Longtext
(
65535
),
NOT_NULL
),
Column
(
"MISSING_BYTES_BEYOND_MAX_MEM_SIZE"
,
SLong
(
20
),
NOT_NULL
),
Column
(
"INSUFFICIENT_PRIVILEGES"
,
STiny
(
1
),
NOT_NULL
),
CEnd
()
};
}
// namespace Show
/*
TODO: one-line needs to be implemented seperately
*/
...
...
sql/set_var.cc
View file @
4156b1a2
...
...
@@ -35,7 +35,7 @@
#include "tztime.h" // my_tz_find, my_tz_SYSTEM, struct Time_zone
#include "sql_acl.h" // SUPER_ACL
#include "sql_select.h" // free_underlaid_joins
#include "sql_
show
.h"
#include "sql_
i_s
.h"
#include "sql_view.h" // updatable_views_with_limit_typelib
#include "lock.h" // lock_global_read_lock,
// make_global_read_lock_block_commit,
...
...
sql/sql_basic_types.h
View file @
4156b1a2
...
...
@@ -23,6 +23,8 @@
typedef
ulonglong
sql_mode_t
;
typedef
int64
query_id_t
;
enum
enum_nullability
{
NOT_NULL
,
NULLABLE
};
/*
"fuzzydate" with strict data type control.
...
...
sql/sql_i_s.h
0 → 100644
View file @
4156b1a2
#ifndef SQL_I_S_INCLUDED
#define SQL_I_S_INCLUDED
/* Copyright (c) 2000, 2017, Oracle and/or its affiliates.
Copyright (c) 2009, 2019, MariaDB
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., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
#include "sql_const.h" // MAX_FIELD_VARCHARLENGTH
#include "sql_basic_types.h" // enum_nullability
#include "sql_string.h" // strlen, MY_CS_NAME_SIZE
#include "lex_string.h" // LEX_CSTRING
#include "mysql_com.h" // enum_field_types
#include "my_time.h" // TIME_SECOND_PART_DIGITS
struct
TABLE_LIST
;
struct
TABLE
;
typedef
class
Item
COND
;
#ifdef MYSQL_CLIENT
#error MYSQL_CLIENT must not be defined
#endif // MYSQL_CLIENT
bool
schema_table_store_record
(
THD
*
thd
,
TABLE
*
table
);
COND
*
make_cond_for_info_schema
(
THD
*
thd
,
COND
*
cond
,
TABLE_LIST
*
table
);
#define MY_I_S_MAYBE_NULL 1U
#define MY_I_S_UNSIGNED 2U
enum
enum_show_open_table
{
SKIP_OPEN_TABLE
=
0U
,
// do not open table
OPEN_FRM_ONLY
=
1U
,
// open FRM file only
OPEN_FULL_TABLE
=
2U
// open FRM,MYD, MYI files
};
struct
ST_FIELD_INFO
{
/**
This is used as column name.
*/
const
char
*
field_name
;
/**
For string-type columns, this is the maximum number of
characters. Otherwise, it is the 'display-length' for the column.
*/
uint
field_length
;
/**
This denotes data type for the column. For the most part, there seems to
be one entry in the enum for each SQL data type, although there seem to
be a number of additional entries in the enum.
*/
enum
enum_field_types
field_type
;
int
value
;
/**
This is used to set column attributes. By default, columns are @c NOT
@c NULL and @c SIGNED, and you can deviate from the default
by setting the appopriate flags. You can use either one of the flags
@c MY_I_S_MAYBE_NULL and @cMY_I_S_UNSIGNED or
combine them using the bitwise or operator @c |. Both flags are
defined in table.h.
*/
uint
field_flags
;
// Field atributes(maybe_null, signed, unsigned etc.)
const
char
*
old_name
;
/**
This should be one of @c SKIP_OPEN_TABLE,
@c OPEN_FRM_ONLY or @c OPEN_FULL_TABLE.
*/
uint
open_method
;
LEX_CSTRING
get_name
()
const
{
return
LEX_CSTRING
({
field_name
,
strlen
(
field_name
)});
}
LEX_CSTRING
get_old_name
()
const
{
return
LEX_CSTRING
({
old_name
,
strlen
(
old_name
)});
}
bool
unsigned_flag
()
const
{
return
field_flags
&
MY_I_S_UNSIGNED
;
}
uint
fsp
()
const
{
DBUG_ASSERT
(
field_length
<=
TIME_SECOND_PART_DIGITS
);
return
field_length
;
}
};
namespace
Show
{
class
Type
{
enum
enum_field_types
m_type
;
uint
m_char_length
;
uint
m_unsigned_flag
;
public:
Type
(
enum_field_types
type
,
uint
length
,
uint
unsigned_flag
)
:
m_type
(
type
),
m_char_length
(
length
),
m_unsigned_flag
(
unsigned_flag
)
{
}
enum_field_types
type
()
const
{
return
m_type
;
}
uint
char_length
()
const
{
return
m_char_length
;
}
uint
unsigned_flag
()
const
{
return
m_unsigned_flag
;
}
};
class
Blob
:
public
Type
{
public:
Blob
(
uint
length
)
:
Type
(
MYSQL_TYPE_BLOB
,
length
,
false
)
{
}
};
class
Varchar
:
public
Type
{
public:
Varchar
(
uint
length
)
:
Type
(
MYSQL_TYPE_STRING
,
length
,
false
)
{
DBUG_ASSERT
(
length
*
3
<=
MAX_FIELD_VARCHARLENGTH
);
}
};
class
Longtext
:
public
Type
{
public:
Longtext
(
uint
length
)
:
Type
(
MYSQL_TYPE_STRING
,
length
,
false
)
{
}
};
class
Yesno
:
public
Varchar
{
public:
Yesno
()
:
Varchar
(
3
)
{
}
};
class
Catalog
:
public
Varchar
{
public:
Catalog
()
:
Varchar
(
FN_REFLEN
)
{
}
};
class
Name
:
public
Varchar
{
public:
Name
()
:
Varchar
(
NAME_CHAR_LEN
)
{
}
};
class
Definer
:
public
Varchar
{
public:
Definer
()
:
Varchar
(
DEFINER_CHAR_LENGTH
)
{
}
};
class
Userhost
:
public
Varchar
{
public:
Userhost
()
:
Varchar
(
USERNAME_CHAR_LENGTH
+
HOSTNAME_LENGTH
+
2
)
{
}
};
class
CSName
:
public
Varchar
{
public:
CSName
()
:
Varchar
(
MY_CS_NAME_SIZE
)
{
}
};
class
SQLMode
:
public
Varchar
{
public:
SQLMode
()
:
Varchar
(
32
*
256
)
{
}
};
class
Datetime
:
public
Type
{
public:
Datetime
(
uint
dec
)
:
Type
(
MYSQL_TYPE_DATETIME
,
dec
,
false
)
{
}
};
class
Decimal
:
public
Type
{
public:
Decimal
(
uint
length
)
:
Type
(
MYSQL_TYPE_DECIMAL
,
length
,
false
)
{
}
};
class
ULonglong
:
public
Type
{
public:
ULonglong
(
uint
length
)
:
Type
(
MYSQL_TYPE_LONGLONG
,
length
,
true
)
{
}
ULonglong
()
:
ULonglong
(
MY_INT64_NUM_DECIMAL_DIGITS
)
{
}
};
class
ULong
:
public
Type
{
public:
ULong
(
uint
length
)
:
Type
(
MYSQL_TYPE_LONG
,
length
,
true
)
{
}
ULong
()
:
ULong
(
MY_INT32_NUM_DECIMAL_DIGITS
)
{
}
};
class
SLonglong
:
public
Type
{
public:
SLonglong
(
uint
length
)
:
Type
(
MYSQL_TYPE_LONGLONG
,
length
,
false
)
{
}
SLonglong
()
:
SLonglong
(
MY_INT64_NUM_DECIMAL_DIGITS
)
{
}
};
class
SLong
:
public
Type
{
public:
SLong
(
uint
length
)
:
Type
(
MYSQL_TYPE_LONG
,
length
,
false
)
{
}
SLong
()
:
SLong
(
MY_INT32_NUM_DECIMAL_DIGITS
)
{
}
};
class
SShort
:
public
Type
{
public:
SShort
(
uint
length
)
:
Type
(
MYSQL_TYPE_SHORT
,
length
,
false
)
{
}
};
class
STiny
:
public
Type
{
public:
STiny
(
uint
length
)
:
Type
(
MYSQL_TYPE_TINY
,
length
,
false
)
{
}
};
class
Double
:
public
Type
{
public:
Double
(
uint
length
)
:
Type
(
MYSQL_TYPE_DOUBLE
,
length
,
false
)
{
}
};
class
Column
:
public
ST_FIELD_INFO
{
public:
Column
(
const
char
*
name
,
const
Type
&
type
,
enum_nullability
nullability
,
const
char
*
old_name
,
enum_show_open_table
open_method
=
SKIP_OPEN_TABLE
)
{
ST_FIELD_INFO
::
field_name
=
name
;
ST_FIELD_INFO
::
field_length
=
type
.
char_length
();
ST_FIELD_INFO
::
field_type
=
type
.
type
();
ST_FIELD_INFO
::
value
=
0
;
ST_FIELD_INFO
::
field_flags
=
(
type
.
unsigned_flag
()
?
MY_I_S_UNSIGNED
:
0
)
|
(
nullability
==
NULLABLE
?
MY_I_S_MAYBE_NULL
:
0
);
ST_FIELD_INFO
::
old_name
=
old_name
;
ST_FIELD_INFO
::
open_method
=
open_method
;
}
Column
(
const
char
*
name
,
const
Type
&
type
,
enum_nullability
nullability
,
enum_show_open_table
open_method
=
SKIP_OPEN_TABLE
)
:
Column
(
name
,
type
,
nullability
,
NullS
,
open_method
)
{
}
};
// End marker
class
CEnd
:
public
Column
{
public:
CEnd
()
:
Column
(
NullS
,
Varchar
(
0
),
NOT_NULL
,
NullS
,
SKIP_OPEN_TABLE
)
{
}
};
}
// namespace Show
struct
TABLE_LIST
;
typedef
class
Item
COND
;
typedef
struct
st_schema_table
{
const
char
*
table_name
;
ST_FIELD_INFO
*
fields_info
;
/* for FLUSH table_name */
int
(
*
reset_table
)
();
/* Fill table with data */
int
(
*
fill_table
)
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
);
/* Handle fileds for old SHOW */
int
(
*
old_format
)
(
THD
*
thd
,
struct
st_schema_table
*
schema_table
);
int
(
*
process_table
)
(
THD
*
thd
,
TABLE_LIST
*
tables
,
TABLE
*
table
,
bool
res
,
const
LEX_CSTRING
*
db_name
,
const
LEX_CSTRING
*
table_name
);
int
idx_field1
,
idx_field2
;
bool
hidden
;
uint
i_s_requested_object
;
/* the object we need to open(TABLE | VIEW) */
}
ST_SCHEMA_TABLE
;
#endif // SQL_I_S_INCLUDED
sql/sql_profile.cc
View file @
4156b1a2
...
...
@@ -32,7 +32,7 @@
#include "mariadb.h"
#include "sql_priv.h"
#include "sql_profile.h"
#include "sql_
show.h"
// schema_table_store_record
#include "sql_
i_s.h"
// schema_table_store_record
#include "sql_class.h" // THD
#ifdef _WIN32
...
...
@@ -60,30 +60,32 @@ int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables,
#endif
}
namespace
Show
{
ST_FIELD_INFO
query_profile_statistics_info
[]
=
{
/* name, length, type, value, maybe_null, old_name, open_method */
{
"QUERY_ID"
,
20
,
MYSQL_TYPE_LONG
,
0
,
false
,
"Query_id"
,
SKIP_OPEN_TABLE
},
{
"SEQ"
,
20
,
MYSQL_TYPE_LONG
,
0
,
false
,
"Seq"
,
SKIP_OPEN_TABLE
},
{
"STATE"
,
30
,
MYSQL_TYPE_STRING
,
0
,
false
,
"Status"
,
SKIP_OPEN_TABLE
},
{
"DURATION"
,
TIME_I_S_DECIMAL_SIZE
,
MYSQL_TYPE_DECIMAL
,
0
,
false
,
"Duration"
,
SKIP_OPEN_TABLE
},
{
"CPU_USER"
,
TIME_I_S_DECIMAL_SIZE
,
MYSQL_TYPE_DECIMAL
,
0
,
true
,
"CPU_user"
,
SKIP_OPEN_TABLE
},
{
"CPU_SYSTEM"
,
TIME_I_S_DECIMAL_SIZE
,
MYSQL_TYPE_DECIMAL
,
0
,
true
,
"CPU_system"
,
SKIP_OPEN_TABLE
},
{
"CONTEXT_VOLUNTARY"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
"Context_voluntary"
,
SKIP_OPEN_TABLE
},
{
"CONTEXT_INVOLUNTARY"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
"Context_involuntary"
,
SKIP_OPEN_TABLE
},
{
"BLOCK_OPS_IN"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
"Block_ops_in"
,
SKIP_OPEN_TABLE
},
{
"BLOCK_OPS_OUT"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
"Block_ops_out"
,
SKIP_OPEN_TABLE
},
{
"MESSAGES_SENT"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
"Messages_sent"
,
SKIP_OPEN_TABLE
},
{
"MESSAGES_RECEIVED"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
"Messages_received"
,
SKIP_OPEN_TABLE
},
{
"PAGE_FAULTS_MAJOR"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
"Page_faults_major"
,
SKIP_OPEN_TABLE
},
{
"PAGE_FAULTS_MINOR"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
"Page_faults_minor"
,
SKIP_OPEN_TABLE
},
{
"SWAPS"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
"Swaps"
,
SKIP_OPEN_TABLE
},
{
"SOURCE_FUNCTION"
,
30
,
MYSQL_TYPE_STRING
,
0
,
true
,
"Source_function"
,
SKIP_OPEN_TABLE
},
{
"SOURCE_FILE"
,
20
,
MYSQL_TYPE_STRING
,
0
,
true
,
"Source_file"
,
SKIP_OPEN_TABLE
},
{
"SOURCE_LINE"
,
20
,
MYSQL_TYPE_LONG
,
0
,
true
,
"Source_line"
,
SKIP_OPEN_TABLE
},
{
NULL
,
0
,
MYSQL_TYPE_STRING
,
0
,
true
,
NULL
,
0
}
Column
(
"QUERY_ID"
,
SLong
(
20
),
NOT_NULL
,
"Query_id"
),
Column
(
"SEQ"
,
SLong
(
20
),
NOT_NULL
,
"Seq"
),
Column
(
"STATE"
,
Varchar
(
30
),
NOT_NULL
,
"Status"
),
Column
(
"DURATION"
,
Decimal
(
TIME_I_S_DECIMAL_SIZE
),
NOT_NULL
,
"Duration"
),
Column
(
"CPU_USER"
,
Decimal
(
TIME_I_S_DECIMAL_SIZE
),
NULLABLE
,
"CPU_user"
),
Column
(
"CPU_SYSTEM"
,
Decimal
(
TIME_I_S_DECIMAL_SIZE
),
NULLABLE
,
"CPU_system"
),
Column
(
"CONTEXT_VOLUNTARY"
,
SLong
(
20
),
NULLABLE
,
"Context_voluntary"
),
Column
(
"CONTEXT_INVOLUNTARY"
,
SLong
(
20
),
NULLABLE
,
"Context_involuntary"
),
Column
(
"BLOCK_OPS_IN"
,
SLong
(
20
),
NULLABLE
,
"Block_ops_in"
),
Column
(
"BLOCK_OPS_OUT"
,
SLong
(
20
),
NULLABLE
,
"Block_ops_out"
),
Column
(
"MESSAGES_SENT"
,
SLong
(
20
),
NULLABLE
,
"Messages_sent"
),
Column
(
"MESSAGES_RECEIVED"
,
SLong
(
20
),
NULLABLE
,
"Messages_received"
),
Column
(
"PAGE_FAULTS_MAJOR"
,
SLong
(
20
),
NULLABLE
,
"Page_faults_major"
),
Column
(
"PAGE_FAULTS_MINOR"
,
SLong
(
20
),
NULLABLE
,
"Page_faults_minor"
),
Column
(
"SWAPS"
,
SLong
(
20
),
NULLABLE
,
"Swaps"
),
Column
(
"SOURCE_FUNCTION"
,
Varchar
(
30
),
NULLABLE
,
"Source_function"
),
Column
(
"SOURCE_FILE"
,
Varchar
(
20
),
NULLABLE
,
"Source_file"
),
Column
(
"SOURCE_LINE"
,
SLong
(
20
),
NULLABLE
,
"Source_line"
),
CEnd
()
};
}
// namespace Show
int
make_profile_table_for_show
(
THD
*
thd
,
ST_SCHEMA_TABLE
*
schema_table
)
{
...
...
sql/sql_profile.h
View file @
4156b1a2
...
...
@@ -22,7 +22,10 @@ class THD;
struct
ST_FIELD_INFO
;
typedef
struct
st_schema_table
ST_SCHEMA_TABLE
;
namespace
Show
{
extern
ST_FIELD_INFO
query_profile_statistics_info
[];
}
// namespace Show
int
fill_query_profile_statistics_info
(
THD
*
thd
,
TABLE_LIST
*
tables
,
Item
*
cond
);
int
make_profile_table_for_show
(
THD
*
thd
,
ST_SCHEMA_TABLE
*
schema_table
);
...
...
sql/sql_show.cc
View file @
4156b1a2
This diff is collapsed.
Click to expand it.
sql/sql_show.h
View file @
4156b1a2
...
...
@@ -117,9 +117,7 @@ bool show_create_trigger(THD *thd, const sp_name *trg_name);
void
view_store_options
(
THD
*
thd
,
TABLE_LIST
*
table
,
String
*
buff
);
void
init_fill_schema_files_row
(
TABLE
*
table
);
bool
schema_table_store_record
(
THD
*
thd
,
TABLE
*
table
);
void
initialize_information_schema_acl
();
COND
*
make_cond_for_info_schema
(
THD
*
thd
,
COND
*
cond
,
TABLE_LIST
*
table
);
ST_SCHEMA_TABLE
*
find_schema_table
(
THD
*
thd
,
const
LEX_CSTRING
*
table_name
,
bool
*
in_plugin
);
...
...
sql/table.h
View file @
4156b1a2
...
...
@@ -31,6 +31,7 @@
#include "thr_lock.h"
/* thr_lock_type */
#include "filesort_utils.h"
#include "parse_file.h"
#include "sql_i_s.h"
/* Structs that defines the TABLE */
...
...
@@ -1662,86 +1663,6 @@ typedef struct st_foreign_key_info
LEX_CSTRING
*
fk_option_name
(
enum_fk_option
opt
);
bool
fk_modifies_child
(
enum_fk_option
opt
);
#define MY_I_S_MAYBE_NULL 1U
#define MY_I_S_UNSIGNED 2U
#define SKIP_OPEN_TABLE 0U // do not open table
#define OPEN_FRM_ONLY 1U // open FRM file only
#define OPEN_FULL_TABLE 2U // open FRM,MYD, MYI files
struct
ST_FIELD_INFO
{
/**
This is used as column name.
*/
const
char
*
field_name
;
/**
For string-type columns, this is the maximum number of
characters. Otherwise, it is the 'display-length' for the column.
*/
uint
field_length
;
/**
This denotes data type for the column. For the most part, there seems to
be one entry in the enum for each SQL data type, although there seem to
be a number of additional entries in the enum.
*/
enum
enum_field_types
field_type
;
int
value
;
/**
This is used to set column attributes. By default, columns are @c NOT
@c NULL and @c SIGNED, and you can deviate from the default
by setting the appopriate flags. You can use either one of the flags
@c MY_I_S_MAYBE_NULL and @cMY_I_S_UNSIGNED or
combine them using the bitwise or operator @c |. Both flags are
defined in table.h.
*/
uint
field_flags
;
// Field atributes(maybe_null, signed, unsigned etc.)
const
char
*
old_name
;
/**
This should be one of @c SKIP_OPEN_TABLE,
@c OPEN_FRM_ONLY or @c OPEN_FULL_TABLE.
*/
uint
open_method
;
LEX_CSTRING
get_name
()
const
{
return
LEX_CSTRING
({
field_name
,
strlen
(
field_name
)});
}
LEX_CSTRING
get_old_name
()
const
{
return
LEX_CSTRING
({
old_name
,
strlen
(
old_name
)});
}
bool
unsigned_flag
()
const
{
return
field_flags
&
MY_I_S_UNSIGNED
;
}
uint
fsp
()
const
{
DBUG_ASSERT
(
field_length
<=
TIME_SECOND_PART_DIGITS
);
return
field_length
;
}
};
struct
TABLE_LIST
;
typedef
class
Item
COND
;
typedef
struct
st_schema_table
{
const
char
*
table_name
;
ST_FIELD_INFO
*
fields_info
;
/* for FLUSH table_name */
int
(
*
reset_table
)
();
/* Fill table with data */
int
(
*
fill_table
)
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
cond
);
/* Handle fileds for old SHOW */
int
(
*
old_format
)
(
THD
*
thd
,
struct
st_schema_table
*
schema_table
);
int
(
*
process_table
)
(
THD
*
thd
,
TABLE_LIST
*
tables
,
TABLE
*
table
,
bool
res
,
const
LEX_CSTRING
*
db_name
,
const
LEX_CSTRING
*
table_name
);
int
idx_field1
,
idx_field2
;
bool
hidden
;
uint
i_s_requested_object
;
/* the object we need to open(TABLE | VIEW) */
}
ST_SCHEMA_TABLE
;
class
IS_table_read_plan
;
/*
...
...
sql/thread_pool_info.cc
View file @
4156b1a2
...
...
@@ -18,24 +18,29 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111 - 1301 USA*/
#include <my_global.h>
#include <sql_class.h>
#include <
table
.h>
#include <
sql_i_s
.h>
#include <mysql/plugin.h>
#include <sql_show.h>
#include <threadpool_generic.h>
namespace
Show
{
static
ST_FIELD_INFO
groups_fields_info
[]
=
{
{
"GROUP_ID"
,
6
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"CONNECTIONS"
,
6
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"THREADS"
,
6
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"ACTIVE_THREADS"
,
6
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"STANDBY_THREADS"
,
6
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"QUEUE_LENGTH"
,
6
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"HAS_LISTENER"
,
1
,
MYSQL_TYPE_TINY
,
0
,
0
,
0
,
0
}
,
{
"IS_STALLED"
,
1
,
MYSQL_TYPE_TINY
,
0
,
0
,
0
,
0
}
,
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"GROUP_ID"
,
SLong
(
6
),
NOT_NULL
)
,
Column
(
"CONNECTIONS"
,
SLong
(
6
),
NOT_NULL
)
,
Column
(
"THREADS"
,
SLong
(
6
),
NOT_NULL
)
,
Column
(
"ACTIVE_THREADS"
,
SLong
(
6
),
NOT_NULL
)
,
Column
(
"STANDBY_THREADS"
,
SLong
(
6
),
NOT_NULL
)
,
Column
(
"QUEUE_LENGTH"
,
SLong
(
6
),
NOT_NULL
)
,
Column
(
"HAS_LISTENER"
,
STiny
(
1
),
NOT_NULL
)
,
Column
(
"IS_STALLED"
,
STiny
(
1
),
NOT_NULL
)
,
CEnd
()
};
}
// namespace Show
static
int
groups_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
)
{
if
(
!
all_groups
)
...
...
@@ -74,22 +79,26 @@ static int groups_fill_table(THD* thd, TABLE_LIST* tables, COND*)
static
int
groups_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
groups_fields_info
;
schema
->
fields_info
=
Show
::
groups_fields_info
;
schema
->
fill_table
=
groups_fill_table
;
return
0
;
}
namespace
Show
{
static
ST_FIELD_INFO
queues_field_info
[]
=
{
{
"GROUP_ID"
,
6
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"POSITION"
,
6
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"PRIORITY"
,
1
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"CONNECTION_ID"
,
19
,
MYSQL_TYPE_LONGLONG
,
MY_I_S_UNSIGNED
,
0
,
0
,
0
}
,
{
"QUEUEING_TIME_MICROSECONDS"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
0
,
0
,
MYSQL_TYPE_NULL
,
0
,
0
,
0
,
0
}
Column
(
"GROUP_ID"
,
SLong
(
6
),
NOT_NULL
)
,
Column
(
"POSITION"
,
SLong
(
6
),
NOT_NULL
)
,
Column
(
"PRIORITY"
,
SLong
(
1
),
NOT_NULL
)
,
Column
(
"CONNECTION_ID"
,
ULonglong
(
19
),
NOT_NULL
)
,
Column
(
"QUEUEING_TIME_MICROSECONDS"
,
SLonglong
(
19
),
NOT_NULL
)
,
CEnd
()
};
}
// namespace Show
typedef
connection_queue_t
::
Iterator
connection_queue_iterator
;
static
int
queues_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
)
...
...
@@ -140,27 +149,32 @@ static int queues_fill_table(THD* thd, TABLE_LIST* tables, COND*)
static
int
queues_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
queues_field_info
;
schema
->
fields_info
=
Show
::
queues_field_info
;
schema
->
fill_table
=
queues_fill_table
;
return
0
;
}
namespace
Show
{
static
ST_FIELD_INFO
stats_fields_info
[]
=
{
{
"GROUP_ID"
,
6
,
MYSQL_TYPE_LONG
,
0
,
0
,
0
,
0
}
,
{
"THREAD_CREATIONS"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"THREAD_CREATIONS_DUE_TO_STALL"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"WAKES"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"WAKES_DUE_TO_STALL"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"THROTTLES"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"STALLS"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"POLLS_BY_LISTENER"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"POLLS_BY_WORKER"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"DEQUEUES_BY_LISTENER"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
"DEQUEUES_BY_WORKER"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"GROUP_ID"
,
SLong
(
6
),
NOT_NULL
)
,
Column
(
"THREAD_CREATIONS"
,
SLonglong
(
19
),
NOT_NULL
)
,
Column
(
"THREAD_CREATIONS_DUE_TO_STALL"
,
SLonglong
(
19
),
NOT_NULL
)
,
Column
(
"WAKES"
,
SLonglong
(
19
),
NOT_NULL
)
,
Column
(
"WAKES_DUE_TO_STALL"
,
SLonglong
(
19
),
NOT_NULL
)
,
Column
(
"THROTTLES"
,
SLonglong
(
19
),
NOT_NULL
)
,
Column
(
"STALLS"
,
SLonglong
(
19
),
NOT_NULL
)
,
Column
(
"POLLS_BY_LISTENER"
,
SLonglong
(
19
),
NOT_NULL
)
,
Column
(
"POLLS_BY_WORKER"
,
SLonglong
(
19
),
NOT_NULL
)
,
Column
(
"DEQUEUES_BY_LISTENER"
,
SLonglong
(
19
),
NOT_NULL
)
,
Column
(
"DEQUEUES_BY_WORKER"
,
SLonglong
(
19
),
NOT_NULL
)
,
CEnd
()
};
}
// namespace Show
static
int
stats_fill_table
(
THD
*
thd
,
TABLE_LIST
*
tables
,
COND
*
)
{
if
(
!
all_groups
)
...
...
@@ -206,21 +220,24 @@ static int stats_reset_table()
static
int
stats_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
stats_fields_info
;
schema
->
fields_info
=
Show
::
stats_fields_info
;
schema
->
fill_table
=
stats_fill_table
;
schema
->
reset_table
=
stats_reset_table
;
return
0
;
}
namespace
Show
{
static
ST_FIELD_INFO
waits_fields_info
[]
=
{
{
"REASON"
,
16
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
,
{
"COUNT"
,
19
,
MYSQL_TYPE_LONGLONG
,
0
,
0
,
0
,
0
}
,
{
0
,
0
,
MYSQL_TYPE_STRING
,
0
,
0
,
0
,
0
}
Column
(
"REASON"
,
Varchar
(
16
),
NOT_NULL
)
,
Column
(
"COUNT"
,
SLonglong
(
19
),
NOT_NULL
)
,
CEnd
()
};
}
// namespace Show
/* See thd_wait_type enum for explanation*/
static
const
LEX_CSTRING
wait_reasons
[
THD_WAIT_LAST
]
=
{
...
...
@@ -267,7 +284,7 @@ static int waits_reset_table()
static
int
waits_init
(
void
*
p
)
{
ST_SCHEMA_TABLE
*
schema
=
(
ST_SCHEMA_TABLE
*
)
p
;
schema
->
fields_info
=
waits_fields_info
;
schema
->
fields_info
=
Show
::
waits_fields_info
;
schema
->
fill_table
=
waits_fill_table
;
schema
->
reset_table
=
waits_reset_table
;
return
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment