~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Brian Aker
  • Date: 2009-03-22 21:27:04 UTC
  • mfrom: (960.2.22 mordred)
  • Revision ID: brian@tangent.org-20090322212704-ysn4mkkjg2u9kv22
Merge Monty

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
 
#include "drizzled/temporal.h"
21
 
 
22
 
extern "C" {
23
 
#include "trx0i_s.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 */
29
 
}
30
 
#include "handler0vars.h"
31
 
 
32
 
static const char plugin_author[] = "Innobase Oy";
33
 
 
34
 
#define OK(expr)                \
35
 
        if ((expr) != 0) {      \
36
 
                DBUG_RETURN(1); \
37
 
        }
38
 
 
39
 
#define RETURN_IF_INNODB_NOT_STARTED(plugin_name)                       \
40
 
do {                                                                    \
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);   \
48
 
                DBUG_RETURN(0);                                         \
49
 
        }                                                               \
50
 
} while (0)
51
 
 
52
 
#if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && !defined __INTEL_COMPILER
53
 
#define STRUCT_FLD(name, value) name: value
54
 
#else
55
 
#define STRUCT_FLD(name, value) value
56
 
#endif
57
 
 
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),
62
 
         STRUCT_FLD(value,              0),
63
 
         STRUCT_FLD(field_flags,        0),
64
 
         STRUCT_FLD(old_name,           ""),
65
 
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)};
66
 
 
67
 
/*
68
 
Use the following types mapping:
69
 
 
70
 
C type  ST_FIELD_INFO::field_type
71
 
---------------------------------
72
 
long                    MYSQL_TYPE_LONGLONG
73
 
(field_length=MY_INT64_NUM_DECIMAL_DIGITS)
74
 
 
75
 
long unsigned           MYSQL_TYPE_LONGLONG
76
 
(field_length=MY_INT64_NUM_DECIMAL_DIGITS, field_flags=MY_I_S_UNSIGNED)
77
 
 
78
 
char*                   MYSQL_TYPE_STRING
79
 
(field_length=n)
80
 
 
81
 
float                   MYSQL_TYPE_FLOAT
82
 
(field_length=0 is ignored)
83
 
 
84
 
void*                   MYSQL_TYPE_LONGLONG
85
 
(field_length=MY_INT64_NUM_DECIMAL_DIGITS, field_flags=MY_I_S_UNSIGNED)
86
 
 
87
 
boolean (if else)       MYSQL_TYPE_LONG
88
 
(field_length=1)
89
 
 
90
 
time_t                  MYSQL_TYPE_DATETIME
91
 
(field_length=0 ignored)
92
 
---------------------------------
93
 
*/
94
 
 
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);
99
 
 
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 */
105
 
static
106
 
int
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) */
113
 
 
114
 
/***********************************************************************
115
 
Unbind a dynamic INFORMATION_SCHEMA table. */
116
 
static
117
 
int
118
 
i_s_common_deinit(
119
 
/*==============*/
120
 
                        /* out: 0 on success */
121
 
        void*   p);     /* in/out: table schema object */
122
 
 
123
 
/***********************************************************************
124
 
Auxiliary function to store time_t value in MYSQL_TYPE_DATETIME
125
 
field. */
126
 
static
127
 
int
128
 
field_store_time_t(
129
 
/*===============*/
130
 
                        /* out: 0 on success */
131
 
        Field*  field,  /* in/out: target field for storage */
132
 
        time_t  time)   /* in: value to store */
133
 
{
134
 
  drizzled::Timestamp timestamp;
135
 
  (void) timestamp.from_time_t(time);
136
 
  char tmp_string[MAX_DATETIME_WIDTH];
137
 
  size_t tmp_string_length;
138
 
 
139
 
  timestamp.to_string(tmp_string, &tmp_string_length);
140
 
 
141
 
        return(field->store(tmp_string, tmp_string_length, &my_charset_bin));
142
 
}
143
 
 
144
 
/***********************************************************************
145
 
Auxiliary function to store char* value in MYSQL_TYPE_STRING field. */
146
 
static
147
 
int
148
 
field_store_string(
149
 
/*===============*/
150
 
                                /* out: 0 on success */
151
 
        Field*          field,  /* in/out: target field for storage */
152
 
        const char*     str)    /* in: NUL-terminated utf-8 string,
153
 
                                or NULL */
154
 
{
155
 
        int     ret;
156
 
 
157
 
        if (str != NULL) {
158
 
 
159
 
                ret = field->store(str, strlen(str),
160
 
                                   system_charset_info);
161
 
                field->set_notnull();
162
 
        } else {
163
 
 
164
 
                ret = 0; /* success */
165
 
                field->set_null();
166
 
        }
167
 
 
168
 
        return(ret);
169
 
}
170
 
 
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. */
174
 
static
175
 
int
176
 
field_store_ulint(
177
 
/*==============*/
178
 
                        /* out: 0 on success */
179
 
        Field*  field,  /* in/out: target field for storage */
180
 
        ulint   n)      /* in: value to store */
181
 
{
182
 
        int     ret;
183
 
 
184
 
        if (n != ULINT_UNDEFINED) {
185
 
 
186
 
                ret = field->store(n);
187
 
                field->set_notnull();
188
 
        } else {
189
 
 
190
 
                ret = 0; /* success */
191
 
                field->set_null();
192
 
        }
193
 
 
194
 
        return(ret);
195
 
}
196
 
 
197
 
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */
198
 
static ST_FIELD_INFO    innodb_trx_fields_info[] =
199
 
{
200
 
#define IDX_TRX_ID              0
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)},
208
 
 
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)},
217
 
 
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)},
226
 
 
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)},
235
 
 
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)},
244
 
 
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)},
253
 
 
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)},
262
 
 
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)},
271
 
 
272
 
        END_OF_ST_FIELD_INFO
273
 
};
274
 
 
275
 
/***********************************************************************
276
 
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_trx
277
 
table with it. */
278
 
static
279
 
int
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 */
287
 
{
288
 
        Field** fields;
289
 
        ulint   rows_num;
290
 
        char    lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
291
 
        ulint   i;
292
 
 
293
 
        DBUG_ENTER("fill_innodb_trx_from_cache");
294
 
 
295
 
        fields = table->field;
296
 
 
297
 
        rows_num = trx_i_s_cache_get_rows_used(cache,
298
 
                                               I_S_INNODB_TRX);
299
 
 
300
 
        for (i = 0; i < rows_num; i++) {
301
 
 
302
 
                i_s_trx_row_t*  row;
303
 
                char            trx_id[TRX_ID_MAX_LEN + 1];
304
 
 
305
 
                row = (i_s_trx_row_t*)
306
 
                        trx_i_s_cache_get_nth_row(
307
 
                                cache, I_S_INNODB_TRX, i);
308
 
 
309
 
                /* trx_id */
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));
312
 
 
313
 
                /* trx_state */
314
 
                OK(field_store_string(fields[IDX_TRX_STATE],
315
 
                                      row->trx_state));
316
 
 
317
 
                /* trx_started */
318
 
                OK(field_store_time_t(fields[IDX_TRX_STARTED],
319
 
                                      (time_t) row->trx_started));
320
 
 
321
 
                /* trx_requested_lock_id */
322
 
                /* trx_wait_started */
323
 
                if (row->trx_wait_started != 0) {
324
 
 
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 */
331
 
 
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();
336
 
                } else {
337
 
 
338
 
                        fields[IDX_TRX_REQUESTED_LOCK_ID]->set_null();
339
 
                        fields[IDX_TRX_WAIT_STARTED]->set_null();
340
 
                }
341
 
 
342
 
                /* trx_weight */
343
 
                OK(fields[IDX_TRX_WEIGHT]->store((longlong) row->trx_weight,
344
 
                                                 true));
345
 
 
346
 
                /* trx_mysql_thread_id */
347
 
                OK(fields[IDX_TRX_MYSQL_THREAD_ID]->store(
348
 
                           row->trx_mysql_thread_id));
349
 
 
350
 
                /* trx_query */
351
 
                OK(field_store_string(fields[IDX_TRX_QUERY],
352
 
                                      row->trx_query));
353
 
 
354
 
                OK(schema_table_store_record(thd, table));
355
 
        }
356
 
 
357
 
        DBUG_RETURN(0);
358
 
}
359
 
 
360
 
/***********************************************************************
361
 
Bind the dynamic table INFORMATION_SCHEMA.innodb_trx */
362
 
static
363
 
int
364
 
innodb_trx_init(
365
 
/*============*/
366
 
                        /* out: 0 on success */
367
 
        void*   p)      /* in/out: table schema object */
368
 
{
369
 
        ST_SCHEMA_TABLE*        schema;
370
 
 
371
 
        DBUG_ENTER("innodb_trx_init");
372
 
 
373
 
        schema = (ST_SCHEMA_TABLE*) p;
374
 
 
375
 
        schema->fields_info = innodb_trx_fields_info;
376
 
        schema->fill_table = trx_i_s_common_fill_table;
377
 
 
378
 
        DBUG_RETURN(0);
379
 
}
380
 
 
381
 
static struct st_mysql_information_schema       i_s_info =
382
 
{
383
 
        MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
384
 
};
385
 
 
386
 
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_trx =
387
 
{
388
 
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
389
 
        /* int */
390
 
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
391
 
 
392
 
        /* pointer to type-specific plugin descriptor */
393
 
        /* void* */
394
 
        STRUCT_FLD(info, &i_s_info),
395
 
 
396
 
        /* plugin name */
397
 
        /* const char* */
398
 
        STRUCT_FLD(name, "INNODB_TRX"),
399
 
 
400
 
        /* plugin author (for SHOW PLUGINS) */
401
 
        /* const char* */
402
 
        STRUCT_FLD(author, plugin_author),
403
 
 
404
 
        /* general descriptive text (for SHOW PLUGINS) */
405
 
        /* const char* */
406
 
        STRUCT_FLD(descr, "InnoDB transactions"),
407
 
 
408
 
        /* the plugin license (PLUGIN_LICENSE_XXX) */
409
 
        /* int */
410
 
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
411
 
 
412
 
        /* the function to invoke when plugin is loaded */
413
 
        /* int (*)(void*); */
414
 
        STRUCT_FLD(init, innodb_trx_init),
415
 
 
416
 
        /* the function to invoke when plugin is unloaded */
417
 
        /* int (*)(void*); */
418
 
        STRUCT_FLD(deinit, i_s_common_deinit),
419
 
 
420
 
        /* plugin version (for SHOW PLUGINS) */
421
 
        /* unsigned int */
422
 
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
423
 
 
424
 
        /* struct st_mysql_show_var* */
425
 
        STRUCT_FLD(status_vars, NULL),
426
 
 
427
 
        /* struct st_mysql_sys_var** */
428
 
        STRUCT_FLD(system_vars, NULL),
429
 
 
430
 
        /* reserved for dependency checking */
431
 
        /* void* */
432
 
        STRUCT_FLD(__reserved1, NULL)
433
 
};
434
 
 
435
 
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */
436
 
