summaryrefslogtreecommitdiff
path: root/sql/event_scheduler.cc
diff options
context:
space:
mode:
authorunknown <andrey@example.com>2006-09-12 12:26:12 +0200
committerunknown <andrey@example.com>2006-09-12 12:26:12 +0200
commit04a5f335d3eaa878ebbc87eeab06dcbf3458fdb7 (patch)
treeae831e3cf94166f42a8cf2ff10194f4359a06d9d /sql/event_scheduler.cc
parent53267edaf6db74ee4e9e598a96ee8c5c0404051e (diff)
downloadmariadb-git-04a5f335d3eaa878ebbc87eeab06dcbf3458fdb7.tar.gz
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
Diffstat (limited to 'sql/event_scheduler.cc')
-rw-r--r--sql/event_scheduler.cc112
1 files changed, 16 insertions, 96 deletions
diff --git a/sql/event_scheduler.cc b/sql/event_scheduler.cc
index d8292c5393c..6f9f6887c12 100644
--- a/sql/event_scheduler.cc
+++ b/sql/event_scheduler.cc
@@ -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);
-
- 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;
+ 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");
- /* 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;
}