~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: Padraig O'Sullivan
  • Date: 2009-12-17 04:48:59 UTC
  • mto: This revision was merged to the branch mainline in revision 1246.
  • Revision ID: osullivan.padraig@gmail.com-20091217044859-qorpkp4911zypfv3
Added some dtrace probes for tracing the optimizer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*****************************************************************************
 
2
 
 
3
Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved.
 
4
 
 
5
This program is free software; you can redistribute it and/or modify it under
 
6
the terms of the GNU General Public License as published by the Free Software
 
7
Foundation; version 2 of the License.
 
8
 
 
9
This program is distributed in the hope that it will be useful, but WITHOUT
 
10
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 
11
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
 
12
 
 
13
You should have received a copy of the GNU General Public License along with
 
14
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
 
15
Place, Suite 330, Boston, MA 02111-1307 USA
 
16
 
 
17
*****************************************************************************/
 
18
 
 
19
/**************************************************//**
 
20
@file handler/i_s.cc
 
21
InnoDB INFORMATION SCHEMA tables interface to MySQL.
 
22
 
 
23
Created July 18, 2007 Vasil Dimov
 
24
*******************************************************/
 
25
 
 
26
#include <drizzled/server_includes.h>
 
27
#include <drizzled/error.h>
 
28
#include <mystrings/m_ctype.h>
 
29
#include <mysys/my_sys.h>
 
30
#include <mysys/hash.h>
 
31
#include <mysys/mysys_err.h>
 
32
#include <drizzled/plugin.h>
 
33
#include <drizzled/field.h>
 
34
#include <drizzled/table.h>
 
35
#include <drizzled/plugin/info_schema_table.h>
 
36
 
 
37
#include "i_s.h"
 
38
 
 
39
 
 
40
extern "C" {
 
41
#include "trx0i_s.h"
 
42
#include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */
 
43
#include "buf0buddy.h" /* for i_s_cmpmem */
 
44
#include "buf0buf.h" /* for buf_pool and PAGE_ZIP_MIN_SIZE */
 
45
#include "ha_prototypes.h" /* for innobase_convert_name() */
 
46
#include "srv0start.h" /* for srv_was_started */
 
47
}
 
48
#include "handler0vars.h"
 
49
 
 
50
static const char plugin_author[] = "Innobase Oy";
 
51
 
 
52
#define OK(expr)                \
 
53
        if ((expr) != 0) {      \
 
54
                return(1);      \
 
55
        }
 
56
 
 
57
#define RETURN_IF_INNODB_NOT_STARTED(plugin_name)                       \
 
58
do {                                                                    \
 
59
        if (!srv_was_started) {                                         \
 
60
                push_warning_printf(session, DRIZZLE_ERROR::WARN_LEVEL_WARN,    \
 
61
                                    ER_CANT_FIND_SYSTEM_REC,            \
 
62
                                    "InnoDB: SELECTing from "           \
 
63
                                    "INFORMATION_SCHEMA.%s but "        \
 
64
                                    "the InnoDB storage engine "        \
 
65
                                    "is not installed", plugin_name);   \
 
66
                return(0);                                              \
 
67
        }                                                               \
 
68
} while (0)
 
69
 
 
70
#define STRUCT_FLD(name, value) value
 
71
 
 
72
drizzled::plugin::InfoSchemaTable *innodb_trx_schema_table= NULL;
 
73
drizzled::plugin::InfoSchemaTable *innodb_locks_schema_table= NULL;
 
74
drizzled::plugin::InfoSchemaTable *innodb_lock_waits_schema_table= NULL;
 
75
drizzled::plugin::InfoSchemaTable *innodb_cmp_schema_table= NULL;
 
76
drizzled::plugin::InfoSchemaTable *innodb_cmp_reset_schema_table= NULL;
 
77
drizzled::plugin::InfoSchemaTable *innodb_cmpmem_schema_table= NULL;
 
78
drizzled::plugin::InfoSchemaTable *innodb_cmpmem_reset_schema_table= NULL;
 
79
 
 
80
static TrxISMethods trx_methods;
 
81
static CmpISMethods cmp_methods;
 
82
static CmpResetISMethods cmp_reset_methods;
 
83
static CmpmemISMethods cmpmem_methods;
 
84
static CmpmemResetISMethods cmpmem_reset_methods;
 
85
 
 
86
/*
 
87
Use the following types mapping:
 
88
 
 
89
C type  ST_FIELD_INFO::field_type
 
90
---------------------------------
 
91
long                    DRIZZLE_TYPE_LONGLONG
 
92
(field_length=MY_INT64_NUM_DECIMAL_DIGITS)
 
93
 
 
94
long unsigned           DRIZZLE_TYPE_LONGLONG
 
95
(field_length=MY_INT64_NUM_DECIMAL_DIGITS, field_flags=MY_I_S_UNSIGNED)
 
96
 
 
97
char*                   DRIZZLE_TYPE_STRING
 
98
(field_length=n)
 
99
 
 
100
float                   DRIZZLE_TYPE_FLOAT
 
101
(field_length=0 is ignored)
 
102
 
 
103
void*                   DRIZZLE_TYPE_LONGLONG
 
104
(field_length=MY_INT64_NUM_DECIMAL_DIGITS, field_flags=MY_I_S_UNSIGNED)
 
105
 
 
106
boolean (if else)       DRIZZLE_TYPE_LONG
 
107
(field_length=1)
 
108
 
 
109
time_t                  DRIZZLE_TYPE_DATETIME
 
110
(field_length=0 ignored)
 
111
---------------------------------
 
112
*/
 
113
 
 
114
/* XXX these are defined in mysql_priv.h inside #ifdef DRIZZLE_SERVER */
 
115
void localtime_to_TIME(DRIZZLE_TIME *to, struct tm *from);
 
116
 
 
117
/*******************************************************************//**
 
118
Auxiliary function to store time_t value in MYSQL_TYPE_DATETIME
 
119
field.
 
120
@return 0 on success */
 
121
static
 
122
int
 
123
field_store_time_t(
 
124
/*===============*/
 
125
        Field*  field,  /*!< in/out: target field for storage */
 
126
        time_t  time)   /*!< in: value to store */
 
