# name : innodb_buffer_pool_pages_i_s.patch # introduced : 11 or before # maintainer : Yasufumi # #!!! notice !!! # Any small change to this file in the main branch # should be done or reviewed by the maintainer! --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -4163,6 +4163,36 @@ mutex_exit(block_mutex); } +/********************************************************************//** +*/ +UNIV_INTERN +buf_block_t* +buf_page_from_array( +/*================*/ + buf_pool_t* buf_pool, + ulint n_block) +{ + ulint n_chunks, offset; + buf_chunk_t* chunk; + + ut_a(n_block < buf_pool->curr_size); + + chunk = buf_pool->chunks; + offset = n_block; + + for (n_chunks = buf_pool->n_chunks; n_chunks--; chunk++) { + if (offset < chunk->size) { + return(&chunk->blocks[offset]); + } + + offset -= chunk->size; + } + + ut_error; + + return(NULL); +} + /*********************************************************************//** Asserts that all file pages in the buffer are in a replaceable state. @return TRUE */ --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -12338,6 +12338,9 @@ i_s_innodb_sys_stats, i_s_innodb_table_stats, i_s_innodb_index_stats, +i_s_innodb_buffer_pool_pages, +i_s_innodb_buffer_pool_pages_index, +i_s_innodb_buffer_pool_pages_blob, i_s_innodb_admin_command mysql_declare_plugin_end; --- a/storage/innobase/handler/i_s.cc +++ b/storage/innobase/handler/i_s.cc @@ -51,6 +51,7 @@ #include "trx0sys.h" /* for trx_sys */ #include "dict0dict.h" /* for dict_sys */ #include "buf0lru.h" /* for XTRA_LRU_[DUMP/RESTORE] */ +#include "btr0btr.h" /* for btr_page_get_index_id */ } #define OK(expr) \ @@ -4411,3 +4412,713 @@ STRUCT_FLD(__reserved1, NULL), STRUCT_FLD(flags, 0UL) }; + +/*********************************************************************** +*/ +static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_fields_info[] = +{ + {STRUCT_FLD(field_name, "page_type"), + STRUCT_FLD(field_length, 64), + STRUCT_FLD(field_type, MYSQL_TYPE_STRING), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_MAYBE_NULL), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "space_id"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "page_no"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "lru_position"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "fix_count"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "flush_type"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + END_OF_ST_FIELD_INFO +}; + +static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_index_fields_info[] = +{ + {STRUCT_FLD(field_name, "index_id"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "space_id"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "page_no"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "n_recs"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "data_size"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "hashed"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "access_time"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "modified"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "dirty"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "old"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "lru_position"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "fix_count"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "flush_type"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + END_OF_ST_FIELD_INFO +}; + +static ST_FIELD_INFO i_s_innodb_buffer_pool_pages_blob_fields_info[] = +{ + {STRUCT_FLD(field_name, "space_id"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "page_no"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "compressed"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "part_len"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "next_page_no"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "lru_position"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "fix_count"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + {STRUCT_FLD(field_name, "flush_type"), + STRUCT_FLD(field_length, MY_INT64_NUM_DECIMAL_DIGITS), + STRUCT_FLD(field_type, MYSQL_TYPE_LONGLONG), + STRUCT_FLD(value, 0), + STRUCT_FLD(field_flags, MY_I_S_UNSIGNED), + STRUCT_FLD(old_name, ""), + STRUCT_FLD(open_method, SKIP_OPEN_TABLE)}, + + END_OF_ST_FIELD_INFO +}; + +/*********************************************************************** +Fill the dynamic table information_schema.innodb_buffer_pool_pages. */ +static +int +i_s_innodb_buffer_pool_pages_fill( +/*================*/ + /* out: 0 on success, 1 on failure */ + THD* thd, /* in: thread */ + TABLE_LIST* tables, /* in/out: tables to fill */ + COND* cond) /* in: condition (ignored) */ +{ + TABLE* table = (TABLE *) tables->table; + int status = 0; + ulint i; + + DBUG_ENTER("i_s_innodb_buffer_pool_pages_fill"); + + /* deny access to non-superusers */ + if (check_global_access(thd, PROCESS_ACL)) { + + DBUG_RETURN(0); + } + + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + + for (i = 0; i < srv_buf_pool_instances; i++) { + ulint n_block; + buf_pool_t* buf_pool; + + buf_pool = buf_pool_from_array(i); + + buf_pool_mutex_enter(buf_pool); + + for (n_block = 0; n_block < buf_pool->curr_size; n_block++) { + buf_block_t* block = buf_page_from_array(buf_pool, n_block); + const buf_frame_t* frame = block->frame; + + char page_type[64]; + + switch(fil_page_get_type(frame)) + { + case FIL_PAGE_INDEX: + strcpy(page_type, "index"); + break; + case FIL_PAGE_UNDO_LOG: + strcpy(page_type, "undo_log"); + break; + case FIL_PAGE_INODE: + strcpy(page_type, "inode"); + break; + case FIL_PAGE_IBUF_FREE_LIST: + strcpy(page_type, "ibuf_free_list"); + break; + case FIL_PAGE_TYPE_ALLOCATED: + strcpy(page_type, "allocated"); + break; + case FIL_PAGE_IBUF_BITMAP: + strcpy(page_type, "bitmap"); + break; + case FIL_PAGE_TYPE_SYS: + strcpy(page_type, "sys"); + break; + case FIL_PAGE_TYPE_TRX_SYS: + strcpy(page_type, "trx_sys"); + break; + case FIL_PAGE_TYPE_FSP_HDR: + strcpy(page_type, "fsp_hdr"); + break; + case FIL_PAGE_TYPE_XDES: + strcpy(page_type, "xdes"); + break; + case FIL_PAGE_TYPE_BLOB: + strcpy(page_type, "blob"); + break; + case FIL_PAGE_TYPE_ZBLOB: + strcpy(page_type, "zblob"); + break; + case FIL_PAGE_TYPE_ZBLOB2: + strcpy(page_type, "zblob2"); + break; + default: + sprintf(page_type, "unknown (type=%li)", fil_page_get_type(frame)); + } + + field_store_string(table->field[0], page_type); + table->field[1]->store(block->page.space); + table->field[2]->store(block->page.offset); + table->field[3]->store(0); + table->field[4]->store(block->page.buf_fix_count); + table->field[5]->store(block->page.flush_type); + + if (schema_table_store_record(thd, table)) { + status = 1; + break; + } + + } + + buf_pool_mutex_exit(buf_pool); + } + + DBUG_RETURN(status); +} + +/*********************************************************************** +Fill the dynamic table information_schema.innodb_buffer_pool_pages_index. */ +static +int +i_s_innodb_buffer_pool_pages_index_fill( +/*================*/ + /* out: 0 on success, 1 on failure */ + THD* thd, /* in: thread */ + TABLE_LIST* tables, /* in/out: tables to fill */ + COND* cond) /* in: condition (ignored) */ +{ + TABLE* table = (TABLE *) tables->table; + int status = 0; + ulint i; + index_id_t index_id; + + DBUG_ENTER("i_s_innodb_buffer_pool_pages_index_fill"); + + /* deny access to non-superusers */ + if (check_global_access(thd, PROCESS_ACL)) { + + DBUG_RETURN(0); + } + + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + + for (i = 0; i < srv_buf_pool_instances; i++) { + ulint n_block; + buf_pool_t* buf_pool; + + buf_pool = buf_pool_from_array(i); + + buf_pool_mutex_enter(buf_pool); + + for (n_block = 0; n_block < buf_pool->curr_size; n_block++) { + buf_block_t* block = buf_page_from_array(buf_pool, n_block); + const buf_frame_t* frame = block->frame; + + if (fil_page_get_type(frame) == FIL_PAGE_INDEX) { + index_id = btr_page_get_index_id(frame); + table->field[0]->store(index_id); + table->field[1]->store(block->page.space); + table->field[2]->store(block->page.offset); + table->field[3]->store(page_get_n_recs(frame)); + table->field[4]->store(page_get_data_size(frame)); + table->field[5]->store(block->index != NULL); + table->field[6]->store(block->page.access_time); + table->field[7]->store(block->page.newest_modification != 0); + table->field[8]->store(block->page.oldest_modification != 0); + table->field[9]->store(block->page.old); + table->field[10]->store(0); + table->field[11]->store(block->page.buf_fix_count); + table->field[12]->store(block->page.flush_type); + + if (schema_table_store_record(thd, table)) { + status = 1; + break; + } + } + } + + buf_pool_mutex_exit(buf_pool); + } + + DBUG_RETURN(status); +} + +/*********************************************************************** +Fill the dynamic table information_schema.innodb_buffer_pool_pages_index. */ +static +int +i_s_innodb_buffer_pool_pages_blob_fill( +/*================*/ + /* out: 0 on success, 1 on failure */ + THD* thd, /* in: thread */ + TABLE_LIST* tables, /* in/out: tables to fill */ + COND* cond) /* in: condition (ignored) */ +{ + TABLE* table = (TABLE *) tables->table; + int status = 0; + ulint i; + + ulint part_len; + ulint next_page_no; + + DBUG_ENTER("i_s_innodb_buffer_pool_pages_blob_fill"); + + /* deny access to non-superusers */ + if (check_global_access(thd, PROCESS_ACL)) { + + DBUG_RETURN(0); + } + + RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); + + for (i = 0; i < srv_buf_pool_instances; i++) { + ulint n_block; + buf_pool_t* buf_pool; + + buf_pool = buf_pool_from_array(i); + + buf_pool_mutex_enter(buf_pool); + + for (n_block = 0; n_block < buf_pool->curr_size; n_block++) { + buf_block_t* block = buf_page_from_array(buf_pool, n_block); + page_zip_des_t* block_page_zip = buf_block_get_page_zip(block); + const buf_frame_t* frame = block->frame; + + if (fil_page_get_type(frame) == FIL_PAGE_TYPE_BLOB) { + + if (UNIV_LIKELY_NULL(block_page_zip)) { + part_len = 0; /* hmm, can't figure it out */ + + next_page_no = mach_read_from_4( + buf_block_get_frame(block) + + FIL_PAGE_NEXT); + } else { + part_len = mach_read_from_4( + buf_block_get_frame(block) + + FIL_PAGE_DATA + + 0 /*BTR_BLOB_HDR_PART_LEN*/); + + next_page_no = mach_read_from_4( + buf_block_get_frame(block) + + FIL_PAGE_DATA + + 4 /*BTR_BLOB_HDR_NEXT_PAGE_NO*/); + } + + table->field[0]->store(block->page.space); + table->field[1]->store(block->page.offset); + table->field[2]->store(block_page_zip != NULL); + table->field[3]->store(part_len); + + if(next_page_no == FIL_NULL) + { + table->field[4]->store(0); + } else { + table->field[4]->store(block->page.offset); + } + + table->field[5]->store(0); + table->field[6]->store(block->page.buf_fix_count); + table->field[7]->store(block->page.flush_type); + + if (schema_table_store_record(thd, table)) { + status = 1; + break; + } + + } + } + + buf_pool_mutex_exit(buf_pool); + } + + DBUG_RETURN(status); +} + +/*********************************************************************** +Bind the dynamic table information_schema.innodb_buffer_pool_pages. */ +static +int +i_s_innodb_buffer_pool_pages_init( +/*=========*/ + /* out: 0 on success */ + void* p) /* in/out: table schema object */ +{ + DBUG_ENTER("i_s_innodb_buffer_pool_pages_init"); + ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; + + schema->fields_info = i_s_innodb_buffer_pool_pages_fields_info; + schema->fill_table = i_s_innodb_buffer_pool_pages_fill; + + DBUG_RETURN(0); +} + +/*********************************************************************** +Bind the dynamic table information_schema.innodb_buffer_pool_pages. */ +static +int +i_s_innodb_buffer_pool_pages_index_init( +/*=========*/ + /* out: 0 on success */ + void* p) /* in/out: table schema object */ +{ + DBUG_ENTER("i_s_innodb_buffer_pool_pages_index_init"); + ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; + + schema->fields_info = i_s_innodb_buffer_pool_pages_index_fields_info; + schema->fill_table = i_s_innodb_buffer_pool_pages_index_fill; + + DBUG_RETURN(0); +} + +/*********************************************************************** +Bind the dynamic table information_schema.innodb_buffer_pool_pages. */ +static +int +i_s_innodb_buffer_pool_pages_blob_init( +/*=========*/ + /* out: 0 on success */ + void* p) /* in/out: table schema object */ +{ + DBUG_ENTER("i_s_innodb_buffer_pool_pages_blob_init"); + ST_SCHEMA_TABLE* schema = (ST_SCHEMA_TABLE*) p; + + schema->fields_info = i_s_innodb_buffer_pool_pages_blob_fields_info; + schema->fill_table = i_s_innodb_buffer_pool_pages_blob_fill; + + DBUG_RETURN(0); +} + + +UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_pool_pages = +{ + /* the plugin type (a MYSQL_XXX_PLUGIN value) */ + /* int */ + STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), + + /* pointer to type-specific plugin descriptor */ + /* void* */ + STRUCT_FLD(info, &i_s_info), + + /* plugin name */ + /* const char* */ + STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES"), + + /* plugin author (for SHOW PLUGINS) */ + /* const char* */ + STRUCT_FLD(author, "Percona"), + + /* general descriptive text (for SHOW PLUGINS) */ + /* const char* */ + STRUCT_FLD(descr, "InnoDB buffer pool pages"), + + /* the plugin license (PLUGIN_LICENSE_XXX) */ + /* int */ + STRUCT_FLD(license, PLUGIN_LICENSE_GPL), + + /* the function to invoke when plugin is loaded */ + /* int (*)(void*); */ + STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_init), + + /* the function to invoke when plugin is unloaded */ + /* int (*)(void*); */ + STRUCT_FLD(deinit, i_s_common_deinit), + + /* plugin version (for SHOW PLUGINS) */ + /* unsigned int */ + STRUCT_FLD(version, 0x0100 /* 1.0 */), + + /* struct st_mysql_show_var* */ + STRUCT_FLD(status_vars, NULL), + + /* struct st_mysql_sys_var** */ + STRUCT_FLD(system_vars, NULL), + + /* reserved for dependency checking */ + /* void* */ + STRUCT_FLD(__reserved1, NULL), + + /* flags for plugin */ + /* unsigned long */ + STRUCT_FLD(flags, 0UL) +}; + +UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_pool_pages_index = +{ + /* the plugin type (a MYSQL_XXX_PLUGIN value) */ + /* int */ + STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), + + /* pointer to type-specific plugin descriptor */ + /* void* */ + STRUCT_FLD(info, &i_s_info), + + /* plugin name */ + /* const char* */ + STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES_INDEX"), + + /* plugin author (for SHOW PLUGINS) */ + /* const char* */ + STRUCT_FLD(author, "Percona"), + + /* general descriptive text (for SHOW PLUGINS) */ + /* const char* */ + STRUCT_FLD(descr, "InnoDB buffer pool index pages"), + + /* the plugin license (PLUGIN_LICENSE_XXX) */ + /* int */ + STRUCT_FLD(license, PLUGIN_LICENSE_GPL), + + /* the function to invoke when plugin is loaded */ + /* int (*)(void*); */ + STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_index_init), + + /* the function to invoke when plugin is unloaded */ + /* int (*)(void*); */ + STRUCT_FLD(deinit, i_s_common_deinit), + + /* plugin version (for SHOW PLUGINS) */ + /* unsigned int */ + STRUCT_FLD(version, 0x0100 /* 1.0 */), + + /* struct st_mysql_show_var* */ + STRUCT_FLD(status_vars, NULL), + + /* struct st_mysql_sys_var** */ + STRUCT_FLD(system_vars, NULL), + + /* reserved for dependency checking */ + /* void* */ + STRUCT_FLD(__reserved1, NULL), + + /* flags for plugin */ + /* unsigned long */ + STRUCT_FLD(flags, 0UL) +}; + +UNIV_INTERN struct st_mysql_plugin i_s_innodb_buffer_pool_pages_blob = +{ + /* the plugin type (a MYSQL_XXX_PLUGIN value) */ + /* int */ + STRUCT_FLD(type, MYSQL_INFORMATION_SCHEMA_PLUGIN), + + /* pointer to type-specific plugin descriptor */ + /* void* */ + STRUCT_FLD(info, &i_s_info), + + /* plugin name */ + /* const char* */ + STRUCT_FLD(name, "INNODB_BUFFER_POOL_PAGES_BLOB"), + + /* plugin author (for SHOW PLUGINS) */ + /* const char* */ + STRUCT_FLD(author, "Percona"), + + /* general descriptive text (for SHOW PLUGINS) */ + /* const char* */ + STRUCT_FLD(descr, "InnoDB buffer pool blob pages"), + + /* the plugin license (PLUGIN_LICENSE_XXX) */ + /* int */ + STRUCT_FLD(license, PLUGIN_LICENSE_GPL), + + /* the function to invoke when plugin is loaded */ + /* int (*)(void*); */ + STRUCT_FLD(init, i_s_innodb_buffer_pool_pages_blob_init), + + /* the function to invoke when plugin is unloaded */ + /* int (*)(void*); */ + STRUCT_FLD(deinit, i_s_common_deinit), + + /* plugin version (for SHOW PLUGINS) */ + /* unsigned int */ + STRUCT_FLD(version, 0x0100 /* 1.0 */), + + /* struct st_mysql_show_var* */ + STRUCT_FLD(status_vars, NULL), + + /* struct st_mysql_sys_var** */ + STRUCT_FLD(system_vars, NULL), + + /* reserved for dependency checking */ + /* void* */ + STRUCT_FLD(__reserved1, NULL), + + /* flags for plugin */ + /* unsigned long */ + STRUCT_FLD(flags, 0UL) +}; + --- a/storage/innobase/handler/i_s.h +++ b/storage/innobase/handler/i_s.h @@ -47,5 +47,8 @@ extern struct st_mysql_plugin i_s_innodb_table_stats; extern struct st_mysql_plugin i_s_innodb_index_stats; extern struct st_mysql_plugin i_s_innodb_admin_command; +extern struct st_mysql_plugin i_s_innodb_buffer_pool_pages; +extern struct st_mysql_plugin i_s_innodb_buffer_pool_pages_index; +extern struct st_mysql_plugin i_s_innodb_buffer_pool_pages_blob; #endif /* i_s_h */ --- a/storage/innobase/include/buf0buf.h +++ b/storage/innobase/include/buf0buf.h @@ -1181,6 +1181,14 @@ /*===========*/ const buf_pool_t* buf_pool) /*!< in: buffer pool */ __attribute__((nonnull, const)); +/********************************************************************//** +*/ +UNIV_INTERN +buf_block_t* +buf_page_from_array( +/*================*/ + buf_pool_t* buf_pool, + ulint n_block); /******************************************************************//** Returns the buffer pool instance given a page instance @return buf_pool */