26 #include <mysqld_error.h>
31 #include <myisampack.h>
32 #include <mysys_err.h>
35 #include <sql_plugin.h>
36 #include <mysql/innodb_priv.h>
69 #define I_S_PAGE_TYPE_IBUF (FIL_PAGE_TYPE_LAST + 1)
73 #define I_S_PAGE_TYPE_UNKNOWN (I_S_PAGE_TYPE_IBUF + 1)
77 #define I_S_PAGE_TYPE_INDEX 1
99 #if I_S_PAGE_TYPE_UNKNOWN > 1<<4
100 # error "i_s_page_type[] is too large"
114 unsigned flush_type:2;
128 unsigned num_recs:UNIV_PAGE_SIZE_SHIFT_MAX-2;
130 unsigned data_size:UNIV_PAGE_SIZE_SHIFT_MAX;
140 #define MAX_BUF_INFO_CACHED 10000
147 #define RETURN_IF_INNODB_NOT_STARTED(plugin_name) \
149 if (!srv_was_started) { \
150 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN, \
151 ER_CANT_FIND_SYSTEM_REC, \
152 "InnoDB: SELECTing from " \
153 "INFORMATION_SCHEMA.%s but " \
154 "the InnoDB storage engine " \
155 "is not installed", plugin_name); \
160 #if !defined __STRICT_ANSI__ && defined __GNUC__ && (__GNUC__) > 2 && \
161 !defined __INTEL_COMPILER && !defined __clang__
162 #define STRUCT_FLD(name, value) name: value
164 #define STRUCT_FLD(name, value) value
169 #define END_OF_ST_FIELD_INFO \
170 {STRUCT_FLD(field_name, NULL), \
171 STRUCT_FLD(field_length, 0), \
172 STRUCT_FLD(field_type, MYSQL_TYPE_NULL), \
173 STRUCT_FLD(value, 0), \
174 STRUCT_FLD(field_flags, 0), \
175 STRUCT_FLD(old_name, ""), \
176 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}
214 trx_i_s_common_fill_table(
246 thd->variables.time_zone->gmt_sec_to_TIME(
247 &my_time, (my_time_t) time);
249 localtime_r(&time, &tm_time);
250 localtime_to_TIME(&my_time, &tm_time);
251 my_time.time_type = MYSQL_TIMESTAMP_DATETIME;
254 memset(&my_time, 0,
sizeof(my_time));
257 return(field->store_time(&my_time, MYSQL_TIMESTAMP_DATETIME));
275 ret = field->store(str, strlen(str),
276 system_charset_info);
277 field->set_notnull();
293 field_store_index_name(
297 const char* index_name)
303 ut_ad(index_name != NULL);
304 ut_ad(field->real_type() == MYSQL_TYPE_VARCHAR);
309 char buf[NAME_LEN + 1];
311 memcpy(buf + 1, index_name + 1, strlen(index_name));
312 ret = field->store(buf, strlen(buf),
313 system_charset_info);
315 ret = field->store(index_name, strlen(index_name),
316 system_charset_info);
319 field->set_notnull();
337 if (n != ULINT_UNDEFINED) {
339 ret = field->store(n);
340 field->set_notnull();
354 {STRUCT_FLD(field_name,
"trx_id"),
356 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
357 STRUCT_FLD(value, 0),
358 STRUCT_FLD(field_flags, 0),
359 STRUCT_FLD(old_name,
""),
360 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
362 #define IDX_TRX_STATE 1
363 {STRUCT_FLD(field_name,
"trx_state"),
364 STRUCT_FLD(field_length, TRX_QUE_STATE_STR_MAX_LEN + 1),
365 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
366 STRUCT_FLD(value, 0),
367 STRUCT_FLD(field_flags, 0),
368 STRUCT_FLD(old_name,
""),
369 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
371 #define IDX_TRX_STARTED 2
372 {STRUCT_FLD(field_name,
"trx_started"),
373 STRUCT_FLD(field_length, 0),
374 STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
375 STRUCT_FLD(value, 0),
376 STRUCT_FLD(field_flags, 0),
377 STRUCT_FLD(old_name,
""),
378 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
380 #define IDX_TRX_REQUESTED_LOCK_ID 3
381 {STRUCT_FLD(field_name,
"trx_requested_lock_id"),
383 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
384 STRUCT_FLD(value, 0),
385 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
386 STRUCT_FLD(old_name,
""),
387 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
389 #define IDX_TRX_WAIT_STARTED 4
390 {STRUCT_FLD(field_name,
"trx_wait_started"),
391 STRUCT_FLD(field_length, 0),
392 STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
393 STRUCT_FLD(value, 0),
394 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
395 STRUCT_FLD(old_name,
""),
396 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
398 #define IDX_TRX_WEIGHT 5
399 {STRUCT_FLD(field_name,
"trx_weight"),
400 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
401 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
402 STRUCT_FLD(value, 0),
403 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
404 STRUCT_FLD(old_name,
""),
405 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
407 #define IDX_TRX_MYSQL_THREAD_ID 6
408 {STRUCT_FLD(field_name,
"trx_mysql_thread_id"),
409 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
410 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
411 STRUCT_FLD(value, 0),
412 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
413 STRUCT_FLD(old_name,
""),
414 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
416 #define IDX_TRX_QUERY 7
417 {STRUCT_FLD(field_name,
"trx_query"),
419 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
420 STRUCT_FLD(value, 0),
421 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
422 STRUCT_FLD(old_name,
""),
423 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
425 #define IDX_TRX_OPERATION_STATE 8
426 {STRUCT_FLD(field_name,
"trx_operation_state"),
428 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
429 STRUCT_FLD(value, 0),
430 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
431 STRUCT_FLD(old_name,
""),
432 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
434 #define IDX_TRX_TABLES_IN_USE 9
435 {STRUCT_FLD(field_name,
"trx_tables_in_use"),
436 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
437 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
438 STRUCT_FLD(value, 0),
439 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
440 STRUCT_FLD(old_name,
""),
441 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
443 #define IDX_TRX_TABLES_LOCKED 10
444 {STRUCT_FLD(field_name,
"trx_tables_locked"),
445 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
446 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
447 STRUCT_FLD(value, 0),
448 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
449 STRUCT_FLD(old_name,
""),
450 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
452 #define IDX_TRX_LOCK_STRUCTS 11
453 {STRUCT_FLD(field_name,
"trx_lock_structs"),
454 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
455 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
456 STRUCT_FLD(value, 0),
457 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
458 STRUCT_FLD(old_name,
""),
459 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
461 #define IDX_TRX_LOCK_MEMORY_BYTES 12
462 {STRUCT_FLD(field_name,
"trx_lock_memory_bytes"),
463 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
464 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
465 STRUCT_FLD(value, 0),
466 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
467 STRUCT_FLD(old_name,
""),
468 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
470 #define IDX_TRX_ROWS_LOCKED 13
471 {STRUCT_FLD(field_name,
"trx_rows_locked"),
472 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
473 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
474 STRUCT_FLD(value, 0),
475 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
476 STRUCT_FLD(old_name,
""),
477 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
479 #define IDX_TRX_ROWS_MODIFIED 14
480 {STRUCT_FLD(field_name,
"trx_rows_modified"),
481 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
482 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
483 STRUCT_FLD(value, 0),
484 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
485 STRUCT_FLD(old_name,
""),
486 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
488 #define IDX_TRX_CONNCURRENCY_TICKETS 15
489 {STRUCT_FLD(field_name,
"trx_concurrency_tickets"),
490 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
491 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
492 STRUCT_FLD(value, 0),
493 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
494 STRUCT_FLD(old_name,
""),
495 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
497 #define IDX_TRX_ISOLATION_LEVEL 16
498 {STRUCT_FLD(field_name,
"trx_isolation_level"),
500 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
501 STRUCT_FLD(value, 0),
502 STRUCT_FLD(field_flags, 0),
503 STRUCT_FLD(old_name,
""),
504 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
506 #define IDX_TRX_UNIQUE_CHECKS 17
507 {STRUCT_FLD(field_name,
"trx_unique_checks"),
508 STRUCT_FLD(field_length, 1),
509 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
510 STRUCT_FLD(value, 1),
511 STRUCT_FLD(field_flags, 0),
512 STRUCT_FLD(old_name,
""),
513 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
515 #define IDX_TRX_FOREIGN_KEY_CHECKS 18
516 {STRUCT_FLD(field_name,
"trx_foreign_key_checks"),
517 STRUCT_FLD(field_length, 1),
518 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
519 STRUCT_FLD(value, 1),
520 STRUCT_FLD(field_flags, 0),
521 STRUCT_FLD(old_name,
""),
522 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
524 #define IDX_TRX_LAST_FOREIGN_KEY_ERROR 19
525 {STRUCT_FLD(field_name,
"trx_last_foreign_key_error"),
527 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
528 STRUCT_FLD(value, 0),
529 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
530 STRUCT_FLD(old_name,
""),
531 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
533 #define IDX_TRX_ADAPTIVE_HASH_LATCHED 20
534 {STRUCT_FLD(field_name,
"trx_adaptive_hash_latched"),
535 STRUCT_FLD(field_length, 1),
536 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
537 STRUCT_FLD(value, 0),
538 STRUCT_FLD(field_flags, 0),
539 STRUCT_FLD(old_name,
""),
540 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
542 #define IDX_TRX_ADAPTIVE_HASH_TIMEOUT 21
543 {STRUCT_FLD(field_name,
"trx_adaptive_hash_timeout"),
544 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
545 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
546 STRUCT_FLD(value, 0),
547 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
548 STRUCT_FLD(old_name,
""),
549 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
551 #define IDX_TRX_READ_ONLY 22
552 {STRUCT_FLD(field_name,
"trx_is_read_only"),
553 STRUCT_FLD(field_length, 1),
554 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
555 STRUCT_FLD(value, 0),
556 STRUCT_FLD(field_flags, 0),
557 STRUCT_FLD(old_name,
""),
558 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
560 #define IDX_TRX_AUTOCOMMIT_NON_LOCKING 23
561 {STRUCT_FLD(field_name,
"trx_autocommit_non_locking"),
562 STRUCT_FLD(field_length, 1),
563 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
564 STRUCT_FLD(value, 0),
565 STRUCT_FLD(field_flags, 0),
566 STRUCT_FLD(old_name,
""),
567 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
578 fill_innodb_trx_from_cache(
590 DBUG_ENTER(
"fill_innodb_trx_from_cache");
592 fields = table->field;
597 for (i = 0; i < rows_num; i++) {
608 OK(field_store_string(fields[IDX_TRX_ID], trx_id));
611 OK(field_store_string(fields[IDX_TRX_STATE],
615 OK(field_store_time_t(fields[IDX_TRX_STARTED],
622 OK(field_store_string(
623 fields[IDX_TRX_REQUESTED_LOCK_ID],
626 lock_id,
sizeof(lock_id))));
629 OK(field_store_time_t(
630 fields[IDX_TRX_WAIT_STARTED],
632 fields[IDX_TRX_WAIT_STARTED]->set_notnull();
635 fields[IDX_TRX_REQUESTED_LOCK_ID]->set_null();
636 fields[IDX_TRX_WAIT_STARTED]->set_null();
640 OK(fields[IDX_TRX_WEIGHT]->store((longlong) row->
trx_weight,
644 OK(fields[IDX_TRX_MYSQL_THREAD_ID]->store(
651 fields[IDX_TRX_QUERY]->store(
654 fields[IDX_TRX_QUERY]->set_notnull();
656 fields[IDX_TRX_QUERY]->set_null();
660 OK(field_store_string(fields[IDX_TRX_OPERATION_STATE],
664 OK(fields[IDX_TRX_TABLES_IN_USE]->store(
668 OK(fields[IDX_TRX_TABLES_LOCKED]->store(
672 OK(fields[IDX_TRX_LOCK_STRUCTS]->store(
676 OK(fields[IDX_TRX_LOCK_MEMORY_BYTES]->store(
680 OK(fields[IDX_TRX_ROWS_LOCKED]->store(
684 OK(fields[IDX_TRX_ROWS_MODIFIED]->store(
688 OK(fields[IDX_TRX_CONNCURRENCY_TICKETS]->store(
692 OK(field_store_string(fields[IDX_TRX_ISOLATION_LEVEL],
696 OK(fields[IDX_TRX_UNIQUE_CHECKS]->store(
700 OK(fields[IDX_TRX_FOREIGN_KEY_CHECKS]->store(
704 OK(field_store_string(fields[IDX_TRX_LAST_FOREIGN_KEY_ERROR],
708 OK(fields[IDX_TRX_ADAPTIVE_HASH_LATCHED]->store(
712 OK(fields[IDX_TRX_ADAPTIVE_HASH_TIMEOUT]->store(
716 OK(fields[IDX_TRX_READ_ONLY]->store(
720 OK(fields[IDX_TRX_AUTOCOMMIT_NON_LOCKING]->store(
724 OK(schema_table_store_record(thd, table));
741 DBUG_ENTER(
"innodb_trx_init");
745 schema->fields_info = innodb_trx_fields_info;
746 schema->fill_table = trx_i_s_common_fill_table;
753 MYSQL_INFORMATION_SCHEMA_INTERFACE_VERSION
760 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
764 STRUCT_FLD(info, &i_s_info),
768 STRUCT_FLD(
name,
"INNODB_TRX"),
772 STRUCT_FLD(author, plugin_author),
776 STRUCT_FLD(
descr,
"InnoDB transactions"),
780 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
784 STRUCT_FLD(init, innodb_trx_init),
788 STRUCT_FLD(deinit, i_s_common_deinit),
792 STRUCT_FLD(version, INNODB_VERSION_SHORT),
795 STRUCT_FLD(status_vars, NULL),
798 STRUCT_FLD(system_vars, NULL),
802 STRUCT_FLD(__reserved1, NULL),
806 STRUCT_FLD(
flags, 0UL),
812 #define IDX_LOCK_ID 0
813 {STRUCT_FLD(field_name,
"lock_id"),
815 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
816 STRUCT_FLD(value, 0),
817 STRUCT_FLD(field_flags, 0),
818 STRUCT_FLD(old_name,
""),
819 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
821 #define IDX_LOCK_TRX_ID 1
822 {STRUCT_FLD(field_name,
"lock_trx_id"),
824 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
825 STRUCT_FLD(value, 0),
826 STRUCT_FLD(field_flags, 0),
827 STRUCT_FLD(old_name,
""),
828 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
830 #define IDX_LOCK_MODE 2
831 {STRUCT_FLD(field_name,
"lock_mode"),
833 STRUCT_FLD(field_length, 32),
834 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
835 STRUCT_FLD(value, 0),
836 STRUCT_FLD(field_flags, 0),
837 STRUCT_FLD(old_name,
""),
838 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
840 #define IDX_LOCK_TYPE 3
841 {STRUCT_FLD(field_name,
"lock_type"),
842 STRUCT_FLD(field_length, 32 ),
843 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
844 STRUCT_FLD(value, 0),
845 STRUCT_FLD(field_flags, 0),
846 STRUCT_FLD(old_name,
""),
847 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
849 #define IDX_LOCK_TABLE 4
850 {STRUCT_FLD(field_name,
"lock_table"),
851 STRUCT_FLD(field_length, 1024),
852 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
853 STRUCT_FLD(value, 0),
854 STRUCT_FLD(field_flags, 0),
855 STRUCT_FLD(old_name,
""),
856 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
858 #define IDX_LOCK_INDEX 5
859 {STRUCT_FLD(field_name,
"lock_index"),
860 STRUCT_FLD(field_length, 1024),
861 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
862 STRUCT_FLD(value, 0),
863 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
864 STRUCT_FLD(old_name,
""),
865 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
867 #define IDX_LOCK_SPACE 6
868 {STRUCT_FLD(field_name,
"lock_space"),
869 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
870 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
871 STRUCT_FLD(value, 0),
872 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
873 STRUCT_FLD(old_name,
""),
874 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
876 #define IDX_LOCK_PAGE 7
877 {STRUCT_FLD(field_name,
"lock_page"),
878 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
879 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
880 STRUCT_FLD(value, 0),
881 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
882 STRUCT_FLD(old_name,
""),
883 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
885 #define IDX_LOCK_REC 8
886 {STRUCT_FLD(field_name,
"lock_rec"),
887 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
888 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
889 STRUCT_FLD(value, 0),
890 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED | MY_I_S_MAYBE_NULL),
891 STRUCT_FLD(old_name,
""),
892 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
894 #define IDX_LOCK_DATA 9
895 {STRUCT_FLD(field_name,
"lock_data"),
897 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
898 STRUCT_FLD(value, 0),
899 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
900 STRUCT_FLD(old_name,
""),
901 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
912 fill_innodb_locks_from_cache(
923 DBUG_ENTER(
"fill_innodb_locks_from_cache");
925 fields = table->field;
930 for (i = 0; i < rows_num; i++) {
933 char buf[MAX_FULL_NAME_LEN + 1];
944 OK(field_store_string(fields[IDX_LOCK_ID],
950 OK(field_store_string(fields[IDX_LOCK_TRX_ID], lock_trx_id));
953 OK(field_store_string(fields[IDX_LOCK_MODE],
957 OK(field_store_string(fields[IDX_LOCK_TYPE],
965 OK(fields[IDX_LOCK_TABLE]->store(buf, bufend - buf,
966 system_charset_info));
970 OK(field_store_index_name(fields[IDX_LOCK_INDEX],
973 fields[IDX_LOCK_INDEX]->set_null();
977 OK(field_store_ulint(fields[IDX_LOCK_SPACE],
981 OK(field_store_ulint(fields[IDX_LOCK_PAGE],
985 OK(field_store_ulint(fields[IDX_LOCK_REC],
989 OK(field_store_string(fields[IDX_LOCK_DATA],
992 OK(schema_table_store_record(thd, table));
1009 DBUG_ENTER(
"innodb_locks_init");
1013 schema->fields_info = innodb_locks_fields_info;
1014 schema->fill_table = trx_i_s_common_fill_table;
1023 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1027 STRUCT_FLD(info, &i_s_info),
1031 STRUCT_FLD(
name,
"INNODB_LOCKS"),
1035 STRUCT_FLD(author, plugin_author),
1039 STRUCT_FLD(
descr,
"InnoDB conflicting locks"),
1043 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1047 STRUCT_FLD(init, innodb_locks_init),
1051 STRUCT_FLD(deinit, i_s_common_deinit),
1055 STRUCT_FLD(version, INNODB_VERSION_SHORT),
1058 STRUCT_FLD(status_vars, NULL),
1061 STRUCT_FLD(system_vars, NULL),
1065 STRUCT_FLD(__reserved1, NULL),
1069 STRUCT_FLD(
flags, 0UL),
1075 #define IDX_REQUESTING_TRX_ID 0
1076 {STRUCT_FLD(field_name,
"requesting_trx_id"),
1078 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
1079 STRUCT_FLD(value, 0),
1080 STRUCT_FLD(field_flags, 0),
1081 STRUCT_FLD(old_name,
""),
1082 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1084 #define IDX_REQUESTED_LOCK_ID 1
1085 {STRUCT_FLD(field_name,
"requested_lock_id"),
1087 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
1088 STRUCT_FLD(value, 0),
1089 STRUCT_FLD(field_flags, 0),
1090 STRUCT_FLD(old_name,
""),
1091 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1093 #define IDX_BLOCKING_TRX_ID 2
1094 {STRUCT_FLD(field_name,
"blocking_trx_id"),
1096 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
1097 STRUCT_FLD(value, 0),
1098 STRUCT_FLD(field_flags, 0),
1099 STRUCT_FLD(old_name,
""),
1100 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1102 #define IDX_BLOCKING_LOCK_ID 3
1103 {STRUCT_FLD(field_name,
"blocking_lock_id"),
1105 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
1106 STRUCT_FLD(value, 0),
1107 STRUCT_FLD(field_flags, 0),
1108 STRUCT_FLD(old_name,
""),
1109 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1111 END_OF_ST_FIELD_INFO
1120 fill_innodb_lock_waits_from_cache(
1133 DBUG_ENTER(
"fill_innodb_lock_waits_from_cache");
1135 fields = table->field;
1140 for (i = 0; i < rows_num; i++) {
1152 ut_snprintf(requesting_trx_id,
sizeof(requesting_trx_id),
1154 OK(field_store_string(fields[IDX_REQUESTING_TRX_ID],
1155 requesting_trx_id));
1158 OK(field_store_string(
1159 fields[IDX_REQUESTED_LOCK_ID],
1163 sizeof(requested_lock_id))));
1166 ut_snprintf(blocking_trx_id,
sizeof(blocking_trx_id),
1168 OK(field_store_string(fields[IDX_BLOCKING_TRX_ID],
1172 OK(field_store_string(
1173 fields[IDX_BLOCKING_LOCK_ID],
1177 sizeof(blocking_lock_id))));
1179 OK(schema_table_store_record(thd, table));
1190 innodb_lock_waits_init(
1196 DBUG_ENTER(
"innodb_lock_waits_init");
1200 schema->fields_info = innodb_lock_waits_fields_info;
1201 schema->fill_table = trx_i_s_common_fill_table;
1210 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1214 STRUCT_FLD(info, &i_s_info),
1218 STRUCT_FLD(
name,
"INNODB_LOCK_WAITS"),
1222 STRUCT_FLD(author, plugin_author),
1226 STRUCT_FLD(
descr,
"InnoDB which lock is blocking which"),
1230 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1234 STRUCT_FLD(init, innodb_lock_waits_init),
1238 STRUCT_FLD(deinit, i_s_common_deinit),
1242 STRUCT_FLD(version, INNODB_VERSION_SHORT),
1245 STRUCT_FLD(status_vars, NULL),
1248 STRUCT_FLD(system_vars, NULL),
1252 STRUCT_FLD(__reserved1, NULL),
1256 STRUCT_FLD(
flags, 0UL),
1267 trx_i_s_common_fill_table(
1277 DBUG_ENTER(
"trx_i_s_common_fill_table");
1290 table_name = tables->schema_table_name;
1293 RETURN_IF_INNODB_NOT_STARTED(table_name);
1303 fprintf(stderr,
"Warning: data in %s truncated due to "
1304 "memory limit of %d bytes\n", table_name,
1314 if (fill_innodb_trx_from_cache(
1315 cache, thd, tables->table) != 0) {
1322 if (fill_innodb_locks_from_cache(
1323 cache, thd, tables->table) != 0) {
1330 if (fill_innodb_lock_waits_from_cache(
1331 cache, thd, tables->table) != 0) {
1340 "InnoDB: trx_i_s_common_fill_table() was "
1341 "called to fill unknown table: %s.\n"
1342 "This function only knows how to fill "
1343 "innodb_trx, innodb_locks and "
1344 "innodb_lock_waits tables.\n", table_name);
1366 {STRUCT_FLD(field_name,
"page_size"),
1367 STRUCT_FLD(field_length, 5),
1368 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1369 STRUCT_FLD(value, 0),
1370 STRUCT_FLD(field_flags, 0),
1371 STRUCT_FLD(old_name,
"Compressed Page Size"),
1372 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1374 {STRUCT_FLD(field_name,
"compress_ops"),
1375 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1376 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1377 STRUCT_FLD(value, 0),
1378 STRUCT_FLD(field_flags, 0),
1379 STRUCT_FLD(old_name,
"Total Number of Compressions"),
1380 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1382 {STRUCT_FLD(field_name,
"compress_ops_ok"),
1383 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1384 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1385 STRUCT_FLD(value, 0),
1386 STRUCT_FLD(field_flags, 0),
1387 STRUCT_FLD(old_name,
"Total Number of"
1388 " Successful Compressions"),
1389 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1391 {STRUCT_FLD(field_name,
"compress_time"),
1392 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1393 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1394 STRUCT_FLD(value, 0),
1395 STRUCT_FLD(field_flags, 0),
1396 STRUCT_FLD(old_name,
"Total Duration of Compressions,"
1398 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1400 {STRUCT_FLD(field_name,
"uncompress_ops"),
1401 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1402 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1403 STRUCT_FLD(value, 0),
1404 STRUCT_FLD(field_flags, 0),
1405 STRUCT_FLD(old_name,
"Total Number of Decompressions"),
1406 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1408 {STRUCT_FLD(field_name,
"uncompress_time"),
1409 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1410 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1411 STRUCT_FLD(value, 0),
1412 STRUCT_FLD(field_flags, 0),
1413 STRUCT_FLD(old_name,
"Total Duration of Decompressions,"
1415 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1417 END_OF_ST_FIELD_INFO
1437 DBUG_ENTER(
"i_s_cmp_fill_low");
1445 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
1450 table->field[0]->store(UNIV_ZIP_SIZE_MIN << i);
1458 table->field[1]->store(zip_stat->
compressed);
1460 table->field[3]->store(
1463 table->field[5]->store(
1467 memset(zip_stat, 0,
sizeof *zip_stat);
1470 if (schema_table_store_record(thd, table)) {
1476 DBUG_RETURN(status);
1490 return(i_s_cmp_fill_low(thd, tables, cond, FALSE));
1504 return(i_s_cmp_fill_low(thd, tables, cond, TRUE));
1516 DBUG_ENTER(
"i_s_cmp_init");
1519 schema->fields_info = i_s_cmp_fields_info;
1520 schema->fill_table = i_s_cmp_fill;
1534 DBUG_ENTER(
"i_s_cmp_reset_init");
1537 schema->fields_info = i_s_cmp_fields_info;
1538 schema->fill_table = i_s_cmp_reset_fill;
1547 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1551 STRUCT_FLD(info, &i_s_info),
1555 STRUCT_FLD(
name,
"INNODB_CMP"),
1559 STRUCT_FLD(author, plugin_author),
1563 STRUCT_FLD(
descr,
"Statistics for the InnoDB compression"),
1567 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1571 STRUCT_FLD(init, i_s_cmp_init),
1575 STRUCT_FLD(deinit, i_s_common_deinit),
1579 STRUCT_FLD(version, INNODB_VERSION_SHORT),
1582 STRUCT_FLD(status_vars, NULL),
1585 STRUCT_FLD(system_vars, NULL),
1589 STRUCT_FLD(__reserved1, NULL),
1593 STRUCT_FLD(
flags, 0UL),
1600 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1604 STRUCT_FLD(info, &i_s_info),
1608 STRUCT_FLD(
name,
"INNODB_CMP_RESET"),
1612 STRUCT_FLD(author, plugin_author),
1616 STRUCT_FLD(
descr,
"Statistics for the InnoDB compression;"
1617 " reset cumulated counts"),
1621 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1625 STRUCT_FLD(init, i_s_cmp_reset_init),
1629 STRUCT_FLD(deinit, i_s_common_deinit),
1633 STRUCT_FLD(version, INNODB_VERSION_SHORT),
1636 STRUCT_FLD(status_vars, NULL),
1639 STRUCT_FLD(system_vars, NULL),
1643 STRUCT_FLD(__reserved1, NULL),
1647 STRUCT_FLD(
flags, 0UL),
1655 #define IDX_DATABASE_NAME 0
1656 {STRUCT_FLD(field_name,
"database_name"),
1657 STRUCT_FLD(field_length, 192),
1658 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
1659 STRUCT_FLD(value, 0),
1660 STRUCT_FLD(field_flags, 0),
1661 STRUCT_FLD(old_name,
""),
1662 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1664 #define IDX_TABLE_NAME 1
1665 {STRUCT_FLD(field_name,
"table_name"),
1666 STRUCT_FLD(field_length, 192),
1667 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
1668 STRUCT_FLD(value, 0),
1669 STRUCT_FLD(field_flags, 0),
1670 STRUCT_FLD(old_name,
""),
1671 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1673 #define IDX_INDEX_NAME 2
1674 {STRUCT_FLD(field_name,
"index_name"),
1675 STRUCT_FLD(field_length, 192),
1676 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
1677 STRUCT_FLD(value, 0),
1678 STRUCT_FLD(field_flags, 0),
1679 STRUCT_FLD(old_name,
""),
1680 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1682 #define IDX_COMPRESS_OPS 3
1683 {STRUCT_FLD(field_name,
"compress_ops"),
1684 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1685 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1686 STRUCT_FLD(value, 0),
1687 STRUCT_FLD(field_flags, 0),
1688 STRUCT_FLD(old_name,
""),
1689 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1691 #define IDX_COMPRESS_OPS_OK 4
1692 {STRUCT_FLD(field_name,
"compress_ops_ok"),
1693 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1694 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1695 STRUCT_FLD(value, 0),
1696 STRUCT_FLD(field_flags, 0),
1697 STRUCT_FLD(old_name,
""),
1698 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1700 #define IDX_COMPRESS_TIME 5
1701 {STRUCT_FLD(field_name,
"compress_time"),
1702 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1703 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1704 STRUCT_FLD(value, 0),
1705 STRUCT_FLD(field_flags, 0),
1706 STRUCT_FLD(old_name,
""),
1707 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1709 #define IDX_UNCOMPRESS_OPS 6
1710 {STRUCT_FLD(field_name,
"uncompress_ops"),
1711 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1712 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1713 STRUCT_FLD(value, 0),
1714 STRUCT_FLD(field_flags, 0),
1715 STRUCT_FLD(old_name,
""),
1716 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1718 #define IDX_UNCOMPRESS_TIME 7
1719 {STRUCT_FLD(field_name,
"uncompress_time"),
1720 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
1721 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
1722 STRUCT_FLD(value, 0),
1723 STRUCT_FLD(field_flags, 0),
1724 STRUCT_FLD(old_name,
""),
1725 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
1727 END_OF_ST_FIELD_INFO
1737 i_s_cmp_per_index_fill_low(
1744 TABLE* table = tables->table;
1745 Field** fields = table->field;
1748 DBUG_ENTER(
"i_s_cmp_per_index_fill_low");
1756 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
1766 page_zip_stat_per_index_t::iterator iter;
1769 for (iter = snap.begin(), i = 0; iter != snap.end(); iter++, i++) {
1774 if (index != NULL) {
1775 char db_utf8[MAX_DB_UTF8_LEN];
1776 char table_utf8[MAX_TABLE_UTF8_LEN];
1779 db_utf8,
sizeof(db_utf8),
1780 table_utf8,
sizeof(table_utf8));
1782 field_store_string(fields[IDX_DATABASE_NAME], db_utf8);
1783 field_store_string(fields[IDX_TABLE_NAME], table_utf8);
1784 field_store_index_name(fields[IDX_INDEX_NAME],
1789 "index_id:" IB_ID_FMT, iter->first);
1790 field_store_string(fields[IDX_DATABASE_NAME],
1792 field_store_string(fields[IDX_TABLE_NAME],
1794 field_store_string(fields[IDX_INDEX_NAME],
1798 fields[IDX_COMPRESS_OPS]->store(
1799 iter->second.compressed);
1801 fields[IDX_COMPRESS_OPS_OK]->store(
1802 iter->second.compressed_ok);
1804 fields[IDX_COMPRESS_TIME]->store(
1805 (
long) (iter->second.compressed_usec / 1000000));
1807 fields[IDX_UNCOMPRESS_OPS]->store(
1808 iter->second.decompressed);
1810 fields[IDX_UNCOMPRESS_TIME]->store(
1811 (
long) (iter->second.decompressed_usec / 1000000));
1813 if (schema_table_store_record(thd, table)) {
1822 if (i % 1000 == 0) {
1834 DBUG_RETURN(status);
1842 i_s_cmp_per_index_fill(
1848 return(i_s_cmp_per_index_fill_low(thd, tables, cond, FALSE));
1856 i_s_cmp_per_index_reset_fill(
1862 return(i_s_cmp_per_index_fill_low(thd, tables, cond, TRUE));
1870 i_s_cmp_per_index_init(
1874 DBUG_ENTER(
"i_s_cmp_init");
1877 schema->fields_info = i_s_cmp_per_index_fields_info;
1878 schema->fill_table = i_s_cmp_per_index_fill;
1888 i_s_cmp_per_index_reset_init(
1892 DBUG_ENTER(
"i_s_cmp_reset_init");
1895 schema->fields_info = i_s_cmp_per_index_fields_info;
1896 schema->fill_table = i_s_cmp_per_index_reset_fill;
1905 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1909 STRUCT_FLD(info, &i_s_info),
1913 STRUCT_FLD(name,
"INNODB_CMP_PER_INDEX"),
1917 STRUCT_FLD(author, plugin_author),
1921 STRUCT_FLD(
descr,
"Statistics for the InnoDB compression (per index)"),
1925 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1929 STRUCT_FLD(init, i_s_cmp_per_index_init),
1933 STRUCT_FLD(deinit, i_s_common_deinit),
1937 STRUCT_FLD(version, INNODB_VERSION_SHORT),
1940 STRUCT_FLD(status_vars, NULL),
1943 STRUCT_FLD(system_vars, NULL),
1947 STRUCT_FLD(__reserved1, NULL),
1951 STRUCT_FLD(
flags, 0UL),
1958 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
1962 STRUCT_FLD(info, &i_s_info),
1966 STRUCT_FLD(name,
"INNODB_CMP_PER_INDEX_RESET"),
1970 STRUCT_FLD(author, plugin_author),
1974 STRUCT_FLD(
descr,
"Statistics for the InnoDB compression (per index);"
1975 " reset cumulated counts"),
1979 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
1983 STRUCT_FLD(init, i_s_cmp_per_index_reset_init),
1987 STRUCT_FLD(deinit, i_s_common_deinit),
1991 STRUCT_FLD(version, INNODB_VERSION_SHORT),
1994 STRUCT_FLD(status_vars, NULL),
1997 STRUCT_FLD(system_vars, NULL),
2001 STRUCT_FLD(__reserved1, NULL),
2005 STRUCT_FLD(
flags, 0UL),
2011 {STRUCT_FLD(field_name,
"page_size"),
2012 STRUCT_FLD(field_length, 5),
2013 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
2014 STRUCT_FLD(value, 0),
2015 STRUCT_FLD(field_flags, 0),
2016 STRUCT_FLD(old_name,
"Buddy Block Size"),
2017 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2019 {STRUCT_FLD(field_name,
"buffer_pool_instance"),
2020 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
2021 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
2022 STRUCT_FLD(value, 0),
2023 STRUCT_FLD(field_flags, 0),
2024 STRUCT_FLD(old_name,
"Buffer Pool Id"),
2025 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2027 {STRUCT_FLD(field_name,
"pages_used"),
2028 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
2029 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
2030 STRUCT_FLD(value, 0),
2031 STRUCT_FLD(field_flags, 0),
2032 STRUCT_FLD(old_name,
"Currently in Use"),
2033 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2035 {STRUCT_FLD(field_name,
"pages_free"),
2036 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
2037 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
2038 STRUCT_FLD(value, 0),
2039 STRUCT_FLD(field_flags, 0),
2040 STRUCT_FLD(old_name,
"Currently Available"),
2041 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2043 {STRUCT_FLD(field_name,
"relocation_ops"),
2044 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2045 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2046 STRUCT_FLD(value, 0),
2047 STRUCT_FLD(field_flags, 0),
2048 STRUCT_FLD(old_name,
"Total Number of Relocations"),
2049 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2051 {STRUCT_FLD(field_name,
"relocation_time"),
2052 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
2053 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
2054 STRUCT_FLD(value, 0),
2055 STRUCT_FLD(field_flags, 0),
2056 STRUCT_FLD(old_name,
"Total Duration of Relocations,"
2058 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2060 END_OF_ST_FIELD_INFO
2069 i_s_cmpmem_fill_low(
2079 DBUG_ENTER(
"i_s_cmpmem_fill_low");
2087 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
2089 for (ulint i = 0; i < srv_buf_pool_instances; i++) {
2104 table->field[1]->store(i);
2105 table->field[2]->store(buddy_stat->
used);
2109 table->field[4]->store(
2110 (longlong) buddy_stat->
relocated,
true);
2111 table->field[5]->store(
2120 if (schema_table_store_record(thd, table)) {
2133 DBUG_RETURN(status);
2147 return(i_s_cmpmem_fill_low(thd, tables, cond, FALSE));
2155 i_s_cmpmem_reset_fill(
2161 return(i_s_cmpmem_fill_low(thd, tables, cond, TRUE));
2173 DBUG_ENTER(
"i_s_cmpmem_init");
2176 schema->fields_info = i_s_cmpmem_fields_info;
2177 schema->fill_table = i_s_cmpmem_fill;
2187 i_s_cmpmem_reset_init(
2191 DBUG_ENTER(
"i_s_cmpmem_reset_init");
2194 schema->fields_info = i_s_cmpmem_fields_info;
2195 schema->fill_table = i_s_cmpmem_reset_fill;
2204 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
2208 STRUCT_FLD(info, &i_s_info),
2212 STRUCT_FLD(name,
"INNODB_CMPMEM"),
2216 STRUCT_FLD(author, plugin_author),
2220 STRUCT_FLD(
descr,
"Statistics for the InnoDB compressed buffer pool"),
2224 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
2228 STRUCT_FLD(init, i_s_cmpmem_init),
2232 STRUCT_FLD(deinit, i_s_common_deinit),
2236 STRUCT_FLD(version, INNODB_VERSION_SHORT),
2239 STRUCT_FLD(status_vars, NULL),
2242 STRUCT_FLD(system_vars, NULL),
2246 STRUCT_FLD(__reserved1, NULL),
2250 STRUCT_FLD(
flags, 0UL),
2257 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
2261 STRUCT_FLD(info, &i_s_info),
2265 STRUCT_FLD(name,
"INNODB_CMPMEM_RESET"),
2269 STRUCT_FLD(author, plugin_author),
2273 STRUCT_FLD(
descr,
"Statistics for the InnoDB compressed buffer pool;"
2274 " reset cumulated counts"),
2278 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
2282 STRUCT_FLD(init, i_s_cmpmem_reset_init),
2286 STRUCT_FLD(deinit, i_s_common_deinit),
2290 STRUCT_FLD(version, INNODB_VERSION_SHORT),
2293 STRUCT_FLD(status_vars, NULL),
2296 STRUCT_FLD(system_vars, NULL),
2300 STRUCT_FLD(__reserved1, NULL),
2304 STRUCT_FLD(
flags, 0UL),
2310 #define METRIC_NAME 0
2311 {STRUCT_FLD(field_name,
"NAME"),
2312 STRUCT_FLD(field_length, NAME_LEN + 1),
2313 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
2314 STRUCT_FLD(value, 0),
2315 STRUCT_FLD(field_flags, 0),
2316 STRUCT_FLD(old_name,
""),
2317 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2319 #define METRIC_SUBSYS 1
2320 {STRUCT_FLD(field_name,
"SUBSYSTEM"),
2321 STRUCT_FLD(field_length, NAME_LEN + 1),
2322 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
2323 STRUCT_FLD(value, 0),
2324 STRUCT_FLD(field_flags, 0),
2325 STRUCT_FLD(old_name,
""),
2326 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2328 #define METRIC_VALUE_START 2
2329 {STRUCT_FLD(field_name,
"COUNT"),
2330 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2331 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2332 STRUCT_FLD(value, 0),
2333 STRUCT_FLD(field_flags, 0),
2334 STRUCT_FLD(old_name,
""),
2335 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2337 #define METRIC_MAX_VALUE_START 3
2338 {STRUCT_FLD(field_name,
"MAX_COUNT"),
2339 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2340 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2341 STRUCT_FLD(value, 0),
2342 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
2343 STRUCT_FLD(old_name,
""),
2344 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2346 #define METRIC_MIN_VALUE_START 4
2347 {STRUCT_FLD(field_name,
"MIN_COUNT"),
2348 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2349 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2350 STRUCT_FLD(value, 0),
2351 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
2352 STRUCT_FLD(old_name,
""),
2353 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2355 #define METRIC_AVG_VALUE_START 5
2356 {STRUCT_FLD(field_name,
"AVG_COUNT"),
2357 STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
2358 STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
2359 STRUCT_FLD(value, 0),
2360 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
2361 STRUCT_FLD(old_name,
""),
2362 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2364 #define METRIC_VALUE_RESET 6
2365 {STRUCT_FLD(field_name,
"COUNT_RESET"),
2366 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2367 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2368 STRUCT_FLD(value, 0),
2369 STRUCT_FLD(field_flags, 0),
2370 STRUCT_FLD(old_name,
""),
2371 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2373 #define METRIC_MAX_VALUE_RESET 7
2374 {STRUCT_FLD(field_name,
"MAX_COUNT_RESET"),
2375 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2376 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2377 STRUCT_FLD(value, 0),
2378 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
2379 STRUCT_FLD(old_name,
""),
2380 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2382 #define METRIC_MIN_VALUE_RESET 8
2383 {STRUCT_FLD(field_name,
"MIN_COUNT_RESET"),
2384 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2385 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2386 STRUCT_FLD(value, 0),
2387 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
2388 STRUCT_FLD(old_name,
""),
2389 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2391 #define METRIC_AVG_VALUE_RESET 9
2392 {STRUCT_FLD(field_name,
"AVG_COUNT_RESET"),
2393 STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
2394 STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
2395 STRUCT_FLD(value, 0),
2396 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
2397 STRUCT_FLD(old_name,
""),
2398 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2400 #define METRIC_START_TIME 10
2401 {STRUCT_FLD(field_name,
"TIME_ENABLED"),
2402 STRUCT_FLD(field_length, 0),
2403 STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
2404 STRUCT_FLD(value, 0),
2405 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
2406 STRUCT_FLD(old_name,
""),
2407 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2409 #define METRIC_STOP_TIME 11
2410 {STRUCT_FLD(field_name,
"TIME_DISABLED"),
2411 STRUCT_FLD(field_length, 0),
2412 STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
2413 STRUCT_FLD(value, 0),
2414 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
2415 STRUCT_FLD(old_name,
""),
2416 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2418 #define METRIC_TIME_ELAPSED 12
2419 {STRUCT_FLD(field_name,
"TIME_ELAPSED"),
2420 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2421 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2422 STRUCT_FLD(value, 0),
2423 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
2424 STRUCT_FLD(old_name,
""),
2425 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2427 #define METRIC_RESET_TIME 13
2428 {STRUCT_FLD(field_name,
"TIME_RESET"),
2429 STRUCT_FLD(field_length, 0),
2430 STRUCT_FLD(field_type, MYSQL_TYPE_DATETIME),
2431 STRUCT_FLD(value, 0),
2432 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
2433 STRUCT_FLD(old_name,
""),
2434 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2436 #define METRIC_STATUS 14
2437 {STRUCT_FLD(field_name,
"STATUS"),
2438 STRUCT_FLD(field_length, NAME_LEN + 1),
2439 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
2440 STRUCT_FLD(value, 0),
2441 STRUCT_FLD(field_flags, 0),
2442 STRUCT_FLD(old_name,
""),
2443 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2445 #define METRIC_TYPE 15
2446 {STRUCT_FLD(field_name,
"TYPE"),
2447 STRUCT_FLD(field_length, NAME_LEN + 1),
2448 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
2449 STRUCT_FLD(value, 0),
2450 STRUCT_FLD(field_flags, 0),
2451 STRUCT_FLD(old_name,
""),
2452 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2454 #define METRIC_DESC 16
2455 {STRUCT_FLD(field_name,
"COMMENT"),
2456 STRUCT_FLD(field_length, NAME_LEN + 1),
2457 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
2458 STRUCT_FLD(value, 0),
2459 STRUCT_FLD(field_flags, 0),
2460 STRUCT_FLD(old_name,
""),
2461 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2463 END_OF_ST_FIELD_INFO
2474 TABLE* table_to_fill)
2478 double time_diff = 0;
2483 DBUG_ENTER(
"i_s_metrics_fill");
2484 fields = table_to_fill->field;
2486 for (count = 0; count < NUM_MONITOR; count++) {
2510 OK(field_store_string(fields[METRIC_NAME],
2513 OK(field_store_string(fields[METRIC_SUBSYS],
2516 OK(field_store_string(fields[METRIC_DESC],
2520 OK(fields[METRIC_VALUE_RESET]->store(
2521 MONITOR_VALUE(count), FALSE));
2523 OK(fields[METRIC_VALUE_START]->store(
2524 MONITOR_VALUE_SINCE_START(count), FALSE));
2529 if (MONITOR_MAX_VALUE(count) == MAX_RESERVED
2531 fields[METRIC_MAX_VALUE_RESET]->set_null();
2533 OK(fields[METRIC_MAX_VALUE_RESET]->store(
2534 MONITOR_MAX_VALUE(count), FALSE));
2535 fields[METRIC_MAX_VALUE_RESET]->set_notnull();
2543 fields[METRIC_MIN_VALUE_RESET]->set_null();
2545 OK(fields[METRIC_MIN_VALUE_RESET]->store(
2546 MONITOR_MIN_VALUE(count), FALSE));
2547 fields[METRIC_MIN_VALUE_RESET]->set_notnull();
2553 if (max_val == MAX_RESERVED
2555 fields[METRIC_MAX_VALUE_START]->set_null();
2557 OK(fields[METRIC_MAX_VALUE_START]->store(
2559 fields[METRIC_MAX_VALUE_START]->set_notnull();
2567 fields[METRIC_MIN_VALUE_START]->set_null();
2569 OK(fields[METRIC_MIN_VALUE_START]->store(
2572 fields[METRIC_MIN_VALUE_START]->set_notnull();
2579 OK(field_store_time_t(fields[METRIC_START_TIME],
2581 fields[METRIC_START_TIME]->set_notnull();
2589 time_diff = difftime(time(NULL),
2592 time_diff = difftime(
2597 OK(fields[METRIC_TIME_ELAPSED]->store(
2599 fields[METRIC_TIME_ELAPSED]->set_notnull();
2601 fields[METRIC_START_TIME]->set_null();
2602 fields[METRIC_TIME_ELAPSED]->set_null();
2618 = MONITOR_VALUE_SINCE_START(
2622 OK(fields[METRIC_AVG_VALUE_START]->store(
2623 MONITOR_VALUE_SINCE_START(count)
2624 / value_start, FALSE));
2626 fields[METRIC_AVG_VALUE_START]->set_notnull();
2628 fields[METRIC_AVG_VALUE_START]->set_null();
2632 OK(fields[METRIC_AVG_VALUE_RESET]->store(
2633 MONITOR_VALUE(count)
2638 fields[METRIC_AVG_VALUE_RESET]->set_null();
2644 OK(fields[METRIC_AVG_VALUE_START]->store(
2645 (
double) MONITOR_VALUE_SINCE_START(
2646 count) / time_diff));
2647 fields[METRIC_AVG_VALUE_START]->set_notnull();
2649 fields[METRIC_AVG_VALUE_START]->set_null();
2656 time_diff = difftime(
2658 count, mon_reset_time));
2660 time_diff = difftime(
2669 OK(fields[METRIC_AVG_VALUE_RESET]->store(
2670 (
double )MONITOR_VALUE(count)
2672 fields[METRIC_AVG_VALUE_RESET]->set_notnull();
2674 fields[METRIC_AVG_VALUE_RESET]->set_null();
2677 fields[METRIC_AVG_VALUE_START]->set_null();
2678 fields[METRIC_AVG_VALUE_RESET]->set_null();
2684 fields[METRIC_STOP_TIME]->set_null();
2689 OK(field_store_time_t(
2690 fields[METRIC_RESET_TIME],
2692 count, mon_reset_time)));
2693 fields[METRIC_RESET_TIME]->set_notnull();
2695 fields[METRIC_RESET_TIME]->set_null();
2699 OK(field_store_string(fields[METRIC_STATUS],
2703 OK(field_store_time_t(fields[METRIC_STOP_TIME],
2705 fields[METRIC_STOP_TIME]->set_notnull();
2707 fields[METRIC_STOP_TIME]->set_null();
2710 fields[METRIC_RESET_TIME]->set_null();
2712 OK(field_store_string(fields[METRIC_STATUS],
2717 OK(field_store_string(fields[METRIC_TYPE],
2720 OK(field_store_string(fields[METRIC_TYPE],
2723 OK(field_store_string(fields[METRIC_TYPE],
2726 OK(field_store_string(fields[METRIC_TYPE],
2729 OK(field_store_string(fields[METRIC_TYPE],
2733 OK(schema_table_store_record(thd, table_to_fill));
2744 i_s_metrics_fill_table(
2750 DBUG_ENTER(
"i_s_metrics_fill_table");
2757 i_s_metrics_fill(thd, tables->table);
2766 innodb_metrics_init(
2772 DBUG_ENTER(
"innodb_metrics_init");
2776 schema->fields_info = innodb_metrics_fields_info;
2777 schema->fill_table = i_s_metrics_fill_table;
2786 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
2790 STRUCT_FLD(info, &i_s_info),
2794 STRUCT_FLD(name,
"INNODB_METRICS"),
2798 STRUCT_FLD(author, plugin_author),
2802 STRUCT_FLD(
descr,
"InnoDB Metrics Info"),
2806 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
2810 STRUCT_FLD(init, innodb_metrics_init),
2814 STRUCT_FLD(deinit, i_s_common_deinit),
2818 STRUCT_FLD(version, INNODB_VERSION_SHORT),
2821 STRUCT_FLD(status_vars, NULL),
2824 STRUCT_FLD(system_vars, NULL),
2828 STRUCT_FLD(__reserved1, NULL),
2832 STRUCT_FLD(
flags, 0UL),
2837 #define STOPWORD_VALUE 0
2838 {STRUCT_FLD(field_name,
"value"),
2840 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
2841 STRUCT_FLD(value, 0),
2842 STRUCT_FLD(field_flags, 0),
2843 STRUCT_FLD(old_name,
""),
2844 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2846 END_OF_ST_FIELD_INFO
2864 DBUG_ENTER(
"i_s_stopword_fill");
2866 fields = table->field;
2871 OK(field_store_string(fields[STOPWORD_VALUE],
2874 OK(schema_table_store_record(thd, table));
2890 DBUG_ENTER(
"i_s_stopword_init");
2893 schema->fields_info = i_s_stopword_fields_info;
2894 schema->fill_table = i_s_stopword_fill;
2903 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
2907 STRUCT_FLD(info, &i_s_stopword_fields_info),
2911 STRUCT_FLD(name,
"INNODB_FT_DEFAULT_STOPWORD"),
2915 STRUCT_FLD(author, plugin_author),
2919 STRUCT_FLD(
descr,
"Default stopword list for InnDB Full Text Search"),
2923 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
2927 STRUCT_FLD(init, i_s_stopword_init),
2931 STRUCT_FLD(deinit, i_s_common_deinit),
2935 STRUCT_FLD(version, INNODB_VERSION_SHORT),
2938 STRUCT_FLD(status_vars, NULL),
2941 STRUCT_FLD(system_vars, NULL),
2945 STRUCT_FLD(__reserved1, NULL),
2949 STRUCT_FLD(
flags, 0UL),
2956 #define I_S_FTS_DOC_ID 0
2957 {STRUCT_FLD(field_name,
"DOC_ID"),
2958 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
2959 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
2960 STRUCT_FLD(value, 0),
2961 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
2962 STRUCT_FLD(old_name,
""),
2963 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
2965 END_OF_ST_FIELD_INFO
2974 i_s_fts_deleted_generic_fill(
2978 ibool being_deleted)
2987 DBUG_ENTER(
"i_s_fts_deleted_generic_fill");
3008 trx->
op_info =
"Select for FTS DELETE TABLE";
3011 (being_deleted) ?
"BEING_DELETED" :
"DELETED",
3016 fields = table->field;
3018 for (ulint j = 0; j < ib_vector_size(deleted->doc_ids); ++j) {
3021 doc_id = *(
doc_id_t*) ib_vector_get_const(deleted->doc_ids, j);
3023 OK(fields[I_S_FTS_DOC_ID]->store((longlong) doc_id,
true));
3025 OK(schema_table_store_record(thd, table));
3042 i_s_fts_deleted_fill(
3048 DBUG_ENTER(
"i_s_fts_deleted_fill");
3050 DBUG_RETURN(i_s_fts_deleted_generic_fill(thd, tables, FALSE));
3058 i_s_fts_deleted_init(
3062 DBUG_ENTER(
"i_s_fts_deleted_init");
3065 schema->fields_info = i_s_fts_doc_fields_info;
3066 schema->fill_table = i_s_fts_deleted_fill;
3075 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
3079 STRUCT_FLD(info, &i_s_fts_doc_fields_info),
3083 STRUCT_FLD(name,
"INNODB_FT_DELETED"),
3087 STRUCT_FLD(author, plugin_author),
3091 STRUCT_FLD(
descr,
"INNODB AUXILIARY FTS DELETED TABLE"),
3095 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
3099 STRUCT_FLD(init, i_s_fts_deleted_init),
3103 STRUCT_FLD(deinit, i_s_common_deinit),
3107 STRUCT_FLD(version, INNODB_VERSION_SHORT),
3110 STRUCT_FLD(status_vars, NULL),
3113 STRUCT_FLD(system_vars, NULL),
3117 STRUCT_FLD(__reserved1, NULL),
3121 STRUCT_FLD(
flags, 0UL),
3129 i_s_fts_being_deleted_fill(
3135 DBUG_ENTER(
"i_s_fts_being_deleted_fill");
3137 DBUG_RETURN(i_s_fts_deleted_generic_fill(thd, tables, TRUE));
3145 i_s_fts_being_deleted_init(
3149 DBUG_ENTER(
"i_s_fts_deleted_init");
3152 schema->fields_info = i_s_fts_doc_fields_info;
3153 schema->fill_table = i_s_fts_being_deleted_fill;
3162 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
3166 STRUCT_FLD(info, &i_s_fts_doc_fields_info),
3170 STRUCT_FLD(name,
"INNODB_FT_BEING_DELETED"),
3174 STRUCT_FLD(author, plugin_author),
3178 STRUCT_FLD(
descr,
"INNODB AUXILIARY FTS BEING DELETED TABLE"),
3182 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
3186 STRUCT_FLD(init, i_s_fts_being_deleted_init),
3190 STRUCT_FLD(deinit, i_s_common_deinit),
3194 STRUCT_FLD(version, INNODB_VERSION_SHORT),
3197 STRUCT_FLD(status_vars, NULL),
3200 STRUCT_FLD(system_vars, NULL),
3204 STRUCT_FLD(__reserved1, NULL),
3208 STRUCT_FLD(
flags, 0UL),
3215 #define I_S_FTS_WORD 0
3216 {STRUCT_FLD(field_name,
"WORD"),
3218 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3219 STRUCT_FLD(value, 0),
3220 STRUCT_FLD(field_flags, 0),
3221 STRUCT_FLD(old_name,
""),
3222 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3224 #define I_S_FTS_FIRST_DOC_ID 1
3225 {STRUCT_FLD(field_name,
"FIRST_DOC_ID"),
3226 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3227 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3228 STRUCT_FLD(value, 0),
3229 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3230 STRUCT_FLD(old_name,
""),
3231 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3233 #define I_S_FTS_LAST_DOC_ID 2
3234 {STRUCT_FLD(field_name,
"LAST_DOC_ID"),
3235 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3236 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3237 STRUCT_FLD(value, 0),
3238 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3239 STRUCT_FLD(old_name,
""),
3240 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3242 #define I_S_FTS_DOC_COUNT 3
3243 {STRUCT_FLD(field_name,
"DOC_COUNT"),
3244 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3245 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3246 STRUCT_FLD(value, 0),
3247 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3248 STRUCT_FLD(old_name,
""),
3249 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3251 #define I_S_FTS_ILIST_DOC_ID 4
3252 {STRUCT_FLD(field_name,
"DOC_ID"),
3253 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3254 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3255 STRUCT_FLD(value, 0),
3256 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3257 STRUCT_FLD(old_name,
""),
3258 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3260 #define I_S_FTS_ILIST_DOC_POS 5
3261 {STRUCT_FLD(field_name,
"POSITION"),
3262 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3263 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3264 STRUCT_FLD(value, 0),
3265 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3266 STRUCT_FLD(old_name,
""),
3267 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3269 END_OF_ST_FIELD_INFO
3278 i_s_fts_index_cache_fill_one_index(
3288 DBUG_ENTER(
"i_s_fts_index_cache_fill_one_index");
3290 fields = table->field;
3303 for (ulint i = 0; i < ib_vector_size(word->
nodes); i++) {
3313 while (decoded < node->ilist_size) {
3322 OK(field_store_string(
3323 fields[I_S_FTS_WORD],
3324 reinterpret_cast<const char*>
3327 OK(fields[I_S_FTS_FIRST_DOC_ID]->store(
3331 OK(fields[I_S_FTS_LAST_DOC_ID]->store(
3335 OK(fields[I_S_FTS_DOC_COUNT]->store(
3338 OK(fields[I_S_FTS_ILIST_DOC_ID]->store(
3339 (longlong) doc_id,
true));
3341 OK(fields[I_S_FTS_ILIST_DOC_POS]->store(
3344 OK(schema_table_store_record(
3350 decoded = ptr - (byte*) node->
ilist;
3362 i_s_fts_index_cache_fill(
3371 DBUG_ENTER(
"i_s_fts_index_cache_fill");
3389 cache = user_table->fts->
cache;
3393 for (ulint i = 0; i < ib_vector_size(cache->
indexes); i++) {
3399 i_s_fts_index_cache_fill_one_index(index_cache, thd, tables);
3412 i_s_fts_index_cache_init(
3416 DBUG_ENTER(
"i_s_fts_index_cache_init");
3419 schema->fields_info = i_s_fts_index_fields_info;
3420 schema->fill_table = i_s_fts_index_cache_fill;
3429 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
3433 STRUCT_FLD(info, &i_s_fts_index_fields_info),
3437 STRUCT_FLD(name,
"INNODB_FT_INDEX_CACHE"),
3441 STRUCT_FLD(author, plugin_author),
3445 STRUCT_FLD(
descr,
"INNODB AUXILIARY FTS INDEX CACHED"),
3449 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
3453 STRUCT_FLD(init, i_s_fts_index_cache_init),
3457 STRUCT_FLD(deinit, i_s_common_deinit),
3461 STRUCT_FLD(version, INNODB_VERSION_SHORT),
3464 STRUCT_FLD(status_vars, NULL),
3467 STRUCT_FLD(system_vars, NULL),
3471 STRUCT_FLD(__reserved1, NULL),
3475 STRUCT_FLD(
flags, 0UL),
3484 i_s_fts_index_table_fill_selected(
3505 trx->
op_info =
"fetching FTS index nodes";
3514 "DECLARE FUNCTION my_func;\n"
3515 "DECLARE CURSOR c IS"
3516 " SELECT word, doc_count, first_doc_id, last_doc_id, "
3522 "WHILE 1 = 1 LOOP\n"
3523 " FETCH c INTO my_func();\n"
3524 " IF c % NOTFOUND THEN\n"
3533 if (error == DB_SUCCESS) {
3543 fprintf(stderr,
" InnoDB: Warning: "
3544 "lock wait timeout reading "
3545 "FTS index. Retrying!\n");
3549 fprintf(stderr,
" InnoDB: Error: %lu "
3550 "while reading FTS index.\n", error);
3571 i_s_fts_index_table_fill_one_index(
3583 DBUG_ENTER(
"i_s_fts_index_cache_fill_one_index");
3588 words = ib_vector_create(ib_heap_allocator_create(
heap),
3591 fields = table->field;
3597 i_s_fts_index_table_fill_selected(index, words, selected);
3600 num_row_fill =
ut_min(ib_vector_size(words), 500000);
3603 for (ulint i = 0; i < num_row_fill; i++) {
3611 for (ulint i = 0; i < ib_vector_size(word->
nodes); i++) {
3622 while (decoded < node->ilist_size) {
3631 OK(field_store_string(
3632 fields[I_S_FTS_WORD],
3633 reinterpret_cast<const char*>
3636 OK(fields[I_S_FTS_FIRST_DOC_ID]->store(
3640 OK(fields[I_S_FTS_LAST_DOC_ID]->store(
3644 OK(fields[I_S_FTS_DOC_COUNT]->store(
3647 OK(fields[I_S_FTS_ILIST_DOC_ID]->store(
3648 (longlong) doc_id,
true));
3650 OK(fields[I_S_FTS_ILIST_DOC_POS]->store(
3653 OK(schema_table_store_record(
3659 decoded = ptr - (byte*) node->
ilist;
3673 i_s_fts_index_table_fill(
3682 DBUG_ENTER(
"i_s_fts_index_table_fill");
3700 for (index = dict_table_get_first_index(user_table);
3701 index; index = dict_table_get_next_index(index)) {
3702 if (index->
type & DICT_FTS) {
3703 i_s_fts_index_table_fill_one_index(index, thd, tables);
3717 i_s_fts_index_table_init(
3721 DBUG_ENTER(
"i_s_fts_index_table_init");
3724 schema->fields_info = i_s_fts_index_fields_info;
3725 schema->fill_table = i_s_fts_index_table_fill;
3734 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
3738 STRUCT_FLD(info, &i_s_fts_index_fields_info),
3742 STRUCT_FLD(name,
"INNODB_FT_INDEX_TABLE"),
3746 STRUCT_FLD(author, plugin_author),
3750 STRUCT_FLD(
descr,
"INNODB AUXILIARY FTS INDEX TABLE"),
3754 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
3758 STRUCT_FLD(init, i_s_fts_index_table_init),
3762 STRUCT_FLD(deinit, i_s_common_deinit),
3766 STRUCT_FLD(version, INNODB_VERSION_SHORT),
3769 STRUCT_FLD(status_vars, NULL),
3772 STRUCT_FLD(system_vars, NULL),
3776 STRUCT_FLD(__reserved1, NULL),
3780 STRUCT_FLD(
flags, 0UL),
3786 #define FTS_CONFIG_KEY 0
3787 {STRUCT_FLD(field_name,
"KEY"),
3788 STRUCT_FLD(field_length, NAME_LEN + 1),
3789 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3790 STRUCT_FLD(value, 0),
3791 STRUCT_FLD(field_flags, 0),
3792 STRUCT_FLD(old_name,
""),
3793 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3795 #define FTS_CONFIG_VALUE 1
3796 {STRUCT_FLD(field_name,
"VALUE"),
3797 STRUCT_FLD(field_length, NAME_LEN + 1),
3798 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
3799 STRUCT_FLD(value, 0),
3800 STRUCT_FLD(field_flags, 0),
3801 STRUCT_FLD(old_name,
""),
3802 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3804 END_OF_ST_FIELD_INFO
3807 static const char* fts_config_key[] = {
3820 i_s_fts_config_fill(
3835 DBUG_ENTER(
"i_s_fts_config_fill");
3846 fields = table->field;
3856 trx->
op_info =
"Select for FTS DELETE TABLE";
3866 while (fts_config_key[i]) {
3869 ulint allocated = FALSE;
3878 fts_config_key[i], index);
3881 key_name = (
char*) fts_config_key[i];
3890 OK(field_store_string(
3891 fields[FTS_CONFIG_KEY], fts_config_key[i]));
3893 OK(field_store_string(
3894 fields[FTS_CONFIG_VALUE], (
const char*) value.
f_str));
3896 OK(schema_table_store_record(thd, table));
3915 i_s_fts_config_init(
3919 DBUG_ENTER(
"i_s_fts_config_init");
3922 schema->fields_info = i_s_fts_config_fields_info;
3923 schema->fill_table = i_s_fts_config_fill;
3932 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
3936 STRUCT_FLD(info, &i_s_fts_config_fields_info),
3940 STRUCT_FLD(name,
"INNODB_FT_CONFIG"),
3944 STRUCT_FLD(author, plugin_author),
3948 STRUCT_FLD(
descr,
"INNODB AUXILIARY FTS CONFIG TABLE"),
3952 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
3956 STRUCT_FLD(init, i_s_fts_config_init),
3960 STRUCT_FLD(deinit, i_s_common_deinit),
3964 STRUCT_FLD(version, INNODB_VERSION_SHORT),
3967 STRUCT_FLD(status_vars, NULL),
3970 STRUCT_FLD(system_vars, NULL),
3974 STRUCT_FLD(__reserved1, NULL),
3978 STRUCT_FLD(
flags, 0UL),
3982 static ST_FIELD_INFO i_s_innodb_buffer_stats_fields_info[] =
3984 #define IDX_BUF_STATS_POOL_ID 0
3985 {STRUCT_FLD(field_name,
"POOL_ID"),
3986 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3987 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3988 STRUCT_FLD(value, 0),
3989 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3990 STRUCT_FLD(old_name,
""),
3991 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
3993 #define IDX_BUF_STATS_POOL_SIZE 1
3994 {STRUCT_FLD(field_name,
"POOL_SIZE"),
3995 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
3996 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
3997 STRUCT_FLD(value, 0),
3998 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
3999 STRUCT_FLD(old_name,
""),
4000 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4002 #define IDX_BUF_STATS_FREE_BUFFERS 2
4003 {STRUCT_FLD(field_name,
"FREE_BUFFERS"),
4004 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4005 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4006 STRUCT_FLD(value, 0),
4007 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4008 STRUCT_FLD(old_name,
""),
4009 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4011 #define IDX_BUF_STATS_LRU_LEN 3
4012 {STRUCT_FLD(field_name,
"DATABASE_PAGES"),
4013 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4014 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4015 STRUCT_FLD(value, 0),
4016 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4017 STRUCT_FLD(old_name,
""),
4018 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4020 #define IDX_BUF_STATS_OLD_LRU_LEN 4
4021 {STRUCT_FLD(field_name,
"OLD_DATABASE_PAGES"),
4022 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4023 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4024 STRUCT_FLD(value, 0),
4025 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4026 STRUCT_FLD(old_name,
""),
4027 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4029 #define IDX_BUF_STATS_FLUSH_LIST_LEN 5
4030 {STRUCT_FLD(field_name,
"MODIFIED_DATABASE_PAGES"),
4031 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4032 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4033 STRUCT_FLD(value, 0),
4034 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4035 STRUCT_FLD(old_name,
""),
4036 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4038 #define IDX_BUF_STATS_PENDING_ZIP 6
4039 {STRUCT_FLD(field_name,
"PENDING_DECOMPRESS"),
4040 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4041 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4042 STRUCT_FLD(value, 0),
4043 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4044 STRUCT_FLD(old_name,
""),
4045 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4047 #define IDX_BUF_STATS_PENDING_READ 7
4048 {STRUCT_FLD(field_name,
"PENDING_READS"),
4049 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4050 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4051 STRUCT_FLD(value, 0),
4052 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4053 STRUCT_FLD(old_name,
""),
4054 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4056 #define IDX_BUF_STATS_FLUSH_LRU 8
4057 {STRUCT_FLD(field_name,
"PENDING_FLUSH_LRU"),
4058 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4059 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4060 STRUCT_FLD(value, 0),
4061 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4062 STRUCT_FLD(old_name,
""),
4063 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4065 #define IDX_BUF_STATS_FLUSH_LIST 9
4066 {STRUCT_FLD(field_name,
"PENDING_FLUSH_LIST"),
4067 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4068 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4069 STRUCT_FLD(value, 0),
4070 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4071 STRUCT_FLD(old_name,
""),
4072 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4074 #define IDX_BUF_STATS_PAGE_YOUNG 10
4075 {STRUCT_FLD(field_name,
"PAGES_MADE_YOUNG"),
4076 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4077 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4078 STRUCT_FLD(value, 0),
4079 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4080 STRUCT_FLD(old_name,
""),
4081 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4083 #define IDX_BUF_STATS_PAGE_NOT_YOUNG 11
4084 {STRUCT_FLD(field_name,
"PAGES_NOT_MADE_YOUNG"),
4085 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4086 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4087 STRUCT_FLD(value, 0),
4088 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4089 STRUCT_FLD(old_name,
""),
4090 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4092 #define IDX_BUF_STATS_PAGE_YOUNG_RATE 12
4093 {STRUCT_FLD(field_name,
"PAGES_MADE_YOUNG_RATE"),
4094 STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
4095 STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
4096 STRUCT_FLD(value, 0),
4097 STRUCT_FLD(field_flags, 0),
4098 STRUCT_FLD(old_name,
""),
4099 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4101 #define IDX_BUF_STATS_PAGE_NOT_YOUNG_RATE 13
4102 {STRUCT_FLD(field_name,
"PAGES_MADE_NOT_YOUNG_RATE"),
4103 STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
4104 STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
4105 STRUCT_FLD(value, 0),
4106 STRUCT_FLD(field_flags, 0),
4107 STRUCT_FLD(old_name,
""),
4108 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4110 #define IDX_BUF_STATS_PAGE_READ 14
4111 {STRUCT_FLD(field_name,
"NUMBER_PAGES_READ"),
4112 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4113 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4114 STRUCT_FLD(value, 0),
4115 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4116 STRUCT_FLD(old_name,
""),
4117 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4119 #define IDX_BUF_STATS_PAGE_CREATED 15
4120 {STRUCT_FLD(field_name,
"NUMBER_PAGES_CREATED"),
4121 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4122 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4123 STRUCT_FLD(value, 0),
4124 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4125 STRUCT_FLD(old_name,
""),
4126 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4128 #define IDX_BUF_STATS_PAGE_WRITTEN 16
4129 {STRUCT_FLD(field_name,
"NUMBER_PAGES_WRITTEN"),
4130 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4131 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4132 STRUCT_FLD(value, 0),
4133 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4134 STRUCT_FLD(old_name,
""),
4135 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4137 #define IDX_BUF_STATS_PAGE_READ_RATE 17
4138 {STRUCT_FLD(field_name,
"PAGES_READ_RATE"),
4139 STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
4140 STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
4141 STRUCT_FLD(value, 0),
4142 STRUCT_FLD(field_flags, 0),
4143 STRUCT_FLD(old_name,
""),
4144 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4146 #define IDX_BUF_STATS_PAGE_CREATE_RATE 18
4147 {STRUCT_FLD(field_name,
"PAGES_CREATE_RATE"),
4148 STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
4149 STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
4150 STRUCT_FLD(value, 0),
4151 STRUCT_FLD(field_flags, 0),
4152 STRUCT_FLD(old_name,
""),
4153 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4155 #define IDX_BUF_STATS_PAGE_WRITTEN_RATE 19
4156 {STRUCT_FLD(field_name,
"PAGES_WRITTEN_RATE"),
4157 STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
4158 STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
4159 STRUCT_FLD(value, 0),
4160 STRUCT_FLD(field_flags, 0),
4161 STRUCT_FLD(old_name,
""),
4162 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4164 #define IDX_BUF_STATS_GET 20
4165 {STRUCT_FLD(field_name,
"NUMBER_PAGES_GET"),
4166 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4167 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4168 STRUCT_FLD(value, 0),
4169 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4170 STRUCT_FLD(old_name,
""),
4171 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4173 #define IDX_BUF_STATS_HIT_RATE 21
4174 {STRUCT_FLD(field_name,
"HIT_RATE"),
4175 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4176 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4177 STRUCT_FLD(value, 0),
4178 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4179 STRUCT_FLD(old_name,
""),
4180 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4182 #define IDX_BUF_STATS_MADE_YOUNG_PCT 22
4183 {STRUCT_FLD(field_name,
"YOUNG_MAKE_PER_THOUSAND_GETS"),
4184 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4185 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4186 STRUCT_FLD(value, 0),
4187 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4188 STRUCT_FLD(old_name,
""),
4189 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4191 #define IDX_BUF_STATS_NOT_MADE_YOUNG_PCT 23
4192 {STRUCT_FLD(field_name,
"NOT_YOUNG_MAKE_PER_THOUSAND_GETS"),
4193 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4194 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4195 STRUCT_FLD(value, 0),
4196 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4197 STRUCT_FLD(old_name,
""),
4198 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4200 #define IDX_BUF_STATS_READ_AHREAD 24
4201 {STRUCT_FLD(field_name,
"NUMBER_PAGES_READ_AHEAD"),
4202 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4203 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4204 STRUCT_FLD(value, 0),
4205 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4206 STRUCT_FLD(old_name,
""),
4207 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4209 #define IDX_BUF_STATS_READ_AHEAD_EVICTED 25
4210 {STRUCT_FLD(field_name,
"NUMBER_READ_AHEAD_EVICTED"),
4211 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4212 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4213 STRUCT_FLD(value, 0),
4214 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4215 STRUCT_FLD(old_name,
""),
4216 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4218 #define IDX_BUF_STATS_READ_AHEAD_RATE 26
4219 {STRUCT_FLD(field_name,
"READ_AHEAD_RATE"),
4220 STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
4221 STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
4222 STRUCT_FLD(value, 0),
4223 STRUCT_FLD(field_flags, 0),
4224 STRUCT_FLD(old_name,
""),
4225 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4227 #define IDX_BUF_STATS_READ_AHEAD_EVICT_RATE 27
4228 {STRUCT_FLD(field_name,
"READ_AHEAD_EVICTED_RATE"),
4229 STRUCT_FLD(field_length, MAX_FLOAT_STR_LENGTH),
4230 STRUCT_FLD(field_type, MYSQL_TYPE_FLOAT),
4231 STRUCT_FLD(value, 0),
4232 STRUCT_FLD(field_flags, 0),
4233 STRUCT_FLD(old_name,
""),
4234 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4236 #define IDX_BUF_STATS_LRU_IO_SUM 28
4237 {STRUCT_FLD(field_name,
"LRU_IO_TOTAL"),
4238 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4239 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4240 STRUCT_FLD(value, 0),
4241 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4242 STRUCT_FLD(old_name,
""),
4243 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4245 #define IDX_BUF_STATS_LRU_IO_CUR 29
4246 {STRUCT_FLD(field_name,
"LRU_IO_CURRENT"),
4247 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4248 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4249 STRUCT_FLD(value, 0),
4250 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4251 STRUCT_FLD(old_name,
""),
4252 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4254 #define IDX_BUF_STATS_UNZIP_SUM 30
4255 {STRUCT_FLD(field_name,
"UNCOMPRESS_TOTAL"),
4256 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4257 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4258 STRUCT_FLD(value, 0),
4259 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4260 STRUCT_FLD(old_name,
""),
4261 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4263 #define IDX_BUF_STATS_UNZIP_CUR 31
4264 {STRUCT_FLD(field_name,
"UNCOMPRESS_CURRENT"),
4265 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4266 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4267 STRUCT_FLD(value, 0),
4268 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4269 STRUCT_FLD(old_name,
""),
4270 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4272 END_OF_ST_FIELD_INFO
4281 i_s_innodb_stats_fill(
4291 DBUG_ENTER(
"i_s_innodb_stats_fill");
4293 table = tables->table;
4295 fields = table->field;
4299 OK(fields[IDX_BUF_STATS_POOL_SIZE]->store(info->
pool_size));
4301 OK(fields[IDX_BUF_STATS_LRU_LEN]->store(info->
lru_len));
4303 OK(fields[IDX_BUF_STATS_OLD_LRU_LEN]->store(info->
old_lru_len));
4305 OK(fields[IDX_BUF_STATS_FREE_BUFFERS]->store(info->
free_list_len));
4307 OK(fields[IDX_BUF_STATS_FLUSH_LIST_LEN]->store(
4310 OK(fields[IDX_BUF_STATS_PENDING_ZIP]->store(info->
n_pend_unzip));
4312 OK(fields[IDX_BUF_STATS_PENDING_READ]->store(info->
n_pend_reads));
4320 OK(fields[IDX_BUF_STATS_PAGE_NOT_YOUNG]->store(
4323 OK(fields[IDX_BUF_STATS_PAGE_YOUNG_RATE]->store(
4326 OK(fields[IDX_BUF_STATS_PAGE_NOT_YOUNG_RATE]->store(
4329 OK(fields[IDX_BUF_STATS_PAGE_READ]->store(info->
n_pages_read));
4335 OK(fields[IDX_BUF_STATS_GET]->store(info->
n_page_gets));
4337 OK(fields[IDX_BUF_STATS_PAGE_READ_RATE]->store(info->
pages_read_rate));
4344 OK(fields[IDX_BUF_STATS_HIT_RATE]->store(
4348 OK(fields[IDX_BUF_STATS_MADE_YOUNG_PCT]->store(
4352 OK(fields[IDX_BUF_STATS_NOT_MADE_YOUNG_PCT]->store(
4356 OK(fields[IDX_BUF_STATS_HIT_RATE]->store(0));
4357 OK(fields[IDX_BUF_STATS_MADE_YOUNG_PCT]->store(0));
4358 OK(fields[IDX_BUF_STATS_NOT_MADE_YOUNG_PCT]->store(0));
4363 OK(fields[IDX_BUF_STATS_READ_AHEAD_EVICTED]->store(
4366 OK(fields[IDX_BUF_STATS_READ_AHEAD_RATE]->store(
4369 OK(fields[IDX_BUF_STATS_READ_AHEAD_EVICT_RATE]->store(
4372 OK(fields[IDX_BUF_STATS_LRU_IO_SUM]->store(info->
io_sum));
4374 OK(fields[IDX_BUF_STATS_LRU_IO_CUR]->store(info->
io_cur));
4376 OK(fields[IDX_BUF_STATS_UNZIP_SUM]->store(info->
unzip_sum));
4378 OK(fields[IDX_BUF_STATS_UNZIP_CUR]->store( info->
unzip_cur));
4380 DBUG_RETURN(schema_table_store_record(thd, table));
4389 i_s_innodb_buffer_stats_fill_table(
4398 DBUG_ENTER(
"i_s_innodb_buffer_fill_general");
4399 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
4407 srv_buf_pool_instances *
sizeof *pool_info);
4410 for (ulint i = 0; i < srv_buf_pool_instances; i++) {
4418 status = i_s_innodb_stats_fill(thd, tables, &pool_info[i]);
4428 DBUG_RETURN(status);
4436 i_s_innodb_buffer_pool_stats_init(
4442 DBUG_ENTER(
"i_s_innodb_buffer_pool_stats_init");
4446 schema->fields_info = i_s_innodb_buffer_stats_fields_info;
4447 schema->fill_table = i_s_innodb_buffer_stats_fill_table;
4456 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
4460 STRUCT_FLD(info, &i_s_info),
4464 STRUCT_FLD(name,
"INNODB_BUFFER_POOL_STATS"),
4468 STRUCT_FLD(author, plugin_author),
4472 STRUCT_FLD(
descr,
"InnoDB Buffer Pool Statistics Information "),
4476 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
4480 STRUCT_FLD(init, i_s_innodb_buffer_pool_stats_init),
4484 STRUCT_FLD(deinit, i_s_common_deinit),
4488 STRUCT_FLD(version, INNODB_VERSION_SHORT),
4491 STRUCT_FLD(status_vars, NULL),
4494 STRUCT_FLD(system_vars, NULL),
4498 STRUCT_FLD(__reserved1, NULL),
4502 STRUCT_FLD(
flags, 0UL),
4508 #define IDX_BUFFER_POOL_ID 0
4509 {STRUCT_FLD(field_name,
"POOL_ID"),
4510 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4511 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4512 STRUCT_FLD(value, 0),
4513 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4514 STRUCT_FLD(old_name,
""),
4515 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4517 #define IDX_BUFFER_BLOCK_ID 1
4518 {STRUCT_FLD(field_name,
"BLOCK_ID"),
4519 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4520 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4521 STRUCT_FLD(value, 0),
4522 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4523 STRUCT_FLD(old_name,
""),
4524 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4526 #define IDX_BUFFER_PAGE_SPACE 2
4527 {STRUCT_FLD(field_name,
"SPACE"),
4528 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4529 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4530 STRUCT_FLD(value, 0),
4531 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4532 STRUCT_FLD(old_name,
""),
4533 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4535 #define IDX_BUFFER_PAGE_NUM 3
4536 {STRUCT_FLD(field_name,
"PAGE_NUMBER"),
4537 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4538 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4539 STRUCT_FLD(value, 0),
4540 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4541 STRUCT_FLD(old_name,
""),
4542 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4544 #define IDX_BUFFER_PAGE_TYPE 4
4545 {STRUCT_FLD(field_name,
"PAGE_TYPE"),
4546 STRUCT_FLD(field_length, 64),
4547 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4548 STRUCT_FLD(value, 0),
4549 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4550 STRUCT_FLD(old_name,
""),
4551 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4553 #define IDX_BUFFER_PAGE_FLUSH_TYPE 5
4554 {STRUCT_FLD(field_name,
"FLUSH_TYPE"),
4555 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4556 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4557 STRUCT_FLD(value, 0),
4558 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4559 STRUCT_FLD(old_name,
""),
4560 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4562 #define IDX_BUFFER_PAGE_FIX_COUNT 6
4563 {STRUCT_FLD(field_name,
"FIX_COUNT"),
4564 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4565 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4566 STRUCT_FLD(value, 0),
4567 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4568 STRUCT_FLD(old_name,
""),
4569 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4571 #define IDX_BUFFER_PAGE_HASHED 7
4572 {STRUCT_FLD(field_name,
"IS_HASHED"),
4573 STRUCT_FLD(field_length, 3),
4574 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4575 STRUCT_FLD(value, 0),
4576 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4577 STRUCT_FLD(old_name,
""),
4578 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4580 #define IDX_BUFFER_PAGE_NEWEST_MOD 8
4581 {STRUCT_FLD(field_name,
"NEWEST_MODIFICATION"),
4582 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4583 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4584 STRUCT_FLD(value, 0),
4585 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4586 STRUCT_FLD(old_name,
""),
4587 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4589 #define IDX_BUFFER_PAGE_OLDEST_MOD 9
4590 {STRUCT_FLD(field_name,
"OLDEST_MODIFICATION"),
4591 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4592 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4593 STRUCT_FLD(value, 0),
4594 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4595 STRUCT_FLD(old_name,
""),
4596 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4598 #define IDX_BUFFER_PAGE_ACCESS_TIME 10
4599 {STRUCT_FLD(field_name,
"ACCESS_TIME"),
4600 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4601 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4602 STRUCT_FLD(value, 0),
4603 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4604 STRUCT_FLD(old_name,
""),
4605 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4607 #define IDX_BUFFER_PAGE_TABLE_NAME 11
4608 {STRUCT_FLD(field_name,
"TABLE_NAME"),
4609 STRUCT_FLD(field_length, 1024),
4610 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4611 STRUCT_FLD(value, 0),
4612 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4613 STRUCT_FLD(old_name,
""),
4614 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4616 #define IDX_BUFFER_PAGE_INDEX_NAME 12
4617 {STRUCT_FLD(field_name,
"INDEX_NAME"),
4618 STRUCT_FLD(field_length, 1024),
4619 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4620 STRUCT_FLD(value, 0),
4621 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4622 STRUCT_FLD(old_name,
""),
4623 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4625 #define IDX_BUFFER_PAGE_NUM_RECS 13
4626 {STRUCT_FLD(field_name,
"NUMBER_RECORDS"),
4627 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4628 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4629 STRUCT_FLD(value, 0),
4630 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4631 STRUCT_FLD(old_name,
""),
4632 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4634 #define IDX_BUFFER_PAGE_DATA_SIZE 14
4635 {STRUCT_FLD(field_name,
"DATA_SIZE"),
4636 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4637 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4638 STRUCT_FLD(value, 0),
4639 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4640 STRUCT_FLD(old_name,
""),
4641 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4643 #define IDX_BUFFER_PAGE_ZIP_SIZE 15
4644 {STRUCT_FLD(field_name,
"COMPRESSED_SIZE"),
4645 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4646 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4647 STRUCT_FLD(value, 0),
4648 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4649 STRUCT_FLD(old_name,
""),
4650 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4652 #define IDX_BUFFER_PAGE_STATE 16
4653 {STRUCT_FLD(field_name,
"PAGE_STATE"),
4654 STRUCT_FLD(field_length, 64),
4655 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4656 STRUCT_FLD(value, 0),
4657 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4658 STRUCT_FLD(old_name,
""),
4659 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4661 #define IDX_BUFFER_PAGE_IO_FIX 17
4662 {STRUCT_FLD(field_name,
"IO_FIX"),
4663 STRUCT_FLD(field_length, 64),
4664 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4665 STRUCT_FLD(value, 0),
4666 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4667 STRUCT_FLD(old_name,
""),
4668 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4670 #define IDX_BUFFER_PAGE_IS_OLD 18
4671 {STRUCT_FLD(field_name,
"IS_OLD"),
4672 STRUCT_FLD(field_length, 3),
4673 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
4674 STRUCT_FLD(value, 0),
4675 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
4676 STRUCT_FLD(old_name,
""),
4677 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4679 #define IDX_BUFFER_PAGE_FREE_CLOCK 19
4680 {STRUCT_FLD(field_name,
"FREE_PAGE_CLOCK"),
4681 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
4682 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
4683 STRUCT_FLD(value, 0),
4684 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
4685 STRUCT_FLD(old_name,
""),
4686 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
4688 END_OF_ST_FIELD_INFO
4697 i_s_innodb_buffer_page_fill(
4709 DBUG_ENTER(
"i_s_innodb_buffer_page_fill");
4711 table = tables->table;
4713 fields = table->field;
4716 for (ulint i = 0; i < num_page; i++) {
4718 char table_name[MAX_FULL_NAME_LEN + 1];
4719 const char* table_name_end = NULL;
4720 const char* state_str;
4723 page_info = info_array +
i;
4727 OK(fields[IDX_BUFFER_POOL_ID]->store(page_info->
pool_id));
4729 OK(fields[IDX_BUFFER_BLOCK_ID]->store(page_info->
block_id));
4731 OK(fields[IDX_BUFFER_PAGE_SPACE]->store(page_info->
space_id));
4733 OK(fields[IDX_BUFFER_PAGE_NUM]->store(page_info->
page_num));
4735 OK(field_store_string(
4736 fields[IDX_BUFFER_PAGE_TYPE],
4739 OK(fields[IDX_BUFFER_PAGE_FLUSH_TYPE]->store(
4742 OK(fields[IDX_BUFFER_PAGE_FIX_COUNT]->store(
4746 OK(field_store_string(
4747 fields[IDX_BUFFER_PAGE_HASHED],
"YES"));
4749 OK(field_store_string(
4750 fields[IDX_BUFFER_PAGE_HASHED],
"NO"));
4753 OK(fields[IDX_BUFFER_PAGE_NEWEST_MOD]->store(
4756 OK(fields[IDX_BUFFER_PAGE_OLDEST_MOD]->store(
4759 OK(fields[IDX_BUFFER_PAGE_ACCESS_TIME]->store(
4762 fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_null();
4764 fields[IDX_BUFFER_PAGE_INDEX_NAME]->set_null();
4778 table_name,
sizeof(table_name),
4783 OK(fields[IDX_BUFFER_PAGE_TABLE_NAME]->store(
4785 table_name_end - table_name,
4786 system_charset_info));
4787 fields[IDX_BUFFER_PAGE_TABLE_NAME]->set_notnull();
4789 OK(field_store_index_name(
4790 fields[IDX_BUFFER_PAGE_INDEX_NAME],
4797 OK(fields[IDX_BUFFER_PAGE_NUM_RECS]->store(
4800 OK(fields[IDX_BUFFER_PAGE_DATA_SIZE]->store(
4803 OK(fields[IDX_BUFFER_PAGE_ZIP_SIZE]->store(
4805 ? (UNIV_ZIP_SIZE_MIN >> 1) << page_info->
zip_ssize
4808 #if BUF_PAGE_STATE_BITS > 3
4809 # error "BUF_PAGE_STATE_BITS > 3, please ensure that all 1<<BUF_PAGE_STATE_BITS values are checked for"
4823 state_str =
"NOT_USED";
4826 state_str =
"READY_FOR_USE";
4829 state_str =
"FILE_PAGE";
4832 state_str =
"MEMORY";
4835 state_str =
"REMOVE_HASH";
4839 OK(field_store_string(fields[IDX_BUFFER_PAGE_STATE],
4842 switch (page_info->
io_fix) {
4844 OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
4848 OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
4852 OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
4856 OK(field_store_string(fields[IDX_BUFFER_PAGE_IO_FIX],
4861 OK(field_store_string(fields[IDX_BUFFER_PAGE_IS_OLD],
4862 (page_info->
is_old) ?
"YES" :
"NO"));
4864 OK(fields[IDX_BUFFER_PAGE_FREE_CLOCK]->store(
4867 if (schema_table_store_record(thd, table)) {
4879 i_s_innodb_set_page_type(
4898 == static_cast<index_id_t>(DICT_IBUF_ID_MIN
4907 ? PAGE_NEW_SUPREMUM_END
4908 : PAGE_OLD_SUPREMUM_END)
4918 ut_a(page_type == i_s_page_type[page_type].type_value);
4937 i_s_innodb_buffer_page_get_info(
4998 frame = block->
frame;
5007 i_s_innodb_set_page_type(page_info, page_type, frame);
5019 i_s_innodb_fill_buffer_pool(
5024 const ulint pool_id)
5029 DBUG_ENTER(
"i_s_innodb_fill_buffer_pool");
5030 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
5036 for (ulint n = 0; n < buf_pool->
n_chunks; n++) {
5043 ulint num_to_process = 0;
5050 while (chunk_size > 0) {
5053 num_to_process =
ut_min(chunk_size,
5071 for (n_blocks = num_to_process; n_blocks--; block++) {
5072 i_s_innodb_buffer_page_get_info(
5073 &block->
page, pool_id, block_id,
5074 info_buffer + num_page);
5083 status = i_s_innodb_buffer_page_fill(
5084 thd, tables, info_buffer,
5093 chunk_size -= num_to_process;
5100 DBUG_RETURN(status);
5109 i_s_innodb_buffer_page_fill_table(
5117 DBUG_ENTER(
"i_s_innodb_buffer_page_fill_table");
5125 for (ulint i = 0; i < srv_buf_pool_instances; i++) {
5132 status = i_s_innodb_fill_buffer_pool(thd, tables, buf_pool, i);
5140 DBUG_RETURN(status);
5148 i_s_innodb_buffer_page_init(
5154 DBUG_ENTER(
"i_s_innodb_buffer_page_init");
5158 schema->fields_info = i_s_innodb_buffer_page_fields_info;
5159 schema->fill_table = i_s_innodb_buffer_page_fill_table;
5168 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
5172 STRUCT_FLD(info, &i_s_info),
5176 STRUCT_FLD(name,
"INNODB_BUFFER_PAGE"),
5180 STRUCT_FLD(author, plugin_author),
5184 STRUCT_FLD(
descr,
"InnoDB Buffer Page Information"),
5188 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
5192 STRUCT_FLD(init, i_s_innodb_buffer_page_init),
5196 STRUCT_FLD(deinit, i_s_common_deinit),
5200 STRUCT_FLD(version, INNODB_VERSION_SHORT),
5203 STRUCT_FLD(status_vars, NULL),
5206 STRUCT_FLD(system_vars, NULL),
5210 STRUCT_FLD(__reserved1, NULL),
5214 STRUCT_FLD(
flags, 0UL),
5217 static ST_FIELD_INFO i_s_innodb_buf_page_lru_fields_info[] =
5219 #define IDX_BUF_LRU_POOL_ID 0
5220 {STRUCT_FLD(field_name,
"POOL_ID"),
5221 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5222 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5223 STRUCT_FLD(value, 0),
5224 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5225 STRUCT_FLD(old_name,
""),
5226 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5228 #define IDX_BUF_LRU_POS 1
5229 {STRUCT_FLD(field_name,
"LRU_POSITION"),
5230 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5231 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5232 STRUCT_FLD(value, 0),
5233 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5234 STRUCT_FLD(old_name,
""),
5235 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5237 #define IDX_BUF_LRU_PAGE_SPACE 2
5238 {STRUCT_FLD(field_name,
"SPACE"),
5239 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5240 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5241 STRUCT_FLD(value, 0),
5242 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5243 STRUCT_FLD(old_name,
""),
5244 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5246 #define IDX_BUF_LRU_PAGE_NUM 3
5247 {STRUCT_FLD(field_name,
"PAGE_NUMBER"),
5248 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5249 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5250 STRUCT_FLD(value, 0),
5251 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5252 STRUCT_FLD(old_name,
""),
5253 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5255 #define IDX_BUF_LRU_PAGE_TYPE 4
5256 {STRUCT_FLD(field_name,
"PAGE_TYPE"),
5257 STRUCT_FLD(field_length, 64),
5258 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
5259 STRUCT_FLD(value, 0),
5260 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
5261 STRUCT_FLD(old_name,
""),
5262 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5264 #define IDX_BUF_LRU_PAGE_FLUSH_TYPE 5
5265 {STRUCT_FLD(field_name,
"FLUSH_TYPE"),
5266 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5267 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5268 STRUCT_FLD(value, 0),
5269 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5270 STRUCT_FLD(old_name,
""),
5271 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5273 #define IDX_BUF_LRU_PAGE_FIX_COUNT 6
5274 {STRUCT_FLD(field_name,
"FIX_COUNT"),
5275 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5276 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5277 STRUCT_FLD(value, 0),
5278 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5279 STRUCT_FLD(old_name,
""),
5280 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5282 #define IDX_BUF_LRU_PAGE_HASHED 7
5283 {STRUCT_FLD(field_name,
"IS_HASHED"),
5284 STRUCT_FLD(field_length, 3),
5285 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
5286 STRUCT_FLD(value, 0),
5287 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
5288 STRUCT_FLD(old_name,
""),
5289 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5291 #define IDX_BUF_LRU_PAGE_NEWEST_MOD 8
5292 {STRUCT_FLD(field_name,
"NEWEST_MODIFICATION"),
5293 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5294 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5295 STRUCT_FLD(value, 0),
5296 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5297 STRUCT_FLD(old_name,
""),
5298 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5300 #define IDX_BUF_LRU_PAGE_OLDEST_MOD 9
5301 {STRUCT_FLD(field_name,
"OLDEST_MODIFICATION"),
5302 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5303 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5304 STRUCT_FLD(value, 0),
5305 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5306 STRUCT_FLD(old_name,
""),
5307 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5309 #define IDX_BUF_LRU_PAGE_ACCESS_TIME 10
5310 {STRUCT_FLD(field_name,
"ACCESS_TIME"),
5311 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5312 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5313 STRUCT_FLD(value, 0),
5314 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5315 STRUCT_FLD(old_name,
""),
5316 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5318 #define IDX_BUF_LRU_PAGE_TABLE_NAME 11
5319 {STRUCT_FLD(field_name,
"TABLE_NAME"),
5320 STRUCT_FLD(field_length, 1024),
5321 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
5322 STRUCT_FLD(value, 0),
5323 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
5324 STRUCT_FLD(old_name,
""),
5325 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5327 #define IDX_BUF_LRU_PAGE_INDEX_NAME 12
5328 {STRUCT_FLD(field_name,
"INDEX_NAME"),
5329 STRUCT_FLD(field_length, 1024),
5330 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
5331 STRUCT_FLD(value, 0),
5332 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
5333 STRUCT_FLD(old_name,
""),
5334 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5336 #define IDX_BUF_LRU_PAGE_NUM_RECS 13
5337 {STRUCT_FLD(field_name,
"NUMBER_RECORDS"),
5338 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5339 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5340 STRUCT_FLD(value, 0),
5341 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5342 STRUCT_FLD(old_name,
""),
5343 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5345 #define IDX_BUF_LRU_PAGE_DATA_SIZE 14
5346 {STRUCT_FLD(field_name,
"DATA_SIZE"),
5347 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5348 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5349 STRUCT_FLD(value, 0),
5350 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5351 STRUCT_FLD(old_name,
""),
5352 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5354 #define IDX_BUF_LRU_PAGE_ZIP_SIZE 15
5355 {STRUCT_FLD(field_name,
"COMPRESSED_SIZE"),
5356 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5357 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5358 STRUCT_FLD(value, 0),
5359 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5360 STRUCT_FLD(old_name,
""),
5361 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5363 #define IDX_BUF_LRU_PAGE_STATE 16
5364 {STRUCT_FLD(field_name,
"COMPRESSED"),
5365 STRUCT_FLD(field_length, 3),
5366 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
5367 STRUCT_FLD(value, 0),
5368 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
5369 STRUCT_FLD(old_name,
""),
5370 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5372 #define IDX_BUF_LRU_PAGE_IO_FIX 17
5373 {STRUCT_FLD(field_name,
"IO_FIX"),
5374 STRUCT_FLD(field_length, 64),
5375 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
5376 STRUCT_FLD(value, 0),
5377 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
5378 STRUCT_FLD(old_name,
""),
5379 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5381 #define IDX_BUF_LRU_PAGE_IS_OLD 18
5382 {STRUCT_FLD(field_name,
"IS_OLD"),
5383 STRUCT_FLD(field_length, 3),
5384 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
5385 STRUCT_FLD(value, 0),
5386 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
5387 STRUCT_FLD(old_name,
""),
5388 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5390 #define IDX_BUF_LRU_PAGE_FREE_CLOCK 19
5391 {STRUCT_FLD(field_name,
"FREE_PAGE_CLOCK"),
5392 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5393 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5394 STRUCT_FLD(value, 0),
5395 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5396 STRUCT_FLD(old_name,
""),
5397 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5399 END_OF_ST_FIELD_INFO
5408 i_s_innodb_buf_page_lru_fill(
5421 DBUG_ENTER(
"i_s_innodb_buf_page_lru_fill");
5423 table = tables->table;
5425 fields = table->field;
5430 for (ulint i = 0; i < num_page; i++) {
5432 char table_name[MAX_FULL_NAME_LEN + 1];
5433 const char* table_name_end = NULL;
5434 const char* state_str;
5439 page_info = info_array +
i;
5441 OK(fields[IDX_BUF_LRU_POOL_ID]->store(page_info->
pool_id));
5443 OK(fields[IDX_BUF_LRU_POS]->store(page_info->
block_id));
5445 OK(fields[IDX_BUF_LRU_PAGE_SPACE]->store(page_info->
space_id));
5447 OK(fields[IDX_BUF_LRU_PAGE_NUM]->store(page_info->
page_num));
5449 OK(field_store_string(
5450 fields[IDX_BUF_LRU_PAGE_TYPE],
5453 OK(fields[IDX_BUF_LRU_PAGE_FLUSH_TYPE]->store(
5456 OK(fields[IDX_BUF_LRU_PAGE_FIX_COUNT]->store(
5460 OK(field_store_string(
5461 fields[IDX_BUF_LRU_PAGE_HASHED],
"YES"));
5463 OK(field_store_string(
5464 fields[IDX_BUF_LRU_PAGE_HASHED],
"NO"));
5467 OK(fields[IDX_BUF_LRU_PAGE_NEWEST_MOD]->store(
5470 OK(fields[IDX_BUF_LRU_PAGE_OLDEST_MOD]->store(
5473 OK(fields[IDX_BUF_LRU_PAGE_ACCESS_TIME]->store(
5476 fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->set_null();
5478 fields[IDX_BUF_LRU_PAGE_INDEX_NAME]->set_null();
5492 table_name,
sizeof(table_name),
5497 OK(fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->store(
5499 table_name_end - table_name,
5500 system_charset_info));
5501 fields[IDX_BUF_LRU_PAGE_TABLE_NAME]->set_notnull();
5503 OK(field_store_index_name(
5504 fields[IDX_BUF_LRU_PAGE_INDEX_NAME],
5511 OK(fields[IDX_BUF_LRU_PAGE_NUM_RECS]->store(
5514 OK(fields[IDX_BUF_LRU_PAGE_DATA_SIZE]->store(
5517 OK(fields[IDX_BUF_LRU_PAGE_ZIP_SIZE]->store(
5543 OK(field_store_string(fields[IDX_BUF_LRU_PAGE_STATE],
5546 switch (page_info->
io_fix) {
5548 OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
5552 OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
5556 OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IO_FIX],
5561 OK(field_store_string(fields[IDX_BUF_LRU_PAGE_IS_OLD],
5562 (page_info->
is_old) ?
"YES" :
"NO"));
5564 OK(fields[IDX_BUF_LRU_PAGE_FREE_CLOCK]->store(
5567 if (schema_table_store_record(thd, table)) {
5586 i_s_innodb_fill_buffer_lru(
5591 const ulint pool_id)
5599 DBUG_ENTER(
"i_s_innodb_fill_buffer_lru");
5600 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
5610 lru_len *
sizeof *info_buffer, MYF(MY_WME));
5617 memset(info_buffer, 0, lru_len *
sizeof *info_buffer);
5623 while (bpage != NULL) {
5626 i_s_innodb_buffer_page_get_info(bpage, pool_id, lru_pos,
5627 (info_buffer + lru_pos));
5634 ut_ad(lru_pos == lru_len);
5641 status = i_s_innodb_buf_page_lru_fill(
5642 thd, tables, info_buffer, lru_len);
5644 my_free(info_buffer);
5647 DBUG_RETURN(status);
5656 i_s_innodb_buf_page_lru_fill_table(
5664 DBUG_ENTER(
"i_s_innodb_buf_page_lru_fill_table");
5672 for (ulint i = 0; i < srv_buf_pool_instances; i++) {
5679 status = i_s_innodb_fill_buffer_lru(thd, tables, buf_pool, i);
5687 DBUG_RETURN(status);
5695 i_s_innodb_buffer_page_lru_init(
5701 DBUG_ENTER(
"i_s_innodb_buffer_page_lru_init");
5705 schema->fields_info = i_s_innodb_buf_page_lru_fields_info;
5706 schema->fill_table = i_s_innodb_buf_page_lru_fill_table;
5715 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
5719 STRUCT_FLD(info, &i_s_info),
5723 STRUCT_FLD(name,
"INNODB_BUFFER_PAGE_LRU"),
5727 STRUCT_FLD(author, plugin_author),
5731 STRUCT_FLD(
descr,
"InnoDB Buffer Page in LRU"),
5735 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
5739 STRUCT_FLD(init, i_s_innodb_buffer_page_lru_init),
5743 STRUCT_FLD(deinit, i_s_common_deinit),
5747 STRUCT_FLD(version, INNODB_VERSION_SHORT),
5750 STRUCT_FLD(status_vars, NULL),
5753 STRUCT_FLD(system_vars, NULL),
5757 STRUCT_FLD(__reserved1, NULL),
5761 STRUCT_FLD(
flags, 0UL),
5773 DBUG_ENTER(
"i_s_common_deinit");
5784 #define SYS_TABLES_ID 0
5785 {STRUCT_FLD(field_name,
"TABLE_ID"),
5786 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
5787 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
5788 STRUCT_FLD(value, 0),
5789 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5790 STRUCT_FLD(old_name,
""),
5791 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5793 #define SYS_TABLES_NAME 1
5794 {STRUCT_FLD(field_name,
"NAME"),
5795 STRUCT_FLD(field_length, MAX_FULL_NAME_LEN + 1),
5796 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
5797 STRUCT_FLD(value, 0),
5798 STRUCT_FLD(field_flags, 0),
5799 STRUCT_FLD(old_name,
""),
5800 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5802 #define SYS_TABLES_FLAG 2
5803 {STRUCT_FLD(field_name,
"FLAG"),
5804 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
5805 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
5806 STRUCT_FLD(value, 0),
5807 STRUCT_FLD(field_flags, 0),
5808 STRUCT_FLD(old_name,
""),
5809 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5811 #define SYS_TABLES_NUM_COLUMN 3
5812 {STRUCT_FLD(field_name,
"N_COLS"),
5813 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
5814 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
5815 STRUCT_FLD(value, 0),
5816 STRUCT_FLD(field_flags, 0),
5817 STRUCT_FLD(old_name,
""),
5818 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5820 #define SYS_TABLES_SPACE 4
5821 {STRUCT_FLD(field_name,
"SPACE"),
5822 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
5823 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
5824 STRUCT_FLD(value, 0),
5825 STRUCT_FLD(field_flags, 0),
5826 STRUCT_FLD(old_name,
""),
5827 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5829 #define SYS_TABLES_FILE_FORMAT 5
5830 {STRUCT_FLD(field_name,
"FILE_FORMAT"),
5831 STRUCT_FLD(field_length, 10),
5832 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
5833 STRUCT_FLD(value, 0),
5834 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
5835 STRUCT_FLD(old_name,
""),
5836 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5838 #define SYS_TABLES_ROW_FORMAT 6
5839 {STRUCT_FLD(field_name,
"ROW_FORMAT"),
5840 STRUCT_FLD(field_length, 12),
5841 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
5842 STRUCT_FLD(value, 0),
5843 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
5844 STRUCT_FLD(old_name,
""),
5845 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5847 #define SYS_TABLES_ZIP_PAGE_SIZE 7
5848 {STRUCT_FLD(field_name,
"ZIP_PAGE_SIZE"),
5849 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
5850 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
5851 STRUCT_FLD(value, 0),
5852 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
5853 STRUCT_FLD(old_name,
""),
5854 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
5856 END_OF_ST_FIELD_INFO
5865 i_s_dict_fill_sys_tables(
5869 TABLE* table_to_fill)
5875 const char* file_format;
5876 const char* row_format;
5880 row_format =
"Redundant";
5881 }
else if (!atomic_blobs) {
5882 row_format =
"Compact";
5884 row_format =
"Compressed";
5886 row_format =
"Dynamic";
5889 DBUG_ENTER(
"i_s_dict_fill_sys_tables");
5891 fields = table_to_fill->field;
5893 OK(fields[SYS_TABLES_ID]->store(longlong(table->
id), TRUE));
5895 OK(field_store_string(fields[SYS_TABLES_NAME], table->
name));
5897 OK(fields[SYS_TABLES_FLAG]->store(table->
flags));
5899 OK(fields[SYS_TABLES_NUM_COLUMN]->store(table->
n_cols));
5901 OK(fields[SYS_TABLES_SPACE]->store(table->
space));
5903 OK(field_store_string(fields[SYS_TABLES_FILE_FORMAT], file_format));
5905 OK(field_store_string(fields[SYS_TABLES_ROW_FORMAT], row_format));
5907 OK(fields[SYS_TABLES_ZIP_PAGE_SIZE]->store(zip_size));
5909 OK(schema_table_store_record(thd, table_to_fill));
5919 i_s_sys_tables_fill_table(
5930 DBUG_ENTER(
"i_s_sys_tables_fill_table");
5931 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
5945 const char* err_msg;
5951 heap, rec, &table_rec,
5957 i_s_dict_fill_sys_tables(thd, table_rec, tables->table);
5959 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
5960 ER_CANT_FIND_SYSTEM_REC,
"%s",
5992 innodb_sys_tables_init(
5998 DBUG_ENTER(
"innodb_sys_tables_init");
6002 schema->fields_info = innodb_sys_tables_fields_info;
6003 schema->fill_table = i_s_sys_tables_fill_table;
6012 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
6016 STRUCT_FLD(info, &i_s_info),
6020 STRUCT_FLD(name,
"INNODB_SYS_TABLES"),
6024 STRUCT_FLD(author, plugin_author),
6028 STRUCT_FLD(
descr,
"InnoDB SYS_TABLES"),
6032 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
6036 STRUCT_FLD(init, innodb_sys_tables_init),
6040 STRUCT_FLD(deinit, i_s_common_deinit),
6044 STRUCT_FLD(version, INNODB_VERSION_SHORT),
6047 STRUCT_FLD(status_vars, NULL),
6050 STRUCT_FLD(system_vars, NULL),
6054 STRUCT_FLD(__reserved1, NULL),
6058 STRUCT_FLD(
flags, 0UL),
6065 #define SYS_TABLESTATS_ID 0
6066 {STRUCT_FLD(field_name,
"TABLE_ID"),
6067 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6068 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6069 STRUCT_FLD(value, 0),
6070 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6071 STRUCT_FLD(old_name,
""),
6072 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6074 #define SYS_TABLESTATS_NAME 1
6075 {STRUCT_FLD(field_name,
"NAME"),
6076 STRUCT_FLD(field_length, NAME_LEN + 1),
6077 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
6078 STRUCT_FLD(value, 0),
6079 STRUCT_FLD(field_flags, 0),
6080 STRUCT_FLD(old_name,
""),
6081 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6083 #define SYS_TABLESTATS_INIT 2
6084 {STRUCT_FLD(field_name,
"STATS_INITIALIZED"),
6085 STRUCT_FLD(field_length, NAME_LEN + 1),
6086 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
6087 STRUCT_FLD(value, 0),
6088 STRUCT_FLD(field_flags, 0),
6089 STRUCT_FLD(old_name,
""),
6090 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6092 #define SYS_TABLESTATS_NROW 3
6093 {STRUCT_FLD(field_name,
"NUM_ROWS"),
6094 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6095 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6096 STRUCT_FLD(value, 0),
6097 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6098 STRUCT_FLD(old_name,
""),
6099 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6101 #define SYS_TABLESTATS_CLUST_SIZE 4
6102 {STRUCT_FLD(field_name,
"CLUST_INDEX_SIZE"),
6103 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6104 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6105 STRUCT_FLD(value, 0),
6106 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6107 STRUCT_FLD(old_name,
""),
6108 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6110 #define SYS_TABLESTATS_INDEX_SIZE 5
6111 {STRUCT_FLD(field_name,
"OTHER_INDEX_SIZE"),
6112 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6113 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6114 STRUCT_FLD(value, 0),
6115 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6116 STRUCT_FLD(old_name,
""),
6117 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6119 #define SYS_TABLESTATS_MODIFIED 6
6120 {STRUCT_FLD(field_name,
"MODIFIED_COUNTER"),
6121 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6122 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6123 STRUCT_FLD(value, 0),
6124 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6125 STRUCT_FLD(old_name,
""),
6126 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6128 #define SYS_TABLESTATS_AUTONINC 7
6129 {STRUCT_FLD(field_name,
"AUTOINC"),
6130 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6131 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6132 STRUCT_FLD(value, 0),
6133 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6134 STRUCT_FLD(old_name,
""),
6135 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6137 #define SYS_TABLESTATS_TABLE_REF_COUNT 8
6138 {STRUCT_FLD(field_name,
"REF_COUNT"),
6139 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
6140 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
6141 STRUCT_FLD(value, 0),
6142 STRUCT_FLD(field_flags, 0),
6143 STRUCT_FLD(old_name,
""),
6144 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6146 END_OF_ST_FIELD_INFO
6155 i_s_dict_fill_sys_tablestats(
6159 TABLE* table_to_fill)
6163 DBUG_ENTER(
"i_s_dict_fill_sys_tablestats");
6165 fields = table_to_fill->field;
6167 OK(fields[SYS_TABLESTATS_ID]->store(longlong(table->
id), TRUE));
6169 OK(field_store_string(fields[SYS_TABLESTATS_NAME], table->
name));
6174 OK(field_store_string(fields[SYS_TABLESTATS_INIT],
6177 OK(fields[SYS_TABLESTATS_NROW]->store(table->
stat_n_rows,
6180 OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(
6183 OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(
6186 OK(fields[SYS_TABLESTATS_MODIFIED]->store(
6189 OK(field_store_string(fields[SYS_TABLESTATS_INIT],
6192 OK(fields[SYS_TABLESTATS_NROW]->store(0, TRUE));
6194 OK(fields[SYS_TABLESTATS_CLUST_SIZE]->store(0));
6196 OK(fields[SYS_TABLESTATS_INDEX_SIZE]->store(0));
6198 OK(fields[SYS_TABLESTATS_MODIFIED]->store(0));
6203 OK(fields[SYS_TABLESTATS_AUTONINC]->store(table->
autoinc, TRUE));
6205 OK(fields[SYS_TABLESTATS_TABLE_REF_COUNT]->store(
6208 OK(schema_table_store_record(thd, table_to_fill));
6220 i_s_sys_tables_fill_table_stats(
6231 DBUG_ENTER(
"i_s_sys_tables_fill_table_stats");
6232 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
6246 const char* err_msg;
6252 heap, rec, &table_rec,
6258 i_s_dict_fill_sys_tablestats(thd, table_rec,
6261 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
6262 ER_CANT_FIND_SYSTEM_REC,
"%s",
6286 innodb_sys_tablestats_init(
6292 DBUG_ENTER(
"innodb_sys_tablestats_init");
6296 schema->fields_info = innodb_sys_tablestats_fields_info;
6297 schema->fill_table = i_s_sys_tables_fill_table_stats;
6306 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
6310 STRUCT_FLD(info, &i_s_info),
6314 STRUCT_FLD(name,
"INNODB_SYS_TABLESTATS"),
6318 STRUCT_FLD(author, plugin_author),
6322 STRUCT_FLD(
descr,
"InnoDB SYS_TABLESTATS"),
6326 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
6330 STRUCT_FLD(init, innodb_sys_tablestats_init),
6334 STRUCT_FLD(deinit, i_s_common_deinit),
6338 STRUCT_FLD(version, INNODB_VERSION_SHORT),
6341 STRUCT_FLD(status_vars, NULL),
6344 STRUCT_FLD(system_vars, NULL),
6348 STRUCT_FLD(__reserved1, NULL),
6352 STRUCT_FLD(
flags, 0UL),
6359 #define SYS_INDEX_ID 0
6360 {STRUCT_FLD(field_name,
"INDEX_ID"),
6361 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6362 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6363 STRUCT_FLD(value, 0),
6364 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6365 STRUCT_FLD(old_name,
""),
6366 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6368 #define SYS_INDEX_NAME 1
6369 {STRUCT_FLD(field_name,
"NAME"),
6370 STRUCT_FLD(field_length, NAME_LEN + 1),
6371 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
6372 STRUCT_FLD(value, 0),
6373 STRUCT_FLD(field_flags, 0),
6374 STRUCT_FLD(old_name,
""),
6375 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6377 #define SYS_INDEX_TABLE_ID 2
6378 {STRUCT_FLD(field_name,
"TABLE_ID"),
6379 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6380 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6381 STRUCT_FLD(value, 0),
6382 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6383 STRUCT_FLD(old_name,
""),
6384 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6386 #define SYS_INDEX_TYPE 3
6387 {STRUCT_FLD(field_name,
"TYPE"),
6388 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
6389 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
6390 STRUCT_FLD(value, 0),
6391 STRUCT_FLD(field_flags, 0),
6392 STRUCT_FLD(old_name,
""),
6393 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6395 #define SYS_INDEX_NUM_FIELDS 4
6396 {STRUCT_FLD(field_name,
"N_FIELDS"),
6397 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
6398 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
6399 STRUCT_FLD(value, 0),
6400 STRUCT_FLD(field_flags, 0),
6401 STRUCT_FLD(old_name,
""),
6402 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6404 #define SYS_INDEX_PAGE_NO 5
6405 {STRUCT_FLD(field_name,
"PAGE_NO"),
6406 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
6407 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
6408 STRUCT_FLD(value, 0),
6409 STRUCT_FLD(field_flags, 0),
6410 STRUCT_FLD(old_name,
""),
6411 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6413 #define SYS_INDEX_SPACE 6
6414 {STRUCT_FLD(field_name,
"SPACE"),
6415 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
6416 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
6417 STRUCT_FLD(value, 0),
6418 STRUCT_FLD(field_flags, 0),
6419 STRUCT_FLD(old_name,
""),
6420 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6422 END_OF_ST_FIELD_INFO
6431 i_s_dict_fill_sys_indexes(
6434 table_id_t table_id,
6437 TABLE* table_to_fill)
6441 DBUG_ENTER(
"i_s_dict_fill_sys_indexes");
6443 fields = table_to_fill->field;
6445 OK(field_store_index_name(fields[SYS_INDEX_NAME], index->
name));
6447 OK(fields[SYS_INDEX_ID]->store(longlong(index->
id), TRUE));
6449 OK(fields[SYS_INDEX_TABLE_ID]->store(longlong(table_id), TRUE));
6451 OK(fields[SYS_INDEX_TYPE]->store(index->
type));
6453 OK(fields[SYS_INDEX_NUM_FIELDS]->store(index->
n_fields));
6457 OK(fields[SYS_INDEX_PAGE_NO]->store(-1));
6459 OK(fields[SYS_INDEX_PAGE_NO]->store(index->
page));
6462 OK(fields[SYS_INDEX_SPACE]->store(index->
space));
6464 OK(schema_table_store_record(thd, table_to_fill));
6474 i_s_sys_indexes_fill_table(
6485 DBUG_ENTER(
"i_s_sys_indexes_fill_table");
6486 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
6502 const char* err_msg;
6503 table_id_t table_id;
6515 i_s_dict_fill_sys_indexes(thd, table_id, &index_rec,
6518 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
6519 ER_CANT_FIND_SYSTEM_REC,
"%s",
6542 innodb_sys_indexes_init(
6548 DBUG_ENTER(
"innodb_sys_indexes_init");
6552 schema->fields_info = innodb_sysindex_fields_info;
6553 schema->fill_table = i_s_sys_indexes_fill_table;
6562 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
6566 STRUCT_FLD(info, &i_s_info),
6570 STRUCT_FLD(name,
"INNODB_SYS_INDEXES"),
6574 STRUCT_FLD(author, plugin_author),
6578 STRUCT_FLD(
descr,
"InnoDB SYS_INDEXES"),
6582 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
6586 STRUCT_FLD(init, innodb_sys_indexes_init),
6590 STRUCT_FLD(deinit, i_s_common_deinit),
6594 STRUCT_FLD(version, INNODB_VERSION_SHORT),
6597 STRUCT_FLD(status_vars, NULL),
6600 STRUCT_FLD(system_vars, NULL),
6604 STRUCT_FLD(__reserved1, NULL),
6608 STRUCT_FLD(
flags, 0UL),
6615 #define SYS_COLUMN_TABLE_ID 0
6616 {STRUCT_FLD(field_name,
"TABLE_ID"),
6617 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6618 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6619 STRUCT_FLD(value, 0),
6620 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6621 STRUCT_FLD(old_name,
""),
6622 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6624 #define SYS_COLUMN_NAME 1
6625 {STRUCT_FLD(field_name,
"NAME"),
6626 STRUCT_FLD(field_length, NAME_LEN + 1),
6627 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
6628 STRUCT_FLD(value, 0),
6629 STRUCT_FLD(field_flags, 0),
6630 STRUCT_FLD(old_name,
""),
6631 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6633 #define SYS_COLUMN_POSITION 2
6634 {STRUCT_FLD(field_name,
"POS"),
6635 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6636 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6637 STRUCT_FLD(value, 0),
6638 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6639 STRUCT_FLD(old_name,
""),
6640 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6642 #define SYS_COLUMN_MTYPE 3
6643 {STRUCT_FLD(field_name,
"MTYPE"),
6644 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
6645 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
6646 STRUCT_FLD(value, 0),
6647 STRUCT_FLD(field_flags, 0),
6648 STRUCT_FLD(old_name,
""),
6649 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6651 #define SYS_COLUMN__PRTYPE 4
6652 {STRUCT_FLD(field_name,
"PRTYPE"),
6653 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
6654 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
6655 STRUCT_FLD(value, 0),
6656 STRUCT_FLD(field_flags, 0),
6657 STRUCT_FLD(old_name,
""),
6658 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6660 #define SYS_COLUMN_COLUMN_LEN 5
6661 {STRUCT_FLD(field_name,
"LEN"),
6662 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
6663 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
6664 STRUCT_FLD(value, 0),
6665 STRUCT_FLD(field_flags, 0),
6666 STRUCT_FLD(old_name,
""),
6667 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6669 END_OF_ST_FIELD_INFO
6678 i_s_dict_fill_sys_columns(
6681 table_id_t table_id,
6682 const char* col_name,
6685 TABLE* table_to_fill)
6689 DBUG_ENTER(
"i_s_dict_fill_sys_columns");
6691 fields = table_to_fill->field;
6693 OK(fields[SYS_COLUMN_TABLE_ID]->store(longlong(table_id), TRUE));
6695 OK(field_store_string(fields[SYS_COLUMN_NAME], col_name));
6697 OK(fields[SYS_COLUMN_POSITION]->store(column->
ind));
6699 OK(fields[SYS_COLUMN_MTYPE]->store(column->
mtype));
6701 OK(fields[SYS_COLUMN__PRTYPE]->store(column->
prtype));
6703 OK(fields[SYS_COLUMN_COLUMN_LEN]->store(column->
len));
6705 OK(schema_table_store_record(thd, table_to_fill));
6715 i_s_sys_columns_fill_table(
6723 const char* col_name;
6727 DBUG_ENTER(
"i_s_sys_columns_fill_table");
6728 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
6742 const char* err_msg;
6744 table_id_t table_id;
6749 &table_id, &col_name);
6755 i_s_dict_fill_sys_columns(thd, table_id, col_name,
6759 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
6760 ER_CANT_FIND_SYSTEM_REC,
"%s",
6783 innodb_sys_columns_init(
6789 DBUG_ENTER(
"innodb_sys_columns_init");
6793 schema->fields_info = innodb_sys_columns_fields_info;
6794 schema->fill_table = i_s_sys_columns_fill_table;
6803 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
6807 STRUCT_FLD(info, &i_s_info),
6811 STRUCT_FLD(name,
"INNODB_SYS_COLUMNS"),
6815 STRUCT_FLD(author, plugin_author),
6819 STRUCT_FLD(
descr,
"InnoDB SYS_COLUMNS"),
6823 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
6827 STRUCT_FLD(init, innodb_sys_columns_init),
6831 STRUCT_FLD(deinit, i_s_common_deinit),
6835 STRUCT_FLD(version, INNODB_VERSION_SHORT),
6838 STRUCT_FLD(status_vars, NULL),
6841 STRUCT_FLD(system_vars, NULL),
6845 STRUCT_FLD(__reserved1, NULL),
6849 STRUCT_FLD(
flags, 0UL),
6856 #define SYS_FIELD_INDEX_ID 0
6857 {STRUCT_FLD(field_name,
"INDEX_ID"),
6858 STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS),
6859 STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG),
6860 STRUCT_FLD(value, 0),
6861 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6862 STRUCT_FLD(old_name,
""),
6863 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6865 #define SYS_FIELD_NAME 1
6866 {STRUCT_FLD(field_name,
"NAME"),
6867 STRUCT_FLD(field_length, NAME_LEN + 1),
6868 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
6869 STRUCT_FLD(value, 0),
6870 STRUCT_FLD(field_flags, 0),
6871 STRUCT_FLD(old_name,
""),
6872 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6874 #define SYS_FIELD_POS 2
6875 {STRUCT_FLD(field_name,
"POS"),
6876 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
6877 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
6878 STRUCT_FLD(value, 0),
6879 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
6880 STRUCT_FLD(old_name,
""),
6881 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
6883 END_OF_ST_FIELD_INFO
6892 i_s_dict_fill_sys_fields(
6895 index_id_t index_id,
6898 TABLE* table_to_fill)
6902 DBUG_ENTER(
"i_s_dict_fill_sys_fields");
6904 fields = table_to_fill->field;
6906 OK(fields[SYS_FIELD_INDEX_ID]->store(longlong(index_id), TRUE));
6908 OK(field_store_string(fields[SYS_FIELD_NAME], field->
name));
6910 OK(fields[SYS_FIELD_POS]->store(pos));
6912 OK(schema_table_store_record(thd, table_to_fill));
6923 i_s_sys_fields_fill_table(
6935 DBUG_ENTER(
"i_s_sys_fields_fill_table");
6936 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
6956 const char* err_msg;
6957 index_id_t index_id;
6963 &pos, &index_id, last_id);
6969 i_s_dict_fill_sys_fields(thd, index_id, &field_rec,
6970 pos, tables->table);
6973 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
6974 ER_CANT_FIND_SYSTEM_REC,
"%s",
6997 innodb_sys_fields_init(
7003 DBUG_ENTER(
"innodb_sys_field_init");
7007 schema->fields_info = innodb_sys_fields_fields_info;
7008 schema->fill_table = i_s_sys_fields_fill_table;
7017 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
7021 STRUCT_FLD(info, &i_s_info),
7025 STRUCT_FLD(name,
"INNODB_SYS_FIELDS"),
7029 STRUCT_FLD(author, plugin_author),
7033 STRUCT_FLD(
descr,
"InnoDB SYS_FIELDS"),
7037 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
7041 STRUCT_FLD(init, innodb_sys_fields_init),
7045 STRUCT_FLD(deinit, i_s_common_deinit),
7049 STRUCT_FLD(version, INNODB_VERSION_SHORT),
7052 STRUCT_FLD(status_vars, NULL),
7055 STRUCT_FLD(system_vars, NULL),
7059 STRUCT_FLD(__reserved1, NULL),
7063 STRUCT_FLD(
flags, 0UL),
7070 #define SYS_FOREIGN_ID 0
7071 {STRUCT_FLD(field_name,
"ID"),
7072 STRUCT_FLD(field_length, NAME_LEN + 1),
7073 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
7074 STRUCT_FLD(value, 0),
7075 STRUCT_FLD(field_flags, 0),
7076 STRUCT_FLD(old_name,
""),
7077 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7079 #define SYS_FOREIGN_FOR_NAME 1
7080 {STRUCT_FLD(field_name,
"FOR_NAME"),
7081 STRUCT_FLD(field_length, NAME_LEN + 1),
7082 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
7083 STRUCT_FLD(value, 0),
7084 STRUCT_FLD(field_flags, 0),
7085 STRUCT_FLD(old_name,
""),
7086 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7088 #define SYS_FOREIGN_REF_NAME 2
7089 {STRUCT_FLD(field_name,
"REF_NAME"),
7090 STRUCT_FLD(field_length, NAME_LEN + 1),
7091 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
7092 STRUCT_FLD(value, 0),
7093 STRUCT_FLD(field_flags, 0),
7094 STRUCT_FLD(old_name,
""),
7095 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7097 #define SYS_FOREIGN_NUM_COL 3
7098 {STRUCT_FLD(field_name,
"N_COLS"),
7099 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
7100 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
7101 STRUCT_FLD(value, 0),
7102 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
7103 STRUCT_FLD(old_name,
""),
7104 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7106 #define SYS_FOREIGN_TYPE 4
7107 {STRUCT_FLD(field_name,
"TYPE"),
7108 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
7109 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
7110 STRUCT_FLD(value, 0),
7111 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
7112 STRUCT_FLD(old_name,
""),
7113 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7115 END_OF_ST_FIELD_INFO
7124 i_s_dict_fill_sys_foreign(
7128 TABLE* table_to_fill)
7132 DBUG_ENTER(
"i_s_dict_fill_sys_foreign");
7134 fields = table_to_fill->field;
7136 OK(field_store_string(fields[SYS_FOREIGN_ID], foreign->
id));
7138 OK(field_store_string(fields[SYS_FOREIGN_FOR_NAME],
7141 OK(field_store_string(fields[SYS_FOREIGN_REF_NAME],
7144 OK(fields[SYS_FOREIGN_NUM_COL]->store(foreign->
n_fields));
7146 OK(fields[SYS_FOREIGN_TYPE]->store(foreign->
type));
7148 OK(schema_table_store_record(thd, table_to_fill));
7160 i_s_sys_foreign_fill_table(
7171 DBUG_ENTER(
"i_s_sys_foreign_fill_table");
7172 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
7187 const char* err_msg;
7198 i_s_dict_fill_sys_foreign(thd, &foreign_rec,
7201 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
7202 ER_CANT_FIND_SYSTEM_REC,
"%s",
7226 innodb_sys_foreign_init(
7232 DBUG_ENTER(
"innodb_sys_foreign_init");
7236 schema->fields_info = innodb_sys_foreign_fields_info;
7237 schema->fill_table = i_s_sys_foreign_fill_table;
7246 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
7250 STRUCT_FLD(info, &i_s_info),
7254 STRUCT_FLD(name,
"INNODB_SYS_FOREIGN"),
7258 STRUCT_FLD(author, plugin_author),
7262 STRUCT_FLD(
descr,
"InnoDB SYS_FOREIGN"),
7266 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
7270 STRUCT_FLD(init, innodb_sys_foreign_init),
7274 STRUCT_FLD(deinit, i_s_common_deinit),
7278 STRUCT_FLD(version, INNODB_VERSION_SHORT),
7281 STRUCT_FLD(status_vars, NULL),
7284 STRUCT_FLD(system_vars, NULL),
7288 STRUCT_FLD(__reserved1, NULL),
7292 STRUCT_FLD(
flags, 0UL),
7297 static ST_FIELD_INFO innodb_sys_foreign_cols_fields_info[] =
7299 #define SYS_FOREIGN_COL_ID 0
7300 {STRUCT_FLD(field_name,
"ID"),
7301 STRUCT_FLD(field_length, NAME_LEN + 1),
7302 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
7303 STRUCT_FLD(value, 0),
7304 STRUCT_FLD(field_flags, 0),
7305 STRUCT_FLD(old_name,
""),
7306 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7308 #define SYS_FOREIGN_COL_FOR_NAME 1
7309 {STRUCT_FLD(field_name,
"FOR_COL_NAME"),
7310 STRUCT_FLD(field_length, NAME_LEN + 1),
7311 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
7312 STRUCT_FLD(value, 0),
7313 STRUCT_FLD(field_flags, 0),
7314 STRUCT_FLD(old_name,
""),
7315 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7317 #define SYS_FOREIGN_COL_REF_NAME 2
7318 {STRUCT_FLD(field_name,
"REF_COL_NAME"),
7319 STRUCT_FLD(field_length, NAME_LEN + 1),
7320 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
7321 STRUCT_FLD(value, 0),
7322 STRUCT_FLD(field_flags, 0),
7323 STRUCT_FLD(old_name,
""),
7324 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7326 #define SYS_FOREIGN_COL_POS 3
7327 {STRUCT_FLD(field_name,
"POS"),
7328 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
7329 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
7330 STRUCT_FLD(value, 0),
7331 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
7332 STRUCT_FLD(old_name,
""),
7333 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7335 END_OF_ST_FIELD_INFO
7344 i_s_dict_fill_sys_foreign_cols(
7348 const char* for_col_name,
7349 const char* ref_col_name,
7352 TABLE* table_to_fill)
7356 DBUG_ENTER(
"i_s_dict_fill_sys_foreign_cols");
7358 fields = table_to_fill->field;
7360 OK(field_store_string(fields[SYS_FOREIGN_COL_ID], name));
7362 OK(field_store_string(fields[SYS_FOREIGN_COL_FOR_NAME], for_col_name));
7364 OK(field_store_string(fields[SYS_FOREIGN_COL_REF_NAME], ref_col_name));
7366 OK(fields[SYS_FOREIGN_COL_POS]->store(pos));
7368 OK(schema_table_store_record(thd, table_to_fill));
7379 i_s_sys_foreign_cols_fill_table(
7390 DBUG_ENTER(
"i_s_sys_foreign_cols_fill_table");
7391 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
7405 const char* err_msg;
7407 const char* for_col_name;
7408 const char* ref_col_name;
7413 heap, rec, &name, &for_col_name, &ref_col_name, &pos);
7419 i_s_dict_fill_sys_foreign_cols(
7420 thd, name, for_col_name, ref_col_name, pos,
7423 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
7424 ER_CANT_FIND_SYSTEM_REC,
"%s",
7447 innodb_sys_foreign_cols_init(
7453 DBUG_ENTER(
"innodb_sys_foreign_cols_init");
7457 schema->fields_info = innodb_sys_foreign_cols_fields_info;
7458 schema->fill_table = i_s_sys_foreign_cols_fill_table;
7467 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
7471 STRUCT_FLD(info, &i_s_info),
7475 STRUCT_FLD(name,
"INNODB_SYS_FOREIGN_COLS"),
7479 STRUCT_FLD(author, plugin_author),
7483 STRUCT_FLD(
descr,
"InnoDB SYS_FOREIGN_COLS"),
7487 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
7491 STRUCT_FLD(init, innodb_sys_foreign_cols_init),
7495 STRUCT_FLD(deinit, i_s_common_deinit),
7499 STRUCT_FLD(version, INNODB_VERSION_SHORT),
7502 STRUCT_FLD(status_vars, NULL),
7505 STRUCT_FLD(system_vars, NULL),
7509 STRUCT_FLD(__reserved1, NULL),
7513 STRUCT_FLD(
flags, 0UL),
7520 #define SYS_TABLESPACES_SPACE 0
7521 {STRUCT_FLD(field_name,
"SPACE"),
7522 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
7523 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
7524 STRUCT_FLD(value, 0),
7525 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
7526 STRUCT_FLD(old_name,
""),
7527 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7529 #define SYS_TABLESPACES_NAME 1
7530 {STRUCT_FLD(field_name,
"NAME"),
7531 STRUCT_FLD(field_length, MAX_FULL_NAME_LEN + 1),
7532 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
7533 STRUCT_FLD(value, 0),
7534 STRUCT_FLD(field_flags, 0),
7535 STRUCT_FLD(old_name,
""),
7536 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7538 #define SYS_TABLESPACES_FLAGS 2
7539 {STRUCT_FLD(field_name,
"FLAG"),
7540 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
7541 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
7542 STRUCT_FLD(value, 0),
7543 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
7544 STRUCT_FLD(old_name,
""),
7545 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7547 #define SYS_TABLESPACES_FILE_FORMAT 3
7548 {STRUCT_FLD(field_name,
"FILE_FORMAT"),
7549 STRUCT_FLD(field_length, 10),
7550 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
7551 STRUCT_FLD(value, 0),
7552 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
7553 STRUCT_FLD(old_name,
""),
7554 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7556 #define SYS_TABLESPACES_ROW_FORMAT 4
7557 {STRUCT_FLD(field_name,
"ROW_FORMAT"),
7558 STRUCT_FLD(field_length, 22),
7559 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
7560 STRUCT_FLD(value, 0),
7561 STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL),
7562 STRUCT_FLD(old_name,
""),
7563 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7565 #define SYS_TABLESPACES_PAGE_SIZE 5
7566 {STRUCT_FLD(field_name,
"PAGE_SIZE"),
7567 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
7568 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
7569 STRUCT_FLD(value, 0),
7570 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
7571 STRUCT_FLD(old_name,
""),
7572 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7574 #define SYS_TABLESPACES_ZIP_PAGE_SIZE 6
7575 {STRUCT_FLD(field_name,
"ZIP_PAGE_SIZE"),
7576 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
7577 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
7578 STRUCT_FLD(value, 0),
7579 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
7580 STRUCT_FLD(old_name,
""),
7581 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7583 END_OF_ST_FIELD_INFO
7593 i_s_dict_fill_sys_tablespaces(
7599 TABLE* table_to_fill)
7605 const char* file_format;
7606 const char* row_format;
7608 DBUG_ENTER(
"i_s_dict_fill_sys_tablespaces");
7611 if (!atomic_blobs) {
7612 row_format =
"Compact or Redundant";
7614 row_format =
"Compressed";
7616 row_format =
"Dynamic";
7619 fields = table_to_fill->field;
7621 OK(fields[SYS_TABLESPACES_SPACE]->store(space));
7623 OK(field_store_string(fields[SYS_TABLESPACES_NAME], name));
7625 OK(fields[SYS_TABLESPACES_FLAGS]->store(flags));
7627 OK(field_store_string(fields[SYS_TABLESPACES_FILE_FORMAT],
7630 OK(field_store_string(fields[SYS_TABLESPACES_ROW_FORMAT],
7633 OK(fields[SYS_TABLESPACES_PAGE_SIZE]->store(page_size));
7635 OK(fields[SYS_TABLESPACES_ZIP_PAGE_SIZE]->store(zip_size));
7637 OK(schema_table_store_record(thd, table_to_fill));
7648 i_s_sys_tablespaces_fill_table(
7659 DBUG_ENTER(
"i_s_sys_tablespaces_fill_table");
7660 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
7674 const char* err_msg;
7681 heap, rec, &space, &name, &flags);
7687 i_s_dict_fill_sys_tablespaces(
7688 thd, space, name, flags,
7691 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
7692 ER_CANT_FIND_SYSTEM_REC,
"%s",
7715 innodb_sys_tablespaces_init(
7721 DBUG_ENTER(
"innodb_sys_tablespaces_init");
7725 schema->fields_info = innodb_sys_tablespaces_fields_info;
7726 schema->fill_table = i_s_sys_tablespaces_fill_table;
7735 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
7739 STRUCT_FLD(info, &i_s_info),
7743 STRUCT_FLD(name,
"INNODB_SYS_TABLESPACES"),
7747 STRUCT_FLD(author, plugin_author),
7751 STRUCT_FLD(
descr,
"InnoDB SYS_TABLESPACES"),
7755 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
7759 STRUCT_FLD(init, innodb_sys_tablespaces_init),
7763 STRUCT_FLD(deinit, i_s_common_deinit),
7767 STRUCT_FLD(version, INNODB_VERSION_SHORT),
7770 STRUCT_FLD(status_vars, NULL),
7773 STRUCT_FLD(system_vars, NULL),
7777 STRUCT_FLD(__reserved1, NULL),
7781 STRUCT_FLD(flags, 0UL),
7788 #define SYS_DATAFILES_SPACE 0
7789 {STRUCT_FLD(field_name,
"SPACE"),
7790 STRUCT_FLD(field_length, MY_INT32_NUM_DECIMAL_DIGITS),
7791 STRUCT_FLD(field_type, MYSQL_TYPE_LONG),
7792 STRUCT_FLD(value, 0),
7793 STRUCT_FLD(field_flags, MY_I_S_UNSIGNED),
7794 STRUCT_FLD(old_name,
""),
7795 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7797 #define SYS_DATAFILES_PATH 1
7798 {STRUCT_FLD(field_name,
"PATH"),
7799 STRUCT_FLD(field_length, OS_FILE_MAX_PATH),
7800 STRUCT_FLD(field_type, MYSQL_TYPE_STRING),
7801 STRUCT_FLD(value, 0),
7802 STRUCT_FLD(field_flags, 0),
7803 STRUCT_FLD(old_name,
""),
7804 STRUCT_FLD(open_method, SKIP_OPEN_TABLE)},
7806 END_OF_ST_FIELD_INFO
7815 i_s_dict_fill_sys_datafiles(
7820 TABLE* table_to_fill)
7824 DBUG_ENTER(
"i_s_dict_fill_sys_datafiles");
7826 fields = table_to_fill->field;
7828 OK(field_store_ulint(fields[SYS_DATAFILES_SPACE], space));
7830 OK(field_store_string(fields[SYS_DATAFILES_PATH], path));
7832 OK(schema_table_store_record(thd, table_to_fill));
7843 i_s_sys_datafiles_fill_table(
7854 DBUG_ENTER(
"i_s_sys_datafiles_fill_table");
7855 RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name);
7869 const char* err_msg;
7875 heap, rec, &space, &path);
7881 i_s_dict_fill_sys_datafiles(
7882 thd, space, path, tables->table);
7884 push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
7885 ER_CANT_FIND_SYSTEM_REC,
"%s",
7908 innodb_sys_datafiles_init(
7914 DBUG_ENTER(
"innodb_sys_datafiles_init");
7918 schema->fields_info = innodb_sys_datafiles_fields_info;
7919 schema->fill_table = i_s_sys_datafiles_fill_table;
7928 STRUCT_FLD(
type, MYSQL_INFORMATION_SCHEMA_PLUGIN),
7932 STRUCT_FLD(info, &i_s_info),
7936 STRUCT_FLD(name,
"INNODB_SYS_DATAFILES"),
7940 STRUCT_FLD(author, plugin_author),
7944 STRUCT_FLD(
descr,
"InnoDB SYS_DATAFILES"),
7948 STRUCT_FLD(license, PLUGIN_LICENSE_GPL),
7952 STRUCT_FLD(init, innodb_sys_datafiles_init),
7956 STRUCT_FLD(deinit, i_s_common_deinit),
7960 STRUCT_FLD(version, INNODB_VERSION_SHORT),
7963 STRUCT_FLD(status_vars, NULL),
7966 STRUCT_FLD(system_vars, NULL),
7970 STRUCT_FLD(__reserved1, NULL),
7974 STRUCT_FLD(flags, 0UL),