127
{
 
128
        DRIZZLE_TIME    my_time;
 
129
        struct tm       tm_time;
 
130
 
 
131
#if 0
 
132
        /* use this if you are sure that `variables' and `time_zone'
 
133
        are always initialized */
 
134
        session->variables.time_zone->gmt_sec_to_TIME(
 
135
                &my_time, (time_t) time);
 
136
#else
 
137
        localtime_r(&time, &tm_time);
 
138
        localtime_to_TIME(&my_time, &tm_time);
 
139
        my_time.time_type = DRIZZLE_TIMESTAMP_DATETIME;
 
140
#endif
 
141
 
 
142
        return(field->store_time(&my_time, DRIZZLE_TIMESTAMP_DATETIME));
 
143
}
 
144
 
 
145
/*******************************************************************//**
 
146
Auxiliary function to store char* value in MYSQL_TYPE_STRING field.
 
147
@return 0 on success */
 
148
static
 
149
int
 
150
field_store_string(
 
151
/*===============*/
 
152
        Field*          field,  /*!< in/out: target field for storage */
 
153
        const char*     str)    /*!< in: NUL-terminated utf-8 string,
 
154
                                or NULL */
 
155
{
 
156
        int     ret;
 
157
 
 
158
        if (str != NULL) {
 
159
 
 
160
                ret = field->store(str, strlen(str),
 
161
                                   system_charset_info);
 
162
                field->set_notnull();
 
163
        } else {
 
164
 
 
165
                ret = 0; /* success */
 
166
                field->set_null();
 
167
        }
 
168
 
 
169
        return(ret);
 
170
}
 
171
 
 
172
/*******************************************************************//**
 
173
Auxiliary function to store ulint value in DRIZZLE_TYPE_LONGLONG field.
 
174
If the value is ULINT_UNDEFINED then the field it set to NULL.
 
175
@return 0 on success */
 
176
static
 
177
int
 
178
field_store_ulint(
 
179
/*==============*/
 
180
        Field*  field,  /*!< in/out: target field for storage */
 
181
        ulint   n)      /*!< in: value to store */
 
182
{
 
183
        int     ret;
 
184
 
 
185
        if (n != ULINT_UNDEFINED) {
 
186
 
 
187
                ret = field->store(n);
 
188
                field->set_notnull();
 
189
        } else {
 
190
 
 
191
                ret = 0; /* success */
 
192
                field->set_null();
 
193
        }
 
194
 
 
195
        return(ret);
 
196
}
 
197
 
 
198
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_trx */
 
199
static drizzled::plugin::ColumnInfo     innodb_trx_fields_info[] =
 
200
{
 
201
#define IDX_TRX_ID              0
 
202
        drizzled::plugin::ColumnInfo("trx_id",
 
203
                  TRX_ID_MAX_LEN + 1,
 
204
                  DRIZZLE_TYPE_VARCHAR,
 
205
                  0,
 
206
                  0,
 
207
                  ""),
 
208
 
 
209
#define IDX_TRX_STATE           1
 
210
        drizzled::plugin::ColumnInfo("trx_state",
 
211
                  TRX_QUE_STATE_STR_MAX_LEN + 1,
 
212
                  DRIZZLE_TYPE_VARCHAR,
 
213
                  0,
 
214
                  0,
 
215
                  ""),
 
216
 
 
217
#define IDX_TRX_STARTED         2
 
218
        drizzled::plugin::ColumnInfo("trx_started",
 
219
                  0,
 
220
                  DRIZZLE_TYPE_DATETIME,
 
221
                  0,
 
222
                  0,
 
223
                  ""),
 
224
 
 
225
#define IDX_TRX_REQUESTED_LOCK_ID       3
 
226
        drizzled::plugin::ColumnInfo("trx_requested_lock_id",
 
227
                  TRX_I_S_LOCK_ID_MAX_LEN + 1,
 
228
                  DRIZZLE_TYPE_VARCHAR,
 
229
                  0,
 
230
                  MY_I_S_MAYBE_NULL,
 
231
                  ""),
 
232
 
 
233
#define IDX_TRX_WAIT_STARTED    4
 
234
        drizzled::plugin::ColumnInfo("trx_wait_started",
 
235
                  0,
 
236
                  DRIZZLE_TYPE_DATETIME,
 
237
                  0,
 
238
                  MY_I_S_MAYBE_NULL,
 
239
                  ""),
 
240
 
 
241
#define IDX_TRX_WEIGHT          5
 
242
        drizzled::plugin::ColumnInfo("trx_weight",
 
243
                  MY_INT64_NUM_DECIMAL_DIGITS,
 
244
                  DRIZZLE_TYPE_LONGLONG,
 
245
                  0,
 
246
                  MY_I_S_UNSIGNED,
 
247
                  ""),
 
248
 
 
249
#define IDX_TRX_DRIZZLE_THREAD_ID       6
 
250
        drizzled::plugin::ColumnInfo("trx_mysql_thread_id",
 
251
                  MY_INT64_NUM_DECIMAL_DIGITS,
 
252
                  DRIZZLE_TYPE_LONGLONG,
 
253
                  0,
 
254
                  MY_I_S_UNSIGNED,
 
255
                  ""),
 
256
 
 
257
#define IDX_TRX_QUERY           7
 
258
        drizzled::plugin::ColumnInfo("trx_query",
 
259
                  TRX_I_S_TRX_QUERY_MAX_LEN,
 
260
                  DRIZZLE_TYPE_VARCHAR,
 
261
                  0,
 
262
                  MY_I_S_MAYBE_NULL,
 
263
                  ""),
 
264
 
 
265
        drizzled::plugin::ColumnInfo()
 
266
};
 
267
 
 
268
/*******************************************************************//**
 
269
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_trx
 
270
table with it.
 
271
@return 0 on success */
 
272
static
 
273
int
 
274
fill_innodb_trx_from_cache(
 
275
/*=======================*/
 
276
        trx_i_s_cache_t*        cache,  /*!< in: cache to read from */
 
277
        Table*                  table,  /*!< in/out: fill this table */
 
278
        drizzled::plugin::InfoSchemaTable *schema_table)
 
