Commit 0d31c13e authored by unknown's avatar unknown

Bug#14529666 INNODB_BUFFER_PAGE DOES NOT MARK CHANGE BUFFER PAGES APPROPRIATELY

== Analysis == 
Both change buffer pages and on-disk indexes pages are marked as
FIL_PAGE_INDEX. So all ibuf index pages will classify as INDEX with NULL
table_name and index_name.

== Solution ==
A new page type for ibuf data pages named I_S_PAGE_TYPE_IBUF is defined. All
these pages whose index_id equal (DICT_IBUF_ID_MIN + IBUF_SPACE_ID) will 
classify as IBUF_DATA instead of INDEX in INNODB_BUFFER_PAGE 
and INNODB_BUFFER_PAGE_LRU.

This fix is only for IS reporting, both on-disk and buffer pool structures
keep unchanged.

Approved by both Marko and Jimmy. rb#2334
parent 35a3f9d7
/***************************************************************************** /*****************************************************************************
Copyright (c) 2007, 2009, Innobase Oy. All Rights Reserved. Copyright (c) 2007, 2013, Innobase Oy. All Rights Reserved.
This program is free software; you can redistribute it and/or modify it under This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software the terms of the GNU General Public License as published by the Free Software
...@@ -24,7 +24,7 @@ Created July 18, 2007 Vasil Dimov ...@@ -24,7 +24,7 @@ Created July 18, 2007 Vasil Dimov
*******************************************************/ *******************************************************/
#include <mysqld_error.h> #include <mysqld_error.h>
#include <sql_acl.h> // PROCESS_ACL #include <sql_acl.h>
#include <m_ctype.h> #include <m_ctype.h>
#include <hash.h> #include <hash.h>
...@@ -37,14 +37,16 @@ Created July 18, 2007 Vasil Dimov ...@@ -37,14 +37,16 @@ Created July 18, 2007 Vasil Dimov
extern "C" { extern "C" {
#include "btr0types.h" #include "btr0types.h"
#include "buf0buddy.h" /* for i_s_cmpmem */ #include "buf0buddy.h"
#include "buf0buf.h" /* for buf_pool and PAGE_ZIP_MIN_SIZE */ #include "buf0buf.h"
#include "ibuf0ibuf.h"
#include "dict0mem.h" #include "dict0mem.h"
#include "dict0types.h" #include "dict0types.h"
#include "ha_prototypes.h" /* for innobase_convert_name() */ #include "dict0boot.h"
#include "srv0start.h" /* for srv_was_started */ #include "ha_prototypes.h"
#include "srv0start.h"
#include "trx0i_s.h" #include "trx0i_s.h"
#include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */ #include "trx0trx.h"
#include "btr0btr.h" #include "btr0btr.h"
#include "page0zip.h" #include "page0zip.h"
#include "log0log.h" #include "log0log.h"
...@@ -60,8 +62,12 @@ struct buffer_page_desc_str_struct{ ...@@ -60,8 +62,12 @@ struct buffer_page_desc_str_struct{
typedef struct buffer_page_desc_str_struct buf_page_desc_str_t; typedef struct buffer_page_desc_str_struct buf_page_desc_str_t;
/** Any states greater than FIL_PAGE_TYPE_LAST would be treated as unknown. */ /** Change buffer B-tree page */
#define I_S_PAGE_TYPE_UNKNOWN (FIL_PAGE_TYPE_LAST + 1) #define I_S_PAGE_TYPE_IBUF (FIL_PAGE_TYPE_LAST + 1)
/** Any states greater than I_S_PAGE_TYPE_IBUF would be treated as
unknown. */
#define I_S_PAGE_TYPE_UNKNOWN (I_S_PAGE_TYPE_IBUF + 1)
/** We also define I_S_PAGE_TYPE_INDEX as the Index Page's position /** We also define I_S_PAGE_TYPE_INDEX as the Index Page's position
in i_s_page_type[] array */ in i_s_page_type[] array */
...@@ -82,6 +88,7 @@ static buf_page_desc_str_t i_s_page_type[] = { ...@@ -82,6 +88,7 @@ static buf_page_desc_str_t i_s_page_type[] = {
{"BLOB", FIL_PAGE_TYPE_BLOB}, {"BLOB", FIL_PAGE_TYPE_BLOB},
{"COMPRESSED_BLOB", FIL_PAGE_TYPE_ZBLOB}, {"COMPRESSED_BLOB", FIL_PAGE_TYPE_ZBLOB},
{"COMPRESSED_BLOB2", FIL_PAGE_TYPE_ZBLOB2}, {"COMPRESSED_BLOB2", FIL_PAGE_TYPE_ZBLOB2},
{"IBUF_INDEX", I_S_PAGE_TYPE_IBUF},
{"UNKNOWN", I_S_PAGE_TYPE_UNKNOWN} {"UNKNOWN", I_S_PAGE_TYPE_UNKNOWN}
}; };
...@@ -2788,14 +2795,21 @@ i_s_innodb_set_page_type( ...@@ -2788,14 +2795,21 @@ i_s_innodb_set_page_type(
if (page_type == FIL_PAGE_INDEX) { if (page_type == FIL_PAGE_INDEX) {
const page_t* page = (const page_t*) frame; const page_t* page = (const page_t*) frame;
page_info->index_id = btr_page_get_index_id(page);
/* FIL_PAGE_INDEX is a bit special, its value /* FIL_PAGE_INDEX is a bit special, its value
is defined as 17855, so we cannot use FIL_PAGE_INDEX is defined as 17855, so we cannot use FIL_PAGE_INDEX
to index into i_s_page_type[] array, its array index to index into i_s_page_type[] array, its array index
in the i_s_page_type[] array is I_S_PAGE_TYPE_INDEX in the i_s_page_type[] array is I_S_PAGE_TYPE_INDEX
(1) */ (1) for index pages or I_S_PAGE_TYPE_IBUF for
change buffer index pages */
if (page_info->index_id
== static_cast<index_id_t>(DICT_IBUF_ID_MIN
+ IBUF_SPACE_ID)) {
page_info->page_type = I_S_PAGE_TYPE_IBUF;
} else {
page_info->page_type = I_S_PAGE_TYPE_INDEX; page_info->page_type = I_S_PAGE_TYPE_INDEX;
}
page_info->index_id = btr_page_get_index_id(page);
page_info->data_size = (ulint)(page_header_get_field( page_info->data_size = (ulint)(page_header_get_field(
page, PAGE_HEAP_TOP) - (page_is_comp(page) page, PAGE_HEAP_TOP) - (page_is_comp(page)
...@@ -2804,7 +2818,7 @@ i_s_innodb_set_page_type( ...@@ -2804,7 +2818,7 @@ i_s_innodb_set_page_type(
- page_header_get_field(page, PAGE_GARBAGE)); - page_header_get_field(page, PAGE_GARBAGE));
page_info->num_recs = page_get_n_recs(page); page_info->num_recs = page_get_n_recs(page);
} else if (page_type >= I_S_PAGE_TYPE_UNKNOWN) { } else if (page_type > FIL_PAGE_TYPE_LAST) {
/* Encountered an unknown page type */ /* Encountered an unknown page type */
page_info->page_type = I_S_PAGE_TYPE_UNKNOWN; page_info->page_type = I_S_PAGE_TYPE_UNKNOWN;
} else { } else {
......
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