21 #include "my_global.h"
22 #include "my_pthread.h"
29 THR_LOCK table_events_stages_current::m_table_lock;
34 { C_STRING_WITH_LEN(
"THREAD_ID") },
35 { C_STRING_WITH_LEN(
"bigint(20)") },
39 { C_STRING_WITH_LEN(
"EVENT_ID") },
40 { C_STRING_WITH_LEN(
"bigint(20)") },
44 { C_STRING_WITH_LEN(
"END_EVENT_ID") },
45 { C_STRING_WITH_LEN(
"bigint(20)") },
49 { C_STRING_WITH_LEN(
"EVENT_NAME") },
50 { C_STRING_WITH_LEN(
"varchar(128)") },
54 { C_STRING_WITH_LEN(
"SOURCE") },
55 { C_STRING_WITH_LEN(
"varchar(64)") },
59 { C_STRING_WITH_LEN(
"TIMER_START") },
60 { C_STRING_WITH_LEN(
"bigint(20)") },
64 { C_STRING_WITH_LEN(
"TIMER_END") },
65 { C_STRING_WITH_LEN(
"bigint(20)") },
69 { C_STRING_WITH_LEN(
"TIMER_WAIT") },
70 { C_STRING_WITH_LEN(
"bigint(20)") },
74 { C_STRING_WITH_LEN(
"NESTING_EVENT_ID") },
75 { C_STRING_WITH_LEN(
"bigint(20)") },
79 { C_STRING_WITH_LEN(
"NESTING_EVENT_TYPE") },
80 { C_STRING_WITH_LEN(
"enum(\'STATEMENT\',\'STAGE\',\'WAIT\'") },
86 table_events_stages_current::m_field_def=
92 { C_STRING_WITH_LEN(
"events_stages_current") },
94 &table_events_stages_current::create,
96 &table_events_stages_current::delete_all_rows,
105 THR_LOCK table_events_stages_history::m_table_lock;
110 { C_STRING_WITH_LEN(
"events_stages_history") },
112 &table_events_stages_history::create,
114 &table_events_stages_history::delete_all_rows,
119 &table_events_stages_current::m_field_def,
123 THR_LOCK table_events_stages_history_long::m_table_lock;
128 { C_STRING_WITH_LEN(
"events_stages_history_long") },
130 &table_events_stages_history_long::create,
132 &table_events_stages_history_long::delete_all_rows,
137 &table_events_stages_current::m_field_def,
141 table_events_stages_common::table_events_stages_common
154 const char *safe_source_file;
160 if (unlikely(klass == NULL))
176 if (unlikely(safe_source_file == NULL))
179 base= base_name(safe_source_file);
197 return HA_ERR_RECORD_DELETED;
200 DBUG_ASSERT(table->s->null_bytes == 1);
203 for (; (f= *fields) ; fields++)
205 if (read_all || bitmap_is_set(table->read_set, f->field_index))
207 switch(f->field_index)
270 table_events_stages_current::table_events_stages_current()
272 m_pos(0), m_next_pos(0)
292 for (m_pos.
set_at(&m_next_pos);
304 stage= &pfs_thread->m_stage_current;
311 return HA_ERR_END_OF_FILE;
324 return HA_ERR_RECORD_DELETED;
326 stage= &pfs_thread->m_stage_current;
331 int table_events_stages_current::delete_all_rows(
void)
342 table_events_stages_history::table_events_stages_history()
344 m_pos(), m_next_pos()
365 return HA_ERR_END_OF_FILE;
367 for (m_pos.
set_at(&m_next_pos);
403 return HA_ERR_END_OF_FILE;
417 return HA_ERR_RECORD_DELETED;
423 return HA_ERR_RECORD_DELETED;
428 return HA_ERR_RECORD_DELETED;
434 int table_events_stages_history::delete_all_rows(
void)
445 table_events_stages_history_long::table_events_stages_history_long()
447 m_pos(0), m_next_pos(0)
467 if (events_stages_history_long_size == 0)
468 return HA_ERR_END_OF_FILE;
471 limit= events_stages_history_long_size;
488 return HA_ERR_END_OF_FILE;
496 if (events_stages_history_long_size == 0)
497 return HA_ERR_RECORD_DELETED;
502 limit= events_stages_history_long_size;
507 return HA_ERR_RECORD_DELETED;
512 return HA_ERR_RECORD_DELETED;
518 int table_events_stages_history_long::delete_all_rows(
void)