279
{
 
280
        Field** fields;
 
281
        ulint   rows_num;
 
282
        char    lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
 
283
        ulint   i;
 
284
 
 
285
        fields = table->field;
 
286
 
 
287
        rows_num = trx_i_s_cache_get_rows_used(cache,
 
288
                                               I_S_INNODB_TRX);
 
289
 
 
290
        for (i = 0; i < rows_num; i++) {
 
291
 
 
292
                i_s_trx_row_t*  row;
 
293
                char            trx_id[TRX_ID_MAX_LEN + 1];
 
294
 
 
295
                row = (i_s_trx_row_t*)
 
296
                        trx_i_s_cache_get_nth_row(
 
297
                                cache, I_S_INNODB_TRX, i);
 
298
 
 
299
                /* trx_id */
 
300
                ut_snprintf(trx_id, sizeof(trx_id), TRX_ID_FMT, row->trx_id);
 
301
                OK(field_store_string(fields[IDX_TRX_ID], trx_id));
 
302
 
 
303
                /* trx_state */
 
304
                OK(field_store_string(fields[IDX_TRX_STATE],
 
305
                                      row->trx_state));
 
306
 
 
307
                /* trx_started */
 
308
                OK(field_store_time_t(fields[IDX_TRX_STARTED],
 
309
                                      (time_t) row->trx_started));
 
310
 
 
311
                /* trx_requested_lock_id */
 
312
                /* trx_wait_started */
 
313
                if (row->trx_wait_started != 0) {
 
314
 
 
315
                        OK(field_store_string(
 
316
                                   fields[IDX_TRX_REQUESTED_LOCK_ID],
 
317
                                   trx_i_s_create_lock_id(
 
318
                                           row->requested_lock_row,
 
319
                                           lock_id, sizeof(lock_id))));
 
320
                        /* field_store_string() sets it no notnull */
 
321
 
 
322
                        OK(field_store_time_t(
 
323
                                   fields[IDX_TRX_WAIT_STARTED],
 
324
                                   (time_t) row->trx_wait_started));
 
325
                        fields[IDX_TRX_WAIT_STARTED]->set_notnull();
 
326
                } else {
 
327
 
 
328
                        fields[IDX_TRX_REQUESTED_LOCK_ID]->set_null();
 
329
                        fields[IDX_TRX_WAIT_STARTED]->set_null();
 
330
                }
 
331
 
 
332
                /* trx_weight */
 
333
                OK(fields[IDX_TRX_WEIGHT]->store((int64_t) row->trx_weight,
 
334
                                                 true));
 
335
 
 
336
                /* trx_mysql_thread_id */
 
337
                OK(fields[IDX_TRX_DRIZZLE_THREAD_ID]->store(
 
338
                           row->trx_mysql_thread_id));
 
339
 
 
340
                /* trx_query */
 
341
                OK(field_store_string(fields[IDX_TRX_QUERY],
 
342
                                      row->trx_query));
 
343
 
 
344
                schema_table->addRow(table->record[0],
 
345
                                     table->s->reclength);
 
346
        }
 
347
 
 
348
        return(0);
 
349
}
 
350
 
 
351
/*******************************************************************//**
 
352
Bind the dynamic table INFORMATION_SCHEMA.innodb_trx
 
353
@return 0 on success */
 
354
int
 
355
innodb_trx_init()
 
356
/*============*/
 
357
{
 
358
        if ((innodb_trx_schema_table= new drizzled::plugin::InfoSchemaTable("INNODB_TRX")) == NULL)
 
359
                return(1);
 
360
 
 
361
        innodb_trx_schema_table->setColumnInfo(innodb_trx_fields_info);
 
362
        innodb_trx_schema_table->setInfoSchemaMethods(&trx_methods);
 
363
 
 
364
        return(0);
 
365
}
 
366
 
 
367
 
 
368
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_locks */
 
369
static drizzled::plugin::ColumnInfo innodb_locks_fields_info[] =
 
370
{
 
371
#define IDX_LOCK_ID             0
 
372
        drizzled::plugin::ColumnInfo("lock_id",
 
373
                  TRX_I_S_LOCK_ID_MAX_LEN + 1,
 
374
                  DRIZZLE_TYPE_VARCHAR,
 
375
                  0,
 
376
                  0,
 
377
                  ""),
 
378
 
 
379
#define IDX_LOCK_TRX_ID         1
 
380
        drizzled::plugin::ColumnInfo("lock_trx_id",
 
381
                  TRX_ID_MAX_LEN + 1,
 
382
                  DRIZZLE_TYPE_VARCHAR,
 
383
                  0,
 
384
                  0,
 
385
                  ""),
 
386
 
 
387
#define IDX_LOCK_MODE           2
 
388
        drizzled::plugin::ColumnInfo("lock_mode",
 
389
         /* S[,GAP] X[,GAP] IS[,GAP] IX[,GAP] AUTO_INC UNKNOWN */
 
390
                  32,
 
391
                  DRIZZLE_TYPE_VARCHAR,
 
392
                  0,
 
393
                  0,
 
394
                  ""),
 
395
 
 
396
#define IDX_LOCK_TYPE           3
 
397
        drizzled::plugin::ColumnInfo("lock_type",
 
398
                  32, /* RECORD|TABLE|UNKNOWN */
 
399
                  DRIZZLE_TYPE_VARCHAR,
 
400
                  0,
 
401
                  0,
 
402
                  ""),
 
403
 
 
404
#define IDX_LOCK_TABLE          4
 
405
        drizzled::plugin::ColumnInfo("lock_table",
 
406
                  1024,
 
407
                  DRIZZLE_TYPE_VARCHAR,
 
408
                  0,
 
409
                  0,
 
410
                  ""),
 
411
 
 
412
#define IDX_LOCK_INDEX          5
 
413
        drizzled::plugin::ColumnInfo("lock_index",
 
414
                  1024,
 
415
                  DRIZZLE_TYPE_VARCHAR,
 
416
                  0,
 
417
                  MY_I_S_MAYBE_NULL,
 
418
                  ""),
 
419
 
 
420
#define IDX_LOCK_SPACE          6
 
421
        drizzled::plugin::ColumnInfo("lock_space",
 
422
                  MY_INT64_NUM_DECIMAL_DIGITS,
 
423
                  DRIZZLE_TYPE_LONGLONG,
 
424
                  0,
 
425
                  MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL,
 
426
                  ""),
 
427
 
 
428
#define IDX_LOCK_PAGE           7
 
429
        drizzled::plugin::ColumnInfo("lock_page",
 
430
                  MY_INT64_NUM_DECIMAL_DIGITS,
 
431
                  DRIZZLE_TYPE_LONGLONG,
 
432
                  0,
 
433
                  MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL,
 
434
                  ""),
 
435
 
 
436
#define IDX_LOCK_REC            8
 
437
        drizzled::plugin::ColumnInfo("lock_rec",
 
438
                  MY_INT64_NUM_DECIMAL_DIGITS,
 
439
                  DRIZZLE_TYPE_LONGLONG,
 
440
                  0,
 
441
                  MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL,
 
442
                  ""),
 
443
 
 
444
#define IDX_LOCK_DATA           9
 
445
        drizzled::plugin::ColumnInfo("lock_data",
 
446
                  TRX_I_S_LOCK_DATA_MAX_LEN,
 
447
                  DRIZZLE_TYPE_VARCHAR,
 
448
                  0,
 
449
                  MY_I_S_MAYBE_NULL,
 
450
                  ""),
 
451
 
 
452
        drizzled::plugin::ColumnInfo()
 
453
};
 
