1
/******************************************************
2
InnoDB INFORMATION SCHEMA tables interface to MySQL.
6
Created July 18, 2007 Vasil Dimov
7
*******************************************************/
9
#include <mysql_priv.h>
10
#include <mysqld_error.h>
14
#include <myisampack.h>
15
#include <mysys_err.h>
18
#include <mysql/plugin.h>
20
#include "drizzled/temporal.h"
24
#include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */
25
#include "buf0buddy.h" /* for i_s_cmpmem */
26
#include "buf0buf.h" /* for buf_pool and PAGE_ZIP_MIN_SIZE */
27
#include "ha_prototypes.h" /* for innobase_convert_name() */
28
#include "srv0start.h" /* for srv_was_started */
30
#include "handler0vars.h"
32
static const char plugin_author[] = "Innobase Oy";
39
#define RETURN_IF_INNODB_NOT_STARTED(plugin_name) \
41
if (!srv_was_started) { \
42
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, \
43
ER_CANT_FIND_SYSTEM_REC, \
44
"InnoDB: SELECTing from " \
45
"INFORMATION_SCHEMA.%s but " \
46
"the InnoDB storage engine " \
47
"is not installed", plugin_name); \
52
#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER
53
#define STRUCT_FLD(name, value) name: value
55
#define STRUCT_FLD(name, value) value
58
static const ST_FIELD_INFO END_OF_ST_FIELD_INFO =
59
{STRUCT_FLD(field_name, NULL),
60
STRUCT_FLD(field_length, 0),
61
STRUCT_FLD(field_type, MYSQL_TYPE_NULL),
63
STRUCT_FLD(field_flags, 0),
64
STRUCT_FLD(old_name, ""),
65
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)};
68
Use the following types mapping:
70
C type ST_FIELD_INFO::field_type
71
---------------------------------
72
long MYSQL_TYPE_LONGLONG
73
(field_length=MY_INT64_NUM_DECIMAL_DIGITS)
75
long unsigned MYSQL_TYPE_LONGLONG
76
(field_length=MY_INT64_NUM_DECIMAL_DIGITS, field_flags=MY_I_S_UNSIGNED)
78
char* MYSQL_TYPE_STRING
81
float MYSQL_TYPE_FLOAT
82
(field_length=0 is ignored)
84
void* MYSQL_TYPE_LONGLONG
85
(field_length=MY_INT64_NUM_DECIMAL_DIGITS, field_flags=MY_I_S_UNSIGNED)
87
boolean (if else) MYSQL_TYPE_LONG
90
time_t MYSQL_TYPE_DATETIME
91
(field_length=0 ignored)
92
---------------------------------
95
/* XXX these are defined in mysql_priv.h inside #ifdef MYSQL_SERVER */
96
bool schema_table_store_record(THD *thd, TABLE *table);
97
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
98
bool check_global_access(THD *thd, ulong want_access);
100
/***********************************************************************
101
Common function to fill any of the dynamic tables:
102
INFORMATION_SCHEMA.innodb_trx
103
INFORMATION_SCHEMA.innodb_locks
104
INFORMATION_SCHEMA.innodb_lock_waits */
107
trx_i_s_common_fill_table(
108
/*======================*/
109
/* out: 0 on success */
110
THD* thd, /* in: thread */
111
TABLE_LIST* tables, /* in/out: tables to fill */
112
COND* cond); /* in: condition (not used) */
114
/***********************************************************************
115
Unbind a dynamic INFORMATION_SCHEMA table. */
120
/* out: 0 on success */
121
void* p); /* in/out: table schema object */
123
/***********************************************************************
124
Auxiliary function to store time_t value in MYSQL_TYPE_DATETIME
130
/* out: 0 on success */
131
Field* field, /* in/out: target field for storage */
132
time_t time) /* in: value to store */
134
drizzled::Timestamp timestamp;
135
(void) timestamp.from_time_t(time);
136
char tmp_string[MAX_DATETIME_WIDTH];
137
size_t tmp_string_length;
139
timestamp.to_string(tmp_string, &tmp_string_length);
141
return(field->store(tmp_string, tmp_string_length, &my_charset_bin));
144
/***********************************************************************
145
Auxiliary function to store char* value in MYSQL_TYPE_STRING field. */
150
/* out: 0 on success */
151
Field* field, /* in/out: target field for storage */
152
const char* str) /* in: NUL-terminated utf-8 string,
159
ret = field->store(str, strlen(str),
160
system_charset_info);
161
field->set_notnull();
164
ret = 0; /* success */
171
/***********************************************************************
172
Auxiliary function to store ulint value in MYSQL_TYPE_LONGLONG field.
173
If the value is ULINT_UNDEFINED then the field it set to NULL. */
178
/* out: 0 on success */
179
Field* field, /* in/out: target field for storage */
180
ulint n) /* in: value to store */
184
if (n != ULINT_UNDEFINED) {
186
ret = field->store(n);
187
field->set_notnull();
190
ret = 0; /* success */
197
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */
198
static ST_FIELD_INFO innodb_trx_fields_info[] =
201
{STRUCT_FLD(field_name, "trx_id"),
202
STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
203
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
204
STRUCT_FLD(value, 0),
205
STRUCT_FLD(field_flags, 0),
206
STRUCT_FLD(old_name, ""),
207
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
209
#define IDX_TRX_STATE 1
210
{STRUCT_FLD(field_name, "trx_state"),
211
STRUCT_FLD(field_length, TRX_QUE_STATE_STR_MAX_LEN + 1),
212
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
213
STRUCT_FLD(value, 0),
214
STRUCT_FLD(field_flags, 0),
215
STRUCT_FLD(old_name, ""),
216
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
218
#define IDX_TRX_STARTED 2
219
{STRUCT_FLD(field_name, "trx_started"),
220
STRUCT_FLD(field_length, 0),
221
STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
222
STRUCT_FLD(value, 0),
223
STRUCT_FLD(field_flags, 0),
224
STRUCT_FLD(old_name, ""),
225
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
227
#define IDX_TRX_REQUESTED_LOCK_ID 3
228
{STRUCT_FLD(field_name, "trx_requested_lock_id"),
229
STRUCT_FLD(field_length, TRX_I_S_LOCK_ID_MAX_LEN + 1),
230
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
231
STRUCT_FLD(value, 0),
232
STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
233
STRUCT_FLD(old_name, ""),
234
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
236
#define IDX_TRX_WAIT_STARTED 4
237
{STRUCT_FLD(field_name, "trx_wait_started"),
238
STRUCT_FLD(field_length, 0),
239
STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
240
STRUCT_FLD(value, 0),
241
STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
242
STRUCT_FLD(old_name, ""),
243
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
245
#define IDX_TRX_WEIGHT 5
246
{STRUCT_FLD(field_name, "trx_weight"),
247
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
248
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
249
STRUCT_FLD(value, 0),
250
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
251
STRUCT_FLD(old_name, ""),
252
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
254
#define IDX_TRX_MYSQL_THREAD_ID 6
255
{STRUCT_FLD(field_name, "trx_mysql_thread_id"),
256
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
257
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
258
STRUCT_FLD(value, 0),
259
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
260
STRUCT_FLD(old_name, ""),
261
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
263
#define IDX_TRX_QUERY 7
264
{STRUCT_FLD(field_name, "trx_query"),
265
STRUCT_FLD(field_length, TRX_I_S_TRX_QUERY_MAX_LEN),
266
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
267
STRUCT_FLD(value, 0),
268
STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
269
STRUCT_FLD(old_name, ""),
270
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
275
/***********************************************************************
276
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_trx
280
fill_innodb_trx_from_cache(
281
/*=======================*/
282
/* out: 0 on success */
283
trx_i_s_cache_t* cache, /* in: cache to read from */
284
THD* thd, /* in: used to call
285
schema_table_store_record() */
286
TABLE* table) /* in/out: fill this table */
290
char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
293
DBUG_ENTER("fill_innodb_trx_from_cache");
295
fields = table->field;
297
rows_num = trx_i_s_cache_get_rows_used(cache,
300
for (i = 0; i < rows_num; i++) {
303
char trx_id[TRX_ID_MAX_LEN + 1];
305
row = (i_s_trx_row_t*)
306
trx_i_s_cache_get_nth_row(
307
cache, I_S_INNODB_TRX, i);
310
ut_snprintf(trx_id, sizeof(trx_id), TRX_ID_FMT, row->trx_id);
311
OK(field_store_string(fields[IDX_TRX_ID], trx_id));
314
OK(field_store_string(fields[IDX_TRX_STATE],
318
OK(field_store_time_t(fields[IDX_TRX_STARTED],
319
(time_t) row->trx_started));
321
/* trx_requested_lock_id */
322
/* trx_wait_started */
323
if (row->trx_wait_started != 0) {
325
OK(field_store_string(
326
fields[IDX_TRX_REQUESTED_LOCK_ID],
327
trx_i_s_create_lock_id(
328
row->requested_lock_row,
329
lock_id, sizeof(lock_id))));
330
/* field_store_string() sets it no notnull */
332
OK(field_store_time_t(
333
fields[IDX_TRX_WAIT_STARTED],
334
(time_t) row->trx_wait_started));
335
fields[IDX_TRX_WAIT_STARTED]->set_notnull();
338
fields[IDX_TRX_REQUESTED_LOCK_ID]->set_null();
339
fields[IDX_TRX_WAIT_STARTED]->set_null();
343
OK(fields[IDX_TRX_WEIGHT]->store((longlong) row->trx_weight,
346
/* trx_mysql_thread_id */
347
OK(fields[IDX_TRX_MYSQL_THREAD_ID]->store(
348
row->trx_mysql_thread_id));
351
OK(field_store_string(fields[IDX_TRX_QUERY],
354
OK(schema_table_store_record(thd, table));
360
/***********************************************************************
361
Bind the dynamic table INFORMATION_SCHEMA.innodb_trx */
366
/* out: 0 on success */
367
void* p) /* in/out: table schema object */
369
ST_SCHEMA_TABLE* schema;
371
DBUG_ENTER("innodb_trx_init");
373
schema = (ST_SCHEMA_TABLE*) p;
375
schema->fields_info = innodb_trx_fields_info;
376
schema->fill_table = trx_i_s_common_fill_table;
381
static struct st_mysql_information_schema i_s_info =
383
MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
386
UNIV_INTERN struct st_mysql_plugin i_s_innodb_trx =
388
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
390
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
392
/* pointer to type-specific plugin descriptor */
394
STRUCT_FLD(info, &i_s_info),
398
STRUCT_FLD(name, "INNODB_TRX"),
400
/* plugin author (for SHOW PLUGINS) */
402
STRUCT_FLD(author, plugin_author),
404
/* general descriptive text (for SHOW PLUGINS) */
406
STRUCT_FLD(descr, "InnoDB transactions"),
408
/* the plugin license (PLUGIN_LICENSE_XXX) */
410
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
412
/* the function to invoke when plugin is loaded */
413
/* int (*)(void*); */
414
STRUCT_FLD(init, innodb_trx_init),
416
/* the function to invoke when plugin is unloaded */
417
/* int (*)(void*); */
418
STRUCT_FLD(deinit, i_s_common_deinit),
420
/* plugin version (for SHOW PLUGINS) */
422
STRUCT_FLD(version, INNODB_VERSION_SHORT),
424
/* struct st_mysql_show_var* */
425
STRUCT_FLD(status_vars, NULL),
427
/* struct st_mysql_sys_var** */
428
STRUCT_FLD(system_vars, NULL),
430
/* reserved for dependency checking */
432
STRUCT_FLD(__reserved1, NULL)
435
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */
436
static ST_FIELD_INFO innodb_locks_fields_info[] =
438
#define IDX_LOCK_ID 0
439
{STRUCT_FLD(field_name, "lock_id"),
440
STRUCT_FLD(field_length, TRX_I_S_LOCK_ID_MAX_LEN + 1),
441
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
442
STRUCT_FLD(value, 0),
443
STRUCT_FLD(field_flags, 0),
444
STRUCT_FLD(old_name, ""),
445
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
447
#define IDX_LOCK_TRX_ID 1
448
{STRUCT_FLD(field_name, "lock_trx_id"),
449
STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
450
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
451
STRUCT_FLD(value, 0),
452
STRUCT_FLD(field_flags, 0),
453
STRUCT_FLD(old_name, ""),
454
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
456
#define IDX_LOCK_MODE 2
457
{STRUCT_FLD(field_name, "lock_mode"),
458
/* S[,GAP] X[,GAP] IS[,GAP] IX[,GAP] AUTO_INC UNKNOWN */
459
STRUCT_FLD(field_length, 32),
460
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
461
STRUCT_FLD(value, 0),
462
STRUCT_FLD(field_flags, 0),
463
STRUCT_FLD(old_name, ""),
464
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
466
#define IDX_LOCK_TYPE 3
467
{STRUCT_FLD(field_name, "lock_type"),
468
STRUCT_FLD(field_length, 32 /* RECORD|TABLE|UNKNOWN */),
469
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
470
STRUCT_FLD(value, 0),
471
STRUCT_FLD(field_flags, 0),
472
STRUCT_FLD(old_name, ""),
473
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
475
#define IDX_LOCK_TABLE 4
476
{STRUCT_FLD(field_name, "lock_table"),
477
STRUCT_FLD(field_length, 1024),
478
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
479
STRUCT_FLD(value, 0),
480
STRUCT_FLD(field_flags, 0),
481
STRUCT_FLD(old_name, ""),
482
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
484
#define IDX_LOCK_INDEX 5
485
{STRUCT_FLD(field_name, "lock_index"),
486
STRUCT_FLD(field_length, 1024),
487
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
488
STRUCT_FLD(value, 0),
489
STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
490
STRUCT_FLD(old_name, ""),
491
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
493
#define IDX_LOCK_SPACE 6
494
{STRUCT_FLD(field_name, "lock_space"),
495
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
496
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
497
STRUCT_FLD(value, 0),
498
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
499
STRUCT_FLD(old_name, ""),
500
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
502
#define IDX_LOCK_PAGE 7
503
{STRUCT_FLD(field_name, "lock_page"),
504
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
505
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
506
STRUCT_FLD(value, 0),
507
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
508
STRUCT_FLD(old_name, ""),
509
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
511
#define IDX_LOCK_REC 8
512
{STRUCT_FLD(field_name, "lock_rec"),
513
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
514
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
515
STRUCT_FLD(value, 0),
516
STRUCT_FLD(field_flags, MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
517
STRUCT_FLD(old_name, ""),
518
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
520
#define IDX_LOCK_DATA 9
521
{STRUCT_FLD(field_name, "lock_data"),
522
STRUCT_FLD(field_length, TRX_I_S_LOCK_DATA_MAX_LEN),
523
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
524
STRUCT_FLD(value, 0),
525
STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
526
STRUCT_FLD(old_name, ""),
527
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
532
/***********************************************************************
533
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_locks
537
fill_innodb_locks_from_cache(
538
/*=========================*/
539
/* out: 0 on success */
540
trx_i_s_cache_t* cache, /* in: cache to read from */
541
THD* thd, /* in: MySQL client connection */
542
TABLE* table) /* in/out: fill this table */
546
char lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
549
DBUG_ENTER("fill_innodb_locks_from_cache");
551
fields = table->field;
553
rows_num = trx_i_s_cache_get_rows_used(cache,
556
for (i = 0; i < rows_num; i++) {
558
i_s_locks_row_t* row;
560
/* note that the decoded database or table name is
561
never expected to be longer than NAME_LEN;
562
NAME_LEN for database name
563
2 for surrounding quotes around database name
564
NAME_LEN for table name
565
2 for surrounding quotes around table name
566
1 for the separating dot (.)
567
9 for the #mysql50# prefix */
568
char buf[2 * NAME_LEN + 14];
571
char lock_trx_id[TRX_ID_MAX_LEN + 1];
573
row = (i_s_locks_row_t*)
574
trx_i_s_cache_get_nth_row(
575
cache, I_S_INNODB_LOCKS, i);
578
trx_i_s_create_lock_id(row, lock_id, sizeof(lock_id));
579
OK(field_store_string(fields[IDX_LOCK_ID],
583
ut_snprintf(lock_trx_id, sizeof(lock_trx_id),
584
TRX_ID_FMT, row->lock_trx_id);
585
OK(field_store_string(fields[IDX_LOCK_TRX_ID], lock_trx_id));
588
OK(field_store_string(fields[IDX_LOCK_MODE],
592
OK(field_store_string(fields[IDX_LOCK_TYPE],
596
bufend = innobase_convert_name(buf, sizeof(buf),
598
strlen(row->lock_table),
600
OK(fields[IDX_LOCK_TABLE]->store(buf, bufend - buf,
601
system_charset_info));
604
if (row->lock_index != NULL) {
606
bufend = innobase_convert_name(buf, sizeof(buf),
608
strlen(row->lock_index),
610
OK(fields[IDX_LOCK_INDEX]->store(buf, bufend - buf,
611
system_charset_info));
612
fields[IDX_LOCK_INDEX]->set_notnull();
615
fields[IDX_LOCK_INDEX]->set_null();
619
OK(field_store_ulint(fields[IDX_LOCK_SPACE],
623
OK(field_store_ulint(fields[IDX_LOCK_PAGE],
627
OK(field_store_ulint(fields[IDX_LOCK_REC],
631
OK(field_store_string(fields[IDX_LOCK_DATA],
634
OK(schema_table_store_record(thd, table));
640
/***********************************************************************
641
Bind the dynamic table INFORMATION_SCHEMA.innodb_locks */
646
/* out: 0 on success */
647
void* p) /* in/out: table schema object */
649
ST_SCHEMA_TABLE* schema;
651
DBUG_ENTER("innodb_locks_init");
653
schema = (ST_SCHEMA_TABLE*) p;
655
schema->fields_info = innodb_locks_fields_info;
656
schema->fill_table = trx_i_s_common_fill_table;
661
UNIV_INTERN struct st_mysql_plugin i_s_innodb_locks =
663
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
665
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
667
/* pointer to type-specific plugin descriptor */
669
STRUCT_FLD(info, &i_s_info),
673
STRUCT_FLD(name, "INNODB_LOCKS"),
675
/* plugin author (for SHOW PLUGINS) */
677
STRUCT_FLD(author, plugin_author),
679
/* general descriptive text (for SHOW PLUGINS) */
681
STRUCT_FLD(descr, "InnoDB conflicting locks"),
683
/* the plugin license (PLUGIN_LICENSE_XXX) */
685
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
687
/* the function to invoke when plugin is loaded */
688
/* int (*)(void*); */
689
STRUCT_FLD(init, innodb_locks_init),
691
/* the function to invoke when plugin is unloaded */
692
/* int (*)(void*); */
693
STRUCT_FLD(deinit, i_s_common_deinit),
695
/* plugin version (for SHOW PLUGINS) */
697
STRUCT_FLD(version, INNODB_VERSION_SHORT),
699
/* struct st_mysql_show_var* */
700
STRUCT_FLD(status_vars, NULL),
702
/* struct st_mysql_sys_var** */
703
STRUCT_FLD(system_vars, NULL),
705
/* reserved for dependency checking */
707
STRUCT_FLD(__reserved1, NULL)
710
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
711
static ST_FIELD_INFO innodb_lock_waits_fields_info[] =
713
#define IDX_REQUESTING_TRX_ID 0
714
{STRUCT_FLD(field_name, "requesting_trx_id"),
715
STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
716
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
717
STRUCT_FLD(value, 0),
718
STRUCT_FLD(field_flags, 0),
719
STRUCT_FLD(old_name, ""),
720
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
722
#define IDX_REQUESTED_LOCK_ID 1
723
{STRUCT_FLD(field_name, "requested_lock_id"),
724
STRUCT_FLD(field_length, TRX_I_S_LOCK_ID_MAX_LEN + 1),
725
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
726
STRUCT_FLD(value, 0),
727
STRUCT_FLD(field_flags, 0),
728
STRUCT_FLD(old_name, ""),
729
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
731
#define IDX_BLOCKING_TRX_ID 2
732
{STRUCT_FLD(field_name, "blocking_trx_id"),
733
STRUCT_FLD(field_length, TRX_ID_MAX_LEN + 1),
734
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
735
STRUCT_FLD(value, 0),
736
STRUCT_FLD(field_flags, 0),
737
STRUCT_FLD(old_name, ""),
738
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
740
#define IDX_BLOCKING_LOCK_ID 3
741
{STRUCT_FLD(field_name, "blocking_lock_id"),
742
STRUCT_FLD(field_length, TRX_I_S_LOCK_ID_MAX_LEN + 1),
743
STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
744
STRUCT_FLD(value, 0),
745
STRUCT_FLD(field_flags, 0),
746
STRUCT_FLD(old_name, ""),
747
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
752
/***********************************************************************
753
Read data from cache buffer and fill the
754
INFORMATION_SCHEMA.innodb_lock_waits table with it. */
757
fill_innodb_lock_waits_from_cache(
758
/*==============================*/
759
/* out: 0 on success */
760
trx_i_s_cache_t* cache, /* in: cache to read from */
761
THD* thd, /* in: used to call
762
schema_table_store_record() */
763
TABLE* table) /* in/out: fill this table */
767
char requested_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
768
char blocking_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
771
DBUG_ENTER("fill_innodb_lock_waits_from_cache");
773
fields = table->field;
775
rows_num = trx_i_s_cache_get_rows_used(cache,
776
I_S_INNODB_LOCK_WAITS);
778
for (i = 0; i < rows_num; i++) {
780
i_s_lock_waits_row_t* row;
782
char requesting_trx_id[TRX_ID_MAX_LEN + 1];
783
char blocking_trx_id[TRX_ID_MAX_LEN + 1];
785
row = (i_s_lock_waits_row_t*)
786
trx_i_s_cache_get_nth_row(
787
cache, I_S_INNODB_LOCK_WAITS, i);
789
/* requesting_trx_id */
790
ut_snprintf(requesting_trx_id, sizeof(requesting_trx_id),
791
TRX_ID_FMT, row->requested_lock_row->lock_trx_id);
792
OK(field_store_string(fields[IDX_REQUESTING_TRX_ID],
795
/* requested_lock_id */
796
OK(field_store_string(
797
fields[IDX_REQUESTED_LOCK_ID],
798
trx_i_s_create_lock_id(
799
row->requested_lock_row,
801
sizeof(requested_lock_id))));
803
/* blocking_trx_id */
804
ut_snprintf(blocking_trx_id, sizeof(blocking_trx_id),
805
TRX_ID_FMT, row->blocking_lock_row->lock_trx_id);
806
OK(field_store_string(fields[IDX_BLOCKING_TRX_ID],
809
/* blocking_lock_id */
810
OK(field_store_string(
811
fields[IDX_BLOCKING_LOCK_ID],
812
trx_i_s_create_lock_id(
813
row->blocking_lock_row,
815
sizeof(blocking_lock_id))));
817
OK(schema_table_store_record(thd, table));
823
/***********************************************************************
824
Bind the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
827
innodb_lock_waits_init(
828
/*===================*/
829
/* out: 0 on success */
830
void* p) /* in/out: table schema object */
832
ST_SCHEMA_TABLE* schema;
834
DBUG_ENTER("innodb_lock_waits_init");
836
schema = (ST_SCHEMA_TABLE*) p;
838
schema->fields_info = innodb_lock_waits_fields_info;
839
schema->fill_table = trx_i_s_common_fill_table;
844
UNIV_INTERN struct st_mysql_plugin i_s_innodb_lock_waits =
846
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
848
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
850
/* pointer to type-specific plugin descriptor */
852
STRUCT_FLD(info, &i_s_info),
856
STRUCT_FLD(name, "INNODB_LOCK_WAITS"),
858
/* plugin author (for SHOW PLUGINS) */
860
STRUCT_FLD(author, "Innobase Oy"),
862
/* general descriptive text (for SHOW PLUGINS) */
864
STRUCT_FLD(descr, "InnoDB which lock is blocking which"),
866
/* the plugin license (PLUGIN_LICENSE_XXX) */
868
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
870
/* the function to invoke when plugin is loaded */
871
/* int (*)(void*); */
872
STRUCT_FLD(init, innodb_lock_waits_init),
874
/* the function to invoke when plugin is unloaded */
875
/* int (*)(void*); */
876
STRUCT_FLD(deinit, i_s_common_deinit),
878
/* plugin version (for SHOW PLUGINS) */
880
STRUCT_FLD(version, INNODB_VERSION_SHORT),
882
/* struct st_mysql_show_var* */
883
STRUCT_FLD(status_vars, NULL),
885
/* struct st_mysql_sys_var** */
886
STRUCT_FLD(system_vars, NULL),
888
/* reserved for dependency checking */
890
STRUCT_FLD(__reserved1, NULL)
893
/***********************************************************************
894
Common function to fill any of the dynamic tables:
895
INFORMATION_SCHEMA.innodb_trx
896
INFORMATION_SCHEMA.innodb_locks
897
INFORMATION_SCHEMA.innodb_lock_waits */
900
trx_i_s_common_fill_table(
901
/*======================*/
902
/* out: 0 on success */
903
THD* thd, /* in: thread */
904
TABLE_LIST* tables, /* in/out: tables to fill */
905
COND* cond) /* in: condition (not used) */
907
const char* table_name;
909
trx_i_s_cache_t* cache;
911
DBUG_ENTER("trx_i_s_common_fill_table");
913
/* deny access to non-superusers */
914
if (check_global_access(thd, PROCESS_ACL)) {
919
/* minimize the number of places where global variables are
921
cache = trx_i_s_cache;
923
/* which table we have to fill? */
924
table_name = tables->schema_table_name;
925
/* or table_name = tables->schema_table->table_name; */
927
RETURN_IF_INNODB_NOT_STARTED(table_name);
929
/* update the cache */
930
trx_i_s_cache_start_write(cache);
931
trx_i_s_possibly_fetch_data_into_cache(cache);
932
trx_i_s_cache_end_write(cache);
934
if (trx_i_s_cache_is_truncated(cache)) {
936
/* XXX show warning to user if possible */
937
fprintf(stderr, "Warning: data in %s truncated due to "
938
"memory limit of %d bytes\n", table_name,
944
trx_i_s_cache_start_read(cache);
946
if (innobase_strcasecmp(table_name, "innodb_trx") == 0) {
948
if (fill_innodb_trx_from_cache(
949
cache, thd, tables->table) != 0) {
954
} else if (innobase_strcasecmp(table_name, "innodb_locks") == 0) {
956
if (fill_innodb_locks_from_cache(
957
cache, thd, tables->table) != 0) {
962
} else if (innobase_strcasecmp(table_name, "innodb_lock_waits") == 0) {
964
if (fill_innodb_lock_waits_from_cache(
965
cache, thd, tables->table) != 0) {
972
/* huh! what happened!? */
974
"InnoDB: trx_i_s_common_fill_table() was "
975
"called to fill unknown table: %s.\n"
976
"This function only knows how to fill "
977
"innodb_trx, innodb_locks and "
978
"innodb_lock_waits tables.\n", table_name);
983
trx_i_s_cache_end_read(cache);
988
/* if this function returns something else than 0 then a
989
deadlock occurs between the mysqld server and mysql client,
990
see http://bugs.mysql.com/29900 ; when that bug is resolved
991
we can enable the DBUG_RETURN(ret) above */
996
/* Fields of the dynamic table information_schema.innodb_cmp. */
997
static ST_FIELD_INFO i_s_cmp_fields_info[] =
999
{STRUCT_FLD(field_name, "page_size"),
1000
STRUCT_FLD(field_length, 5),
1001
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1002
STRUCT_FLD(value, 0),
1003
STRUCT_FLD(field_flags, 0),
1004
STRUCT_FLD(old_name, "Compressed Page Size"),
1005
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1007
{STRUCT_FLD(field_name, "compress_ops"),
1008
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1009
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1010
STRUCT_FLD(value, 0),
1011
STRUCT_FLD(field_flags, 0),
1012
STRUCT_FLD(old_name, "Total Number of Compressions"),
1013
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1015
{STRUCT_FLD(field_name, "compress_ops_ok"),
1016
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1017
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1018
STRUCT_FLD(value, 0),
1019
STRUCT_FLD(field_flags, 0),
1020
STRUCT_FLD(old_name, "Total Number of"
1021
" Successful Compressions"),
1022
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1024
{STRUCT_FLD(field_name, "compress_time"),
1025
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1026
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1027
STRUCT_FLD(value, 0),
1028
STRUCT_FLD(field_flags, 0),
1029
STRUCT_FLD(old_name, "Total Duration of Compressions,"
1031
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1033
{STRUCT_FLD(field_name, "uncompress_ops"),
1034
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1035
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1036
STRUCT_FLD(value, 0),
1037
STRUCT_FLD(field_flags, 0),
1038
STRUCT_FLD(old_name, "Total Number of Decompressions"),
1039
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1041
{STRUCT_FLD(field_name, "uncompress_time"),
1042
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1043
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1044
STRUCT_FLD(value, 0),
1045
STRUCT_FLD(field_flags, 0),
1046
STRUCT_FLD(old_name, "Total Duration of Decompressions,"
1048
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1050
END_OF_ST_FIELD_INFO
1054
/***********************************************************************
1055
Fill the dynamic table information_schema.innodb_cmp or
1056
innodb_cmp_reset. */
1061
/* out: 0 on success, 1 on failure */
1062
THD* thd, /* in: thread */
1063
TABLE_LIST* tables, /* in/out: tables to fill */
1064
COND* cond, /* in: condition (ignored) */
1065
ibool reset) /* in: TRUE=reset cumulated counts */
1067
TABLE* table = (TABLE *) tables->table;
1070
DBUG_ENTER("i_s_cmp_fill_low");
1072
/* deny access to non-superusers */
1073
if (check_global_access(thd, PROCESS_ACL)) {
1078
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
1080
for (uint i = 0; i < PAGE_ZIP_NUM_SSIZE - 1; i++) {
1081
page_zip_stat_t* zip_stat = &page_zip_stat[i];
1083
table->field[0]->store(PAGE_ZIP_MIN_SIZE << i);
1085
/* The cumulated counts are not protected by any
1086
mutex. Thus, some operation in page0zip.c could
1087
increment a counter between the time we read it and
1088
clear it. We could introduce mutex protection, but it
1089
could cause a measureable performance hit in
1091
table->field[1]->store(zip_stat->compressed);
1092
table->field[2]->store(zip_stat->compressed_ok);
1093
table->field[3]->store(
1094
(ulong) (zip_stat->compressed_usec / 1000000));
1095
table->field[4]->store(zip_stat->decompressed);
1096
table->field[5]->store(
1097
(ulong) (zip_stat->decompressed_usec / 1000000));
1100
memset(zip_stat, 0, sizeof *zip_stat);
1103
if (schema_table_store_record(thd, table)) {
1109
DBUG_RETURN(status);
1112
/***********************************************************************
1113
Fill the dynamic table information_schema.innodb_cmp. */
1118
/* out: 0 on success, 1 on failure */
1119
THD* thd, /* in: thread */
1120
TABLE_LIST* tables, /* in/out: tables to fill */
1121
COND* cond) /* in: condition (ignored) */
1123
return(i_s_cmp_fill_low(thd, tables, cond, FALSE));
1126
/***********************************************************************
1127
Fill the dynamic table information_schema.innodb_cmp_reset. */
1132
/* out: 0 on success, 1 on failure */
1133
THD* thd, /* in: thread */
1134
TABLE_LIST* tables, /* in/out: tables to fill */
1135
COND* cond) /* in: condition (ignored) */
1137
return(i_s_cmp_fill_low(thd, tables, cond, TRUE));
1140
/***********************************************************************
1141
Bind the dynamic table information_schema.innodb_cmp. */
1146
/* out: 0 on success */
1147
void* p) /* in/out: table schema object */
1149
DBUG_ENTER("i_s_cmp_init");
1150
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
1152
schema->fields_info = i_s_cmp_fields_info;
1153
schema->fill_table = i_s_cmp_fill;
1158
/***********************************************************************
1159
Bind the dynamic table information_schema.innodb_cmp_reset. */
1164
/* out: 0 on success */
1165
void* p) /* in/out: table schema object */
1167
DBUG_ENTER("i_s_cmp_reset_init");
1168
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
1170
schema->fields_info = i_s_cmp_fields_info;
1171
schema->fill_table = i_s_cmp_reset_fill;
1176
UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp =
1178
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
1180
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1182
/* pointer to type-specific plugin descriptor */
1184
STRUCT_FLD(info, &i_s_info),
1188
STRUCT_FLD(name, "INNODB_CMP"),
1190
/* plugin author (for SHOW PLUGINS) */
1192
STRUCT_FLD(author, plugin_author),
1194
/* general descriptive text (for SHOW PLUGINS) */
1196
STRUCT_FLD(descr, "Statistics for the InnoDB compression"),
1198
/* the plugin license (PLUGIN_LICENSE_XXX) */
1200
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1202
/* the function to invoke when plugin is loaded */
1203
/* int (*)(void*); */
1204
STRUCT_FLD(init, i_s_cmp_init),
1206
/* the function to invoke when plugin is unloaded */
1207
/* int (*)(void*); */
1208
STRUCT_FLD(deinit, i_s_common_deinit),
1210
/* plugin version (for SHOW PLUGINS) */
1212
STRUCT_FLD(version, INNODB_VERSION_SHORT),
1214
/* struct st_mysql_show_var* */
1215
STRUCT_FLD(status_vars, NULL),
1217
/* struct st_mysql_sys_var** */
1218
STRUCT_FLD(system_vars, NULL),
1220
/* reserved for dependency checking */
1222
STRUCT_FLD(__reserved1, NULL)
1225
UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmp_reset =
1227
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
1229
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1231
/* pointer to type-specific plugin descriptor */
1233
STRUCT_FLD(info, &i_s_info),
1237
STRUCT_FLD(name, "INNODB_CMP_RESET"),
1239
/* plugin author (for SHOW PLUGINS) */
1241
STRUCT_FLD(author, plugin_author),
1243
/* general descriptive text (for SHOW PLUGINS) */
1245
STRUCT_FLD(descr, "Statistics for the InnoDB compression;"
1246
" reset cumulated counts"),
1248
/* the plugin license (PLUGIN_LICENSE_XXX) */
1250
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1252
/* the function to invoke when plugin is loaded */
1253
/* int (*)(void*); */
1254
STRUCT_FLD(init, i_s_cmp_reset_init),
1256
/* the function to invoke when plugin is unloaded */
1257
/* int (*)(void*); */
1258
STRUCT_FLD(deinit, i_s_common_deinit),
1260
/* plugin version (for SHOW PLUGINS) */
1262
STRUCT_FLD(version, INNODB_VERSION_SHORT),
1264
/* struct st_mysql_show_var* */
1265
STRUCT_FLD(status_vars, NULL),
1267
/* struct st_mysql_sys_var** */
1268
STRUCT_FLD(system_vars, NULL),
1270
/* reserved for dependency checking */
1272
STRUCT_FLD(__reserved1, NULL)
1275
/* Fields of the dynamic table information_schema.innodb_cmpmem. */
1276
static ST_FIELD_INFO i_s_cmpmem_fields_info[] =
1278
{STRUCT_FLD(field_name, "page_size"),
1279
STRUCT_FLD(field_length, 5),
1280
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1281
STRUCT_FLD(value, 0),
1282
STRUCT_FLD(field_flags, 0),
1283
STRUCT_FLD(old_name, "Buddy Block Size"),
1284
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1286
{STRUCT_FLD(field_name, "pages_used"),
1287
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1288
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1289
STRUCT_FLD(value, 0),
1290
STRUCT_FLD(field_flags, 0),
1291
STRUCT_FLD(old_name, "Currently in Use"),
1292
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1294
{STRUCT_FLD(field_name, "pages_free"),
1295
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1296
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1297
STRUCT_FLD(value, 0),
1298
STRUCT_FLD(field_flags, 0),
1299
STRUCT_FLD(old_name, "Currently Available"),
1300
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1302
{STRUCT_FLD(field_name, "relocation_ops"),
1303
STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
1304
STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
1305
STRUCT_FLD(value, 0),
1306
STRUCT_FLD(field_flags, 0),
1307
STRUCT_FLD(old_name, "Total Number of Relocations"),
1308
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1310
{STRUCT_FLD(field_name, "relocation_time"),
1311
STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1312
STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1313
STRUCT_FLD(value, 0),
1314
STRUCT_FLD(field_flags, 0),
1315
STRUCT_FLD(old_name, "Total Duration of Relocations,"
1317
STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1319
END_OF_ST_FIELD_INFO
1322
/***********************************************************************
1323
Fill the dynamic table information_schema.innodb_cmpmem or
1324
innodb_cmpmem_reset. */
1327
i_s_cmpmem_fill_low(
1328
/*================*/
1329
/* out: 0 on success, 1 on failure */
1330
THD* thd, /* in: thread */
1331
TABLE_LIST* tables, /* in/out: tables to fill */
1332
COND* cond, /* in: condition (ignored) */
1333
ibool reset) /* in: TRUE=reset cumulated counts */
1335
TABLE* table = (TABLE *) tables->table;
1338
DBUG_ENTER("i_s_cmpmem_fill_low");
1340
/* deny access to non-superusers */
1341
if (check_global_access(thd, PROCESS_ACL)) {
1346
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
1348
buf_pool_mutex_enter();
1350
for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
1351
buf_buddy_stat_t* buddy_stat = &buf_buddy_stat[x];
1353
table->field[0]->store(BUF_BUDDY_LOW << x);
1354
table->field[1]->store(buddy_stat->used);
1355
table->field[2]->store(UNIV_LIKELY(x < BUF_BUDDY_SIZES)
1356
? UT_LIST_GET_LEN(buf_pool->zip_free[x])
1358
table->field[3]->store((longlong) buddy_stat->relocated, true);
1359
table->field[4]->store(
1360
(ulong) (buddy_stat->relocated_usec / 1000000));
1363
/* This is protected by buf_pool_mutex. */
1364
buddy_stat->relocated = 0;
1365
buddy_stat->relocated_usec = 0;
1368
if (schema_table_store_record(thd, table)) {
1374
buf_pool_mutex_exit();
1375
DBUG_RETURN(status);
1378
/***********************************************************************
1379
Fill the dynamic table information_schema.innodb_cmpmem. */
1384
/* out: 0 on success, 1 on failure */
1385
THD* thd, /* in: thread */
1386
TABLE_LIST* tables, /* in/out: tables to fill */
1387
COND* cond) /* in: condition (ignored) */
1389
return(i_s_cmpmem_fill_low(thd, tables, cond, FALSE));
1392
/***********************************************************************
1393
Fill the dynamic table information_schema.innodb_cmpmem_reset. */
1396
i_s_cmpmem_reset_fill(
1397
/*==================*/
1398
/* out: 0 on success, 1 on failure */
1399
THD* thd, /* in: thread */
1400
TABLE_LIST* tables, /* in/out: tables to fill */
1401
COND* cond) /* in: condition (ignored) */
1403
return(i_s_cmpmem_fill_low(thd, tables, cond, TRUE));
1406
/***********************************************************************
1407
Bind the dynamic table information_schema.innodb_cmpmem. */
1412
/* out: 0 on success */
1413
void* p) /* in/out: table schema object */
1415
DBUG_ENTER("i_s_cmpmem_init");
1416
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
1418
schema->fields_info = i_s_cmpmem_fields_info;
1419
schema->fill_table = i_s_cmpmem_fill;
1424
/***********************************************************************
1425
Bind the dynamic table information_schema.innodb_cmpmem_reset. */
1428
i_s_cmpmem_reset_init(
1429
/*==================*/
1430
/* out: 0 on success */
1431
void* p) /* in/out: table schema object */
1433
DBUG_ENTER("i_s_cmpmem_reset_init");
1434
ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
1436
schema->fields_info = i_s_cmpmem_fields_info;
1437
schema->fill_table = i_s_cmpmem_reset_fill;
1442
UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem =
1444
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
1446
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1448
/* pointer to type-specific plugin descriptor */
1450
STRUCT_FLD(info, &i_s_info),
1454
STRUCT_FLD(name, "INNODB_CMPMEM"),
1456
/* plugin author (for SHOW PLUGINS) */
1458
STRUCT_FLD(author, plugin_author),
1460
/* general descriptive text (for SHOW PLUGINS) */
1462
STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool"),
1464
/* the plugin license (PLUGIN_LICENSE_XXX) */
1466
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1468
/* the function to invoke when plugin is loaded */
1469
/* int (*)(void*); */
1470
STRUCT_FLD(init, i_s_cmpmem_init),
1472
/* the function to invoke when plugin is unloaded */
1473
/* int (*)(void*); */
1474
STRUCT_FLD(deinit, i_s_common_deinit),
1476
/* plugin version (for SHOW PLUGINS) */
1478
STRUCT_FLD(version, INNODB_VERSION_SHORT),
1480
/* struct st_mysql_show_var* */
1481
STRUCT_FLD(status_vars, NULL),
1483
/* struct st_mysql_sys_var** */
1484
STRUCT_FLD(system_vars, NULL),
1486
/* reserved for dependency checking */
1488
STRUCT_FLD(__reserved1, NULL)
1491
UNIV_INTERN struct st_mysql_plugin i_s_innodb_cmpmem_reset =
1493
/* the plugin type (a MYSQL_XXX_PLUGIN value) */
1495
STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1497
/* pointer to type-specific plugin descriptor */
1499
STRUCT_FLD(info, &i_s_info),
1503
STRUCT_FLD(name, "INNODB_CMPMEM_RESET"),
1505
/* plugin author (for SHOW PLUGINS) */
1507
STRUCT_FLD(author, plugin_author),
1509
/* general descriptive text (for SHOW PLUGINS) */
1511
STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool;"
1512
" reset cumulated counts"),
1514
/* the plugin license (PLUGIN_LICENSE_XXX) */
1516
STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1518
/* the function to invoke when plugin is loaded */
1519
/* int (*)(void*); */
1520
STRUCT_FLD(init, i_s_cmpmem_reset_init),
1522
/* the function to invoke when plugin is unloaded */
1523
/* int (*)(void*); */
1524
STRUCT_FLD(deinit, i_s_common_deinit),
1526
/* plugin version (for SHOW PLUGINS) */
1528
STRUCT_FLD(version, INNODB_VERSION_SHORT),
1530
/* struct st_mysql_show_var* */
1531
STRUCT_FLD(status_vars, NULL),
1533
/* struct st_mysql_sys_var** */
1534
STRUCT_FLD(system_vars, NULL),
1536
/* reserved for dependency checking */
1538
STRUCT_FLD(__reserved1, NULL)
1541
/***********************************************************************
1542
Unbind a dynamic INFORMATION_SCHEMA table. */
1547
/* out: 0 on success */
1548
void* p) /* in/out: table schema object */
1550
DBUG_ENTER("i_s_common_deinit");