~jaypipes/drizzle/new-test-runner

« back to all changes in this revision

Viewing changes to storage/innobase/handler/i_s.cc

  • Committer: Jay Pipes
  • Date: 2008-12-11 17:52:34 UTC
  • mfrom: (482.16.152 testable)
  • Revision ID: jpipes@serialcoder-20081211175234-uqsfvmgxejvmellq
merge with trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************
 
2
InnoDB INFORMATION SCHEMA tables interface to MySQL.
 
3
 
 
4
(c) 2007 Innobase Oy
 
5
 
 
6
Created July 18, 2007 Vasil Dimov
 
7
*******************************************************/
 
8
 
 
9
#include <mysql_priv.h>
 
10
#include <mysqld_error.h>
 
11
 
 
12
#include <m_ctype.h>
 
13
#include <hash.h>
 
14
#include <myisampack.h>
 
15
#include <mysys_err.h>
 
16
#include <my_sys.h>
 
17
#include "i_s.h"
 
18
#include <mysql/plugin.h>
 
19
 
 
20
extern "C" {
 
21
#include "trx0i_s.h"
 
22
#include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */
 
23
#include "buf0buddy.h" /* for i_s_cmpmem */
 
24
#include "buf0buf.h" /* for buf_pool and PAGE_ZIP_MIN_SIZE */
 
25
#include "ha_prototypes.h" /* for innobase_convert_name() */
 
26
#include "srv0start.h" /* for srv_was_started */
 
27
}
 
28
#include "handler0vars.h"
 
29
 
 
30
static const char plugin_author[] = "Innobase Oy";
 
31
 
 
32
#define OK(expr)                \
 
33
        if ((expr) != 0) {      \
 
34
                DBUG_RETURN(1); \
 
35
        }
 
36
 
 
37
#define RETURN_IF_INNODB_NOT_STARTED(plugin_name)                       \
 
38
do {                                                                    \
 
39
        if (!srv_was_started) {                                         \
 
40
                push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN,  \
 
41
                                    ER_CANT_FIND_SYSTEM_REC,            \
 
42
                                    "InnoDB: SELECTing from "           \
 
43
                                    "INFORMATION_SCHEMA.%s but "        \
 
44
                                    "the InnoDB storage engine "        \
 
45
                                    "is not installed", plugin_name);   \
 
46
                DBUG_RETURN(0);                                         \
 
47
        }                                                               \
 
48
} while (0)
 
49
 
 
50
#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER
 
51
#define STRUCT_FLD(name, value) name: value
 
52
#else
 
53
#define STRUCT_FLD(name, value) value
 
54
#endif
 
55
 
 
56
static const ST_FIELD_INFO END_OF_ST_FIELD_INFO =
 
57
        {STRUCT_FLD(field_name,         NULL),
 
58
         STRUCT_FLD(field_length,       0),
 
59
         STRUCT_FLD(field_type,         MYSQL_TYPE_NULL),
 
60
         STRUCT_FLD(value,              0),
 
61
         STRUCT_FLD(field_flags,        0),
 
62
         STRUCT_FLD(old_name,           ""),
 
63
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)};
 
64
 
 
65
/*
 
66
Use the following types mapping:
 
67
 
 
68
C type  ST_FIELD_INFO::field_type
 
69
---------------------------------
 
70
long                    MYSQL_TYPE_LONGLONG
 
71
(field_length=MY_INT64_NUM_DECIMAL_DIGITS)
 
72
 
 
73
long unsigned           MYSQL_TYPE_LONGLONG
 
74
(field_length=MY_INT64_NUM_DECIMAL_DIGITS, field_flags=MY_I_S_UNSIGNED)
 
75
 
 
76
char*                   MYSQL_TYPE_STRING
 
77
(field_length=n)
 
78
 
 
79
float                   MYSQL_TYPE_FLOAT
 
80
(field_length=0 is ignored)
 
81
 
 
82
void*                   MYSQL_TYPE_LONGLONG
 
83
(field_length=MY_INT64_NUM_DECIMAL_DIGITS, field_flags=MY_I_S_UNSIGNED)
 
84
 
 
85
boolean (if else)       MYSQL_TYPE_LONG
 
86
(field_length=1)
 
87
 
 
88
time_t                  MYSQL_TYPE_DATETIME
 
89
(field_length=0 ignored)
 
90
---------------------------------
 
91
*/
 
92
 
 
93
/* XXX these are defined in mysql_priv.h inside #ifdef MYSQL_SERVER */
 
94
bool schema_table_store_record(THD *thd, TABLE *table);
 
95
void localtime_to_TIME(MYSQL_TIME *to, struct tm *from);
 
96
bool check_global_access(THD *thd, ulong want_access);
 
97
 
 
98
/***********************************************************************
 
99
Common function to fill any of the dynamic tables:
 
100
INFORMATION_SCHEMA.innodb_trx
 
101
INFORMATION_SCHEMA.innodb_locks
 
102
INFORMATION_SCHEMA.innodb_lock_waits */
 
103
static
 
104
int
 
105
trx_i_s_common_fill_table(
 
106
/*======================*/
 
107
                                /* out: 0 on success */
 
108
        THD*            thd,    /* in: thread */
 
109
        TABLE_LIST*     tables, /* in/out: tables to fill */
 
110
        COND*           cond);  /* in: condition (not used) */
 
111
 
 
112
/***********************************************************************
 
113
Unbind a dynamic INFORMATION_SCHEMA table. */
 
114
static
 
115
int
 
116
i_s_common_deinit(
 
117
/*==============*/
 
118
                        /* out: 0 on success */
 
119
        void*   p);     /* in/out: table schema object */
 
120
 
 
121
/***********************************************************************
 
122
Auxiliary function to store time_t value in MYSQL_TYPE_DATETIME
 
123
field. */
 
124
static
 
125
int
 
126
field_store_time_t(
 
127
/*===============*/
 
128
                        /* out: 0 on success */
 
129
        Field*  field,  /* in/out: target field for storage */
 
130
        time_t  time)   /* in: value to store */
 
131
{
 
132
        MYSQL_TIME      my_time;
 
133
        struct tm       tm_time;
 
134
 
 
135
#if 0
 
136
        /* use this if you are sure that `variables' and `time_zone'
 
137
        are always initialized */
 
138
        thd->variables.time_zone->gmt_sec_to_TIME(
 
139
                &my_time, (my_time_t) time);
 
140
#else
 
141
        localtime_r(&time, &tm_time);
 
142
        localtime_to_TIME(&my_time, &tm_time);
 
143
        my_time.time_type = MYSQL_TIMESTAMP_DATETIME;
 
144
#endif
 
145
 
 
146
        return(field->store_time(&my_time, MYSQL_TIMESTAMP_DATETIME));
 
147
}
 
148
 
 
149
/***********************************************************************
 
150
Auxiliary function to store char* value in MYSQL_TYPE_STRING field. */
 
151
static
 
152
int
 
153
field_store_string(
 
154
/*===============*/
 
155
                                /* out: 0 on success */
 
156
        Field*          field,  /* in/out: target field for storage */
 
157
        const char*     str)    /* in: NUL-terminated utf-8 string,
 
158
                                or NULL */
 
159
{
 
160
        int     ret;
 
161
 
 
162
        if (str != NULL) {
 
163
 
 
164
                ret = field->store(str, strlen(str),
 
165
                                   system_charset_info);
 
166
                field->set_notnull();
 
167
        } else {
 
168
 
 
169
                ret = 0; /* success */
 
170
                field->set_null();
 
171
        }
 
172
 
 
173
        return(ret);
 
174
}
 
175
 
 
176
/***********************************************************************
 
177
Auxiliary function to store ulint value in MYSQL_TYPE_LONGLONG field.
 
178
If the value is ULINT_UNDEFINED then the field it set to NULL. */
 
179
static
 
180
int
 
181
field_store_ulint(
 
182
/*==============*/
 
183
                        /* out: 0 on success */
 
184
        Field*  field,  /* in/out: target field for storage */
 
185
        ulint   n)      /* in: value to store */
 
186
{
 
187
        int     ret;
 
188
 
 
189
        if (n != ULINT_UNDEFINED) {
 
190
 
 
191
                ret = field->store(n);
 
192
                field->set_notnull();
 
193
        } else {
 
194
 
 
195
                ret = 0; /* success */
 
196
                field->set_null();
 
197
        }
 
198
 
 
199
        return(ret);
 
200
}
 