454
 
 
455
/*******************************************************************//**
 
456
Read data from cache buffer and fill the INFORMATION_SCHEMA.innodb_locks
 
457
table with it.
 
458
@return 0 on success */
 
459
static
 
460
int
 
461
fill_innodb_locks_from_cache(
 
462
/*=========================*/
 
463
        trx_i_s_cache_t*        cache,  /*!< in: cache to read from */
 
464
        Session*                session,/*!< in: MySQL client connection */
 
465
        Table*                  table,  /*!< in/out: fill this table */
 
466
        drizzled::plugin::InfoSchemaTable *schema_table)
 
467
{
 
468
        Field** fields;
 
469
        ulint   rows_num;
 
470
        char    lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
 
471
        ulint   i;
 
472
 
 
473
        fields = table->field;
 
474
 
 
475
        rows_num = trx_i_s_cache_get_rows_used(cache,
 
476
                                               I_S_INNODB_LOCKS);
 
477
 
 
478
        for (i = 0; i < rows_num; i++) {
 
479
 
 
480
                i_s_locks_row_t*        row;
 
481
 
 
482
                /* note that the decoded database or table name is
 
483
                never expected to be longer than NAME_LEN;
 
484
                NAME_LEN for database name
 
485
                2 for surrounding quotes around database name
 
486
                NAME_LEN for table name
 
487
                2 for surrounding quotes around table name
 
488
                1 for the separating dot (.)
 
489
                9 for the #mysql50# prefix */
 
490
                char                    buf[2 * NAME_LEN + 14];
 
491
                const char*             bufend;
 
492
 
 
493
                char                    lock_trx_id[TRX_ID_MAX_LEN + 1];
 
494
 
 
495
                row = (i_s_locks_row_t*)
 
496
                        trx_i_s_cache_get_nth_row(
 
497
                                cache, I_S_INNODB_LOCKS, i);
 
498
 
 
499
                /* lock_id */
 
500
                trx_i_s_create_lock_id(row, lock_id, sizeof(lock_id));
 
501
                OK(field_store_string(fields[IDX_LOCK_ID],
 
502
                                      lock_id));
 
503
 
 
504
                /* lock_trx_id */
 
505
                ut_snprintf(lock_trx_id, sizeof(lock_trx_id),
 
506
                            TRX_ID_FMT, row->lock_trx_id);
 
507
                OK(field_store_string(fields[IDX_LOCK_TRX_ID], lock_trx_id));
 
508
 
 
509
                /* lock_mode */
 
510
                OK(field_store_string(fields[IDX_LOCK_MODE],
 
511
                                      row->lock_mode));
 
512
 
 
513
                /* lock_type */
 
514
                OK(field_store_string(fields[IDX_LOCK_TYPE],
 
515
                                      row->lock_type));
 
516
 
 
517
                /* lock_table */
 
518
                bufend = innobase_convert_name(buf, sizeof(buf),
 
519
                                               row->lock_table,
 
520
                                               strlen(row->lock_table),
 
521
                                               session, TRUE);
 
522
                OK(fields[IDX_LOCK_TABLE]->store(buf, bufend - buf,
 
523
                                                 system_charset_info));
 
524
 
 
525
                /* lock_index */
 
526
                if (row->lock_index != NULL) {
 
527
 
 
528
                        bufend = innobase_convert_name(buf, sizeof(buf),
 
529
                                                       row->lock_index,
 
530
                                                       strlen(row->lock_index),
 
531
                                                       session, FALSE);
 
532
                        OK(fields[IDX_LOCK_INDEX]->store(buf, bufend - buf,
 
533
                                                         system_charset_info));
 
534
                        fields[IDX_LOCK_INDEX]->set_notnull();
 
535
                } else {
 
536
 
 
537
                        fields[IDX_LOCK_INDEX]->set_null();
 
538
                }
 
539
 
 
540
                /* lock_space */
 
541
                OK(field_store_ulint(fields[IDX_LOCK_SPACE],
 
542
                                     row->lock_space));
 
543
 
 
544
                /* lock_page */
 
545
                OK(field_store_ulint(fields[IDX_LOCK_PAGE],
 
546
                                     row->lock_page));
 
547
 
 
548
                /* lock_rec */
 
549
                OK(field_store_ulint(fields[IDX_LOCK_REC],
 
550
                                     row->lock_rec));
 
551
 
 
552
                /* lock_data */
 
553
                OK(field_store_string(fields[IDX_LOCK_DATA],
 
554
                                      row->lock_data));
 
555
 
 
556
                schema_table->addRow(table->record[0],
 
557
                                     table->s->reclength);
 
558
        }
 
559
 
 
560
        return(0);
 
561
}
 
562
 
 
563
/*******************************************************************//**
 
564
Bind the dynamic table INFORMATION_SCHEMA.innodb_locks
 
565
@return 0 on success */
 
566
int
 
567
innodb_locks_init()
 
568
/*==============*/
 
569
{
 
570
 
 
571
        if ((innodb_locks_schema_table= new drizzled::plugin::InfoSchemaTable("INNODB_LOCKS")) == NULL)
 
572
                return(1);
 
573
 
 
574
        innodb_locks_schema_table->setColumnInfo(innodb_locks_fields_info);
 
575
        innodb_locks_schema_table->setInfoSchemaMethods(&trx_methods);
 
576
        return(0);
 
577
}
 
578
 
 
579
 
 
580
/* Fields of the dynamic table INFORMATION_SCHEMA.innodb_lock_waits */
 
581
static drizzled::plugin::ColumnInfo innodb_lock_waits_fields_info[] =
 
582
{
 
583
#define IDX_REQUESTING_TRX_ID   0
 
584
        drizzled::plugin::ColumnInfo("requesting_trx_id",
 
585
                  TRX_ID_MAX_LEN + 1,
 
586
                  DRIZZLE_TYPE_VARCHAR,
 
587
                  0,
 
588
                  0,
 
589
                  ""),
 
590
 
 
591
#define IDX_REQUESTED_LOCK_ID   1
 
592
        drizzled::plugin::ColumnInfo("requested_lock_id",
 
593
                  TRX_I_S_LOCK_ID_MAX_LEN + 1,
 
594
                  DRIZZLE_TYPE_VARCHAR,
 
595
                  0,
 
596
                  0,
 
597
                  ""),
 
598
 
 
599
#define IDX_BLOCKING_TRX_ID     2
 
600
        drizzled::plugin::ColumnInfo("blocking_trx_id",
 
601
                  TRX_ID_MAX_LEN + 1,
 
602
                  DRIZZLE_TYPE_VARCHAR,
 
603
                  0,
 
604
                  0,
 
605
                  ""),
 
606
 
 
607
#define IDX_BLOCKING_LOCK_ID    3
 
608
        drizzled::plugin::ColumnInfo("blocking_lock_id",
 
609
                  TRX_I_S_LOCK_ID_MAX_LEN + 1,
 
610
                  DRIZZLE_TYPE_VARCHAR,
 
611
                  0,
 
612
                  0,
 
613
                  ""),
 
614
 
 
615
        drizzled::plugin::ColumnInfo()
 
616
};
 
617
 
 
618
/*******************************************************************//**
 
619
Read data from cache buffer and fill the
 
620
INFORMATION_SCHEMA.innodb_lock_waits table with it.
 
621
@return 0 on success */
 
622
static
 
623
int
 
624
fill_innodb_lock_waits_from_cache(
 
625
/*==============================*/
 
626
        trx_i_s_cache_t*        cache,  /*!< in: cache to read from */
 
627
        Table*                  table,  /*!< in/out: fill this table */
 
628
        drizzled::plugin::InfoSchemaTable *schema_table)
 
629
{
 
630
        Field** fields;
 
631
        ulint   rows_num;
 
632
        char    requested_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
 
633
        char    blocking_lock_id[TRX_I_S_LOCK_ID_MAX_LEN + 1];
 
634
        ulint   i;
 
635
 
 
636
        fields = table->field;
 
637
 
 
638
        rows_num = trx_i_s_cache_get_rows_used(cache,
 
639
                                               I_S_INNODB_LOCK_WAITS);
 
640
 
 
641
        for (i = 0; i < rows_num; i++) {
 
642
 
 
643
                i_s_lock_waits_row_t*   row;
 
644
 
 
645
                char    requesting_trx_id[TRX_ID_MAX_LEN + 1];
 
646
                char    blocking_trx_id[TRX_ID_MAX_LEN + 1];
 
647
 
 
648
                row = (i_s_lock_waits_row_t*)
 
649
                        trx_i_s_cache_get_nth_row(
 
650
                                cache, I_S_INNODB_LOCK_WAITS, i);
 
651
 
 
652
                /* requesting_trx_id */
 
653
                ut_snprintf(requesting_trx_id, sizeof(requesting_trx_id),
 
654
                            TRX_ID_FMT, row->requested_lock_row->lock_trx_id);
 
655
                OK(field_store_string(fields[IDX_REQUESTING_TRX_ID],
 
656
                                      requesting_trx_id));
 
657
 
 
658
                /* requested_lock_id */
 
659
                OK(field_store_string(
 
660
                           fields[IDX_REQUESTED_LOCK_ID],
 
661
                           trx_i_s_create_lock_id(
 
662
                                   row->requested_lock_row,
 
663
                                   requested_lock_id,
 
664
                                   sizeof(requested_lock_id))));
 
665
 
 
666
                /* blocking_trx_id */
 
667
                ut_snprintf(blocking_trx_id, sizeof(blocking_trx_id),
 
668
                            TRX_ID_FMT, row->blocking_lock_row->lock_trx_id);
 
669
                OK(field_store_string(fields[IDX_BLOCKING_TRX_ID],
 
670
                                      blocking_trx_id));
 
671
 
 
672
                /* blocking_lock_id */
 
673
                OK(field_store_string(
 
674
                           fields[IDX_BLOCKING_LOCK_ID],
 
675
                           trx_i_s_create_lock_id(
 
676
                                   row->blocking_lock_row,
 
677
                                   blocking_lock_id,
 
678
                                   sizeof(blocking_lock_id))));
 
679
 
 
680
                schema_table->addRow(table->record[0],
 
681
                                     table->s->reclength);
 
682
        }
 
683
 
 
684
        return(0);
 
685
}
 
686
 
 
687
/*******************************************************************//**
 
688
Bind the dynamic table INFORMATION_SCHEMA.innodb_lock_waits
 
689
@return 0 on success */
 
690
int
 
691
innodb_lock_waits_init()
 
692
/*===================*/
 
693
{
 
694
 
 
695
        if ((innodb_lock_waits_schema_table= new drizzled::plugin::InfoSchemaTable("INNODB_LOCK_WAITS")) == NULL)
 
696
                return(1);
 
697
 
 
698
        innodb_lock_waits_schema_table->setColumnInfo(innodb_lock_waits_fields_info);
 
699
        innodb_lock_waits_schema_table->setInfoSchemaMethods(&trx_methods);
 
700
 
 
701
 
 
702
        return(0);
 
703
}
 
704
 
 
705
 
 
706
/*******************************************************************//**
 
707
Common function to fill any of the dynamic tables:
 
708
INFORMATION_SCHEMA.innodb_trx
 
709
INFORMATION_SCHEMA.innodb_locks
 
710
INFORMATION_SCHEMA.innodb_lock_waits
 
711
@return 0 on success */
 
712
int
 
713
TrxISMethods::fillTable(
 
714
/*======================*/
 
715
        Session*        session,/*!< in: thread */
 
716
        Table*  table,  /*!< in/out: tables to fill */
 
717
        drizzled::plugin::InfoSchemaTable *schema_table)
 
718
{
 
719
        const char*             table_name;
 
720
        int                     ret;
 
721
        trx_i_s_cache_t*        cache;
 
722
 
 
723
        /* minimize the number of places where global variables are
 
724
        referenced */
 
725
        cache = trx_i_s_cache;
 
726
 
 
727
        /* which table we have to fill? */
 
728
        table_name = schema_table->getName().c_str();
 
729
        /* or table_name = tables->schema_table->table_name; */
 
730
 
 
731
        RETURN_IF_INNODB_NOT_STARTED(table_name);
 
732
 
 
733
        /* update the cache */
 
734
        trx_i_s_cache_start_write(cache);
 
735
        trx_i_s_possibly_fetch_data_into_cache(cache);
 
736
        trx_i_s_cache_end_write(cache);
 
737
 
 
738
        if (trx_i_s_cache_is_truncated(cache)) {
 
739
 
 
740
                /* XXX show warning to user if possible */
 
741
                fprintf(stderr, "Warning: data in %s truncated due to "
 
742
                        "memory limit of %d bytes\n", table_name,
 
743
                        TRX_I_S_MEM_LIMIT);
 
744
        }
 
745
 
 
746
        ret = 0;
 
747
 
 
748
        trx_i_s_cache_start_read(cache);
 
749
 
 
750
        if (innobase_strcasecmp(table_name, "innodb_trx") == 0) {
 
751
 
 
752
                if (fill_innodb_trx_from_cache(
 
753
                        cache, table, schema_table) != 0) {
 
754
 
 
755
                        ret = 1;
 
756
                }
 
757
 
 
758
        } else if (innobase_strcasecmp(table_name, "innodb_locks") == 0) {
 
759
 
 
760
                if (fill_innodb_locks_from_cache(
 
761
                        cache, session, table, schema_table) != 0) {
 
762
 
 
763
                        ret = 1;
 
764
                }
 
765
 
 
766
        } else if (innobase_strcasecmp(table_name, "innodb_lock_waits") == 0) {
 
767
 
 
768
                if (fill_innodb_lock_waits_from_cache(
 
769
                        cache, table, schema_table) != 0) {
 
770
 
 
771
                        ret = 1;
 
772
                }
 
773
 
 
774
        } else {
 
775
 
 
776
                /* huh! what happened!? */
 
777
                fprintf(stderr,
 
778
                        "InnoDB: trx_i_s_common_fill_table() was "
 
779
                        "called to fill unknown table: %s.\n"
 
780
                        "This function only knows how to fill "
 
781
                        "innodb_trx, innodb_locks and "
 
782
                        "innodb_lock_waits tables.\n", table_name);
 
783
 
 
784
                ret = 1;
 
785
        }
 
786
 
 
787
        trx_i_s_cache_end_read(cache);
 
788
 
 
789
#if 0
 
790
        return(ret);
 
791
#else
 
792
        /* if this function returns something else than 0 then a
 
793
        deadlock occurs between the mysqld server and mysql client,
 
794
        see http://bugs.mysql.com/29900 ; when that bug is resolved
 
795
        we can enable the return(ret) above */
 
796
        return(0);
 
797
#endif
 
798
}
 
799
 
 
800
/* Fields of the dynamic table information_schema.innodb_cmp. */
 
801
static drizzled::plugin::ColumnInfo     i_s_cmp_fields_info[] =
 
802
{
 
803
        drizzled::plugin::ColumnInfo("page_size",
 
804
                  5,
 
805
                  DRIZZLE_TYPE_LONG,
 
806
                  0,
 
807
                  0,
 
808
                  "Compressed Page Size"),
 
809
 
 
810
        drizzled::plugin::ColumnInfo("compress_ops",
 
811
                  MY_INT32_NUM_DECIMAL_DIGITS,
 
812
                  DRIZZLE_TYPE_LONG,
 
813
                  0,
 
814
                  0,
 
815
                  "Total Number of Compressions"),
 
816
 
 
817
        drizzled::plugin::ColumnInfo("compress_ops_ok",
 
818
                  MY_INT32_NUM_DECIMAL_DIGITS,
 
819
                  DRIZZLE_TYPE_LONG,
 
820
                  0,
 
821
                  0,
 
822
                  "Total Number of Successful Compressions"),
 
823
 
 
824
        drizzled::plugin::ColumnInfo("compress_time",
 
825
                  MY_INT32_NUM_DECIMAL_DIGITS,
 
826
                  DRIZZLE_TYPE_LONG,
 
827
                  0,
 
828
                  0,
 
829
                  "Total Duration of Compressions in Seconds"),
 
830
 
 
831
        drizzled::plugin::ColumnInfo("uncompress_ops",
 
832
                  MY_INT32_NUM_DECIMAL_DIGITS,
 
833
                  DRIZZLE_TYPE_LONG,
 
834
                  0,
 
835
                  0,
 
836
                  "Total Number of Decompressions"),
 
837
 
 
838
        drizzled::plugin::ColumnInfo("uncompress_time",
 
839
                  MY_INT32_NUM_DECIMAL_DIGITS,
 
840
                  DRIZZLE_TYPE_LONG,
 
841
                  0,
 
842
                  0,
 
843
                  "Total Duration of Decompressions in Seconds"),
 
844
 
 
845
        drizzled::plugin::ColumnInfo()
 
846
};
 
847
 
 
848
 
 
849
/*******************************************************************//**
 
850
Fill the dynamic table information_schema.innodb_cmp or
 
851
innodb_cmp_reset.
 
852
@return 0 on success, 1 on failure */
 
853
static
 
854
int
 
855
i_s_cmp_fill_low(
 
856
/*=============*/
 
857
        Session*        session,/*!< in: thread */
 
858
        Table*  table,  /*!< in/out: tables to fill */
 
859
        drizzled::plugin::InfoSchemaTable *schema_table,
 
860
        ibool           reset)  /*!< in: TRUE=reset cumulated counts */
 
