Commit c65932be authored by Annamalai Gurusami's avatar Annamalai Gurusami

Bug #13113026 INFORMATION_SCHEMA.INNODB_BUFFER_PAGE_LRUFROM 5.6 BACKPORT

Backporting the WL#5716, "Information schema table for InnoDB 
buffer pool information". Backporting revisions 2876.244.113, 
2876.244.102 from mysql-trunk.

rb://1175 approved by Jimmy Yang. 
parent 882e9381
......@@ -1001,6 +1001,9 @@ sub collect_one_test_case {
"innodb_cmp=$plugin_filename$sep" .
"innodb_cmp_reset=$plugin_filename$sep" .
"innodb_cmpmem=$plugin_filename$sep" .
"innodb_buffer_page=$plugin_filename$sep" .
"innodb_buffer_page_lru=$plugin_filename$sep" .
"innodb_buffer_pool_stats=$plugin_filename$sep" .
"innodb_cmpmem_reset=$plugin_filename";
foreach my $k ('master_opt', 'slave_opt')
......
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
CREATE TABLE infoschema_buffer_test (col1 INT) ENGINE = INNODB;
INSERT INTO infoschema_buffer_test VALUES(9);
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_buffer_test"
and PAGE_STATE="file_page" and PAGE_TYPE="index";
TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
test/infoschema_buffer_test GEN_CLUST_INDEX 1 29 FILE_PAGE INDEX
INSERT INTO infoschema_buffer_test VALUES(19);
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_buffer_test"
and PAGE_STATE="file_page" and PAGE_TYPE="index";
TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
test/infoschema_buffer_test GEN_CLUST_INDEX 2 58 FILE_PAGE INDEX
CREATE INDEX idx ON infoschema_buffer_test(col1);
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_buffer_test"
and PAGE_STATE="file_page" and INDEX_NAME = "idx" and PAGE_TYPE="index";
TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
test/infoschema_buffer_test idx 2 32 FILE_PAGE INDEX
DROP TABLE infoschema_buffer_test;
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_buffer_test";
TABLE_NAME INDEX_NAME NUMBER_RECORDS DATA_SIZE PAGE_STATE PAGE_TYPE
CREATE TABLE infoschema_parent (id INT NOT NULL, PRIMARY KEY (id))
ENGINE=INNODB;
CREATE TABLE infoschema_child (id INT, parent_id INT, INDEX par_ind (parent_id),
FOREIGN KEY (parent_id)
REFERENCES infoschema_parent(id)
ON DELETE CASCADE)
ENGINE=INNODB;
SELECT count(*)
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_child" and PAGE_STATE="file_page"
and PAGE_TYPE="index";
count(*)
2
DROP TABLE infoschema_child;
DROP TABLE infoschema_parent;
show create table information_schema.innodb_buffer_page;
Table Create Table
INNODB_BUFFER_PAGE CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE` (
`BLOCK_ID` bigint(21) unsigned NOT NULL DEFAULT '0',
`SPACE` bigint(21) unsigned NOT NULL DEFAULT '0',
`PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT '0',
`PAGE_TYPE` varchar(64) DEFAULT NULL,
`FLUSH_TYPE` bigint(21) unsigned NOT NULL DEFAULT '0',
`FIX_COUNT` bigint(21) unsigned NOT NULL DEFAULT '0',
`IS_HASHED` varchar(3) DEFAULT NULL,
`NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
`OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
`ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT '0',
`TABLE_NAME` varchar(1024) DEFAULT NULL,
`INDEX_NAME` varchar(1024) DEFAULT NULL,
`NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT '0',
`DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
`COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
`PAGE_STATE` varchar(64) DEFAULT NULL,
`IO_FIX` varchar(64) DEFAULT NULL,
`IS_OLD` varchar(3) DEFAULT NULL,
`FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
show create table information_schema.innodb_buffer_page_lru;
Table Create Table
INNODB_BUFFER_PAGE_LRU CREATE TEMPORARY TABLE `INNODB_BUFFER_PAGE_LRU` (
`LRU_POSITION` bigint(21) unsigned NOT NULL DEFAULT '0',
`SPACE` bigint(21) unsigned NOT NULL DEFAULT '0',
`PAGE_NUMBER` bigint(21) unsigned NOT NULL DEFAULT '0',
`PAGE_TYPE` varchar(64) DEFAULT NULL,
`FLUSH_TYPE` bigint(21) unsigned NOT NULL DEFAULT '0',
`FIX_COUNT` bigint(21) unsigned NOT NULL DEFAULT '0',
`IS_HASHED` varchar(3) DEFAULT NULL,
`NEWEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
`OLDEST_MODIFICATION` bigint(21) unsigned NOT NULL DEFAULT '0',
`ACCESS_TIME` bigint(21) unsigned NOT NULL DEFAULT '0',
`TABLE_NAME` varchar(1024) DEFAULT NULL,
`INDEX_NAME` varchar(1024) DEFAULT NULL,
`NUMBER_RECORDS` bigint(21) unsigned NOT NULL DEFAULT '0',
`DATA_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
`COMPRESSED_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
`COMPRESSED` varchar(3) DEFAULT NULL,
`IO_FIX` varchar(64) DEFAULT NULL,
`IS_OLD` varchar(3) DEFAULT NULL,
`FREE_PAGE_CLOCK` bigint(21) unsigned NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
show create table information_schema.innodb_buffer_pool_stats;
Table Create Table
INNODB_BUFFER_POOL_STATS CREATE TEMPORARY TABLE `INNODB_BUFFER_POOL_STATS` (
`POOL_SIZE` bigint(21) unsigned NOT NULL DEFAULT '0',
`FREE_BUFFERS` bigint(21) unsigned NOT NULL DEFAULT '0',
`DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT '0',
`OLD_DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT '0',
`MODIFIED_DATABASE_PAGES` bigint(21) unsigned NOT NULL DEFAULT '0',
`PENDING_DECOMPRESS` bigint(21) unsigned NOT NULL DEFAULT '0',
`PENDING_READS` bigint(21) unsigned NOT NULL DEFAULT '0',
`PENDING_FLUSH_LRU` bigint(21) unsigned NOT NULL DEFAULT '0',
`PENDING_FLUSH_LIST` bigint(21) unsigned NOT NULL DEFAULT '0',
`PAGES_MADE_YOUNG` bigint(21) unsigned NOT NULL DEFAULT '0',
`PAGES_NOT_MADE_YOUNG` bigint(21) unsigned NOT NULL DEFAULT '0',
`PAGES_MADE_YOUNG_RATE` double NOT NULL DEFAULT '0',
`PAGES_MADE_NOT_YOUNG_RATE` double NOT NULL DEFAULT '0',
`NUMBER_PAGES_READ` bigint(21) unsigned NOT NULL DEFAULT '0',
`NUMBER_PAGES_CREATED` bigint(21) unsigned NOT NULL DEFAULT '0',
`NUMBER_PAGES_WRITTEN` bigint(21) unsigned NOT NULL DEFAULT '0',
`PAGES_READ_RATE` double NOT NULL DEFAULT '0',
`PAGES_CREATE_RATE` double NOT NULL DEFAULT '0',
`PAGES_WRITTEN_RATE` double NOT NULL DEFAULT '0',
`NUMBER_PAGES_GET` bigint(21) unsigned NOT NULL DEFAULT '0',
`HIT_RATE` bigint(21) unsigned NOT NULL DEFAULT '0',
`YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL DEFAULT '0',
`NOT_YOUNG_MAKE_PER_THOUSAND_GETS` bigint(21) unsigned NOT NULL DEFAULT '0',
`NUMBER_PAGES_READ_AHEAD` bigint(21) unsigned NOT NULL DEFAULT '0',
`NUMBER_READ_AHEAD_EVICTED` bigint(21) unsigned NOT NULL DEFAULT '0',
`READ_AHEAD_RATE` double NOT NULL DEFAULT '0',
`READ_AHEAD_EVICTED_RATE` double NOT NULL DEFAULT '0',
`LRU_IO_TOTAL` bigint(21) unsigned NOT NULL DEFAULT '0',
`LRU_IO_CURRENT` bigint(21) unsigned NOT NULL DEFAULT '0',
`UNCOMPRESS_TOTAL` bigint(21) unsigned NOT NULL DEFAULT '0',
`UNCOMPRESS_CURRENT` bigint(21) unsigned NOT NULL DEFAULT '0'
) ENGINE=MEMORY DEFAULT CHARSET=utf8
# Exercise the code path for INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS
# and INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
-- source include/have_innodb_plugin.inc
-- disable_result_log
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
# How many buffer pools we have
SELECT count(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_POOL_STATS;
SELECT * FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
# This gives the over all buffer pool size
SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE;
-- enable_result_log
# Create a table and check its page info behave correctly in the pool
CREATE TABLE infoschema_buffer_test (col1 INT) ENGINE = INNODB;
INSERT INTO infoschema_buffer_test VALUES(9);
# We should be able to see this table in the buffer pool if we check
# right away
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_buffer_test"
and PAGE_STATE="file_page" and PAGE_TYPE="index";
# The NUMBER_RECORDS and DATA_SIZE should check with each insertion
INSERT INTO infoschema_buffer_test VALUES(19);
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_buffer_test"
and PAGE_STATE="file_page" and PAGE_TYPE="index";
CREATE INDEX idx ON infoschema_buffer_test(col1);
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_buffer_test"
and PAGE_STATE="file_page" and INDEX_NAME = "idx" and PAGE_TYPE="index";
# Check the buffer after dropping the table
DROP TABLE infoschema_buffer_test;
SELECT TABLE_NAME, INDEX_NAME, NUMBER_RECORDS, DATA_SIZE, PAGE_STATE, PAGE_TYPE
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_buffer_test";
# Do one more test
#--replace_regex /'*[0-9]*'/'NUM'/
CREATE TABLE infoschema_parent (id INT NOT NULL, PRIMARY KEY (id))
ENGINE=INNODB;
CREATE TABLE infoschema_child (id INT, parent_id INT, INDEX par_ind (parent_id),
FOREIGN KEY (parent_id)
REFERENCES infoschema_parent(id)
ON DELETE CASCADE)
ENGINE=INNODB;
SELECT count(*)
FROM INFORMATION_SCHEMA.INNODB_BUFFER_PAGE
WHERE TABLE_NAME like "%infoschema_child" and PAGE_STATE="file_page"
and PAGE_TYPE="index";
DROP TABLE infoschema_child;
DROP TABLE infoschema_parent;
show create table information_schema.innodb_buffer_page;
show create table information_schema.innodb_buffer_page_lru;
show create table information_schema.innodb_buffer_pool_stats;
......@@ -269,14 +269,6 @@ read-ahead or flush occurs */
UNIV_INTERN ibool buf_debug_prints = FALSE;
#endif /* UNIV_DEBUG */
/** A chunk of buffers. The buffer pool is allocated in chunks. */
struct buf_chunk_struct{
ulint mem_size; /*!< allocated size of the chunk */
ulint size; /*!< size of frames[] and blocks[] */
void* mem; /*!< pointer to the memory area which
was allocated for the frames */
buf_block_t* blocks; /*!< array of buffer control blocks */
};
#endif /* !UNIV_HOTBACKUP */
/********************************************************************//**
......@@ -3623,6 +3615,133 @@ buf_get_free_list_len(void)
return(len);
}
/*******************************************************************//**
Collect buffer pool stats information for a buffer pool. Also
record aggregated stats if there are more than one buffer pool
in the server */
UNIV_INTERN
void
buf_stats_get_pool_info(
/*====================*/
buf_pool_info_t* pool_info) /*!< in/out: buffer pool info
to fill */
{
time_t current_time;
double time_elapsed;
buf_pool_mutex_enter();
pool_info->pool_size = buf_pool->curr_size;
pool_info->lru_len = UT_LIST_GET_LEN(buf_pool->LRU);
pool_info->old_lru_len = buf_pool->LRU_old_len;
pool_info->free_list_len = UT_LIST_GET_LEN(buf_pool->free);
pool_info->flush_list_len = UT_LIST_GET_LEN(buf_pool->flush_list);
pool_info->n_pend_unzip = UT_LIST_GET_LEN(buf_pool->unzip_LRU);
pool_info->n_pend_reads = buf_pool->n_pend_reads;
pool_info->n_pending_flush_lru =
(buf_pool->n_flush[BUF_FLUSH_LRU]
+ buf_pool->init_flush[BUF_FLUSH_LRU]);
pool_info->n_pending_flush_list =
(buf_pool->n_flush[BUF_FLUSH_LIST]
+ buf_pool->init_flush[BUF_FLUSH_LIST]);
pool_info->n_pending_flush_single_page =
(buf_pool->n_flush[BUF_FLUSH_SINGLE_PAGE]
+ buf_pool->init_flush[BUF_FLUSH_SINGLE_PAGE]);
current_time = time(NULL);
time_elapsed = 0.001 + difftime(current_time,
buf_pool->last_printout_time);
pool_info->n_pages_made_young = buf_pool->stat.n_pages_made_young;
pool_info->n_pages_not_made_young =
buf_pool->stat.n_pages_not_made_young;
pool_info->n_pages_read = buf_pool->stat.n_pages_read;
pool_info->n_pages_created = buf_pool->stat.n_pages_created;
pool_info->n_pages_written = buf_pool->stat.n_pages_written;
pool_info->n_page_gets = buf_pool->stat.n_page_gets;
pool_info->n_ra_pages_read_rnd = buf_pool->stat.n_ra_pages_read_rnd;
pool_info->n_ra_pages_read = buf_pool->stat.n_ra_pages_read;
pool_info->n_ra_pages_evicted = buf_pool->stat.n_ra_pages_evicted;
pool_info->page_made_young_rate =
(buf_pool->stat.n_pages_made_young
- buf_pool->old_stat.n_pages_made_young) / time_elapsed;
pool_info->page_not_made_young_rate =
(buf_pool->stat.n_pages_not_made_young
- buf_pool->old_stat.n_pages_not_made_young) / time_elapsed;
pool_info->pages_read_rate =
(buf_pool->stat.n_pages_read
- buf_pool->old_stat.n_pages_read) / time_elapsed;
pool_info->pages_created_rate =
(buf_pool->stat.n_pages_created
- buf_pool->old_stat.n_pages_created) / time_elapsed;
pool_info->pages_written_rate =
(buf_pool->stat.n_pages_written
- buf_pool->old_stat.n_pages_written) / time_elapsed;
pool_info->n_page_get_delta = buf_pool->stat.n_page_gets
- buf_pool->old_stat.n_page_gets;
if (pool_info->n_page_get_delta) {
pool_info->page_read_delta = buf_pool->stat.n_pages_read
- buf_pool->old_stat.n_pages_read;
pool_info->young_making_delta =
buf_pool->stat.n_pages_made_young
- buf_pool->old_stat.n_pages_made_young;
pool_info->not_young_making_delta =
buf_pool->stat.n_pages_not_made_young
- buf_pool->old_stat.n_pages_not_made_young;
}
pool_info->pages_readahead_rnd_rate =
(buf_pool->stat.n_ra_pages_read_rnd
- buf_pool->old_stat.n_ra_pages_read_rnd) / time_elapsed;
pool_info->pages_readahead_rate =
(buf_pool->stat.n_ra_pages_read
- buf_pool->old_stat.n_ra_pages_read) / time_elapsed;
pool_info->pages_evicted_rate =
(buf_pool->stat.n_ra_pages_evicted
- buf_pool->old_stat.n_ra_pages_evicted) / time_elapsed;
pool_info->unzip_lru_len = UT_LIST_GET_LEN(buf_pool->unzip_LRU);
pool_info->io_sum = buf_LRU_stat_sum.io;
pool_info->io_cur = buf_LRU_stat_cur.io;
pool_info->unzip_sum = buf_LRU_stat_sum.unzip;
pool_info->unzip_cur = buf_LRU_stat_cur.unzip;
buf_refresh_io_stats();
buf_pool_mutex_exit();
}
#else /* !UNIV_HOTBACKUP */
/********************************************************************//**
Inits a page to the buffer buf_pool, for use in ibbackup --restore. */
......@@ -3653,3 +3772,5 @@ buf_page_init_for_backup_restore(
}
}
#endif /* !UNIV_HOTBACKUP */
......@@ -11341,7 +11341,10 @@ i_s_innodb_lock_waits,
i_s_innodb_cmp,
i_s_innodb_cmp_reset,
i_s_innodb_cmpmem,
i_s_innodb_cmpmem_reset
i_s_innodb_cmpmem_reset,
i_s_innodb_buffer_page,
i_s_innodb_buffer_page_lru,
i_s_innodb_buffer_stats
mysql_declare_plugin_end;
/** @brief Initialize the default value of innodb_commit_concurrency.
......
This diff is collapsed.
......@@ -33,5 +33,8 @@ extern struct st_mysql_plugin i_s_innodb_cmp;
extern struct st_mysql_plugin i_s_innodb_cmp_reset;
extern struct st_mysql_plugin i_s_innodb_cmpmem;
extern struct st_mysql_plugin i_s_innodb_cmpmem_reset;
extern struct st_mysql_plugin i_s_innodb_buffer_page;
extern struct st_mysql_plugin i_s_innodb_buffer_page_lru;
extern struct st_mysql_plugin i_s_innodb_buffer_stats;
#endif /* i_s_h */
......@@ -103,6 +103,81 @@ enum buf_page_state {
before putting to the free list */
};
/** This structure defines information we will fetch from each buffer pool. It
will be used to print table IO stats */
struct buf_pool_info_struct{
/* General buffer pool info */
ulint pool_size; /*!< Buffer Pool size in pages */
ulint lru_len; /*!< Length of buf_pool->LRU */
ulint old_lru_len; /*!< buf_pool->LRU_old_len */
ulint free_list_len; /*!< Length of buf_pool->free list */
ulint flush_list_len; /*!< Length of buf_pool->flush_list */
ulint n_pend_unzip; /*!< buf_pool->n_pend_unzip, pages
pending decompress */
ulint n_pend_reads; /*!< buf_pool->n_pend_reads, pages
pending read */
ulint n_pending_flush_lru; /*!< Pages pending flush in LRU */
ulint n_pending_flush_single_page;/*!< Pages pending to be
flushed as part of single page
flushes issued by various user
threads */
ulint n_pending_flush_list; /*!< Pages pending flush in FLUSH
LIST */
ulint n_pages_made_young; /*!< number of pages made young */
ulint n_pages_not_made_young; /*!< number of pages not made young */
ulint n_pages_read; /*!< buf_pool->n_pages_read */
ulint n_pages_created; /*!< buf_pool->n_pages_created */
ulint n_pages_written; /*!< buf_pool->n_pages_written */
ulint n_page_gets; /*!< buf_pool->n_page_gets */
ulint n_ra_pages_read_rnd; /*!< buf_pool->n_ra_pages_read_rnd,
number of pages readahead */
ulint n_ra_pages_read; /*!< buf_pool->n_ra_pages_read, number
of pages readahead */
ulint n_ra_pages_evicted; /*!< buf_pool->n_ra_pages_evicted,
number of readahead pages evicted
without access */
ulint n_page_get_delta; /*!< num of buffer pool page gets since
last printout */
/* Buffer pool access stats */
double page_made_young_rate; /*!< page made young rate in pages
per second */
double page_not_made_young_rate;/*!< page not made young rate
in pages per second */
double pages_read_rate; /*!< num of pages read per second */
double pages_created_rate; /*!< num of pages create per second */
double pages_written_rate; /*!< num of pages written per second */
ulint page_read_delta; /*!< num of pages read since last
printout */
ulint young_making_delta; /*!< num of pages made young since
last printout */
ulint not_young_making_delta; /*!< num of pages not make young since
last printout */
/* Statistics about read ahead algorithm. */
double pages_readahead_rnd_rate;/*!< random readahead rate in pages per
second */
double pages_readahead_rate; /*!< readahead rate in pages per
second */
double pages_evicted_rate; /*!< rate of readahead page evicted
without access, in pages per second */
/* Stats about LRU eviction */
ulint unzip_lru_len; /*!< length of buf_pool->unzip_LRU
list */
/* Counters for LRU policy */
ulint io_sum; /*!< buf_LRU_stat_sum.io */
ulint io_cur; /*!< buf_LRU_stat_cur.io, num of IO
for current interval */
ulint unzip_sum; /*!< buf_LRU_stat_sum.unzip */
ulint unzip_cur; /*!< buf_LRU_stat_cur.unzip, num
pages decompressed in current
interval */
};
typedef struct buf_pool_info_struct buf_pool_info_t;
#ifndef UNIV_HOTBACKUP
/********************************************************************//**
Creates the buffer pool.
......@@ -618,6 +693,16 @@ void
buf_print_io(
/*=========*/
FILE* file); /*!< in: file where to print */
/*******************************************************************//**
Collect buffer pool stats information for a buffer pool. Also
record aggregated stats if there are more than one buffer pool
in the server */
UNIV_INTERN
void
buf_stats_get_pool_info(
/*====================*/
buf_pool_info_t* pool_info); /*!< in/out: buffer pool info
to fill */
/*********************************************************************//**
Returns the ratio in percents of modified pages in the buffer pool /
database pages in the buffer pool.
......@@ -1037,12 +1122,27 @@ UNIV_INTERN
ulint
buf_get_free_list_len(void);
/*=======================*/
/*********************************************************************//**
Get the nth chunk's buffer block in the specified buffer pool.
@return the nth chunk's buffer block. */
UNIV_INLINE
buf_block_t*
buf_get_nth_chunk_block(
/*====================*/
const buf_pool_t* buf_pool, /*!< in: buffer pool instance */
ulint n, /*!< in: nth chunk in the buffer pool */
ulint* chunk_size); /*!< in: chunk size */
#endif /* !UNIV_HOTBACKUP */
/** The common buffer control block structure
for compressed and uncompressed frames */
/** Number of bits used for buffer page states. */
#define BUF_PAGE_STATE_BITS 3
struct buf_page_struct{
/** @name General fields
None of these bit-fields must be modified without holding
......@@ -1057,7 +1157,8 @@ struct buf_page_struct{
unsigned offset:32; /*!< page number; also protected
by buf_pool_mutex. */
unsigned state:3; /*!< state of the control block; also
unsigned state:BUF_PAGE_STATE_BITS;
/*!< state of the control block; also
protected by buf_pool_mutex.
State transitions from
BUF_BLOCK_READY_FOR_USE to
......
......@@ -36,6 +36,16 @@ Created 11/5/1995 Heikki Tuuri
#include "buf0lru.h"
#include "buf0rea.h"
/** A chunk of buffers. The buffer pool is allocated in chunks. */
struct buf_chunk_struct{
ulint mem_size; /*!< allocated size of the chunk */
ulint size; /*!< size of frames[] and blocks[] */
void* mem; /*!< pointer to the memory area which
was allocated for the frames */
buf_block_t* blocks; /*!< array of buffer control blocks */
};
/********************************************************************//**
Reads the freed_page_clock of a buffer block.
@return freed_page_clock */
......@@ -1106,4 +1116,23 @@ buf_block_dbg_add_level(
sync_thread_add_level(&block->lock, level, FALSE);
}
#endif /* UNIV_SYNC_DEBUG */
/*********************************************************************//**
Get the nth chunk's buffer block in the specified buffer pool.
@return the nth chunk's buffer block. */
UNIV_INLINE
buf_block_t*
buf_get_nth_chunk_block(
/*====================*/
const buf_pool_t* buf_pool, /*!< in: buffer pool instance */
ulint n, /*!< in: nth chunk in the buffer pool */
ulint* chunk_size) /*!< in: chunk size */
{
const buf_chunk_t* chunk;
chunk = buf_pool->chunks + n;
*chunk_size = chunk->size;
return(chunk->blocks);
}
#endif /* !UNIV_HOTBACKUP */
......@@ -141,6 +141,8 @@ extern fil_addr_t fil_addr_null;
#define FIL_PAGE_TYPE_BLOB 10 /*!< Uncompressed BLOB page */
#define FIL_PAGE_TYPE_ZBLOB 11 /*!< First compressed BLOB page */
#define FIL_PAGE_TYPE_ZBLOB2 12 /*!< Subsequent compressed BLOB page */
#define FIL_PAGE_TYPE_LAST FIL_PAGE_TYPE_ZBLOB2
/*!< Last page type */
/* @} */
/** Space types @{ */
......
......@@ -41,6 +41,9 @@ Created 12/9/1995 Heikki Tuuri
#include "sync0rw.h"
#endif /* !UNIV_HOTBACKUP */
/* Type used for all log sequence number storage and arithmetics */
typedef ib_uint64_t lsn_t;
/** Redo log buffer */
typedef struct log_struct log_t;
/** Redo log group */
......
......@@ -7,3 +7,6 @@ INSTALL PLUGIN innodb_cmp SONAME 'ha_innodb.so';
INSTALL PLUGIN innodb_cmp_reset SONAME 'ha_innodb.so';
INSTALL PLUGIN innodb_cmpmem SONAME 'ha_innodb.so';
INSTALL PLUGIN innodb_cmpmem_reset SONAME 'ha_innodb.so';
INSTALL PLUGIN innodb_buffer_pool_stats SONAME 'ha_innodb.so';
INSTALL PLUGIN innodb_buffer_page SONAME 'ha_innodb.so';
INSTALL PLUGIN innodb_buffer_page_lru SONAME 'ha_innodb.so';
......@@ -7,3 +7,6 @@ INSTALL PLUGIN innodb_cmp SONAME 'ha_innodb.dll';
INSTALL PLUGIN innodb_cmp_reset SONAME 'ha_innodb.dll';
INSTALL PLUGIN innodb_cmpmem SONAME 'ha_innodb.dll';
INSTALL PLUGIN innodb_cmpmem_reset SONAME 'ha_innodb.dll';
INSTALL PLUGIN innodb_buffer_pool_stats SONAME 'ha_innodb.dll';
INSTALL PLUGIN innodb_buffer_page SONAME 'ha_innodb.dll';
INSTALL PLUGIN innodb_buffer_page_lru SONAME 'ha_innodb.dll';
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment