mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Unify profiling SHOW code and INFORMATION_SCHEMA code for
profiling. Also, Bug#26938: profiling client hang if used before enabled In the SHOW command, not sending header data because we had no rows to send was a protocol violation. Porting the SHOW PROFILE command to use the Information Schema table avoids that problem.
This commit is contained in:
@ -2315,6 +2315,15 @@ int prepare_schema_table(THD *thd, LEX *lex, Table_ident *table_ident,
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case SCH_PROFILES:
|
||||
/*
|
||||
Mark this current profiling record to be discarded. We don't
|
||||
wish to have SHOW commands show up in profiling.
|
||||
*/
|
||||
#ifdef ENABLED_PROFILING
|
||||
thd->profiling.discard();
|
||||
#endif
|
||||
break;
|
||||
case SCH_OPEN_TABLES:
|
||||
case SCH_VARIABLES:
|
||||
case SCH_STATUS:
|
||||
@ -2755,23 +2764,6 @@ mysql_execute_command(THD *thd)
|
||||
#else
|
||||
my_error(ER_FEATURE_DISABLED, MYF(0), "SHOW PROFILES", "enable-profiling");
|
||||
goto error;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
case SQLCOM_SHOW_PROFILE:
|
||||
{
|
||||
#ifdef ENABLED_PROFILING
|
||||
thd->profiling.store();
|
||||
thd->profiling.discard(); // will get re-enabled by reset()
|
||||
if (lex->profile_query_id != 0)
|
||||
res= thd->profiling.show(lex->profile_options, lex->profile_query_id);
|
||||
else
|
||||
res= thd->profiling.show_last(lex->profile_options);
|
||||
if (res)
|
||||
goto error;
|
||||
#else
|
||||
my_error(ER_FEATURE_DISABLED, MYF(0), "SHOW PROFILE", "enable-profiling");
|
||||
goto error;
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
Reference in New Issue
Block a user