861
{
 
862
        int     status  = 0;
 
863
 
 
864
 
 
865
        RETURN_IF_INNODB_NOT_STARTED(schema_table->getName().c_str());
 
866
 
 
867
        for (uint i = 0; i < PAGE_ZIP_NUM_SSIZE - 1; i++) {
 
868
                page_zip_stat_t*        zip_stat = &page_zip_stat[i];
 
869
 
 
870
                table->field[0]->store(PAGE_ZIP_MIN_SIZE << i);
 
871
 
 
872
                /* The cumulated counts are not protected by any
 
873
                mutex.  Thus, some operation in page0zip.c could
 
874
                increment a counter between the time we read it and
 
875
                clear it.  We could introduce mutex protection, but it
 
876
                could cause a measureable performance hit in
 
877
                page0zip.c. */
 
878
                table->field[1]->store(zip_stat->compressed);
 
879
                table->field[2]->store(zip_stat->compressed_ok);
 
880
                table->field[3]->store(
 
881
                        (ulong) (zip_stat->compressed_usec / 1000000));
 
882
                table->field[4]->store(zip_stat->decompressed);
 
883
                table->field[5]->store(
 
884
                        (ulong) (zip_stat->decompressed_usec / 1000000));
 
885
 
 
886
                if (reset) {
 
887
                        memset(zip_stat, 0, sizeof *zip_stat);
 
888
                }
 
889
 
 
890
                schema_table->addRow(table->record[0],
 
891
                                     table->s->reclength);
 
892
        }
 
893
 
 
894
        return(status);
 
895
}
 
896
 
 
897
/*******************************************************************//**
 
898
Fill the dynamic table information_schema.innodb_cmp.
 
899
@return 0 on success, 1 on failure */
 
900
int
 
901
CmpISMethods::fillTable(
 
902
/*=========*/
 
903
        Session*        session,/*!< in: thread */
 
904
        Table*  table,  /*!< in/out: tables to fill */
 
905
        drizzled::plugin::InfoSchemaTable *schema_table)
 
906
{
 
907
        return(i_s_cmp_fill_low(session, table, schema_table, FALSE));
 
908
}
 
909
 
 
910
/*******************************************************************//**
 
911
Fill the dynamic table information_schema.innodb_cmp_reset.
 
912
@return 0 on success, 1 on failure */
 
913
int
 
914
CmpResetISMethods::fillTable(
 
915
/*===============*/
 
916
        Session*        session,/*!< in: thread */
 
917
        Table*  table,  /*!< in/out: tables to fill */
 
918
        drizzled::plugin::InfoSchemaTable *schema_table)
 
919
{
 
920
        return(i_s_cmp_fill_low(session, table, schema_table, TRUE));
 
921
}
 
922
 
 
923
/*******************************************************************//**
 
924
Bind the dynamic table information_schema.innodb_cmp.
 
925
@return 0 on success */
 
926
int
 
927
i_s_cmp_init()
 
928
/*=========*/
 
929
{
 
930
 
 
931
        if ((innodb_cmp_schema_table= new drizzled::plugin::InfoSchemaTable("INNODB_CMP")) == NULL)
 
932
                return(1);
 
933
 
 
934
        innodb_cmp_schema_table->setColumnInfo(i_s_cmp_fields_info);
 
935
        innodb_cmp_schema_table->setInfoSchemaMethods(&cmp_methods);
 
936
 
 
937
        return(0);
 
938
}
 
939
 
 
940
/*******************************************************************//**
 
941
Bind the dynamic table information_schema.innodb_cmp_reset.
 
942
@return 0 on success */
 
943
int
 
944
i_s_cmp_reset_init()
 
945
/*===============*/
 
946
{
 
947
 
 
948
        if ((innodb_cmp_reset_schema_table= new drizzled::plugin::InfoSchemaTable("INNODB_CMP_RESET")) == NULL)
 
949
                return(1);
 
950
 
 
951
        innodb_cmp_reset_schema_table->setColumnInfo(i_s_cmp_fields_info);
 
952
        innodb_cmp_reset_schema_table->setInfoSchemaMethods(&cmp_reset_methods);
 
953
 
 
954
        return(0);
 
955
}
 
956
 
 
957
 
 
958
 
 
959
/* Fields of the dynamic table information_schema.innodb_cmpmem. */
 
960
static drizzled::plugin::ColumnInfo     i_s_cmpmem_fields_info[] =
 
961
{
 
962
        drizzled::plugin::ColumnInfo("page_size",
 
963
                  5,
 
964
                  DRIZZLE_TYPE_LONG,
 
965
                  0,
 
966
                  0,
 
967
                  "Buddy Block Size"),
 
968
 
 
969
        drizzled::plugin::ColumnInfo("pages_used",
 
970
                  MY_INT32_NUM_DECIMAL_DIGITS,
 
971
                  DRIZZLE_TYPE_LONG,
 
972
                  0,
 
973
                  0,
 
974
                  "Currently in Use"),
 
975
 
 
976
        drizzled::plugin::ColumnInfo("pages_free",
 
977
                  MY_INT32_NUM_DECIMAL_DIGITS,
 
978
                  DRIZZLE_TYPE_LONG,
 
979
                  0,
 
980
                  0,
 
981
                  "Currently Available"),
 
982
 
 
983
        drizzled::plugin::ColumnInfo("relocation_ops",
 
984
                  MY_INT64_NUM_DECIMAL_DIGITS,
 
985
                  DRIZZLE_TYPE_LONGLONG,
 
986
                  0,
 
987
                  0,
 
988
                  "Total Number of Relocations"),
 
989
 
 
990
        drizzled::plugin::ColumnInfo("relocation_time",
 
991
                  MY_INT32_NUM_DECIMAL_DIGITS,
 
992
                  DRIZZLE_TYPE_LONG,
 
993
                  0,
 
994
                  0,
 
995
                  "Total Duration of Relocations, in Seconds"),
 
996
 
 
997
        drizzled::plugin::ColumnInfo()
 
998
};
 