static ST_FIELD_INFO    innodb_locks_fields_info[] =
437
 
{
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)},
446
 
 
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)},
455
 
 
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)},
465
 
 
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)},
474
 
 
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)},
483
 
 
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)},
492
 
 
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)},
501
 
 
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)},
510
 
 
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)},
519
 
 
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)},
528
 
 
529
 
        END_OF_ST_FIELD_INFO
530
 
};
531
 
 
532
 
/***********************************************************************
533
 
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_locks
534
 
table with it. */
535
 
static
536
 
int
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 */
543
 
{
544
 
        Field** fields;
545
 
        ulint   rows_num;
546
 
        char    lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
547
 
        ulint   i;
548
 
 
549
 
        DBUG_ENTER("fill_innodb_locks_from_cache");
550
 
 
551
 
        fields = table->field;
552
 
 
553
 
        rows_num = trx_i_s_cache_get_rows_used(cache,
554
 
                                               I_S_INNODB_LOCKS);
555
 
 
556
 
        for (i = 0; i < rows_num; i++) {
557
 
 
558
 
                i_s_locks_row_t*        row;
559
 
 
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];
569
 
                const char*             bufend;
570
 
 
571
 
                char                    lock_trx_id[TRX_ID_MAX_LEN + 1];
572
 
 
573
 
                row = (i_s_locks_row_t*)
574
 
                        trx_i_s_cache_get_nth_row(
575
 
                                cache, I_S_INNODB_LOCKS, i);
576
 
 
577
 
                /* lock_id */
578
 
                trx_i_s_create_lock_id(row, lock_id, sizeof(lock_id));
579
 
                OK(field_store_string(fields[IDX_LOCK_ID],
580
 
                                      lock_id));
581
 
 
582
 
                /* lock_trx_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));
586
 
 
587
 
                /* lock_mode */
588
 
                OK(field_store_string(fields[IDX_LOCK_MODE],
589
 
                                      row->lock_mode));
590
 
 
591
 
                /* lock_type */
592
 
                OK(field_store_string(fields[IDX_LOCK_TYPE],
593
 
                                      row->lock_type));
594
 
 
595
 
                /* lock_table */
596
 
                bufend = innobase_convert_name(buf, sizeof(buf),
597
 
                                               row->lock_table,
598
 
                                               strlen(row->lock_table),
599
 
                                               thd, TRUE);
600
 
                OK(fields[IDX_LOCK_TABLE]->store(buf, bufend - buf,
601
 
                                                 system_charset_info));
602
 
 
603
 
                /* lock_index */
604
 
                if (row->lock_index != NULL) {
605
 
 
606
 
                        bufend = innobase_convert_name(buf, sizeof(buf),
607
 
                                                       row->lock_index,
608
 
                                                       strlen(row->lock_index),
609
 
                                                       thd, FALSE);
610
 
                        OK(fields[IDX_LOCK_INDEX]->store(buf, bufend - buf,
611
 
                                                         system_charset_info));
612
 
                        fields[IDX_LOCK_INDEX]->set_notnull();
613
 
                } else {
614
 
 
615
 
                        fields[IDX_LOCK_INDEX]->set_null();
616
 
                }
617
 
 
618
 
                /* lock_space */
619
 
                OK(field_store_ulint(fields[IDX_LOCK_SPACE],
620
 
                                     row->lock_space));
621
 
 
622
 
                /* lock_page */
623
 
                OK(field_store_ulint(fields[IDX_LOCK_PAGE],
624
 
                                     row->lock_page));
625
 
 
626
 
                /* lock_rec */
627
 
                OK(field_store_ulint(fields[IDX_LOCK_REC],
628
 
                                     row->lock_rec));
629
 
 
630
 
                /* lock_data */
631
 
                OK(field_store_string(fields[IDX_LOCK_DATA],
632
 
                                      row->lock_data));
633
 
 
634
 
                OK(schema_table_store_record(thd, table));
635
 
        }
636
 
 
637
 
        DBUG_RETURN(0);
638
 
}
639
 
 
640
 
/***********************************************************************
641
 
Bind the dynamic table INFORMATION_SCHEMA.innodb_locks */
642
 
static
643
 
int
644
 
innodb_locks_init(
645
 
/*==============*/
646
 
                        /* out: 0 on success */
647
 
        void*   p)      /* in/out: table schema object */
648
 
{
649
 
        ST_SCHEMA_TABLE*        schema;
650
 
 
651
 
        DBUG_ENTER("innodb_locks_init");
652
 
 
653
 
        schema = (ST_SCHEMA_TABLE*) p;
654
 
 
655
 
        schema->fields_info = innodb_locks_fields_info;
656
 
        schema->fill_table = trx_i_s_common_fill_table;
657
 
 
658
 
        DBUG_RETURN(0);
659
 
}
660
 
 
661
 
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_locks =
662
 
