1 /* Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
2 
3   This program is free software; you can redistribute it and/or modify
4   it under the terms of the GNU General Public License, version 2.0,
5   as published by the Free Software Foundation.
6 
7   This program is also distributed with certain software (including
8   but not limited to OpenSSL) that is licensed under separate terms,
9   as designated in a particular file or component or in included license
10   documentation.  The authors of MySQL hereby grant you an additional
11   permission to link the program and your derivative works with the
12   separately licensed software that they have included with MySQL.
13 
14   This program is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17   GNU General Public License, version 2.0, for more details.
18 
19   You should have received a copy of the GNU General Public License
20   along with this program; if not, write to the Free Software
21   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335  USA */
22 
23 /**
24   @file storage/perfschema/table_tlws_by_table.cc
25   Table TABLE_LOCK_WAITS_SUMMARY_BY_TABLE (implementation).
26 */
27 
28 #include "my_global.h"
29 #include "my_pthread.h"
30 #include "pfs_instr_class.h"
31 #include "pfs_column_types.h"
32 #include "pfs_column_values.h"
33 #include "table_tlws_by_table.h"
34 #include "pfs_global.h"
35 #include "pfs_visitor.h"
36 
37 THR_LOCK table_tlws_by_table::m_table_lock;
38 
39 PFS_engine_table_share
40 table_tlws_by_table::m_share=
41 {
42   { C_STRING_WITH_LEN("table_lock_waits_summary_by_table") },
43   &pfs_truncatable_acl,
44   table_tlws_by_table::create,
45   NULL, /* write_row */
46   table_tlws_by_table::delete_all_rows,
47   NULL, /* get_row_count */
48   1000, /* records */
49   sizeof(PFS_simple_index),
50   &m_table_lock,
51   { C_STRING_WITH_LEN("CREATE TABLE table_lock_waits_summary_by_table("
52                       "OBJECT_TYPE VARCHAR(64) comment 'Since this table records waits by table, always set to TABLE.',"
53                       "OBJECT_SCHEMA VARCHAR(64) comment 'Schema name.',"
54                       "OBJECT_NAME VARCHAR(64) comment 'Table name.',"
55                       "COUNT_STAR BIGINT unsigned not null comment 'Number of summarized events and the sum of the x_READ and x_WRITE columns.',"
56                       "SUM_TIMER_WAIT BIGINT unsigned not null comment 'Total wait time of the summarized events that are timed.',"
57                       "MIN_TIMER_WAIT BIGINT unsigned not null comment 'Minimum wait time of the summarized events that are timed.',"
58                       "AVG_TIMER_WAIT BIGINT unsigned not null comment 'Average wait time of the summarized events that are timed.',"
59                       "MAX_TIMER_WAIT BIGINT unsigned not null comment 'Maximum wait time of the summarized events that are timed.',"
60                       "COUNT_READ BIGINT unsigned not null comment 'Number of all read operations, and the sum of the equivalent x_READ_NORMAL, x_READ_WITH_SHARED_LOCKS, x_READ_HIGH_PRIORITY and x_READ_NO_INSERT columns.',"
61                       "SUM_TIMER_READ BIGINT unsigned not null comment 'Total wait time of all read operations that are timed.',"
62                       "MIN_TIMER_READ BIGINT unsigned not null comment 'Minimum wait time of all read operations that are timed.',"
63                       "AVG_TIMER_READ BIGINT unsigned not null comment 'Average wait time of all read operations that are timed.',"
64                       "MAX_TIMER_READ BIGINT unsigned not null comment 'Maximum wait time of all read operations that are timed.',"
65                       "COUNT_WRITE BIGINT unsigned not null comment 'Number of all write operations, and the sum of the equivalent x_WRITE_ALLOW_WRITE, x_WRITE_CONCURRENT_INSERT, x_WRITE_DELAYED, x_WRITE_LOW_PRIORITY and x_WRITE_NORMAL columns.',"
66                       "SUM_TIMER_WRITE BIGINT unsigned not null comment 'Total wait time of all write operations that are timed.',"
67                       "MIN_TIMER_WRITE BIGINT unsigned not null comment 'Minimum wait time of all write operations that are timed.',"
68                       "AVG_TIMER_WRITE BIGINT unsigned not null comment 'Average wait time of all write operations that are timed.',"
69                       "MAX_TIMER_WRITE BIGINT unsigned not null comment 'Maximum wait time of all write operations that are timed.',"
70                       "COUNT_READ_NORMAL BIGINT unsigned not null comment 'Number of all internal read normal locks.',"
71                       "SUM_TIMER_READ_NORMAL BIGINT unsigned not null comment 'Total wait time of all internal read normal locks that are timed.',"
72                       "MIN_TIMER_READ_NORMAL BIGINT unsigned not null comment 'Minimum wait time of all internal read normal locks that are timed.',"
73                       "AVG_TIMER_READ_NORMAL BIGINT unsigned not null comment 'Average wait time of all internal read normal locks that are timed.',"
74                       "MAX_TIMER_READ_NORMAL BIGINT unsigned not null comment 'Maximum wait time of all internal read normal locks that are timed.',"
75                       "COUNT_READ_WITH_SHARED_LOCKS BIGINT unsigned not null comment 'Number of all internal read with shared locks.',"
76                       "SUM_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null comment 'Total wait time of all internal read with shared locks that are timed.',"
77                       "MIN_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null comment 'Minimum wait time of all internal read with shared locks that are timed.',"
78                       "AVG_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null comment 'Average wait time of all internal read with shared locks that are timed.',"
79                       "MAX_TIMER_READ_WITH_SHARED_LOCKS BIGINT unsigned not null comment 'Maximum wait time of all internal read with shared locks that are timed.',"
80                       "COUNT_READ_HIGH_PRIORITY BIGINT unsigned not null comment 'Number of all internal read high priority locks.',"
81                       "SUM_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null comment 'Total wait time of all internal read high priority locks that are timed.',"
82                       "MIN_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null comment 'Minimum wait time of all internal read high priority locks that are timed.',"
83                       "AVG_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null comment 'Average wait time of all internal read high priority locks that are timed.',"
84                       "MAX_TIMER_READ_HIGH_PRIORITY BIGINT unsigned not null comment 'Maximum wait time of all internal read high priority locks that are timed.',"
85                       "COUNT_READ_NO_INSERT BIGINT unsigned not null comment 'Number of all internal read no insert locks.',"
86                       "SUM_TIMER_READ_NO_INSERT BIGINT unsigned not null comment 'Total wait time of all internal read no insert locks that are timed.',"
87                       "MIN_TIMER_READ_NO_INSERT BIGINT unsigned not null comment 'Minimum wait time of all internal read no insert locks that are timed.',"
88                       "AVG_TIMER_READ_NO_INSERT BIGINT unsigned not null comment 'Average wait time of all internal read no insert locks that are timed.',"
89                       "MAX_TIMER_READ_NO_INSERT BIGINT unsigned not null comment 'Maximum wait time of all internal read no insert locks that are timed.',"
90                       "COUNT_READ_EXTERNAL BIGINT unsigned not null comment 'Number of all external read locks.',"
91                       "SUM_TIMER_READ_EXTERNAL BIGINT unsigned not null comment 'Total wait time of all external read locks that are timed.',"
92                       "MIN_TIMER_READ_EXTERNAL BIGINT unsigned not null comment 'Minimum wait time of all external read locks that are timed.',"
93                       "AVG_TIMER_READ_EXTERNAL BIGINT unsigned not null comment 'Average wait time of all external read locks that are timed.',"
94                       "MAX_TIMER_READ_EXTERNAL BIGINT unsigned not null comment 'Maximum wait time of all external read locks that are timed.',"
95                       "COUNT_WRITE_ALLOW_WRITE BIGINT unsigned not null comment 'Number of all internal read normal locks.',"
96                       "SUM_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null comment 'Total wait time of all internal write allow write locks that are timed.',"
97                       "MIN_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null comment 'Minimum wait time of all internal write allow write locks that are timed.',"
98                       "AVG_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null comment 'Average wait time of all internal write allow write locks that are timed.',"
99                       "MAX_TIMER_WRITE_ALLOW_WRITE BIGINT unsigned not null comment 'Maximum wait time of all internal write allow write locks that are timed.',"
100                       "COUNT_WRITE_CONCURRENT_INSERT BIGINT unsigned not null comment 'Number of all internal concurrent insert write locks.',"
101                       "SUM_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null comment 'Total wait time of all internal concurrent insert write locks that are timed.',"
102                       "MIN_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null comment 'Minimum wait time of all internal concurrent insert write locks that are timed.',"
103                       "AVG_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null comment 'Average wait time of all internal concurrent insert write locks that are timed.',"
104                       "MAX_TIMER_WRITE_CONCURRENT_INSERT BIGINT unsigned not null comment 'Maximum wait time of all internal concurrent insert write locks that are timed.',"
105                       "COUNT_WRITE_DELAYED BIGINT unsigned not null comment 'Number of all internal write delayed locks.',"
106                       "SUM_TIMER_WRITE_DELAYED BIGINT unsigned not null comment 'Total wait time of all internal write delayed locks that are timed.',"
107                       "MIN_TIMER_WRITE_DELAYED BIGINT unsigned not null comment 'Minimum wait time of all internal write delayed locks that are timed.',"
108                       "AVG_TIMER_WRITE_DELAYED BIGINT unsigned not null comment 'Average wait time of all internal write delayed locks that are timed.',"
109                       "MAX_TIMER_WRITE_DELAYED BIGINT unsigned not null comment 'Maximum wait time of all internal write delayed locks that are timed.',"
110                       "COUNT_WRITE_LOW_PRIORITY BIGINT unsigned not null comment 'Number of all internal write low priority locks.',"
111                       "SUM_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null comment 'Total wait time of all internal write low priority locks that are timed.',"
112                       "MIN_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null comment 'Minimum wait time of all internal write low priority locks that are timed.',"
113                       "AVG_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null comment 'Average wait time of all internal write low priority locks that are timed.',"
114                       "MAX_TIMER_WRITE_LOW_PRIORITY BIGINT unsigned not null comment 'Maximum wait time of all internal write low priority locks that are timed.',"
115                       "COUNT_WRITE_NORMAL BIGINT unsigned not null comment 'Number of all internal write normal locks.',"
116                       "SUM_TIMER_WRITE_NORMAL BIGINT unsigned not null comment 'Total wait time of all internal write normal locks that are timed.',"
117                       "MIN_TIMER_WRITE_NORMAL BIGINT unsigned not null comment 'Minimum wait time of all internal write normal locks that are timed.',"
118                       "AVG_TIMER_WRITE_NORMAL BIGINT unsigned not null comment 'Average wait time of all internal write normal locks that are timed.',"
119                       "MAX_TIMER_WRITE_NORMAL BIGINT unsigned not null comment 'Maximum wait time of all internal write normal locks that are timed.',"
120                       "COUNT_WRITE_EXTERNAL BIGINT unsigned not null comment 'Number of all external write locks.',"
121                       "SUM_TIMER_WRITE_EXTERNAL BIGINT unsigned not null comment 'Total wait time of all external write locks that are timed.',"
122                       "MIN_TIMER_WRITE_EXTERNAL BIGINT unsigned not null comment 'Minimum wait time of all external write locks that are timed.',"
123                       "AVG_TIMER_WRITE_EXTERNAL BIGINT unsigned not null comment 'Average wait time of all external write locks that are timed.',"
124                       "MAX_TIMER_WRITE_EXTERNAL BIGINT unsigned not null comment 'Maximum wait time of all external write locks that are timed.')") }
125 };
126 
127 PFS_engine_table*
create(void)128 table_tlws_by_table::create(void)
129 {
130   return new table_tlws_by_table();
131 }
132 
133 int
delete_all_rows(void)134 table_tlws_by_table::delete_all_rows(void)
135 {
136   reset_table_lock_waits_by_table_handle();
137   reset_table_lock_waits_by_table();
138   return 0;
139 }
140 
table_tlws_by_table()141 table_tlws_by_table::table_tlws_by_table()
142   : PFS_engine_table(&m_share, &m_pos),
143     m_row_exists(false), m_pos(0), m_next_pos(0)
144 {}
145 
reset_position(void)146 void table_tlws_by_table::reset_position(void)
147 {
148   m_pos.m_index= 0;
149   m_next_pos.m_index= 0;
150 }
151 
rnd_init(bool scan)152 int table_tlws_by_table::rnd_init(bool scan)
153 {
154   m_normalizer= time_normalizer::get(wait_timer);
155   return 0;
156 }
157 
rnd_next(void)158 int table_tlws_by_table::rnd_next(void)
159 {
160   PFS_table_share *table_share;
161 
162   for (m_pos.set_at(&m_next_pos);
163        m_pos.m_index < table_share_max;
164        m_pos.m_index++)
165   {
166     table_share= &table_share_array[m_pos.m_index];
167     if (table_share->m_lock.is_populated())
168     {
169       make_row(table_share);
170       m_next_pos.set_after(&m_pos);
171       return 0;
172     }
173   }
174 
175   return HA_ERR_END_OF_FILE;
176 }
177 
178 int
rnd_pos(const void * pos)179 table_tlws_by_table::rnd_pos(const void *pos)
180 {
181   PFS_table_share *table_share;
182 
183   set_position(pos);
184 
185   table_share= &table_share_array[m_pos.m_index];
186   if (table_share->m_lock.is_populated())
187   {
188     make_row(table_share);
189     return 0;
190   }
191 
192   return HA_ERR_RECORD_DELETED;
193 }
194 
make_row(PFS_table_share * share)195 void table_tlws_by_table::make_row(PFS_table_share *share)
196 {
197   pfs_lock lock;
198 
199   m_row_exists= false;
200 
201   share->m_lock.begin_optimistic_lock(&lock);
202 
203   if (m_row.m_object.make_row(share))
204     return;
205 
206   PFS_table_lock_stat_visitor visitor;
207   PFS_object_iterator::visit_tables(share, & visitor);
208 
209   if (! share->m_lock.end_optimistic_lock(&lock))
210     return;
211 
212   m_row_exists= true;
213   m_row.m_stat.set(m_normalizer, &visitor.m_stat);
214 }
215 
read_row_values(TABLE * table,unsigned char * buf,Field ** fields,bool read_all)216 int table_tlws_by_table::read_row_values(TABLE *table,
217                                          unsigned char *buf,
218                                          Field **fields,
219                                          bool read_all)
220 {
221   Field *f;
222 
223   if (unlikely(! m_row_exists))
224     return HA_ERR_RECORD_DELETED;
225 
226   /* Set the null bits */
227   DBUG_ASSERT(table->s->null_bytes == 1);
228   buf[0]= 0;
229 
230   for (; (f= *fields) ; fields++)
231   {
232     if (read_all || bitmap_is_set(table->read_set, f->field_index))
233     {
234       switch(f->field_index)
235       {
236       case 0: /* OBJECT_TYPE */
237       case 1: /* SCHEMA_NAME */
238       case 2: /* OBJECT_NAME */
239         m_row.m_object.set_field(f->field_index, f);
240         break;
241       case 3: /* COUNT_STAR */
242         set_field_ulonglong(f, m_row.m_stat.m_all.m_count);
243         break;
244       case 4: /* SUM_TIMER */
245         set_field_ulonglong(f, m_row.m_stat.m_all.m_sum);
246         break;
247       case 5: /* MIN_TIMER */
248         set_field_ulonglong(f, m_row.m_stat.m_all.m_min);
249         break;
250       case 6: /* AVG_TIMER */
251         set_field_ulonglong(f, m_row.m_stat.m_all.m_avg);
252         break;
253       case 7: /* MAX_TIMER */
254         set_field_ulonglong(f, m_row.m_stat.m_all.m_max);
255         break;
256       case 8: /* COUNT_READ */
257         set_field_ulonglong(f, m_row.m_stat.m_all_read.m_count);
258         break;
259       case 9: /* SUM_TIMER_READ */
260         set_field_ulonglong(f, m_row.m_stat.m_all_read.m_sum);
261         break;
262       case 10: /* MIN_TIMER_READ */
263         set_field_ulonglong(f, m_row.m_stat.m_all_read.m_min);
264         break;
265       case 11: /* AVG_TIMER_READ */
266         set_field_ulonglong(f, m_row.m_stat.m_all_read.m_avg);
267         break;
268       case 12: /* MAX_TIMER_READ */
269         set_field_ulonglong(f, m_row.m_stat.m_all_read.m_max);
270         break;
271       case 13: /* COUNT_WRITE */
272         set_field_ulonglong(f, m_row.m_stat.m_all_write.m_count);
273         break;
274       case 14: /* SUM_TIMER_WRITE */
275         set_field_ulonglong(f, m_row.m_stat.m_all_write.m_sum);
276         break;
277       case 15: /* MIN_TIMER_WRITE */
278         set_field_ulonglong(f, m_row.m_stat.m_all_write.m_min);
279         break;
280       case 16: /* AVG_TIMER_WRITE */
281         set_field_ulonglong(f, m_row.m_stat.m_all_write.m_avg);
282         break;
283       case 17: /* MAX_TIMER_WRITE */
284         set_field_ulonglong(f, m_row.m_stat.m_all_write.m_max);
285         break;
286 
287       case 18: /* COUNT_READ_NORMAL */
288         set_field_ulonglong(f, m_row.m_stat.m_read_normal.m_count);
289         break;
290       case 19: /* SUM_TIMER_READ_NORMAL */
291         set_field_ulonglong(f, m_row.m_stat.m_read_normal.m_sum);
292         break;
293       case 20: /* MIN_TIMER_READ_NORMAL */
294         set_field_ulonglong(f, m_row.m_stat.m_read_normal.m_min);
295         break;
296       case 21: /* AVG_TIMER_READ_NORMAL */
297         set_field_ulonglong(f, m_row.m_stat.m_read_normal.m_avg);
298         break;
299       case 22: /* MAX_TIMER_READ_NORMAL */
300         set_field_ulonglong(f, m_row.m_stat.m_read_normal.m_max);
301         break;
302 
303       case 23: /* COUNT_READ_WITH_SHARED_LOCKS */
304         set_field_ulonglong(f, m_row.m_stat.m_read_with_shared_locks.m_count);
305         break;
306       case 24: /* SUM_TIMER_READ_WITH_SHARED_LOCKS */
307         set_field_ulonglong(f, m_row.m_stat.m_read_with_shared_locks.m_sum);
308         break;
309       case 25: /* MIN_TIMER_READ_WITH_SHARED_LOCKS */
310         set_field_ulonglong(f, m_row.m_stat.m_read_with_shared_locks.m_min);
311         break;
312       case 26: /* AVG_TIMER_READ_WITH_SHARED_LOCKS */
313         set_field_ulonglong(f, m_row.m_stat.m_read_with_shared_locks.m_avg);
314         break;
315       case 27: /* MAX_TIMER_READ_WITH_SHARED_LOCKS */
316         set_field_ulonglong(f, m_row.m_stat.m_read_with_shared_locks.m_max);
317         break;
318 
319       case 28: /* COUNT_READ_HIGH_PRIORITY */
320         set_field_ulonglong(f, m_row.m_stat.m_read_high_priority.m_count);
321         break;
322       case 29: /* SUM_TIMER_READ_HIGH_PRIORITY */
323         set_field_ulonglong(f, m_row.m_stat.m_read_high_priority.m_sum);
324         break;
325       case 30: /* MIN_TIMER_READ_HIGH_PRIORITY */
326         set_field_ulonglong(f, m_row.m_stat.m_read_high_priority.m_min);
327         break;
328       case 31: /* AVG_TIMER_READ_HIGH_PRIORITY */
329         set_field_ulonglong(f, m_row.m_stat.m_read_high_priority.m_avg);
330         break;
331       case 32: /* MAX_TIMER_READ_HIGH_PRIORITY */
332         set_field_ulonglong(f, m_row.m_stat.m_read_high_priority.m_max);
333         break;
334 
335       case 33: /* COUNT_READ_NO_INSERT */
336         set_field_ulonglong(f, m_row.m_stat.m_read_no_insert.m_count);
337         break;
338       case 34: /* SUM_TIMER_READ_NO_INSERT */
339         set_field_ulonglong(f, m_row.m_stat.m_read_no_insert.m_sum);
340         break;
341       case 35: /* MIN_TIMER_READ_NO_INSERT */
342         set_field_ulonglong(f, m_row.m_stat.m_read_no_insert.m_min);
343         break;
344       case 36: /* AVG_TIMER_READ_NO_INSERT */
345         set_field_ulonglong(f, m_row.m_stat.m_read_no_insert.m_avg);
346         break;
347       case 37: /* MAX_TIMER_READ_NO_INSERT */
348         set_field_ulonglong(f, m_row.m_stat.m_read_no_insert.m_max);
349         break;
350 
351       case 38: /* COUNT_READ_EXTERNAL */
352         set_field_ulonglong(f, m_row.m_stat.m_read_external.m_count);
353         break;
354       case 39: /* SUM_TIMER_READ_EXTERNAL */
355         set_field_ulonglong(f, m_row.m_stat.m_read_external.m_sum);
356         break;
357       case 40: /* MIN_TIMER_READ_EXTERNAL */
358         set_field_ulonglong(f, m_row.m_stat.m_read_external.m_min);
359         break;
360       case 41: /* AVG_TIMER_READ_EXTERNAL */
361         set_field_ulonglong(f, m_row.m_stat.m_read_external.m_avg);
362         break;
363       case 42: /* MAX_TIMER_READ_EXTERNAL */
364         set_field_ulonglong(f, m_row.m_stat.m_read_external.m_max);
365         break;
366 
367       case 43: /* COUNT_WRITE_ALLOW_WRITE */
368         set_field_ulonglong(f, m_row.m_stat.m_write_allow_write.m_count);
369         break;
370       case 44: /* SUM_TIMER_WRITE_ALLOW_WRITE */
371         set_field_ulonglong(f, m_row.m_stat.m_write_allow_write.m_sum);
372         break;
373       case 45: /* MIN_TIMER_WRITE_ALLOW_WRITE */
374         set_field_ulonglong(f, m_row.m_stat.m_write_allow_write.m_min);
375         break;
376       case 46: /* AVG_TIMER_WRITE_ALLOW_WRITE */
377         set_field_ulonglong(f, m_row.m_stat.m_write_allow_write.m_avg);
378         break;
379       case 47: /* MAX_TIMER_WRITE_ALLOW_WRITE */
380         set_field_ulonglong(f, m_row.m_stat.m_write_allow_write.m_max);
381         break;
382 
383       case 48: /* COUNT_WRITE_CONCURRENT_INSERT */
384         set_field_ulonglong(f, m_row.m_stat.m_write_concurrent_insert.m_count);
385         break;
386       case 49: /* SUM_TIMER_WRITE_CONCURRENT_INSERT */
387         set_field_ulonglong(f, m_row.m_stat.m_write_concurrent_insert.m_sum);
388         break;
389       case 50: /* MIN_TIMER_WRITE_CONCURRENT_INSERT */
390         set_field_ulonglong(f, m_row.m_stat.m_write_concurrent_insert.m_min);
391         break;
392       case 51: /* AVG_TIMER_WRITE_CONCURRENT_INSERT */
393         set_field_ulonglong(f, m_row.m_stat.m_write_concurrent_insert.m_avg);
394         break;
395       case 52: /* MAX_TIMER_WRITE_CONCURRENT_INSERT */
396         set_field_ulonglong(f, m_row.m_stat.m_write_concurrent_insert.m_max);
397         break;
398 
399       case 53: /* COUNT_WRITE_DELAYED */
400         set_field_ulonglong(f, m_row.m_stat.m_write_delayed.m_count);
401         break;
402       case 54: /* SUM_TIMER_WRITE_DELAYED */
403         set_field_ulonglong(f, m_row.m_stat.m_write_delayed.m_sum);
404         break;
405       case 55: /* MIN_TIMER_WRITE_DELAYED */
406         set_field_ulonglong(f, m_row.m_stat.m_write_delayed.m_min);
407         break;
408       case 56: /* AVG_TIMER_WRITE_DELAYED */
409         set_field_ulonglong(f, m_row.m_stat.m_write_delayed.m_avg);
410         break;
411       case 57: /* MAX_TIMER_WRITE_DELAYED */
412         set_field_ulonglong(f, m_row.m_stat.m_write_delayed.m_max);
413         break;
414 
415       case 58: /* COUNT_WRITE_LOW_PRIORITY */
416         set_field_ulonglong(f, m_row.m_stat.m_write_low_priority.m_count);
417         break;
418       case 59: /* SUM_TIMER_WRITE_LOW_PRIORITY */
419         set_field_ulonglong(f, m_row.m_stat.m_write_low_priority.m_sum);
420         break;
421       case 60: /* MIN_TIMER_WRITE_LOW_PRIORITY */
422         set_field_ulonglong(f, m_row.m_stat.m_write_low_priority.m_min);
423         break;
424       case 61: /* AVG_TIMER_WRITE_LOW_PRIORITY */
425         set_field_ulonglong(f, m_row.m_stat.m_write_low_priority.m_avg);
426         break;
427       case 62: /* MAX_TIMER_WRITE_LOW_PRIORITY */
428         set_field_ulonglong(f, m_row.m_stat.m_write_low_priority.m_max);
429         break;
430 
431       case 63: /* COUNT_WRITE_NORMAL */
432         set_field_ulonglong(f, m_row.m_stat.m_write_normal.m_count);
433         break;
434       case 64: /* SUM_TIMER_WRITE_NORMAL */
435         set_field_ulonglong(f, m_row.m_stat.m_write_normal.m_sum);
436         break;
437       case 65: /* MIN_TIMER_WRITE_NORMAL */
438         set_field_ulonglong(f, m_row.m_stat.m_write_normal.m_min);
439         break;
440       case 66: /* AVG_TIMER_WRITE_NORMAL */
441         set_field_ulonglong(f, m_row.m_stat.m_write_normal.m_avg);
442         break;
443       case 67: /* MAX_TIMER_WRITE_NORMAL */
444         set_field_ulonglong(f, m_row.m_stat.m_write_normal.m_max);
445         break;
446 
447       case 68: /* COUNT_WRITE_EXTERNAL */
448         set_field_ulonglong(f, m_row.m_stat.m_write_external.m_count);
449         break;
450       case 69: /* SUM_TIMER_WRITE_EXTERNAL */
451         set_field_ulonglong(f, m_row.m_stat.m_write_external.m_sum);
452         break;
453       case 70: /* MIN_TIMER_WRITE_EXTERNAL */
454         set_field_ulonglong(f, m_row.m_stat.m_write_external.m_min);
455         break;
456       case 71: /* AVG_TIMER_WRITE_EXTERNAL */
457         set_field_ulonglong(f, m_row.m_stat.m_write_external.m_avg);
458         break;
459       case 72: /* MAX_TIMER_WRITE_EXTERNAL */
460         set_field_ulonglong(f, m_row.m_stat.m_write_external.m_max);
461         break;
462 
463       default:
464         DBUG_ASSERT(false);
465       }
466     }
467   }
468 
469   return 0;
470 }
471 
472