21 #include "my_global.h"
22 #include "my_pthread.h"
34 THR_LOCK table_esms_by_digest::m_table_lock;
39 { C_STRING_WITH_LEN(
"SCHEMA_NAME") },
40 { C_STRING_WITH_LEN(
"varchar(64)") },
44 { C_STRING_WITH_LEN(
"DIGEST") },
45 { C_STRING_WITH_LEN(
"varchar(32)") },
49 { C_STRING_WITH_LEN(
"DIGEST_TEXT") },
50 { C_STRING_WITH_LEN(
"longtext") },
54 { C_STRING_WITH_LEN(
"COUNT_STAR") },
55 { C_STRING_WITH_LEN(
"bigint(20)") },
59 { C_STRING_WITH_LEN(
"SUM_TIMER_WAIT") },
60 { C_STRING_WITH_LEN(
"bigint(20)") },
64 { C_STRING_WITH_LEN(
"MIN_TIMER_WAIT") },
65 { C_STRING_WITH_LEN(
"bigint(20)") },
69 { C_STRING_WITH_LEN(
"AVG_TIMER_WAIT") },
70 { C_STRING_WITH_LEN(
"bigint(20)") },
74 { C_STRING_WITH_LEN(
"MAX_TIMER_WAIT") },
75 { C_STRING_WITH_LEN(
"bigint(20)") },
79 { C_STRING_WITH_LEN(
"SUM_LOCK_TIME") },
80 { C_STRING_WITH_LEN(
"bigint(20)") },
84 { C_STRING_WITH_LEN(
"SUM_ERRORS") },
85 { C_STRING_WITH_LEN(
"bigint(20)") },
89 { C_STRING_WITH_LEN(
"SUM_WARNINGS") },
90 { C_STRING_WITH_LEN(
"bigint(20)") },
94 { C_STRING_WITH_LEN(
"SUM_ROWS_AFFECTED") },
95 { C_STRING_WITH_LEN(
"bigint(20)") },
99 { C_STRING_WITH_LEN(
"SUM_ROWS_SENT") },
100 { C_STRING_WITH_LEN(
"bigint(20)") },
104 { C_STRING_WITH_LEN(
"SUM_ROWS_EXAMINED") },
105 { C_STRING_WITH_LEN(
"bigint(20)") },
109 { C_STRING_WITH_LEN(
"SUM_CREATED_TMP_DISK_TABLES") },
110 { C_STRING_WITH_LEN(
"bigint(20)") },
114 { C_STRING_WITH_LEN(
"SUM_CREATED_TMP_TABLES") },
115 { C_STRING_WITH_LEN(
"bigint(20)") },
119 { C_STRING_WITH_LEN(
"SUM_SELECT_FULL_JOIN") },
120 { C_STRING_WITH_LEN(
"bigint(20)") },
124 { C_STRING_WITH_LEN(
"SUM_SELECT_FULL_RANGE_JOIN") },
125 { C_STRING_WITH_LEN(
"bigint(20)") },
129 { C_STRING_WITH_LEN(
"SUM_SELECT_RANGE") },
130 { C_STRING_WITH_LEN(
"bigint(20)") },
134 { C_STRING_WITH_LEN(
"SUM_SELECT_RANGE_CHECK") },
135 { C_STRING_WITH_LEN(
"bigint(20)") },
139 { C_STRING_WITH_LEN(
"SUM_SELECT_SCAN") },
140 { C_STRING_WITH_LEN(
"bigint(20)") },
144 { C_STRING_WITH_LEN(
"SUM_SORT_MERGE_PASSES") },
145 { C_STRING_WITH_LEN(
"bigint(20)") },
149 { C_STRING_WITH_LEN(
"SUM_SORT_RANGE") },
150 { C_STRING_WITH_LEN(
"bigint(20)") },
154 { C_STRING_WITH_LEN(
"SUM_SORT_ROWS") },
155 { C_STRING_WITH_LEN(
"bigint(20)") },
159 { C_STRING_WITH_LEN(
"SUM_SORT_SCAN") },
160 { C_STRING_WITH_LEN(
"bigint(20)") },
164 { C_STRING_WITH_LEN(
"SUM_NO_INDEX_USED") },
165 { C_STRING_WITH_LEN(
"bigint(20)") },
169 { C_STRING_WITH_LEN(
"SUM_NO_GOOD_INDEX_USED") },
170 { C_STRING_WITH_LEN(
"bigint(20)") },
174 { C_STRING_WITH_LEN(
"FIRST_SEEN") },
175 { C_STRING_WITH_LEN(
"timestamp") },
179 { C_STRING_WITH_LEN(
"LAST_SEEN") },
180 { C_STRING_WITH_LEN(
"timestamp") },
186 table_esms_by_digest::m_field_def=
192 { C_STRING_WITH_LEN(
"events_statements_summary_by_digest") },
194 table_esms_by_digest::create,
196 table_esms_by_digest::delete_all_rows,
206 table_esms_by_digest::create(
void)
212 table_esms_by_digest::delete_all_rows(
void)
214 reset_esms_by_digest();
218 table_esms_by_digest::table_esms_by_digest()
220 m_row_exists(false), m_pos(0), m_next_pos(0)
233 if (statements_digest_stat_array == NULL)
234 return HA_ERR_END_OF_FILE;
236 for (m_pos.
set_at(&m_next_pos);
240 digest_stat= &statements_digest_stat_array[m_pos.
m_index];
243 make_row(digest_stat);
249 return HA_ERR_END_OF_FILE;
257 if (statements_digest_stat_array == NULL)
258 return HA_ERR_END_OF_FILE;
261 digest_stat= &statements_digest_stat_array[m_pos.
m_index];
265 make_row(digest_stat);
269 return HA_ERR_RECORD_DELETED;
295 if (unlikely(! m_row_exists))
296 return HA_ERR_RECORD_DELETED;
302 DBUG_ASSERT(table->s->null_bytes == 1);
305 for (; (f= *fields) ; fields++)
307 if (read_all || bitmap_is_set(table->read_set, f->field_index))
309 switch(f->field_index)
314 m_row.m_digest.set_field(f->field_index, f);
317 set_field_timestamp(f, m_row.m_first_seen);
320 set_field_timestamp(f, m_row.m_last_seen);
323 m_row.m_stat.set_field(f->field_index - 3, f);