{
663
 
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
664
 
        /* int */
665
 
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
666
 
 
667
 
        /* pointer to type-specific plugin descriptor */
668
 
        /* void* */
669
 
        STRUCT_FLD(info, &i_s_info),
670
 
 
671
 
        /* plugin name */
672
 
        /* const char* */
673
 
        STRUCT_FLD(name, "INNODB_LOCKS"),
674
 
 
675
 
        /* plugin author (for SHOW PLUGINS) */
676
 
        /* const char* */
677
 
        STRUCT_FLD(author, plugin_author),
678
 
 
679
 
        /* general descriptive text (for SHOW PLUGINS) */
680
 
        /* const char* */
681
 
        STRUCT_FLD(descr, "InnoDB conflicting locks"),
682
 
 
683
 
        /* the plugin license (PLUGIN_LICENSE_XXX) */
684
 
        /* int */
685
 
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
686
 
 
687
 
        /* the function to invoke when plugin is loaded */
688
 
        /* int (*)(void*); */
689
 
        STRUCT_FLD(init, innodb_locks_init),
690
 
 
691
 
        /* the function to invoke when plugin is unloaded */
692
 
        /* int (*)(void*); */
693
 
        STRUCT_FLD(deinit, i_s_common_deinit),
694
 
 
695
 
        /* plugin version (for SHOW PLUGINS) */
696
 
        /* unsigned int */
697
 
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
698
 
 
699
 
        /* struct st_mysql_show_var* */
700
 
        STRUCT_FLD(status_vars, NULL),
701
 
 
702
 
        /* struct st_mysql_sys_var** */
703
 
        STRUCT_FLD(system_vars, NULL),
704
 
 
705
 
        /* reserved for dependency checking */
706
 
        /* void* */
707
 
        STRUCT_FLD(__reserved1, NULL)
708
 
};
709
 
 
710
 
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
711
 
static ST_FIELD_INFO    innodb_lock_waits_fields_info[] =
712
 
{
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)},
721
 
 
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)},
730
 
 
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)},
739
 
 
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)},
748
 
 
749
 
        END_OF_ST_FIELD_INFO
750
 
};
751
 
 
752
 
/***********************************************************************
753
 
Read data from cache buffer and fill the
754
 
INFORMATION_SCHEMA.innodb_lock_waits table with it. */
755
 
static
756
 
int
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 */
764
 
{
765
 
        Field** fields;
766
 
        ulint   rows_num;
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];
769
 
        ulint   i;
770
 
 
771
 
        DBUG_ENTER("fill_innodb_lock_waits_from_cache");
772
 
 
773
 
        fields = table->field;
774
 
 
775
 
        rows_num = trx_i_s_cache_get_rows_used(cache,
776
 
                                               I_S_INNODB_LOCK_WAITS);
777
 
 
778
 
        for (i = 0; i < rows_num; i++) {
779
 
 
780
 
                i_s_lock_waits_row_t*   row;
781
 
 
782
 
                char    requesting_trx_id[TRX_ID_MAX_LEN + 1];
783
 
                char    blocking_trx_id[TRX_ID_MAX_LEN + 1];
784
 
 
785
 
                row = (i_s_lock_waits_row_t*)
786
 
                        trx_i_s_cache_get_nth_row(
787
 
                                cache, I_S_INNODB_LOCK_WAITS, i);
788
 
 
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],
793
 
                                      requesting_trx_id));
794
 
 
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,
800
 
                                   requested_lock_id,
801
 
                                   sizeof(requested_lock_id))));
802
 
 
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],
807
 
                                      blocking_trx_id));
808
 
 
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,
814
 
                                   blocking_lock_id,
815
 
                                   sizeof(blocking_lock_id))));
816
 
 
817
 
                OK(schema_table_store_record(thd, table));
818
 
        }
819
 
 
820
 
        DBUG_RETURN(0);
821
 
}
822
 
 
823
 
/***********************************************************************
824
 
Bind the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
825
 
static
826
 
int
827
 
innodb_lock_waits_init(
828
 
/*===================*/
829
 
                        /* out: 0 on success */
830
 
        void*   p)      /* in/out: table schema object */
831
 
{
832
 
        ST_SCHEMA_TABLE*        schema;
833
 
 
834
 
        DBUG_ENTER("innodb_lock_waits_init");
835
 
 
836
 
        schema = (ST_SCHEMA_TABLE*) p;
837
 
 
838
 
        schema->fields_info = innodb_lock_waits_fields_info;
839
 
        schema->fill_table = trx_i_s_common_fill_table;
840
 
 
841
 
        DBUG_RETURN(0);
842
 
}
843
 
 
844
 
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_lock_waits =
845
 