201
 
 
202
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */
 
203
static ST_FIELD_INFO    innodb_trx_fields_info[] =
 
204
{
 
205
#define IDX_TRX_ID              0
 
206
        {STRUCT_FLD(field_name,         "trx_id"),
 
207
         STRUCT_FLD(field_length,       TRX_ID_MAX_LEN + 1),
 
208
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
209
         STRUCT_FLD(value,              0),
 
210
         STRUCT_FLD(field_flags,        0),
 
211
         STRUCT_FLD(old_name,           ""),
 
212
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
213
 
 
214
#define IDX_TRX_STATE           1
 
215
        {STRUCT_FLD(field_name,         "trx_state"),
 
216
         STRUCT_FLD(field_length,       TRX_QUE_STATE_STR_MAX_LEN + 1),
 
217
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
218
         STRUCT_FLD(value,              0),
 
219
         STRUCT_FLD(field_flags,        0),
 
220
         STRUCT_FLD(old_name,           ""),
 
221
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
222
 
 
223
#define IDX_TRX_STARTED         2
 
224
        {STRUCT_FLD(field_name,         "trx_started"),
 
225
         STRUCT_FLD(field_length,       0),
 
226
         STRUCT_FLD(field_type,         MYSQL_TYPE_DATETIME),
 
227
         STRUCT_FLD(value,              0),
 
228
         STRUCT_FLD(field_flags,        0),
 
229
         STRUCT_FLD(old_name,           ""),
 
230
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
231
 
 
232
#define IDX_TRX_REQUESTED_LOCK_ID       3
 
233
        {STRUCT_FLD(field_name,         "trx_requested_lock_id"),
 
234
         STRUCT_FLD(field_length,       TRX_I_S_LOCK_ID_MAX_LEN + 1),
 
235
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
236
         STRUCT_FLD(value,              0),
 
237
         STRUCT_FLD(field_flags,        MY_I_S_MAYBE_NULL),
 
238
         STRUCT_FLD(old_name,           ""),
 
239
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
240
 
 
241
#define IDX_TRX_WAIT_STARTED    4
 
242
        {STRUCT_FLD(field_name,         "trx_wait_started"),
 
243
         STRUCT_FLD(field_length,       0),
 
244
         STRUCT_FLD(field_type,         MYSQL_TYPE_DATETIME),
 
245
         STRUCT_FLD(value,              0),
 
246
         STRUCT_FLD(field_flags,        MY_I_S_MAYBE_NULL),
 
247
         STRUCT_FLD(old_name,           ""),
 
248
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
249
 
 
250
#define IDX_TRX_WEIGHT          5
 
251
        {STRUCT_FLD(field_name,         "trx_weight"),
 
252
         STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
 
253
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
 
254
         STRUCT_FLD(value,              0),
 
255
         STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
 
256
         STRUCT_FLD(old_name,           ""),
 
257
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
258
 
 
259
#define IDX_TRX_MYSQL_THREAD_ID 6
 
260
        {STRUCT_FLD(field_name,         "trx_mysql_thread_id"),
 
261
         STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
 
262
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
 
263
         STRUCT_FLD(value,              0),
 
264
         STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED),
 
265
         STRUCT_FLD(old_name,           ""),
 
266
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
267
 
 
268
#define IDX_TRX_QUERY           7
 
269
        {STRUCT_FLD(field_name,         "trx_query"),
 
270
         STRUCT_FLD(field_length,       TRX_I_S_TRX_QUERY_MAX_LEN),
 
271
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
272
         STRUCT_FLD(value,              0),
 
273
         STRUCT_FLD(field_flags,        MY_I_S_MAYBE_NULL),
 
274
         STRUCT_FLD(old_name,           ""),
 
275
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
276
 
 
277
        END_OF_ST_FIELD_INFO
 
278
};
 
279
 
 
280
/***********************************************************************
 
281
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_trx
 
282
table with it. */
 
283
static
 
284
int
 
285
fill_innodb_trx_from_cache(
 
286
/*=======================*/
 
287
                                        /* out: 0 on success */
 
288
        trx_i_s_cache_t*        cache,  /* in: cache to read from */
 
289
        THD*                    thd,    /* in: used to call
 
290
                                        schema_table_store_record() */
 
291
        TABLE*                  table)  /* in/out: fill this table */
 
292
{
 
293
        Field** fields;
 
294
        ulint   rows_num;
 
295
        char    lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
 
296
        ulint   i;
 
297
 
 
298
        DBUG_ENTER("fill_innodb_trx_from_cache");
 
299
 
 
300
        fields = table->field;
 
301
 
 
302
        rows_num = trx_i_s_cache_get_rows_used(cache,
 
303
                                               I_S_INNODB_TRX);
 
304
 
 
305
        for (i = 0; i < rows_num; i++) {
 
306
 
 
307
                i_s_trx_row_t*  row;
 
308
                char            trx_id[TRX_ID_MAX_LEN + 1];
 
309
 
 
310
                row = (i_s_trx_row_t*)
 
311
                        trx_i_s_cache_get_nth_row(
 
312
                                cache, I_S_INNODB_TRX, i);
 
313
 
 
314
                /* trx_id */
 
315
                ut_snprintf(trx_id, sizeof(trx_id), TRX_ID_FMT, row->trx_id);
 
316
                OK(field_store_string(fields[IDX_TRX_ID], trx_id));
 
317
 
 
318
                /* trx_state */
 
319
                OK(field_store_string(fields[IDX_TRX_STATE],
 
320
                                      row->trx_state));
 
321
 
 
322
                /* trx_started */
 
323
                OK(field_store_time_t(fields[IDX_TRX_STARTED],
 
324
                                      (time_t) row->trx_started));
 
325
 
 
326
                /* trx_requested_lock_id */
 
327
                /* trx_wait_started */
 
328
                if (row->trx_wait_started != 0) {
 
329
 
 
330
                        OK(field_store_string(
 
331
                                   fields[IDX_TRX_REQUESTED_LOCK_ID],
 
332
                                   trx_i_s_create_lock_id(
 
333
                                           row->requested_lock_row,
 
334
                                           lock_id, sizeof(lock_id))));
 
335
                        /* field_store_string() sets it no notnull */
 
336
 
 
337
                        OK(field_store_time_t(
 
338
                                   fields[IDX_TRX_WAIT_STARTED],
 
339
                                   (time_t) row->trx_wait_started));
 
340
                        fields[IDX_TRX_WAIT_STARTED]->set_notnull();
 
341
                } else {
 
342
 
 
343
                        fields[IDX_TRX_REQUESTED_LOCK_ID]->set_null();
 
344
                        fields[IDX_TRX_WAIT_STARTED]->set_null();
 
345
                }
 
346
 
 
347
                /* trx_weight */
 
348
                OK(fields[IDX_TRX_WEIGHT]->store((longlong) row->trx_weight,
 
349
                                                 true));
 
350
 
 
351
                /* trx_mysql_thread_id */
 
352
                OK(fields[IDX_TRX_MYSQL_THREAD_ID]->store(
 
353
                           row->trx_mysql_thread_id));
 
354
 
 
355
                /* trx_query */
 
356
                OK(field_store_string(fields[IDX_TRX_QUERY],
 
357
                                      row->trx_query));
 
358
 
 
359
                OK(schema_table_store_record(thd, table));
 
360
        }
 
361
 
 
362
        DBUG_RETURN(0);
 
363
}
 
364
 
 
365
/***********************************************************************
 
366
Bind the dynamic table INFORMATION_SCHEMA.innodb_trx */
 
367
static
 
368
int
 
369
innodb_trx_init(
 
370
/*============*/
 
371
                        /* out: 0 on success */
 
372
        void*   p)      /* in/out: table schema object */
 
373
{
 
374
        ST_SCHEMA_TABLE*        schema;
 
375
 
 
376
        DBUG_ENTER("innodb_trx_init");
 
377
 
 
378
        schema = (ST_SCHEMA_TABLE*) p;
 
379
 
 
380
        schema->fields_info = innodb_trx_fields_info;
 
381
        schema->fill_table = trx_i_s_common_fill_table;
 
382
 
 
383
        DBUG_RETURN(0);
 
384
}
 
385
 
 
386
static struct st_mysql_information_schema       i_s_info =
 
387
{
 
388
        MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
 
389
};
 
390
 
 
391
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_trx =
 
392
{
 
393
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
 
394
        /* int */
 
395
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
 
396
 
 
397
        /* pointer to type-specific plugin descriptor */
 
398
        /* void* */
 
399
        STRUCT_FLD(info, &i_s_info),
 
400
 
 
401
        /* plugin name */
 
402
        /* const char* */
 
403
        STRUCT_FLD(name, "INNODB_TRX"),
 
404
 
 
405
        /* plugin author (for SHOW PLUGINS) */
 
406
        /* const char* */
 
407
        STRUCT_FLD(author, plugin_author),
 
408
 
 
409
        /* general descriptive text (for SHOW PLUGINS) */
 
410
        /* const char* */
 
411
        STRUCT_FLD(descr, "InnoDB transactions"),
 
412
 
 
413
        /* the plugin license (PLUGIN_LICENSE_XXX) */
 
414
        /* int */
 
415
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
 
416
 
 
417
        /* the function to invoke when plugin is loaded */
 
418
        /* int (*)(void*); */
 
419
        STRUCT_FLD(init, innodb_trx_init),
 
420
 
 
421
        /* the function to invoke when plugin is unloaded */
 
422
        /* int (*)(void*); */
 
423
        STRUCT_FLD(deinit, i_s_common_deinit),
 
424
 
 
425
        /* plugin version (for SHOW PLUGINS) */
 
426
        /* unsigned int */
 
427
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
 
428
 
 
429
        /* struct st_mysql_show_var* */
 
430
        STRUCT_FLD(status_vars, NULL),
 
431
 
 
432
        /* struct st_mysql_sys_var** */
 
433
        STRUCT_FLD(system_vars, NULL),
 
434
 
 
435
        /* reserved for dependency checking */
 
436
        /* void* */
 
437
        STRUCT_FLD(__reserved1, NULL)
 
438
};
 
439
 
 
440
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */
 
441
static ST_FIELD_INFO    innodb_locks_fields_info[] =
 
442
{
 
443
#define IDX_LOCK_ID             0
 
444
        {STRUCT_FLD(field_name,         "lock_id"),
 
445
         STRUCT_FLD(field_length,       TRX_I_S_LOCK_ID_MAX_LEN + 1),
 
446
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
447
         STRUCT_FLD(value,              0),
 
448
         STRUCT_FLD(field_flags,        0),
 
449
         STRUCT_FLD(old_name,           ""),
 
450
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
451
 
 
452
#define IDX_LOCK_TRX_ID         1
 
453
        {STRUCT_FLD(field_name,         "lock_trx_id"),
 
454
         STRUCT_FLD(field_length,       TRX_ID_MAX_LEN + 1),
 
455
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
456
         STRUCT_FLD(value,              0),
 
457
         STRUCT_FLD(field_flags,        0),
 
458
         STRUCT_FLD(old_name,           ""),
 
459
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
460
 
 
461
#define IDX_LOCK_MODE           2
 
462
        {STRUCT_FLD(field_name,         "lock_mode"),
 
463
         /* S[,GAP] X[,GAP] IS[,GAP] IX[,GAP] AUTO_INC UNKNOWN */
 
464
         STRUCT_FLD(field_length,       32),
 
465
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
466
         STRUCT_FLD(value,              0),
 
467
         STRUCT_FLD(field_flags,        0),
 
468
         STRUCT_FLD(old_name,           ""),
 
469
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
470
 
 
471
#define IDX_LOCK_TYPE           3
 
472
        {STRUCT_FLD(field_name,         "lock_type"),
 
473
         STRUCT_FLD(field_length,       32 /* RECORD|TABLE|UNKNOWN */),
 
474
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
475
         STRUCT_FLD(value,              0),
 
476
         STRUCT_FLD(field_flags,        0),
 
477
         STRUCT_FLD(old_name,           ""),
 
478
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
479
 
 
480
#define IDX_LOCK_TABLE          4
 
481
        {STRUCT_FLD(field_name,         "lock_table"),
 
482
         STRUCT_FLD(field_length,       1024),
 
483
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
484
         STRUCT_FLD(value,              0),
 
485
         STRUCT_FLD(field_flags,        0),
 
486
         STRUCT_FLD(old_name,           ""),
 
487
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
488
 
 
489
#define IDX_LOCK_INDEX          5
 
490
        {STRUCT_FLD(field_name,         "lock_index"),
 
491
         STRUCT_FLD(field_length,       1024),
 
492
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
493
         STRUCT_FLD(value,              0),
 
494
         STRUCT_FLD(field_flags,        MY_I_S_MAYBE_NULL),
 
495
         STRUCT_FLD(old_name,           ""),
 
496
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
497
 
 
498
#define IDX_LOCK_SPACE          6
 
499
        {STRUCT_FLD(field_name,         "lock_space"),
 
500
         STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
 
501
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
 
502
         STRUCT_FLD(value,              0),
 
503
         STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
 
504
         STRUCT_FLD(old_name,           ""),
 
505
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
506
 
 
507
#define IDX_LOCK_PAGE           7
 
508
        {STRUCT_FLD(field_name,         "lock_page"),
 
509
         STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
 
510
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
 
511
         STRUCT_FLD(value,              0),
 
512
         STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
 
513
         STRUCT_FLD(old_name,           ""),
 
514
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
515
 
 
516
#define IDX_LOCK_REC            8
 
517
        {STRUCT_FLD(field_name,         "lock_rec"),
 
518
         STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
 
519
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
 
520
         STRUCT_FLD(value,              0),
 
521
         STRUCT_FLD(field_flags,        MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
 
522
         STRUCT_FLD(old_name,           ""),
 
523
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
524
 
 
525
#define IDX_LOCK_DATA           9
 
526
        {STRUCT_FLD(field_name,         "lock_data"),
 
527
         STRUCT_FLD(field_length,       TRX_I_S_LOCK_DATA_MAX_LEN),
 
528
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
529
         STRUCT_FLD(value,              0),
 
530
         STRUCT_FLD(field_flags,        MY_I_S_MAYBE_NULL),
 
531
         STRUCT_FLD(old_name,           ""),
 
532
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
533
 
 
534
        END_OF_ST_FIELD_INFO
 
535
};
 
536
 
 
537
/***********************************************************************
 
538
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_locks
 
539
table with it. */
 
540
static
 
541
int
 
542
fill_innodb_locks_from_cache(
 
543
/*=========================*/
 
544
                                        /* out: 0 on success */
 
545
        trx_i_s_cache_t*        cache,  /* in: cache to read from */
 
546
        THD*                    thd,    /* in: MySQL client connection */
 
547
        TABLE*                  table)  /* in/out: fill this table */
 
548
{
 
549
        Field** fields;
 
550
        ulint   rows_num;
 
551
        char    lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
 
552
        ulint   i;
 
553
 
 
554
        DBUG_ENTER("fill_innodb_locks_from_cache");
 
555
 
 
556
        fields = table->field;
 
557
 
 
558
        rows_num = trx_i_s_cache_get_rows_used(cache,
 
559
                                               I_S_INNODB_LOCKS);
 
560
 
 
561
        for (i = 0; i < rows_num; i++) {
 
562
 
 
563
                i_s_locks_row_t*        row;
 
564
 
 
565
                /* note that the decoded database or table name is
 
566
                never expected to be longer than NAME_LEN;
 
567
                NAME_LEN for database name
 
568
                2 for surrounding quotes around database name
 
569
                NAME_LEN for table name
 
570
                2 for surrounding quotes around table name
 
571
                1 for the separating dot (.)
 
572
                9 for the #mysql50# prefix */
 
573
                char                    buf[2 * NAME_LEN + 14];
 
574
                const char*             bufend;
 
575
 
 
576
                char                    lock_trx_id[TRX_ID_MAX_LEN + 1];
 
577
 
 
578
                row = (i_s_locks_row_t*)
 
579
                        trx_i_s_cache_get_nth_row(
 
580
                                cache, I_S_INNODB_LOCKS, i);
 
581
 
 
582
                /* lock_id */
 
583
                trx_i_s_create_lock_id(row, lock_id, sizeof(lock_id));
 
584
                OK(field_store_string(fields[IDX_LOCK_ID],
 
585
                                      lock_id));
 
586
 
 
587
                /* lock_trx_id */
 
588
                ut_snprintf(lock_trx_id, sizeof(lock_trx_id),
 
589
                            TRX_ID_FMT, row->lock_trx_id);
 
590
                OK(field_store_string(fields[IDX_LOCK_TRX_ID], lock_trx_id));
 
591
 
 
592
                /* lock_mode */
 
593
                OK(field_store_string(fields[IDX_LOCK_MODE],
 
594
                                      row->lock_mode));
 
595
 
 
596
                /* lock_type */
 
597
                OK(field_store_string(fields[IDX_LOCK_TYPE],
 
598
                                      row->lock_type));
 
599
 
 
600
                /* lock_table */
 
601
                bufend = innobase_convert_name(buf, sizeof(buf),
 
602
                                               row->lock_table,
 
603
                                               strlen(row->lock_table),
 
604
                                               thd, TRUE);
 
605
                OK(fields[IDX_LOCK_TABLE]->store(buf, bufend - buf,
 
606
                                                 system_charset_info));
 
607
 
 
608
                /* lock_index */
 
609
                if (row->lock_index != NULL) {
 
610
 
 
611
                        bufend = innobase_convert_name(buf, sizeof(buf),
 
612
                                                       row->lock_index,
 
613
                                                       strlen(row->lock_index),
 
614
                                                       thd, FALSE);
 
615
                        OK(fields[IDX_LOCK_INDEX]->store(buf, bufend - buf,
 
616
                                                         system_charset_info));
 
617
                        fields[IDX_LOCK_INDEX]->set_notnull();
 
618
                } else {
 
619
 
 
620
                        fields[IDX_LOCK_INDEX]->set_null();
 
621
                }
 
622
 
 
623
                /* lock_space */
 
624
                OK(field_store_ulint(fields[IDX_LOCK_SPACE],
 
625
                                     row->lock_space));
 
626
 
 
627
                /* lock_page */
 
628
                OK(field_store_ulint(fields[IDX_LOCK_PAGE],
 
629
                                     row->lock_page));
 
630
 
 
631
                /* lock_rec */
 
632
                OK(field_store_ulint(fields[IDX_LOCK_REC],
 
633
                                     row->lock_rec));
 
634
 
 
635
                /* lock_data */
 
636
                OK(field_store_string(fields[IDX_LOCK_DATA],
 
637
                                      row->lock_data));
 
638
 
 
639
                OK(schema_table_store_record(thd, table));
 
640
        }
 
641
 
 
642
        DBUG_RETURN(0);
 
643
}
 
644
 
 
645
/***********************************************************************
 
646
Bind the dynamic table INFORMATION_SCHEMA.innodb_locks */
 
647
static
 
648
int
 
649
innodb_locks_init(
 
650
/*==============*/
 
651
                        /* out: 0 on success */
 
652
        void*   p)      /* in/out: table schema object */
 
653
{
 
654
        ST_SCHEMA_TABLE*        schema;
 
655
 
 
656
        DBUG_ENTER("innodb_locks_init");
 
657
 
 
658
        schema = (ST_SCHEMA_TABLE*) p;
 
659
 
 
660
        schema->fields_info = innodb_locks_fields_info;
 
661
        schema->fill_table = trx_i_s_common_fill_table;
 
662
 
 
663
        DBUG_RETURN(0);
 
664
}
 
665
 
 
666
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_locks =
 
667
{
 
668
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
 
669
        /* int */
 
670
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
 
671
 
 
672
        /* pointer to type-specific plugin descriptor */
 
673
        /* void* */
 
674
        STRUCT_FLD(info, &i_s_info),
 
675
 
 
676
        /* plugin name */
 
677
        /* const char* */
 
678
        STRUCT_FLD(name, "INNODB_LOCKS"),
 
679
 
 
680
        /* plugin author (for SHOW PLUGINS) */
 
681
        /* const char* */
 
682
        STRUCT_FLD(author, plugin_author),
 
683
 
 
684
        /* general descriptive text (for SHOW PLUGINS) */
 
685
        /* const char* */
 
686
        STRUCT_FLD(descr, "InnoDB conflicting locks"),
 
687
 
 
688
        /* the plugin license (PLUGIN_LICENSE_XXX) */
 
689
        /* int */
 
690
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
 
691
 
 
692
        /* the function to invoke when plugin is loaded */
 
693
        /* int (*)(void*); */
 
694
        STRUCT_FLD(init, innodb_locks_init),
 
695
 
 
696
        /* the function to invoke when plugin is unloaded */
 
697
        /* int (*)(void*); */
 
698
        STRUCT_FLD(deinit, i_s_common_deinit),
 
699
 
 
700
        /* plugin version (for SHOW PLUGINS) */
 
701
        /* unsigned int */
 
702
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
 
703
 
 
704
        /* struct st_mysql_show_var* */
 
705
        STRUCT_FLD(status_vars, NULL),
 
706
 
 
707
        /* struct st_mysql_sys_var** */
 
708
        STRUCT_FLD(system_vars, NULL),
 
709
 
 
710
        /* reserved for dependency checking */
 
711
        /* void* */
 
712
        STRUCT_FLD(__reserved1, NULL)
 
713
};
 
714
 
 
715
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
 
716
static ST_FIELD_INFO    innodb_lock_waits_fields_info[] =
 
717
{
 
718
#define IDX_REQUESTING_TRX_ID   0
 
719
        {STRUCT_FLD(field_name,         "requesting_trx_id"),
 
720
         STRUCT_FLD(field_length,       TRX_ID_MAX_LEN + 1),
 
721
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
722
         STRUCT_FLD(value,              0),
 
723
         STRUCT_FLD(field_flags,        0),
 
724
         STRUCT_FLD(old_name,           ""),
 
725
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
726
 
 
727
#define IDX_REQUESTED_LOCK_ID   1
 
728
        {STRUCT_FLD(field_name,         "requested_lock_id"),
 
729
         STRUCT_FLD(field_length,       TRX_I_S_LOCK_ID_MAX_LEN + 1),
 
730
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
731
         STRUCT_FLD(value,              0),
 
732
         STRUCT_FLD(field_flags,        0),
 
733
         STRUCT_FLD(old_name,           ""),
 
734
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
735
 
 
736
#define IDX_BLOCKING_TRX_ID     2
 
737
        {STRUCT_FLD(field_name,         "blocking_trx_id"),
 
738
         STRUCT_FLD(field_length,       TRX_ID_MAX_LEN + 1),
 
739
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
740
         STRUCT_FLD(value,              0),
 
741
         STRUCT_FLD(field_flags,        0),
 
742
         STRUCT_FLD(old_name,           ""),
 
743
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
744
 
 
745
#define IDX_BLOCKING_LOCK_ID    3
 
746
        {STRUCT_FLD(field_name,         "blocking_lock_id"),
 
747
         STRUCT_FLD(field_length,       TRX_I_S_LOCK_ID_MAX_LEN + 1),
 
748
         STRUCT_FLD(field_type,         MYSQL_TYPE_STRING),
 
749
         STRUCT_FLD(value,              0),
 
750
         STRUCT_FLD(field_flags,        0),
 
751
         STRUCT_FLD(old_name,           ""),
 
752
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
753
 
 
754
        END_OF_ST_FIELD_INFO
 
755
};
 
756
 
 
757
/***********************************************************************
 
758
Read data from cache buffer and fill the
 
759
INFORMATION_SCHEMA.innodb_lock_waits table with it. */
 
760
static
 
761
int
 
762
fill_innodb_lock_waits_from_cache(
 
763
/*==============================*/
 
764
                                        /* out: 0 on success */
 
765
        trx_i_s_cache_t*        cache,  /* in: cache to read from */
 
766
        THD*                    thd,    /* in: used to call
 
767
                                        schema_table_store_record() */
 
768
        TABLE*                  table)  /* in/out: fill this table */
 
769
{
 
770
        Field** fields;
 
771
        ulint   rows_num;
 
772
        char    requested_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
 
773
        char    blocking_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
 
774
        ulint   i;
 
775
 
 
776
        DBUG_ENTER("fill_innodb_lock_waits_from_cache");
 
777
 
 
778
        fields = table->field;
 
779
 
 
780
        rows_num = trx_i_s_cache_get_rows_used(cache,
 
781
                                               I_S_INNODB_LOCK_WAITS);
 
782
 
 
783
        for (i = 0; i < rows_num; i++) {
 
784
 
 
785
                i_s_lock_waits_row_t*   row;
 
786
 
 
787
                char    requesting_trx_id[TRX_ID_MAX_LEN + 1];
 
788
                char    blocking_trx_id[TRX_ID_MAX_LEN + 1];
 
789
 
 
790
                row = (i_s_lock_waits_row_t*)
 
791
                        trx_i_s_cache_get_nth_row(
 
792
                                cache, I_S_INNODB_LOCK_WAITS, i);
 
793
 
 
794
                /* requesting_trx_id */
 
795
                ut_snprintf(requesting_trx_id, sizeof(requesting_trx_id),
 
796
                            TRX_ID_FMT, row->requested_lock_row->lock_trx_id);
 
797
                OK(field_store_string(fields[IDX_REQUESTING_TRX_ID],
 
798
                                      requesting_trx_id));
 
799
 
 
800
                /* requested_lock_id */
 
801
                OK(field_store_string(
 
802
                           fields[IDX_REQUESTED_LOCK_ID],
 
803
                           trx_i_s_create_lock_id(
 
804
                                   row->requested_lock_row,
 
805
                                   requested_lock_id,
 
806
                                   sizeof(requested_lock_id))));
 
807
 
 
808
                /* blocking_trx_id */
 
809
                ut_snprintf(blocking_trx_id, sizeof(blocking_trx_id),
 
810
                            TRX_ID_FMT, row->blocking_lock_row->lock_trx_id);
 
811
                OK(field_store_string(fields[IDX_BLOCKING_TRX_ID],
 
812
                                      blocking_trx_id));
 
813
 
 
814
                /* blocking_lock_id */
 
815
                OK(field_store_string(
 
816
                           fields[IDX_BLOCKING_LOCK_ID],
 
817
                           trx_i_s_create_lock_id(
 
818
                                   row->blocking_lock_row,
 
819
                                   blocking_lock_id,
 
820
                                   sizeof(blocking_lock_id))));
 
821
 
 
822
                OK(schema_table_store_record(thd, table));
 
823
        }
 
824
 
 
825
        DBUG_RETURN(0);
 
826
}
 
827
 
 
828
/***********************************************************************
 
829
Bind the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
 
830
static
 
831
int
 
832
innodb_lock_waits_init(
 
833
/*===================*/
 
834
                        /* out: 0 on success */
 
835
        void*   p)      /* in/out: table schema object */
 
836
{
 
837
        ST_SCHEMA_TABLE*        schema;
 
838
 
 
839
        DBUG_ENTER("innodb_lock_waits_init");
 
840
 
 
841
        schema = (ST_SCHEMA_TABLE*) p;
 
842
 
 
843
        schema->fields_info = innodb_lock_waits_fields_info;
 
844
        schema->fill_table = trx_i_s_common_fill_table;
 
845
 
 
846
        DBUG_RETURN(0);
 
847
}
 
848
 
 
849
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_lock_waits =
 
850
{
 
851
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
 
852
        /* int */
 
853
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
 
854
 
 
855
        /* pointer to type-specific plugin descriptor */
 
856
        /* void* */
 
857
        STRUCT_FLD(info, &i_s_info),
 
858
 
 
859
        /* plugin name */
 
860
        /* const char* */
 
861
        STRUCT_FLD(name, "INNODB_LOCK_WAITS"),
 
862
 
 
863
        /* plugin author (for SHOW PLUGINS) */
 
864
        /* const char* */
 
865
        STRUCT_FLD(author, "Innobase Oy"),
 
866
 
 
867
        /* general descriptive text (for SHOW PLUGINS) */
 
868
        /* const char* */
 
869
        STRUCT_FLD(descr, "InnoDB which lock is blocking which"),
 
870
 
 
871
        /* the plugin license (PLUGIN_LICENSE_XXX) */
 
872
        /* int */
 
873
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
 
874
 
 
875
        /* the function to invoke when plugin is loaded */
 
876
        /* int (*)(void*); */
 
877
        STRUCT_FLD(init, innodb_lock_waits_init),
 
878
 
 
879
        /* the function to invoke when plugin is unloaded */
 
880
        /* int (*)(void*); */
 
881
        STRUCT_FLD(deinit, i_s_common_deinit),
 
882
 
 
883
        /* plugin version (for SHOW PLUGINS) */
 
884
        /* unsigned int */
 
885
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
 
886
 
 
887
        /* struct st_mysql_show_var* */
 
888
        STRUCT_FLD(status_vars, NULL),
 
889
 
 
890
        /* struct st_mysql_sys_var** */
 
891
        STRUCT_FLD(system_vars, NULL),
 
892
 
 
893
        /* reserved for dependency checking */
 
894
        /* void* */
 
895
        STRUCT_FLD(__reserved1, NULL)
 
896
};
 
897
 
 
898
/***********************************************************************
 
899
Common function to fill any of the dynamic tables:
 
900
INFORMATION_SCHEMA.innodb_trx
 
901
INFORMATION_SCHEMA.innodb_locks
 
902
INFORMATION_SCHEMA.innodb_lock_waits */
 
903
static
 
904
int
 
905
trx_i_s_common_fill_table(
 
906
/*======================*/
 
907
                                /* out: 0 on success */
 
908
        THD*            thd,    /* in: thread */
 
909
        TABLE_LIST*     tables, /* in/out: tables to fill */
 
910
        COND*           cond)   /* in: condition (not used) */
 
911
{
 
912
        const char*             table_name;
 
913
        int                     ret;
 
914
        trx_i_s_cache_t*        cache;
 
915
 
 
916
        DBUG_ENTER("trx_i_s_common_fill_table");
 
917
 
 
918
        /* deny access to non-superusers */
 
919
        if (check_global_access(thd, PROCESS_ACL)) {
 
920
 
 
921
                DBUG_RETURN(0);
 
922
        }
 
923
 
 
924
        /* minimize the number of places where global variables are
 
925
        referenced */
 
926
        cache = trx_i_s_cache;
 
927
 
 
928
        /* which table we have to fill? */
 
929
        table_name = tables->schema_table_name;
 
930
        /* or table_name = tables->schema_table->table_name; */
 
931
 
 
932
        RETURN_IF_INNODB_NOT_STARTED(table_name);
 
933
 
 
934
        /* update the cache */
 
935
        trx_i_s_cache_start_write(cache);
 
936
        trx_i_s_possibly_fetch_data_into_cache(cache);
 
937
        trx_i_s_cache_end_write(cache);
 
938
 
 
939
        if (trx_i_s_cache_is_truncated(cache)) {
 
940
 
 
941
                /* XXX show warning to user if possible */
 
942
                fprintf(stderr, "Warning: data in %s truncated due to "
 
943
                        "memory limit of %d bytes\n", table_name,
 
944
                        TRX_I_S_MEM_LIMIT);
 
945
        }
 
946
 
 
947
        ret = 0;
 
948
 
 
949
        trx_i_s_cache_start_read(cache);
 
950
 
 
951
        if (innobase_strcasecmp(table_name, "innodb_trx") == 0) {
 
952
 
 
953
                if (fill_innodb_trx_from_cache(
 
954
                        cache, thd, tables->table) != 0) {
 
955
 
 
956
                        ret = 1;
 
957
                }
 
958
 
 
959
        } else if (innobase_strcasecmp(table_name, "innodb_locks") == 0) {
 
960
 
 
961
                if (fill_innodb_locks_from_cache(
 
962
                        cache, thd, tables->table) != 0) {
 
963
 
 
964
                        ret = 1;
 
965
                }
 
966
 
 
967
        } else if (innobase_strcasecmp(table_name, "innodb_lock_waits") == 0) {
 
968
 
 
969
                if (fill_innodb_lock_waits_from_cache(
 
970
                        cache, thd, tables->table) != 0) {
 
971
 
 
972
                        ret = 1;
 
973
                }
 
974
 
 
975
        } else {
 
976
 
 
977
                /* huh! what happened!? */
 
978
                fprintf(stderr,
 
979
                        "InnoDB: trx_i_s_common_fill_table() was "
 
980
                        "called to fill unknown table: %s.\n"
 
981
                        "This function only knows how to fill "
 
982
                        "innodb_trx, innodb_locks and "
 
983
                        "innodb_lock_waits tables.\n", table_name);
 
984
 
 
985
                ret = 1;
 
986
        }
 
987
 
 
988
        trx_i_s_cache_end_read(cache);
 
989
 
 
990
#if 0
 
991
        DBUG_RETURN(ret);
 
992
#else
 
993
        /* if this function returns something else than 0 then a
 
994
        deadlock occurs between the mysqld server and mysql client,
 
995
        see http://bugs.mysql.com/29900 ; when that bug is resolved
 
996
        we can enable the DBUG_RETURN(ret) above */
 
997
        DBUG_RETURN(0);
 
998
#endif
 
999
}
 
1000
 
 
1001
/* Fields of the dynamic table information_schema.innodb_cmp. */
 
1002
static ST_FIELD_INFO    i_s_cmp_fields_info[] =
 
1003
{
 
1004
        {STRUCT_FLD(field_name,         "page_size"),
 
1005
         STRUCT_FLD(field_length,       5),
 
1006
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONG),
 
1007
         STRUCT_FLD(value,              0),
 
1008
         STRUCT_FLD(field_flags,        0),
 
1009
         STRUCT_FLD(old_name,           "Compressed Page Size"),
 
1010
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1011
 
 
1012
        {STRUCT_FLD(field_name,         "compress_ops"),
 
1013
         STRUCT_FLD(field_length,       MY_INT32_NUM_DECIMAL_DIGITS),
 
1014
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONG),
 
1015
         STRUCT_FLD(value,              0),
 
1016
         STRUCT_FLD(field_flags,        0),
 
1017
         STRUCT_FLD(old_name,           "Total Number of Compressions"),
 
1018
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1019
 
 
1020
        {STRUCT_FLD(field_name,         "compress_ops_ok"),
 
1021
         STRUCT_FLD(field_length,       MY_INT32_NUM_DECIMAL_DIGITS),
 
1022
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONG),
 
1023
         STRUCT_FLD(value,              0),
 
1024
         STRUCT_FLD(field_flags,        0),
 
1025
         STRUCT_FLD(old_name,           "Total Number of"
 
1026
                                        " Successful Compressions"),
 
1027
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1028
 
 
1029
        {STRUCT_FLD(field_name,         "compress_time"),
 
1030
         STRUCT_FLD(field_length,       MY_INT32_NUM_DECIMAL_DIGITS),
 
1031
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONG),
 
1032
         STRUCT_FLD(value,              0),
 
1033
         STRUCT_FLD(field_flags,        0),
 
1034
         STRUCT_FLD(old_name,           "Total Duration of Compressions,"
 
1035
                    " in Seconds"),
 
1036
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1037
 
 
1038
        {STRUCT_FLD(field_name,         "uncompress_ops"),
 
1039
         STRUCT_FLD(field_length,       MY_INT32_NUM_DECIMAL_DIGITS),
 
1040
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONG),
 
1041
         STRUCT_FLD(value,              0),
 
1042
         STRUCT_FLD(field_flags,        0),
 
1043
         STRUCT_FLD(old_name,           "Total Number of Decompressions"),
 
1044
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1045
 
 
1046
        {STRUCT_FLD(field_name,         "uncompress_time"),
 
1047
         STRUCT_FLD(field_length,       MY_INT32_NUM_DECIMAL_DIGITS),
 
1048
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONG),
 
1049
         STRUCT_FLD(value,              0),
 
1050
         STRUCT_FLD(field_flags,        0),
 
1051
         STRUCT_FLD(old_name,           "Total Duration of Decompressions,"
 
1052
                    " in Seconds"),
 
1053
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1054
 
 
1055
        END_OF_ST_FIELD_INFO
 
1056
};
 
1057
 
 
1058
 
 
1059
/***********************************************************************
 
1060
Fill the dynamic table information_schema.innodb_cmp or
 
1061
innodb_cmp_reset. */
 
1062
static
 
1063
int
 
1064
i_s_cmp_fill_low(
 
1065
/*=============*/
 
1066
                                /* out: 0 on success, 1 on failure */
 
1067
        THD*            thd,    /* in: thread */
 
1068
        TABLE_LIST*     tables, /* in/out: tables to fill */
 
1069
        COND*           cond,   /* in: condition (ignored) */
 
1070
        ibool           reset)  /* in: TRUE=reset cumulated counts */
 
1071
{
 
1072
        TABLE*  table   = (TABLE *) tables->table;
 
1073
        int     status  = 0;
 
1074
 
 
1075
        DBUG_ENTER("i_s_cmp_fill_low");
 
1076
 
 
1077
        /* deny access to non-superusers */
 
1078
        if (check_global_access(thd, PROCESS_ACL)) {
 
1079
 
 
1080
                DBUG_RETURN(0);
 
1081
        }
 
1082
 
 
1083
        RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
 
1084
 
 
1085
        for (uint i = 0; i < PAGE_ZIP_NUM_SSIZE - 1; i++) {
 
1086
                page_zip_stat_t*        zip_stat = &page_zip_stat[i];
 
1087
 
 
1088
                table->field[0]->store(PAGE_ZIP_MIN_SIZE << i);
 
1089
 
 
1090
                /* The cumulated counts are not protected by any
 
1091
                mutex.  Thus, some operation in page0zip.c could
 
1092
                increment a counter between the time we read it and
 
1093
                clear it.  We could introduce mutex protection, but it
 
1094
                could cause a measureable performance hit in
 
1095
                page0zip.c. */
 
1096
                table->field[1]->store(zip_stat->compressed);
 
1097
                table->field[2]->store(zip_stat->compressed_ok);
 
1098
                table->field[3]->store(
 
1099
                        (ulong) (zip_stat->compressed_usec / 1000000));
 
1100
                table->field[4]->store(zip_stat->decompressed);
 
1101
                table->field[5]->store(
 
1102
                        (ulong) (zip_stat->decompressed_usec / 1000000));
 
1103
 
 
1104
                if (reset) {
 
1105
                        memset(zip_stat, 0, sizeof *zip_stat);
 
1106
                }
 
1107
 
 
1108
                if (schema_table_store_record(thd, table)) {
 
1109
                        status = 1;
 
1110
                        break;
 
1111
                }
 
1112
        }
 
1113
 
 
1114
        DBUG_RETURN(status);
 
1115
}
 
1116
 
 
1117
/***********************************************************************
 
1118
Fill the dynamic table information_schema.innodb_cmp. */
 
1119
static
 
1120
int
 
1121
i_s_cmp_fill(
 
1122
/*=========*/
 
1123
                                /* out: 0 on success, 1 on failure */
 
1124
        THD*            thd,    /* in: thread */
 
1125
        TABLE_LIST*     tables, /* in/out: tables to fill */
 
1126
        COND*           cond)   /* in: condition (ignored) */
 
1127
{
 
1128
        return(i_s_cmp_fill_low(thd, tables, cond, FALSE));
 
1129
}
 
1130
 
 
1131
/***********************************************************************
 
1132
Fill the dynamic table information_schema.innodb_cmp_reset. */
 
1133
static
 
1134
int
 
1135
i_s_cmp_reset_fill(
 
1136
/*===============*/
 
1137
                                /* out: 0 on success, 1 on failure */
 
1138
        THD*            thd,    /* in: thread */
 
1139
        TABLE_LIST*     tables, /* in/out: tables to fill */
 
1140
        COND*           cond)   /* in: condition (ignored) */
 
1141
{
 
1142
        return(i_s_cmp_fill_low(thd, tables, cond, TRUE));
 
1143
}
 
1144
 
 
1145
/***********************************************************************
 
1146
Bind the dynamic table information_schema.innodb_cmp. */
 
1147
static
 
1148
int
 
1149
i_s_cmp_init(
 
1150
/*=========*/
 
1151
                        /* out: 0 on success */
 
1152
        void*   p)      /* in/out: table schema object */
 
1153
{
 
1154
        DBUG_ENTER("i_s_cmp_init");
 
1155
        ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
 
1156
 
 
1157
        schema->fields_info = i_s_cmp_fields_info;
 
1158
        schema->fill_table = i_s_cmp_fill;
 
1159
 
 
1160
        DBUG_RETURN(0);
 
1161
}
 
1162
 
 
1163
/***********************************************************************
 
1164
Bind the dynamic table information_schema.innodb_cmp_reset. */
 
1165
static
 
1166
int
 
1167
i_s_cmp_reset_init(
 
1168
/*===============*/
 
1169
                        /* out: 0 on success */
 
1170
        void*   p)      /* in/out: table schema object */
 
1171
{
 
1172
        DBUG_ENTER("i_s_cmp_reset_init");
 
1173
        ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
 
1174
 
 
1175
        schema->fields_info = i_s_cmp_fields_info;
 
1176
        schema->fill_table = i_s_cmp_reset_fill;
 
1177
 
 
1178
        DBUG_RETURN(0);
 
1179
}
 
1180
 
 
1181
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_cmp =
 
1182
{
 
1183
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
 
1184
        /* int */
 
1185
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
 
1186
 
 
1187
        /* pointer to type-specific plugin descriptor */
 
1188
        /* void* */
 
1189
        STRUCT_FLD(info, &i_s_info),
 
1190
 
 
1191
        /* plugin name */
 
1192
        /* const char* */
 
1193
        STRUCT_FLD(name, "INNODB_CMP"),
 
1194
 
 
1195
        /* plugin author (for SHOW PLUGINS) */
 
1196
        /* const char* */
 
1197
        STRUCT_FLD(author, plugin_author),
 
1198
 
 
1199
        /* general descriptive text (for SHOW PLUGINS) */
 
1200
        /* const char* */
 
1201
        STRUCT_FLD(descr, "Statistics for the InnoDB compression"),
 
1202
 
 
1203
        /* the plugin license (PLUGIN_LICENSE_XXX) */
 
1204
        /* int */
 
1205
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
 
1206
 
 
1207
        /* the function to invoke when plugin is loaded */
 
1208
        /* int (*)(void*); */
 
1209
        STRUCT_FLD(init, i_s_cmp_init),
 
1210
 
 
1211
        /* the function to invoke when plugin is unloaded */
 
1212
        /* int (*)(void*); */
 
1213
        STRUCT_FLD(deinit, i_s_common_deinit),
 
1214
 
 
1215
        /* plugin version (for SHOW PLUGINS) */
 
1216
        /* unsigned int */
 
1217
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
 
1218
 
 
1219
        /* struct st_mysql_show_var* */
 
1220
        STRUCT_FLD(status_vars, NULL),
 
1221
 
 
1222
        /* struct st_mysql_sys_var** */
 
1223
        STRUCT_FLD(system_vars, NULL),
 
1224
 
 
1225
        /* reserved for dependency checking */
 
1226
        /* void* */
 
1227
        STRUCT_FLD(__reserved1, NULL)
 
1228
};
 
1229
 
 
1230
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_cmp_reset =
 
1231
{
 
1232
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
 
1233
        /* int */
 
1234
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
 
1235
 
 
1236
        /* pointer to type-specific plugin descriptor */
 
1237
        /* void* */
 
1238
        STRUCT_FLD(info, &i_s_info),
 
1239
 
 
1240
        /* plugin name */
 
1241
        /* const char* */
 
1242
        STRUCT_FLD(name, "INNODB_CMP_RESET"),
 
1243
 
 
1244
        /* plugin author (for SHOW PLUGINS) */
 
1245
        /* const char* */
 
1246
        STRUCT_FLD(author, plugin_author),
 
1247
 
 
1248
        /* general descriptive text (for SHOW PLUGINS) */
 
1249
        /* const char* */
 
1250
        STRUCT_FLD(descr, "Statistics for the InnoDB compression;"
 
1251
                   " reset cumulated counts"),
 
1252
 
 
1253
        /* the plugin license (PLUGIN_LICENSE_XXX) */
 
1254
        /* int */
 
1255
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
 
1256
 
 
1257
        /* the function to invoke when plugin is loaded */
 
1258
        /* int (*)(void*); */
 
1259
        STRUCT_FLD(init, i_s_cmp_reset_init),
 
1260
 
 
1261
        /* the function to invoke when plugin is unloaded */
 
1262
        /* int (*)(void*); */
 
1263
        STRUCT_FLD(deinit, i_s_common_deinit),
 
1264
 
 
1265
        /* plugin version (for SHOW PLUGINS) */
 
1266
        /* unsigned int */
 
1267
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
 
1268
 
 
1269
        /* struct st_mysql_show_var* */
 
1270
        STRUCT_FLD(status_vars, NULL),
 
1271
 
 
1272
        /* struct st_mysql_sys_var** */
 
1273
        STRUCT_FLD(system_vars, NULL),
 
1274
 
 
1275
        /* reserved for dependency checking */
 
1276
        /* void* */
 
1277
        STRUCT_FLD(__reserved1, NULL)
 
1278
};
 
1279
 
 
1280
/* Fields of the dynamic table information_schema.innodb_cmpmem. */
 
1281
static ST_FIELD_INFO    i_s_cmpmem_fields_info[] =
 
1282
{
 
1283
        {STRUCT_FLD(field_name,         "page_size"),
 
1284
         STRUCT_FLD(field_length,       5),
 
1285
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONG),
 
1286
         STRUCT_FLD(value,              0),
 
1287
         STRUCT_FLD(field_flags,        0),
 
1288
         STRUCT_FLD(old_name,           "Buddy Block Size"),
 
1289
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1290
 
 
1291
        {STRUCT_FLD(field_name,         "pages_used"),
 
1292
         STRUCT_FLD(field_length,       MY_INT32_NUM_DECIMAL_DIGITS),
 
1293
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONG),
 
1294
         STRUCT_FLD(value,              0),
 
1295
         STRUCT_FLD(field_flags,        0),
 
1296
         STRUCT_FLD(old_name,           "Currently in Use"),
 
1297
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1298
 
 
1299
        {STRUCT_FLD(field_name,         "pages_free"),
 
1300
         STRUCT_FLD(field_length,       MY_INT32_NUM_DECIMAL_DIGITS),
 
1301
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONG),
 
1302
         STRUCT_FLD(value,              0),
 
1303
         STRUCT_FLD(field_flags,        0),
 
1304
         STRUCT_FLD(old_name,           "Currently Available"),
 
1305
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1306
 
 
1307
        {STRUCT_FLD(field_name,         "relocation_ops"),
 
1308
         STRUCT_FLD(field_length,       MY_INT64_NUM_DECIMAL_DIGITS),
 
1309
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONGLONG),
 
1310
         STRUCT_FLD(value,              0),
 
1311
         STRUCT_FLD(field_flags,        0),
 
1312
         STRUCT_FLD(old_name,           "Total Number of Relocations"),
 
1313
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1314
 
 
1315
        {STRUCT_FLD(field_name,         "relocation_time"),
 
1316
         STRUCT_FLD(field_length,       MY_INT32_NUM_DECIMAL_DIGITS),
 
1317
         STRUCT_FLD(field_type,         MYSQL_TYPE_LONG),
 
1318
         STRUCT_FLD(value,              0),
 
1319
         STRUCT_FLD(field_flags,        0),
 
1320
         STRUCT_FLD(old_name,           "Total Duration of Relocations,"
 
1321
                    " in Seconds"),
 
1322
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
 
1323
 
 
1324
        END_OF_ST_FIELD_INFO
 
1325
};
 
1326
 
 
1327
/***********************************************************************
 
1328
Fill the dynamic table information_schema.innodb_cmpmem or
 
1329
innodb_cmpmem_reset. */
 
1330
static
 
1331
int
 
1332
i_s_cmpmem_fill_low(
 
1333
/*================*/
 
1334
                                /* out: 0 on success, 1 on failure */
 
1335
        THD*            thd,    /* in: thread */
 
1336
        TABLE_LIST*     tables, /* in/out: tables to fill */
 
1337
        COND*           cond,   /* in: condition (ignored) */
 
1338
        ibool           reset)  /* in: TRUE=reset cumulated counts */
 
1339
{
 
1340
        TABLE*  table   = (TABLE *) tables->table;
 
1341
        int     status  = 0;
 
1342
 
 
1343
        DBUG_ENTER("i_s_cmpmem_fill_low");
 
1344
 
 
1345
        /* deny access to non-superusers */
 
1346
        if (check_global_access(thd, PROCESS_ACL)) {
 
1347
 
 
1348
                DBUG_RETURN(0);
 
1349
        }
 
1350
 
 
1351
        RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
 
1352
 
 
1353
        buf_pool_mutex_enter();
 
1354
 
 
1355
        for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
 
1356
                buf_buddy_stat_t*       buddy_stat = &buf_buddy_stat[x];
 
1357
 
 
1358
                table->field[0]->store(BUF_BUDDY_LOW << x);
 
1359
                table->field[1]->store(buddy_stat->used);
 
1360
                table->field[2]->store(UNIV_LIKELY(x < BUF_BUDDY_SIZES)
 
1361
                                       ? UT_LIST_GET_LEN(buf_pool->zip_free[x])
 
1362
                                       : 0);
 
1363
                table->field[3]->store((longlong) buddy_stat->relocated, true);
 
1364
                table->field[4]->store(
 
1365
                        (ulong) (buddy_stat->relocated_usec / 1000000));
 
1366
 
 
1367
                if (reset) {
 
1368
                        /* This is protected by buf_pool_mutex. */
 
1369
                        buddy_stat->relocated = 0;
 
1370
                        buddy_stat->relocated_usec = 0;
 
1371
                }
 
1372
 
 
1373
                if (schema_table_store_record(thd, table)) {
 
1374
                        status = 1;
 
1375
                        break;
 
1376
                }
 
1377
        }
 
1378
 
 
1379
        buf_pool_mutex_exit();
 
1380
        DBUG_RETURN(status);
 
1381
}
 
1382
 
 
1383
/***********************************************************************
 
1384
Fill the dynamic table information_schema.innodb_cmpmem. */
 
1385
static
 
1386
int
 
1387
i_s_cmpmem_fill(
 
1388
/*============*/
 
1389
                                /* out: 0 on success, 1 on failure */
 
1390
        THD*            thd,    /* in: thread */
 
1391
        TABLE_LIST*     tables, /* in/out: tables to fill */
 
1392
        COND*           cond)   /* in: condition (ignored) */
 
1393
{
 
1394
        return(i_s_cmpmem_fill_low(thd, tables, cond, FALSE));
 
1395
}
 
1396
 
 
1397
/***********************************************************************
 
1398
Fill the dynamic table information_schema.innodb_cmpmem_reset. */
 
1399
static
 
1400
int
 
1401
i_s_cmpmem_reset_fill(
 
1402
/*==================*/
 
1403
                                /* out: 0 on success, 1 on failure */
 
1404
        THD*            thd,    /* in: thread */
 
1405
        TABLE_LIST*     tables, /* in/out: tables to fill */
 
1406
        COND*           cond)   /* in: condition (ignored) */
 
1407
{
 
1408
        return(i_s_cmpmem_fill_low(thd, tables, cond, TRUE));
 
1409
}
 
1410
 
 
1411
/***********************************************************************
 
1412
Bind the dynamic table information_schema.innodb_cmpmem. */
 
1413
static
 
1414
int
 
1415
i_s_cmpmem_init(
 
1416
/*============*/
 
1417
                        /* out: 0 on success */
 
1418
        void*   p)      /* in/out: table schema object */
 
1419
{
 
1420
        DBUG_ENTER("i_s_cmpmem_init");
 
1421
        ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
 
1422
 
 
1423
        schema->fields_info = i_s_cmpmem_fields_info;
 
1424
        schema->fill_table = i_s_cmpmem_fill;
 
1425
 
 
1426
        DBUG_RETURN(0);
 
1427
}
 
1428
 
 
1429
/***********************************************************************
 
1430
Bind the dynamic table information_schema.innodb_cmpmem_reset. */
 
1431
static
 
1432
int
 
1433
i_s_cmpmem_reset_init(
 
1434
/*==================*/
 
1435
                        /* out: 0 on success */
 
1436
        void*   p)      /* in/out: table schema object */
 
1437
{
 
1438
        DBUG_ENTER("i_s_cmpmem_reset_init");
 
1439
        ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
 
1440
 
 
1441
        schema->fields_info = i_s_cmpmem_fields_info;
 
1442
        schema->fill_table = i_s_cmpmem_reset_fill;
 
1443
 
 
1444
        DBUG_RETURN(0);
 
1445
}
 
1446
 
 
1447
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_cmpmem =
 
1448
{
 
1449
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
 
1450
        /* int */
 
1451
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
 
1452
 
 
1453
        /* pointer to type-specific plugin descriptor */
 
1454
        /* void* */
 
1455
        STRUCT_FLD(info, &i_s_info),
 
1456
 
 
1457
        /* plugin name */
 
1458
        /* const char* */
 
1459
        STRUCT_FLD(name, "INNODB_CMPMEM"),
 
1460
 
 
1461
        /* plugin author (for SHOW PLUGINS) */
 
1462
        /* const char* */
 
1463
        STRUCT_FLD(author, plugin_author),
 
1464
 
 
1465
        /* general descriptive text (for SHOW PLUGINS) */
 
1466
        /* const char* */
 
1467
        STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool"),
 
1468
 
 
1469
        /* the plugin license (PLUGIN_LICENSE_XXX) */
 
1470
        /* int */
 
1471
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
 
1472
 
 
1473
        /* the function to invoke when plugin is loaded */
 
1474
        /* int (*)(void*); */
 
1475
        STRUCT_FLD(init, i_s_cmpmem_init),
 
1476
 
 
1477
        /* the function to invoke when plugin is unloaded */
 
1478
        /* int (*)(void*); */
 
1479
        STRUCT_FLD(deinit, i_s_common_deinit),
 
1480
 
 
1481
        /* plugin version (for SHOW PLUGINS) */
 
1482
        /* unsigned int */
 
1483
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
 
1484
 
 
1485
        /* struct st_mysql_show_var* */
 
1486
        STRUCT_FLD(status_vars, NULL),
 
1487
 
 
1488
        /* struct st_mysql_sys_var** */
 
1489
        STRUCT_FLD(system_vars, NULL),
 
1490
 
 
1491
        /* reserved for dependency checking */
 
1492
        /* void* */
 
1493
        STRUCT_FLD(__reserved1, NULL)
 
1494
};
 
1495
 
 
1496
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_cmpmem_reset =
 
1497
{
 
1498
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
 
1499
        /* int */
 
1500
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
 
1501
 
 
1502
        /* pointer to type-specific plugin descriptor */
 
1503
        /* void* */
 
1504
        STRUCT_FLD(info, &i_s_info),
 
1505
 
 
1506
        /* plugin name */
 
1507
        /* const char* */
 
1508
        STRUCT_FLD(name, "INNODB_CMPMEM_RESET"),
 
1509
 
 
1510
        /* plugin author (for SHOW PLUGINS) */
 
1511
        /* const char* */
 
1512
        STRUCT_FLD(author, plugin_author),
 
1513
 
 
1514
        /* general descriptive text (for SHOW PLUGINS) */
 
1515
        /* const char* */
 
1516
        STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool;"
 
1517
                   " reset cumulated counts"),
 
1518
 
 
1519
        /* the plugin license (PLUGIN_LICENSE_XXX) */
 
1520
        /* int */
 
1521
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
 
1522
 
 
1523
        /* the function to invoke when plugin is loaded */
 
1524
        /* int (*)(void*); */
 
1525
        STRUCT_FLD(init, i_s_cmpmem_reset_init),
 
1526
 
 
1527
        /* the function to invoke when plugin is unloaded */
 
1528
        /* int (*)(void*); */
 
1529
        STRUCT_FLD(deinit, i_s_common_deinit),
 
1530
 
 
1531
        /* plugin version (for SHOW PLUGINS) */
 
1532
        /* unsigned int */
 
1533
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
 
1534
 
 
1535
        /* struct st_mysql_show_var* */
 
1536
        STRUCT_FLD(status_vars, NULL),
 
1537
 
 
1538
        /* struct st_mysql_sys_var** */
 
1539
        STRUCT_FLD(system_vars, NULL),
 
1540
 
 
1541
        /* reserved for dependency checking */
 
1542
        /* void* */
 
1543
        STRUCT_FLD(__reserved1, NULL)
 
1544
};
 
1545
 
 
1546
/***********************************************************************
 
1547
Unbind a dynamic INFORMATION_SCHEMA table. */
 
1548
static
 
1549
int
 
1550
i_s_common_deinit(
 
1551
/*==============*/
 
1552
                        /* out: 0 on success */
 
1553
        void*   p)      /* in/out: table schema object */
 
1554
{
 
1555
        DBUG_ENTER("i_s_common_deinit");
 
1556
 
 
1557
        /* Do nothing */
 
1558
 
 
1559
        DBUG_RETURN(0);
 
1560
}