999
 
 
1000
/*******************************************************************//**
 
1001
Fill the dynamic table information_schema.innodb_cmpmem or
 
1002
innodb_cmpmem_reset.
 
1003
@return 0 on success, 1 on failure */
 
1004
static
 
1005
int
 
1006
i_s_cmpmem_fill_low(
 
1007
/*================*/
 
1008
        Session*        session,/*!< in: thread */
 
1009
        Table*  table,  /*!< in/out: tables to fill */
 
1010
        drizzled::plugin::InfoSchemaTable *schema_table,
 
1011
        ibool           reset)  /*!< in: TRUE=reset cumulated counts */
 
1012
{
 
1013
        int     status  = 0;
 
1014
 
 
1015
        RETURN_IF_INNODB_NOT_STARTED(schema_table->getName().c_str());
 
1016
 
 
1017
        buf_pool_mutex_enter();
 
1018
 
 
1019
        for (uint x = 0; x <= BUF_BUDDY_SIZES; x++) {
 
1020
                buf_buddy_stat_t*       buddy_stat = &buf_buddy_stat[x];
 
1021
 
 
1022
                table->field[0]->store(BUF_BUDDY_LOW << x);
 
1023
                table->field[1]->store(buddy_stat->used);
 
1024
                table->field[2]->store(UNIV_LIKELY(x < BUF_BUDDY_SIZES)
 
1025
                                       ? UT_LIST_GET_LEN(buf_pool->zip_free[x])
 
1026
                                       : 0);
 
1027
                table->field[3]->store((int64_t) buddy_stat->relocated, true);
 
1028
                table->field[4]->store(
 
1029
                        (ulong) (buddy_stat->relocated_usec / 1000000));
 
1030
 
 
1031
                if (reset) {
 
1032
                        /* This is protected by buf_pool_mutex. */
 
1033
                        buddy_stat->relocated = 0;
 
1034
                        buddy_stat->relocated_usec = 0;
 
1035
                }
 
1036
 
 
1037
                schema_table->addRow(table->record[0],
 
1038
                                     table->s->reclength);
 
1039
        }
 
1040
 
 
1041
        buf_pool_mutex_exit();
 
1042
        return(status);
 
1043
}
 
1044
 
 
1045
/*******************************************************************//**
 
1046
Fill the dynamic table information_schema.innodb_cmpmem.
 
1047
@return 0 on success, 1 on failure */
 
1048
int
 
1049
CmpmemISMethods::fillTable(
 
1050
/*============*/
 
1051
        Session*        session,/*!< in: thread */
 
1052
        Table*  table, /*!< in/out: tables to fill */
 
1053
        drizzled::plugin::InfoSchemaTable *schema_table)        
 
1054
{
 
1055
        return(i_s_cmpmem_fill_low(session, table, schema_table, FALSE));
 
1056
}
 
1057
 
 
1058
/*******************************************************************//**
 
1059
Fill the dynamic table information_schema.innodb_cmpmem_reset.
 
1060
@return 0 on success, 1 on failure */
 
1061
int
 
1062
CmpmemResetISMethods::fillTable(
 
1063
/*==================*/
 
1064
        Session*        session,/*!< in: thread */
 
1065
        Table*  table,  /*!< in/out: tables to fill */
 
1066
        drizzled::plugin::InfoSchemaTable *schema_table)
 
1067
{
 
1068
        return(i_s_cmpmem_fill_low(session, table, schema_table, TRUE));
 
1069
}
 
1070
 
 
1071
/*******************************************************************//**
 
1072
Bind the dynamic table information_schema.innodb_cmpmem.
 
1073
@return 0 on success */
 
1074
int
 
1075
i_s_cmpmem_init()
 
1076
/*============*/
 
1077
{
 
1078
 
 
1079
        if ((innodb_cmpmem_schema_table= new drizzled::plugin::InfoSchemaTable("INNODB_CMPMEM")) == NULL)
 
1080
                return(1);
 
1081
 
 
1082
        innodb_cmpmem_schema_table->setColumnInfo(i_s_cmpmem_fields_info);
 
1083
        innodb_cmpmem_schema_table->setInfoSchemaMethods(&cmpmem_methods);
 
1084
 
 
1085
        return(0);
 
1086
}
 
1087
 
 
1088
/*******************************************************************//**
 
1089
Bind the dynamic table information_schema.innodb_cmpmem_reset.
 
1090
@return 0 on success */
 
1091
int
 
1092
i_s_cmpmem_reset_init()
 
1093
/*==================*/
 
1094
{
 
1095
        if ((innodb_cmpmem_reset_schema_table= new drizzled::plugin::InfoSchemaTable("INNODB_CMPMEM_RESET")) == NULL)
 
1096
                return(1);
 
1097
 
 
1098
        innodb_cmpmem_reset_schema_table->setColumnInfo(i_s_cmpmem_fields_info);
 
1099
        innodb_cmpmem_reset_schema_table->setInfoSchemaMethods(&cmpmem_reset_methods);
 
1100
        return(0);
 
1101
}
 
1102
 
 
1103
 
 
1104
/*******************************************************************//**
 
1105
Unbind a dynamic INFORMATION_SCHEMA table.
 
1106
@return 0 on success */
 
1107
int
 
1108
i_s_common_deinit(
 
1109
/*==============*/
 
1110
        drizzled::plugin::Registry &registry)   /*!< in/out: table schema object */
 
1111
{
 
1112
        registry.remove(innodb_trx_schema_table);
 
1113
        registry.remove(innodb_locks_schema_table);
 
1114
        registry.remove(innodb_lock_waits_schema_table);
 
1115
        registry.remove(innodb_cmp_schema_table);
 
1116
        registry.remove(innodb_cmp_reset_schema_table);
 
1117
        registry.remove(innodb_cmpmem_schema_table);
 
1118
        registry.remove(innodb_cmpmem_reset_schema_table);
 
1119
 
 
1120
        delete innodb_trx_schema_table;
 
1121
        delete innodb_locks_schema_table;
 
1122
        delete innodb_lock_waits_schema_table;
 
1123
        delete innodb_cmp_schema_table;
 
1124
        delete innodb_cmp_reset_schema_table;
 
1125
        delete innodb_cmpmem_schema_table;
 
1126
        delete innodb_cmpmem_reset_schema_table;
 
1127
 
 
1128
        return(0);
 
1129
}