{
846
 
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
847
 
        /* int */
848
 
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
849
 
 
850
 
        /* pointer to type-specific plugin descriptor */
851
 
        /* void* */
852
 
        STRUCT_FLD(info, &i_s_info),
853
 
 
854
 
        /* plugin name */
855
 
        /* const char* */
856
 
        STRUCT_FLD(name, "INNODB_LOCK_WAITS"),
857
 
 
858
 
        /* plugin author (for SHOW PLUGINS) */
859
 
        /* const char* */
860
 
        STRUCT_FLD(author, "Innobase Oy"),
861
 
 
862
 
        /* general descriptive text (for SHOW PLUGINS) */
863
 
        /* const char* */
864
 
        STRUCT_FLD(descr, "InnoDB which lock is blocking which"),
865
 
 
866
 
        /* the plugin license (PLUGIN_LICENSE_XXX) */
867
 
        /* int */
868
 
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
869
 
 
870
 
        /* the function to invoke when plugin is loaded */
871
 
        /* int (*)(void*); */
872
 
        STRUCT_FLD(init, innodb_lock_waits_init),
873
 
 
874
 
        /* the function to invoke when plugin is unloaded */
875
 
        /* int (*)(void*); */
876
 
        STRUCT_FLD(deinit, i_s_common_deinit),
877
 
 
878
 
        /* plugin version (for SHOW PLUGINS) */
879
 
        /* unsigned int */
880
 
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
881
 
 
882
 
        /* struct st_mysql_show_var* */
883
 
        STRUCT_FLD(status_vars, NULL),
884
 
 
885
 
        /* struct st_mysql_sys_var** */
886
 
        STRUCT_FLD(system_vars, NULL),
887
 
 
888
 
        /* reserved for dependency checking */
889
 
        /* void* */
890
 
        STRUCT_FLD(__reserved1, NULL)
891
 
};
892
 
 
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 */
898
 
static
899
 
int
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) */
906
 
{
907
 
        const char*             table_name;
908
 
        int                     ret;
909
 
        trx_i_s_cache_t*        cache;
910
 
 
911
 
        DBUG_ENTER("trx_i_s_common_fill_table");
912
 
 
913
 
        /* deny access to non-superusers */
914
 
        if (check_global_access(thd, PROCESS_ACL)) {
915
 
 
916
 
                DBUG_RETURN(0);
917
 
        }
918
 
 
919
 
        /* minimize the number of places where global variables are
920
 
        referenced */
921
 
        cache = trx_i_s_cache;
922
 
 
923
 
        /* which table we have to fill? */
924
 
        table_name = tables->schema_table_name;
925
 
        /* or table_name = tables->schema_table->table_name; */
926
 
 
927
 
        RETURN_IF_INNODB_NOT_STARTED(table_name);
928
 
 
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);
933
 
 
934
 
        if (trx_i_s_cache_is_truncated(cache)) {
935
 
 
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,
939
 
                        TRX_I_S_MEM_LIMIT);
940
 
        }
941
 
 
942
 
        ret = 0;
943
 
 
944
 
        trx_i_s_cache_start_read(cache);
945
 
 
946
 
        if (innobase_strcasecmp(table_name, "innodb_trx") == 0) {
947
 
 
948
 
                if (fill_innodb_trx_from_cache(
949
 
                        cache, thd, tables->table) != 0) {
950
 
 
951
 
                        ret = 1;
952
 
                }
953
 
 
954
 
        } else if (innobase_strcasecmp(table_name, "innodb_locks") == 0) {
955
 
 
956
 
                if (fill_innodb_locks_from_cache(
957
 
                        cache, thd, tables->table) != 0) {
958
 
 
959
 
                        ret = 1;
960
 
                }
961
 
 
962
 
        } else if (innobase_strcasecmp(table_name, "innodb_lock_waits") == 0) {
963
 
 
964
 
                if (fill_innodb_lock_waits_from_cache(
965
 
                        cache, thd, tables->table) != 0) {
966
 
 
967
 
                        ret = 1;
968
 
                }
969
 
 
970
 
        } else {
971
 
 
972
 
                /* huh! what happened!? */
973
 
                fprintf(stderr,
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);
979
 
 
980
 
                ret = 1;
981
 
        }
982
 
 
983
 
        trx_i_s_cache_end_read(cache);
984
 
 
985
 
#if 0
986
 
        DBUG_RETURN(ret);
987
 
#else
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 */
992
 
        DBUG_RETURN(0);
993
 
#endif
994
 
}
995
 
 
996
 
/* Fields of the dynamic table information_schema.innodb_cmp. */
997
 
static ST_FIELD_INFO    i_s_cmp_fields_info[] =
998
 
{
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)},
1006
 
 
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)},
1014
 
 
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)},
1023
 
 
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,"
1030
 
                    " in Seconds"),
1031
 
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
1032
 
 
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)},
1040
 
 
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,"
1047
 
                    " in Seconds"),
1048
 
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
1049
 
 
1050
 
        END_OF_ST_FIELD_INFO
1051
 
};
1052
 
 
1053
 
 
1054
 
/***********************************************************************
1055
 
Fill the dynamic table information_schema.innodb_cmp or
1056
 
innodb_cmp_reset. */
1057
 
static
1058
 
int
1059
 
i_s_cmp_fill_low(
1060
 
/*=============*/
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 */
1066
 
{
1067
 
        TABLE*  table   = (TABLE *) tables->table;
1068
 
        int     status  = 0;
1069
 
 
1070
 
        DBUG_ENTER("i_s_cmp_fill_low");
1071
 
 
1072
 
        /* deny access to non-superusers */
1073
 
        if (check_global_access(thd, PROCESS_ACL)) {
1074
 
 
1075
 
                DBUG_RETURN(0);
1076
 
        }
1077
 
 
1078
 
        RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
1079
 
 
1080
 
        for (uint i = 0; i < PAGE_ZIP_NUM_SSIZE - 1; i++) {
1081
 
                page_zip_stat_t*        zip_stat = &page_zip_stat[i];
1082
 
 
1083
 
                table->field[0]->store(PAGE_ZIP_MIN_SIZE << i);
1084
 
 
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
1090
 
                page0zip.c. */
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));
1098
 
 
1099
 
                if (reset) {
1100
 
                        memset(zip_stat, 0, sizeof *zip_stat);
1101
 
                }
1102
 
 
1103
 
                if (schema_table_store_record(thd, table)) {
1104
 
                        status = 1;
1105
 
                        break;
1106
 
                }
1107
 
        }
1108
 
 
1109
 
        DBUG_RETURN(status);
1110
 
}
1111
 
 
1112
 
/***********************************************************************
1113
 
Fill the dynamic table information_schema.innodb_cmp. */
1114
 
static
1115
 
int
1116
 
i_s_cmp_fill(
1117
 
/*=========*/
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) */
1122
 
{
1123
 
        return(i_s_cmp_fill_low(thd, tables, cond, FALSE));
1124
 
}
1125
 
 
1126
 
/***********************************************************************
1127
 
Fill the dynamic table information_schema.innodb_cmp_reset. */
1128
 
static
1129
 
int
1130
 
i_s_cmp_reset_fill(
1131
 
/*===============*/
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) */
1136
 
{
1137
 
        return(i_s_cmp_fill_low(thd, tables, cond, TRUE));
1138
 
}
1139
 
 
1140
 
/***********************************************************************
1141
 
Bind the dynamic table information_schema.innodb_cmp. */
1142
 
static
1143
 
int
1144
 
i_s_cmp_init(
1145
 
/*=========*/
1146
 
                        /* out: 0 on success */
1147
 
        void*   p)      /* in/out: table schema object */
1148
 
{
1149
 
        DBUG_ENTER("i_s_cmp_init");
1150
 
        ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
1151
 
 
1152
 
        schema->fields_info = i_s_cmp_fields_info;
1153
 
        schema->fill_table = i_s_cmp_fill;
1154
 
 
1155
 
        DBUG_RETURN(0);
1156
 
}
1157
 
 
1158
 
/***********************************************************************
1159
 
Bind the dynamic table information_schema.innodb_cmp_reset. */
1160
 
static
1161
 
int
1162
 
i_s_cmp_reset_init(
1163
 
/*===============*/
1164
 
                        /* out: 0 on success */
1165
 
        void*   p)      /* in/out: table schema object */
1166
 
{
1167
 
        DBUG_ENTER("i_s_cmp_reset_init");
1168
 
        ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
1169
 
 
1170
 
        schema->fields_info = i_s_cmp_fields_info;
1171
 
        schema->fill_table = i_s_cmp_reset_fill;
1172
 
 
1173
 
        DBUG_RETURN(0);
1174
 
}
1175
 
 
1176
 
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_cmp =
1177
 
{
1178
 
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
1179
 
        /* int */
1180
 
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1181
 
 
1182
 
        /* pointer to type-specific plugin descriptor */
1183
 
        /* void* */
1184
 
        STRUCT_FLD(info, &i_s_info),
1185
 
 
1186
 
        /* plugin name */
1187
 
        /* const char* */
1188
 
        STRUCT_FLD(name, "INNODB_CMP"),
1189
 
 
1190
 
        /* plugin author (for SHOW PLUGINS) */
1191
 
        /* const char* */
1192
 
        STRUCT_FLD(author, plugin_author),
1193
 
 
1194
 
        /* general descriptive text (for SHOW PLUGINS) */
1195
 
        /* const char* */
1196
 
        STRUCT_FLD(descr, "Statistics for the InnoDB compression"),
1197
 
 
1198
 
        /* the plugin license (PLUGIN_LICENSE_XXX) */
1199
 
        /* int */
1200
 
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1201
 
 
1202
 
        /* the function to invoke when plugin is loaded */
1203
 
        /* int (*)(void*); */
1204
 
        STRUCT_FLD(init, i_s_cmp_init),
1205
 
 
1206
 
        /* the function to invoke when plugin is unloaded */
1207
 
        /* int (*)(void*); */
1208
 
        STRUCT_FLD(deinit, i_s_common_deinit),
1209
 
 
1210
 
        /* plugin version (for SHOW PLUGINS) */
1211
 
        /* unsigned int */
1212
 
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
1213
 
 
1214
 
        /* struct st_mysql_show_var* */
1215
 
        STRUCT_FLD(status_vars, NULL),
1216
 
 
1217
 
        /* struct st_mysql_sys_var** */
1218
 
        STRUCT_FLD(system_vars, NULL),
1219
 
 
1220
 
        /* reserved for dependency checking */
1221
 
        /* void* */
1222
 
        STRUCT_FLD(__reserved1, NULL)
1223
 
};
1224
 
 
1225
 
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_cmp_reset =
1226
 
{
1227
 
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
1228
 
        /* int */
1229
 
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1230
 
 
1231
 
        /* pointer to type-specific plugin descriptor */
1232
 
        /* void* */
1233
 
        STRUCT_FLD(info, &i_s_info),
1234
 
 
1235
 
        /* plugin name */
1236
 
        /* const char* */
1237
 
        STRUCT_FLD(name, "INNODB_CMP_RESET"),
1238
 
 
1239
 
        /* plugin author (for SHOW PLUGINS) */
1240
 
        /* const char* */
1241
 
        STRUCT_FLD(author, plugin_author),
1242
 
 
1243
 
        /* general descriptive text (for SHOW PLUGINS) */
1244
 
        /* const char* */
1245
 
        STRUCT_FLD(descr, "Statistics for the InnoDB compression;"
1246
 
                   " reset cumulated counts"),
1247
 
 
1248
 
        /* the plugin license (PLUGIN_LICENSE_XXX) */
1249
 
        /* int */
1250
 
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1251
 
 
1252
 
        /* the function to invoke when plugin is loaded */
1253
 
        /* int (*)(void*); */
1254
 
        STRUCT_FLD(init, i_s_cmp_reset_init),
1255
 
 
1256
 
        /* the function to invoke when plugin is unloaded */
1257
 
        /* int (*)(void*); */
1258
 
        STRUCT_FLD(deinit, i_s_common_deinit),
1259
 
 
1260
 
        /* plugin version (for SHOW PLUGINS) */
1261
 
        /* unsigned int */
1262
 
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
1263
 
 
1264
 
        /* struct st_mysql_show_var* */
1265
 
        STRUCT_FLD(status_vars, NULL),
1266
 
 
1267
 
        /* struct st_mysql_sys_var** */
1268
 
        STRUCT_FLD(system_vars, NULL),
1269
 
 
1270
 
        /* reserved for dependency checking */
1271
 
        /* void* */
1272
 
        STRUCT_FLD(__reserved1, NULL)
1273
 
};
1274
 
 
1275
 
/* Fields of the dynamic table information_schema.innodb_cmpmem. */
1276
 
static ST_FIELD_INFO    i_s_cmpmem_fields_info[] =
1277
 
{
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)},
1285
 
 
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)},
1293
 
 
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)},
1301
 
 
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)},
1309
 
 
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,"
1316
 
                    " in Seconds"),
1317
 
         STRUCT_FLD(open_method,        SKIP_OPEN_TABLE)},
1318
 
 
1319
 
        END_OF_ST_FIELD_INFO
1320
 
};
1321
 
 
1322
 
/***********************************************************************
1323
 
Fill the dynamic table information_schema.innodb_cmpmem or
1324
 
innodb_cmpmem_reset. */
1325
 
static
1326
 
int
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 */
1334
 
{
1335
 
        TABLE*  table   = (TABLE *) tables->table;
1336
 
        int     status  = 0;
1337
 
 
1338
 
        DBUG_ENTER("i_s_cmpmem_fill_low");
1339
 
 
1340
 
        /* deny access to non-superusers */
1341
 
        if (check_global_access(thd, PROCESS_ACL)) {
1342
 
 
1343
 
                DBUG_RETURN(0);
1344
 
        }
1345
 
 
1346
 
        RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
1347
 
 
1348
 
        buf_pool_mutex_enter();
1349
 
 
1350
 
        for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
1351
 
                buf_buddy_stat_t*       buddy_stat = &buf_buddy_stat[x];
1352
 
 
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])
1357
 
                                       : 0);
1358
 
                table->field[3]->store((longlong) buddy_stat->relocated, true);
1359
 
                table->field[4]->store(
1360
 
                        (ulong) (buddy_stat->relocated_usec / 1000000));
1361
 
 
1362
 
                if (reset) {
1363
 
                        /* This is protected by buf_pool_mutex. */
1364
 
                        buddy_stat->relocated = 0;
1365
 
                        buddy_stat->relocated_usec = 0;
1366
 
                }
1367
 
 
1368
 
                if (schema_table_store_record(thd, table)) {
1369
 
                        status = 1;
1370
 
                        break;
1371
 
                }
1372
 
        }
1373
 
 
1374
 
        buf_pool_mutex_exit();
1375
 
        DBUG_RETURN(status);
1376
 
}
1377
 
 
1378
 
/***********************************************************************
1379
 
Fill the dynamic table information_schema.innodb_cmpmem. */
1380
 
static
1381
 
int
1382
 
i_s_cmpmem_fill(
1383
 
/*============*/
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) */
1388
 
{
1389
 
        return(i_s_cmpmem_fill_low(thd, tables, cond, FALSE));
1390
 
}
1391
 
 
1392
 
/***********************************************************************
1393
 
Fill the dynamic table information_schema.innodb_cmpmem_reset. */
1394
 
static
1395
 
int
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) */
1402
 
{
1403
 
        return(i_s_cmpmem_fill_low(thd, tables, cond, TRUE));
1404
 
}
1405
 
 
1406
 
/***********************************************************************
1407
 
Bind the dynamic table information_schema.innodb_cmpmem. */
1408
 
static
1409
 
int
1410
 
i_s_cmpmem_init(
1411
 
/*============*/
1412
 
                        /* out: 0 on success */
1413
 
        void*   p)      /* in/out: table schema object */
1414
 
{
1415
 
        DBUG_ENTER("i_s_cmpmem_init");
1416
 
        ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
1417
 
 
1418
 
        schema->fields_info = i_s_cmpmem_fields_info;
1419
 
        schema->fill_table = i_s_cmpmem_fill;
1420
 
 
1421
 
        DBUG_RETURN(0);
1422
 
}
1423
 
 
1424
 
/***********************************************************************
1425
 
Bind the dynamic table information_schema.innodb_cmpmem_reset. */
1426
 
static
1427
 
int
1428
 
i_s_cmpmem_reset_init(
1429
 
/*==================*/
1430
 
                        /* out: 0 on success */
1431
 
        void*   p)      /* in/out: table schema object */
1432
 
{
1433
 
        DBUG_ENTER("i_s_cmpmem_reset_init");
1434
 
        ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p;
1435
 
 
1436
 
        schema->fields_info = i_s_cmpmem_fields_info;
1437
 
        schema->fill_table = i_s_cmpmem_reset_fill;
1438
 
 
1439
 
        DBUG_RETURN(0);
1440
 
}
1441
 
 
1442
 
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_cmpmem =
1443
 
{
1444
 
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
1445
 
        /* int */
1446
 
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1447
 
 
1448
 
        /* pointer to type-specific plugin descriptor */
1449
 
        /* void* */
1450
 
        STRUCT_FLD(info, &i_s_info),
1451
 
 
1452
 
        /* plugin name */
1453
 
        /* const char* */
1454
 
        STRUCT_FLD(name, "INNODB_CMPMEM"),
1455
 
 
1456
 
        /* plugin author (for SHOW PLUGINS) */
1457
 
        /* const char* */
1458
 
        STRUCT_FLD(author, plugin_author),
1459
 
 
1460
 
        /* general descriptive text (for SHOW PLUGINS) */
1461
 
        /* const char* */
1462
 
        STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool"),
1463
 
 
1464
 
        /* the plugin license (PLUGIN_LICENSE_XXX) */
1465
 
        /* int */
1466
 
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1467
 
 
1468
 
        /* the function to invoke when plugin is loaded */
1469
 
        /* int (*)(void*); */
1470
 
        STRUCT_FLD(init, i_s_cmpmem_init),
1471
 
 
1472
 
        /* the function to invoke when plugin is unloaded */
1473
 
        /* int (*)(void*); */
1474
 
        STRUCT_FLD(deinit, i_s_common_deinit),
1475
 
 
1476
 
        /* plugin version (for SHOW PLUGINS) */
1477
 
        /* unsigned int */
1478
 
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
1479
 
 
1480
 
        /* struct st_mysql_show_var* */
1481
 
        STRUCT_FLD(status_vars, NULL),
1482
 
 
1483
 
        /* struct st_mysql_sys_var** */
1484
 
        STRUCT_FLD(system_vars, NULL),
1485
 
 
1486
 
        /* reserved for dependency checking */
1487
 
        /* void* */
1488
 
        STRUCT_FLD(__reserved1, NULL)
1489
 
};
1490
 
 
1491
 
UNIV_INTERN struct st_mysql_plugin      i_s_innodb_cmpmem_reset =
1492
 
{
1493
 
        /* the plugin type (a MYSQL_XXX_PLUGIN value) */
1494
 
        /* int */
1495
 
        STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1496
 
 
1497
 
        /* pointer to type-specific plugin descriptor */
1498
 
        /* void* */
1499
 
        STRUCT_FLD(info, &i_s_info),
1500
 
 
1501
 
        /* plugin name */
1502
 
        /* const char* */
1503
 
        STRUCT_FLD(name, "INNODB_CMPMEM_RESET"),
1504
 
 
1505
 
        /* plugin author (for SHOW PLUGINS) */
1506
 
        /* const char* */
1507
 
        STRUCT_FLD(author, plugin_author),
1508
 
 
1509
 
        /* general descriptive text (for SHOW PLUGINS) */
1510
 
        /* const char* */
1511
 
        STRUCT_FLD(descr, "Statistics for the InnoDB compressed buffer pool;"
1512
 
                   " reset cumulated counts"),
1513
 
 
1514
 
        /* the plugin license (PLUGIN_LICENSE_XXX) */
1515
 
        /* int */
1516
 
        STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1517
 
 
1518
 
        /* the function to invoke when plugin is loaded */
1519
 
        /* int (*)(void*); */
1520
 
        STRUCT_FLD(init, i_s_cmpmem_reset_init),
1521
 
 
1522
 
        /* the function to invoke when plugin is unloaded */
1523
 
        /* int (*)(void*); */
1524
 
        STRUCT_FLD(deinit, i_s_common_deinit),
1525
 
 
1526
 
        /* plugin version (for SHOW PLUGINS) */
1527
 
        /* unsigned int */
1528
 
        STRUCT_FLD(version, INNODB_VERSION_SHORT),
1529
 
 
1530
 
        /* struct st_mysql_show_var* */
1531
 
        STRUCT_FLD(status_vars, NULL),
1532
 
 
1533
 
        /* struct st_mysql_sys_var** */
1534
 
        STRUCT_FLD(system_vars, NULL),
1535
 
 
1536
 
        /* reserved for dependency checking */
1537
 
        /* void* */
1538
 
        STRUCT_FLD(__reserved1, NULL)
1539
 
};
1540
 
 
1541
 
/***********************************************************************
1542
 
Unbind a dynamic INFORMATION_SCHEMA table. */
1543
 
static
1544
 
int
1545
 
i_s_common_deinit(
1546
 
/*==============*/
1547
 
                        /* out: 0 on success */
1548
 
        void*   p)      /* in/out: table schema object */
1549
 
{
1550
 
        DBUG_ENTER("i_s_common_deinit");
1551
 
 
1552
 
        /* Do nothing */
1553
 
 
1554
 
        DBUG_RETURN(0);
1555
 
}