mirror of
https://github.com/MariaDB/server.git
synced 2025-01-16 03:52:35 +01:00
Fix several merge problems. There are many changes in 5.1 from 5.0
that affect profiling. mysql-test/r/information_schema.result: Merge fixed. This result moved to a new file. sql/sql_parse.cc: Include profiling in statistics. Add hook for SHOW_PROFILE in execution. sql/sql_profile.cc: Move/add the FEATURE_DISABLED warning to the I_S filling func. Fix merge, where a new member was added to ST_FIELD_INFO. orig_sql_command method was removed from Lex structure. sql/sql_show.cc: Fix merge problem. sql/sql_yacc.yy: orig_sql_command member removed from Lex structure in 5.1 .
This commit is contained in:
parent
cca4ea275b
commit
b01c89ed8c
5 changed files with 27 additions and 29 deletions
|
@ -1402,13 +1402,6 @@ TABLE_PRIVILEGES information_schema.TABLE_PRIVILEGES 1
|
|||
TRIGGERS information_schema.TRIGGERS 1
|
||||
USER_PRIVILEGES information_schema.USER_PRIVILEGES 1
|
||||
VIEWS information_schema.VIEWS 1
|
||||
show global status like "Uptime_%";
|
||||
Variable_name Value
|
||||
Uptime_since_flush_status #
|
||||
flush status;
|
||||
show global status like "Uptime_%";
|
||||
Variable_name Value
|
||||
Uptime_since_flush_status #
|
||||
create table t1(f1 int);
|
||||
create view v1 as select f1+1 as a from t1;
|
||||
create table t2 (f1 int, f2 int);
|
||||
|
|
|
@ -265,6 +265,8 @@ void init_update_queries(void)
|
|||
sql_command_flags[SQLCOM_SHOW_PROC_CODE]= CF_STATUS_COMMAND;
|
||||
sql_command_flags[SQLCOM_SHOW_FUNC_CODE]= CF_STATUS_COMMAND;
|
||||
sql_command_flags[SQLCOM_SHOW_CREATE_EVENT]= CF_STATUS_COMMAND;
|
||||
sql_command_flags[SQLCOM_SHOW_PROFILES]= CF_STATUS_COMMAND;
|
||||
sql_command_flags[SQLCOM_SHOW_PROFILE]= CF_STATUS_COMMAND;
|
||||
|
||||
sql_command_flags[SQLCOM_SHOW_TABLES]= (CF_STATUS_COMMAND |
|
||||
CF_SHOW_TABLE_COMMAND);
|
||||
|
@ -1911,6 +1913,7 @@ mysql_execute_command(THD *thd)
|
|||
case SQLCOM_SHOW_CHARSETS:
|
||||
case SQLCOM_SHOW_COLLATIONS:
|
||||
case SQLCOM_SHOW_STORAGE_ENGINES:
|
||||
case SQLCOM_SHOW_PROFILE:
|
||||
case SQLCOM_SELECT:
|
||||
thd->status_var.last_query_cost= 0.0;
|
||||
if (all_tables)
|
||||
|
|
|
@ -34,6 +34,7 @@ int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables,
|
|||
#if defined(ENABLED_PROFILING) && defined(COMMUNITY_SERVER)
|
||||
return(thd->profiling.fill_statistics_info(thd, tables, cond));
|
||||
#else
|
||||
my_error(ER_FEATURE_DISABLED, MYF(0), "SHOW PROFILE", "enable-profiling");
|
||||
return(1);
|
||||
#endif
|
||||
}
|
||||
|
@ -41,24 +42,24 @@ int fill_query_profile_statistics_info(THD *thd, TABLE_LIST *tables,
|
|||
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, NULL, SKIP_OPEN_TABLE},
|
||||
{"SEQ", 20, MYSQL_TYPE_LONG, 0, false, NULL, SKIP_OPEN_TABLE},
|
||||
{"STATE", 30, MYSQL_TYPE_STRING, 0, false, NULL, SKIP_OPEN_TABLE},
|
||||
{"DURATION", TIME_FLOAT_DIGITS, MYSQL_TYPE_DOUBLE, 0, false, NULL, SKIP_OPEN_TABLE},
|
||||
{"CPU_USER", TIME_FLOAT_DIGITS, MYSQL_TYPE_DOUBLE, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"CPU_SYSTEM", TIME_FLOAT_DIGITS, MYSQL_TYPE_DOUBLE, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"CONTEXT_VOLUNTARY", 20, MYSQL_TYPE_LONG, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"CONTEXT_INVOLUNTARY", 20, MYSQL_TYPE_LONG, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"BLOCK_OPS_IN", 20, MYSQL_TYPE_LONG, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"BLOCK_OPS_OUT", 20, MYSQL_TYPE_LONG, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"MESSAGES_SENT", 20, MYSQL_TYPE_LONG, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"MESSAGES_RECEIVED", 20, MYSQL_TYPE_LONG, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"PAGE_FAULTS_MAJOR", 20, MYSQL_TYPE_LONG, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"PAGE_FAULTS_MINOR", 20, MYSQL_TYPE_LONG, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"SWAPS", 20, MYSQL_TYPE_LONG, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"SOURCE_FUNCTION", 30, MYSQL_TYPE_STRING, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"SOURCE_FILE", 20, MYSQL_TYPE_STRING, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"SOURCE_LINE", 20, MYSQL_TYPE_LONG, 0, true, NULL, SKIP_OPEN_TABLE},
|
||||
{"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_FLOAT_DIGITS, MYSQL_TYPE_DOUBLE, 0, false, "Duration", SKIP_OPEN_TABLE},
|
||||
{"CPU_USER", TIME_FLOAT_DIGITS, MYSQL_TYPE_DOUBLE, 0, true, "CPU_user", SKIP_OPEN_TABLE},
|
||||
{"CPU_SYSTEM", TIME_FLOAT_DIGITS, MYSQL_TYPE_DOUBLE, 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, NULL}
|
||||
};
|
||||
|
||||
|
@ -513,7 +514,7 @@ int PROFILING::fill_statistics_info(THD *thd, TABLE_LIST *tables, Item *cond)
|
|||
{
|
||||
entry= query->entries.iterator_value(entry_iterator);
|
||||
|
||||
if (thd->lex->orig_sql_command == SQLCOM_SHOW_PROFILE)
|
||||
if (thd->lex->sql_command == SQLCOM_SHOW_PROFILE)
|
||||
{
|
||||
/*
|
||||
We got here via a SHOW command. That means that we stored
|
||||
|
|
|
@ -6507,6 +6507,7 @@ ST_SCHEMA_TABLE schema_tables[]=
|
|||
get_all_tables, 0, get_schema_key_column_usage_record, 4, 5, 0,
|
||||
OPEN_TABLE_ONLY},
|
||||
{"OPEN_TABLES", open_tables_fields_info, create_schema_table,
|
||||
fill_open_tables, make_old_format, 0, -1, -1, 1, 0},
|
||||
{"PARTITIONS", partitions_fields_info, create_schema_table,
|
||||
get_all_tables, 0, get_schema_partitions_record, 1, 2, 0, OPEN_TABLE_ONLY},
|
||||
{"PLUGINS", plugin_fields_info, create_schema_table,
|
||||
|
@ -6514,7 +6515,8 @@ ST_SCHEMA_TABLE schema_tables[]=
|
|||
{"PROCESSLIST", processlist_fields_info, create_schema_table,
|
||||
fill_schema_processlist, make_old_format, 0, -1, -1, 0, 0},
|
||||
{"PROFILING", query_profile_statistics_info, create_schema_table,
|
||||
fill_query_profile_statistics_info, NULL, NULL, -1, -1, false},
|
||||
fill_query_profile_statistics_info, make_profile_table_for_show,
|
||||
NULL, -1, -1, false, 0},
|
||||
{"REFERENTIAL_CONSTRAINTS", referential_constraints_fields_info,
|
||||
create_schema_table, get_all_tables, 0, get_referential_constraints_record,
|
||||
1, 9, 0, OPEN_TABLE_ONLY},
|
||||
|
|
|
@ -9094,8 +9094,7 @@ show_param:
|
|||
| PROFILE_SYM opt_profile_defs opt_profile_args opt_limit_clause_init
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
lex->sql_command= SQLCOM_SELECT;
|
||||
lex->orig_sql_command= SQLCOM_SHOW_PROFILE;
|
||||
lex->sql_command= SQLCOM_SHOW_PROFILE;
|
||||
if (prepare_schema_table(YYTHD, lex, NULL, SCH_PROFILES) != 0)
|
||||
YYABORT;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue