WL#3337 (Event scheduler new architecture)
Remove SHOW SCHEDULER STATUS command and migrate the information output to `mysqladmin debug` (COM_DEBUG) SHOW SCHEDULER STATUS was introduced in 5.1.11, provided some debug information about event scheduler internals and was enabled only in debug builds. sql/event_queue.cc: Remove SHOW SCHEDULER STATUS. Reporting still will be there but through COM_DEBUG (mysqladmin debug) sql/event_queue.h: dump_internal_status cannot return an error, therefore it should be void. sql/event_scheduler.cc: Remove SHOW SCHEDULER STATUS. Reporting still will be there but through COM_DEBUG (mysqladmin debug) sql/event_scheduler.h: dump_internal_status cannot return an error, therefore it should be void. sql/events.cc: Change from outputting the internal data from the wire to the standard output. SHOW SCHEDULER STATUS was removed. sql/events.h: dump_internal_status() cannot return an error, therefore it should be void sql/lex.h: remove SCHEDULER as recognized word. This is part of removing SHOW SCHEDULER STATUS sql/sp_head.cc: SQLCOM_SHOW_SCHEDULER_STATUS has been removed sql/sql_lex.h: SQLCOM_SHOW_SCHEDULER_STATUS has been removed sql/sql_parse.cc: SQLCOM_SHOW_SCHEDULER_STATUS has been removed sql/sql_test.cc: Dump Events' internal information on COM_DEBUG sql/sql_yacc.yy: SQLCOM_SHOW_SCHEDULER_STATUS has been removed
This commit is contained in:
parent
53267edaf6
commit
04a5f335d3
@ -907,7 +907,7 @@ Event_queue::cond_wait(THD *thd, struct timespec *abstime, const char* msg,
|
||||
do but we need to obey cond_wait()
|
||||
*/
|
||||
thd->exit_cond("");
|
||||
LOCK_QUEUE_DATA();
|
||||
lock_data(func, line);
|
||||
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
@ -918,102 +918,31 @@ Event_queue::cond_wait(THD *thd, struct timespec *abstime, const char* msg,
|
||||
|
||||
SYNOPSIS
|
||||
Event_queue::dump_internal_status()
|
||||
thd Thread
|
||||
|
||||
RETURN VALUE
|
||||
FALSE OK
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
bool
|
||||
Event_queue::dump_internal_status(THD *thd)
|
||||
void
|
||||
Event_queue::dump_internal_status()
|
||||
{
|
||||
DBUG_ENTER("Event_queue::dump_internal_status");
|
||||
#ifndef DBUG_OFF
|
||||
CHARSET_INFO *scs= system_charset_info;
|
||||
Protocol *protocol= thd->protocol;
|
||||
List<Item> field_list;
|
||||
int ret;
|
||||
char tmp_buff[5*STRING_BUFFER_USUAL_SIZE];
|
||||
char int_buff[STRING_BUFFER_USUAL_SIZE];
|
||||
String tmp_string(tmp_buff, sizeof(tmp_buff), scs);
|
||||
String int_string(int_buff, sizeof(int_buff), scs);
|
||||
tmp_string.length(0);
|
||||
int_string.length(0);
|
||||
|
||||
/* workers_count */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("queue element count"), scs);
|
||||
int_string.set((longlong) queue.elements, scs);
|
||||
protocol->store(&int_string);
|
||||
ret= protocol->write();
|
||||
/* element count */
|
||||
puts("");
|
||||
puts("Event queue status:");
|
||||
printf("Element count : %u\n", queue.elements);
|
||||
printf("Data locked : %s\n", mutex_queue_data_locked? "YES":"NO");
|
||||
printf("Attempting lock : %s\n", mutex_queue_data_attempting_lock? "YES":"NO");
|
||||
printf("LLA : %s:%u\n", mutex_last_locked_in_func,
|
||||
mutex_last_locked_at_line);
|
||||
printf("LUA : %s:%u\n", mutex_last_unlocked_in_func,
|
||||
mutex_last_unlocked_at_line);
|
||||
if (mutex_last_attempted_lock_at_line)
|
||||
printf("Last lock attempt at: %s:%u\n", mutex_last_attempted_lock_in_func,
|
||||
mutex_last_attempted_lock_at_line);
|
||||
printf("WOC : %s\n", waiting_on_cond? "YES":"NO");
|
||||
printf("Next activation : %04d-%02d-%02d %02d:%02d:%02d\n",
|
||||
next_activation_at.year, next_activation_at.month,
|
||||
next_activation_at.day, next_activation_at.hour,
|
||||
next_activation_at.minute, next_activation_at.second);
|
||||
|
||||
/* queue_data_locked */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("queue data locked"), scs);
|
||||
int_string.set((longlong) mutex_queue_data_locked, scs);
|
||||
protocol->store(&int_string);
|
||||
ret= protocol->write();
|
||||
|
||||
/* queue_data_attempting_lock */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("queue data attempting lock"), scs);
|
||||
int_string.set((longlong) mutex_queue_data_attempting_lock, scs);
|
||||
protocol->store(&int_string);
|
||||
ret= protocol->write();
|
||||
|
||||
/* last locked at*/
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("queue last locked at"), scs);
|
||||
tmp_string.length(scs->cset->snprintf(scs, (char*) tmp_string.ptr(),
|
||||
tmp_string.alloced_length(), "%s::%d",
|
||||
mutex_last_locked_in_func,
|
||||
mutex_last_locked_at_line));
|
||||
protocol->store(&tmp_string);
|
||||
ret= protocol->write();
|
||||
|
||||
/* last unlocked at*/
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("queue last unlocked at"), scs);
|
||||
tmp_string.length(scs->cset->snprintf(scs, (char*) tmp_string.ptr(),
|
||||
tmp_string.alloced_length(), "%s::%d",
|
||||
mutex_last_unlocked_in_func,
|
||||
mutex_last_unlocked_at_line));
|
||||
protocol->store(&tmp_string);
|
||||
ret= protocol->write();
|
||||
|
||||
/* last attempted lock at*/
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("queue last attempted lock at"), scs);
|
||||
tmp_string.length(scs->cset->snprintf(scs, (char*) tmp_string.ptr(),
|
||||
tmp_string.alloced_length(), "%s::%d",
|
||||
mutex_last_attempted_lock_in_func,
|
||||
mutex_last_attempted_lock_at_line));
|
||||
protocol->store(&tmp_string);
|
||||
ret= protocol->write();
|
||||
|
||||
/* waiting on */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("queue waiting on condition"), scs);
|
||||
int_string.set((longlong) waiting_on_cond, scs);
|
||||
protocol->store(&int_string);
|
||||
ret= protocol->write();
|
||||
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("next activation at"), scs);
|
||||
tmp_string.length(scs->cset->snprintf(scs, (char*) tmp_string.ptr(),
|
||||
tmp_string.alloced_length(),
|
||||
"%4d-%02d-%02d %02d:%02d:%02d",
|
||||
next_activation_at.year,
|
||||
next_activation_at.month,
|
||||
next_activation_at.day,
|
||||
next_activation_at.hour,
|
||||
next_activation_at.minute,
|
||||
next_activation_at.second
|
||||
));
|
||||
protocol->store(&tmp_string);
|
||||
ret= protocol->write();
|
||||
|
||||
#endif
|
||||
DBUG_RETURN(FALSE);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -61,8 +61,9 @@ public:
|
||||
|
||||
bool
|
||||
get_top_for_execution_if_time(THD *thd, Event_job_data **job_data);
|
||||
bool
|
||||
dump_internal_status(THD *thd);
|
||||
|
||||
void
|
||||
dump_internal_status();
|
||||
|
||||
int
|
||||
load_events_from_db(THD *thd);
|
||||
|
@ -38,6 +38,7 @@ extern pthread_attr_t connection_attrib;
|
||||
static
|
||||
const LEX_STRING scheduler_states_names[] =
|
||||
{
|
||||
{ C_STRING_WITH_LEN("UNINITIALIZED") },
|
||||
{ C_STRING_WITH_LEN("INITIALIZED") },
|
||||
{ C_STRING_WITH_LEN("RUNNING") },
|
||||
{ C_STRING_WITH_LEN("STOPPING") }
|
||||
@ -757,106 +758,25 @@ Event_scheduler::cond_wait(THD *thd, struct timespec *abstime, const char* msg,
|
||||
|
||||
SYNOPSIS
|
||||
Event_scheduler::dump_internal_status()
|
||||
thd Thread
|
||||
|
||||
RETURN VALUE
|
||||
FALSE OK
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
bool
|
||||
Event_scheduler::dump_internal_status(THD *thd)
|
||||
void
|
||||
Event_scheduler::dump_internal_status()
|
||||
{
|
||||
int ret= 0;
|
||||
DBUG_ENTER("Event_scheduler::dump_internal_status");
|
||||
|
||||
#ifndef DBUG_OFF
|
||||
CHARSET_INFO *scs= system_charset_info;
|
||||
Protocol *protocol= thd->protocol;
|
||||
char tmp_buff[5*STRING_BUFFER_USUAL_SIZE];
|
||||
char int_buff[STRING_BUFFER_USUAL_SIZE];
|
||||
String tmp_string(tmp_buff, sizeof(tmp_buff), scs);
|
||||
String int_string(int_buff, sizeof(int_buff), scs);
|
||||
tmp_string.length(0);
|
||||
int_string.length(0);
|
||||
puts("");
|
||||
puts("Event scheduler status:");
|
||||
printf("State : %s\n", scheduler_states_names[state].str);
|
||||
printf("Thread id : %lu\n", scheduler_thd? scheduler_thd->thread_id : 0);
|
||||
printf("LLA : %s:%u\n", mutex_last_locked_in_func,
|
||||
mutex_last_locked_at_line);
|
||||
printf("LUA : %s:%u\n", mutex_last_unlocked_in_func,
|
||||
mutex_last_unlocked_at_line);
|
||||
printf("WOC : %s\n", waiting_on_cond? "YES":"NO");
|
||||
printf("Workers : %u\n", workers_count());
|
||||
printf("Executed : %llu\n", started_events);
|
||||
printf("Data locked: %s\n", mutex_scheduler_data_locked ? "YES":"NO");
|
||||
|
||||
do
|
||||
{
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("scheduler state"), scs);
|
||||
protocol->store(scheduler_states_names[state].str,
|
||||
scheduler_states_names[state].length, scs);
|
||||
|
||||
if ((ret= protocol->write()))
|
||||
break;
|
||||
|
||||
/* thread_id */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("thread_id"), scs);
|
||||
if (thread_id)
|
||||
{
|
||||
int_string.set((longlong) scheduler_thd->thread_id, scs);
|
||||
protocol->store(&int_string);
|
||||
}
|
||||
else
|
||||
protocol->store_null();
|
||||
if ((ret= protocol->write()))
|
||||
break;
|
||||
|
||||
/* last locked at*/
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("scheduler last locked at"), scs);
|
||||
tmp_string.length(scs->cset->snprintf(scs, (char*) tmp_string.ptr(),
|
||||
tmp_string.alloced_length(), "%s::%d",
|
||||
mutex_last_locked_in_func,
|
||||
mutex_last_locked_at_line));
|
||||
protocol->store(&tmp_string);
|
||||
if ((ret= protocol->write()))
|
||||
break;
|
||||
|
||||
/* last unlocked at*/
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("scheduler last unlocked at"), scs);
|
||||
tmp_string.length(scs->cset->snprintf(scs, (char*) tmp_string.ptr(),
|
||||
tmp_string.alloced_length(), "%s::%d",
|
||||
mutex_last_unlocked_in_func,
|
||||
mutex_last_unlocked_at_line));
|
||||
protocol->store(&tmp_string);
|
||||
if ((ret= protocol->write()))
|
||||
break;
|
||||
|
||||
/* waiting on */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("scheduler waiting on condition"), scs);
|
||||
int_string.set((longlong) waiting_on_cond, scs);
|
||||
protocol->store(&int_string);
|
||||
if ((ret= protocol->write()))
|
||||
break;
|
||||
|
||||
/* workers_count */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("scheduler workers count"), scs);
|
||||
int_string.set((longlong) workers_count(), scs);
|
||||
protocol->store(&int_string);
|
||||
if ((ret= protocol->write()))
|
||||
break;
|
||||
|
||||
/* workers_count */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("scheduler executed events"), scs);
|
||||
int_string.set((longlong) started_events, scs);
|
||||
protocol->store(&int_string);
|
||||
if ((ret= protocol->write()))
|
||||
break;
|
||||
|
||||
/* scheduler_data_locked */
|
||||
protocol->prepare_for_resend();
|
||||
protocol->store(STRING_WITH_LEN("scheduler data locked"), scs);
|
||||
int_string.set((longlong) mutex_scheduler_data_locked, scs);
|
||||
protocol->store(&int_string);
|
||||
ret= protocol->write();
|
||||
} while (0);
|
||||
#endif
|
||||
|
||||
DBUG_RETURN(ret);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
@ -65,8 +65,8 @@ public:
|
||||
bool
|
||||
is_running();
|
||||
|
||||
bool
|
||||
dump_internal_status(THD *thd);
|
||||
void
|
||||
dump_internal_status();
|
||||
|
||||
private:
|
||||
uint
|
||||
|
@ -744,32 +744,20 @@ Events::destroy_mutexes()
|
||||
|
||||
SYNOPSIS
|
||||
Events::dump_internal_status()
|
||||
thd Thread
|
||||
|
||||
RETURN VALUE
|
||||
FALSE OK
|
||||
TRUE Error
|
||||
*/
|
||||
|
||||
bool
|
||||
Events::dump_internal_status(THD *thd)
|
||||
void
|
||||
Events::dump_internal_status()
|
||||
{
|
||||
DBUG_ENTER("Events::dump_internal_status");
|
||||
Protocol *protocol= thd->protocol;
|
||||
List<Item> field_list;
|
||||
puts("\n\n\nEvents status:");
|
||||
puts("LLA = Last Locked At LUA = Last Unlocked At");
|
||||
puts("WOC = Waiting On Condition DL = Data Locked");
|
||||
|
||||
field_list.push_back(new Item_empty_string("Name", 30));
|
||||
field_list.push_back(new Item_empty_string("Value",20));
|
||||
if (protocol->send_fields(&field_list, Protocol::SEND_NUM_ROWS |
|
||||
Protocol::SEND_EOF))
|
||||
DBUG_RETURN(TRUE);
|
||||
scheduler->dump_internal_status();
|
||||
event_queue->dump_internal_status();
|
||||
|
||||
if (scheduler->dump_internal_status(thd) ||
|
||||
event_queue->dump_internal_status(thd))
|
||||
DBUG_RETURN(TRUE);
|
||||
|
||||
send_eof(thd);
|
||||
DBUG_RETURN(FALSE);
|
||||
DBUG_VOID_RETURN;
|
||||
}
|
||||
|
||||
|
||||
|
@ -112,8 +112,8 @@ public:
|
||||
static int
|
||||
fill_schema_events(THD *thd, TABLE_LIST *tables, COND * /* cond */);
|
||||
|
||||
bool
|
||||
dump_internal_status(THD *thd);
|
||||
void
|
||||
dump_internal_status();
|
||||
|
||||
private:
|
||||
bool
|
||||
|
@ -452,7 +452,6 @@ static SYMBOL symbols[] = {
|
||||
{ "RTREE", SYM(RTREE_SYM)},
|
||||
{ "SAVEPOINT", SYM(SAVEPOINT_SYM)},
|
||||
{ "SCHEDULE", SYM(SCHEDULE_SYM)},
|
||||
{ "SCHEDULER", SYM(SCHEDULER_SYM)},
|
||||
{ "SCHEMA", SYM(DATABASE)},
|
||||
{ "SCHEMAS", SYM(DATABASES)},
|
||||
{ "SECOND", SYM(SECOND_SYM)},
|
||||
|
@ -196,7 +196,6 @@ sp_get_flags_for_command(LEX *lex)
|
||||
case SQLCOM_SHOW_PRIVILEGES:
|
||||
case SQLCOM_SHOW_PROCESSLIST:
|
||||
case SQLCOM_SHOW_PROC_CODE:
|
||||
case SQLCOM_SHOW_SCHEDULER_STATUS:
|
||||
case SQLCOM_SHOW_SLAVE_HOSTS:
|
||||
case SQLCOM_SHOW_SLAVE_STAT:
|
||||
case SQLCOM_SHOW_STATUS:
|
||||
|
@ -113,7 +113,6 @@ enum enum_sql_command {
|
||||
SQLCOM_SHOW_CONTRIBUTORS,
|
||||
SQLCOM_CREATE_EVENT, SQLCOM_ALTER_EVENT, SQLCOM_DROP_EVENT,
|
||||
SQLCOM_SHOW_CREATE_EVENT, SQLCOM_SHOW_EVENTS,
|
||||
SQLCOM_SHOW_SCHEDULER_STATUS,
|
||||
|
||||
/* This should be the last !!! */
|
||||
|
||||
|
@ -3960,13 +3960,6 @@ end_with_restore_list:
|
||||
}
|
||||
break;
|
||||
}
|
||||
#ifndef DBUG_OFF
|
||||
case SQLCOM_SHOW_SCHEDULER_STATUS:
|
||||
{
|
||||
res= Events::get_instance()->dump_internal_status(thd);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
case SQLCOM_CREATE_FUNCTION: // UDF function
|
||||
{
|
||||
if (check_access(thd,INSERT_ACL,"mysql",0,1,0,0))
|
||||
|
@ -28,6 +28,8 @@
|
||||
#include <sys/malloc.h>
|
||||
#endif
|
||||
|
||||
#include "events.h"
|
||||
|
||||
static const char *lock_descriptions[] =
|
||||
{
|
||||
"No lock",
|
||||
@ -532,5 +534,7 @@ Estimated memory (with thread stack): %ld\n",
|
||||
(int) info.keepcost,
|
||||
(long) (thread_count * thread_stack + info.hblkhd + info.arena));
|
||||
#endif
|
||||
|
||||
Events::get_instance()->dump_internal_status();
|
||||
puts("");
|
||||
}
|
||||
|
@ -590,7 +590,6 @@ bool my_yyoverflow(short **a, YYSTYPE **b, ulong *yystacksize);
|
||||
%token RTREE_SYM
|
||||
%token SAVEPOINT_SYM
|
||||
%token SCHEDULE_SYM
|
||||
%token SCHEDULER_SYM
|
||||
%token SECOND_MICROSECOND_SYM
|
||||
%token SECOND_SYM
|
||||
%token SECURITY_SYM
|
||||
@ -8112,15 +8111,6 @@ show_param:
|
||||
if (prepare_schema_table(YYTHD, lex, 0, SCH_EVENTS))
|
||||
YYABORT;
|
||||
}
|
||||
| SCHEDULER_SYM STATUS_SYM
|
||||
{
|
||||
#ifndef DBUG_OFF
|
||||
Lex->sql_command= SQLCOM_SHOW_SCHEDULER_STATUS;
|
||||
#else
|
||||
yyerror(ER(ER_SYNTAX_ERROR));
|
||||
YYABORT;
|
||||
#endif
|
||||
}
|
||||
| TABLE_SYM STATUS_SYM opt_db wild_and_where
|
||||
{
|
||||
LEX *lex= Lex;
|
||||
@ -9503,7 +9493,6 @@ keyword_sp:
|
||||
| ROW_SYM {}
|
||||
| RTREE_SYM {}
|
||||
| SCHEDULE_SYM {}
|
||||
| SCHEDULER_SYM {}
|
||||
| SECOND_SYM {}
|
||||
| SERIAL_SYM {}
|
||||
| SERIALIZABLE_SYM {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user