30 changed files with 2118 additions and 66 deletions
-
8mysql-test/r/information_schema_all_engines.result
-
0mysql-test/suite/sys_vars/r/innodb_changed_pages_limit_basic.result
-
24mysql-test/suite/sys_vars/r/innodb_persistent_stats_root_page_basic.result
-
21mysql-test/suite/sys_vars/r/innodb_track_changed_pages_basic.result
-
0mysql-test/suite/sys_vars/t/innodb_changed_pages_limit_basic.test
-
26mysql-test/suite/sys_vars/t/innodb_persistent_stats_root_page_basic.test
-
21mysql-test/suite/sys_vars/t/innodb_track_changed_pages_basic.test
-
31storage/xtradb/CMakeLists.txt
-
9storage/xtradb/btr/btr0sea.c
-
13storage/xtradb/buf/buf0buf.c
-
112storage/xtradb/buf/buf0lru.c
-
36storage/xtradb/handler/ha_innodb.cc
-
295storage/xtradb/handler/i_s.cc
-
1storage/xtradb/handler/i_s.h
-
11storage/xtradb/include/buf0lru.h
-
5storage/xtradb/include/log0log.h
-
111storage/xtradb/include/log0online.h
-
37storage/xtradb/include/log0recv.h
-
9storage/xtradb/include/os0file.h
-
28storage/xtradb/include/os0sync.h
-
23storage/xtradb/include/srv0srv.h
-
2storage/xtradb/include/univ.i
-
22storage/xtradb/include/ut0rbt.h
-
126storage/xtradb/log/log0log.c
-
1085storage/xtradb/log/log0online.c
-
8storage/xtradb/log/log0recv.c
-
20storage/xtradb/os/os0file.c
-
52storage/xtradb/srv/srv0srv.c
-
19storage/xtradb/srv/srv0start.c
-
29storage/xtradb/ut/ut0rbt.c
@ -0,0 +1,24 @@ |
|||
SELECT @@global.innodb_persistent_stats_root_page; |
|||
@@global.innodb_persistent_stats_root_page |
|||
0 |
|||
SELECT COUNT(@@global.innodb_persistent_stats_root_page); |
|||
COUNT(@@global.innodb_persistent_stats_root_page) |
|||
1 |
|||
SET @@global.innodb_persistent_stats_root_page=100; |
|||
ERROR HY000: Variable 'innodb_persistent_stats_root_page' is a read only variable |
|||
SELECT @@global.innodb_persistent_stats_root_page = VARIABLE_VALUE |
|||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
|||
WHERE VARIABLE_NAME='innodb_persistent_stats_root_page'; |
|||
@@global.innodb_persistent_stats_root_page = VARIABLE_VALUE |
|||
1 |
|||
SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
|||
WHERE VARIABLE_NAME='innodb_persistent_stats_root_page'; |
|||
COUNT(*) |
|||
1 |
|||
SELECT @@innodb_persistent_stats_root_page = @@global.innodb_persistent_stats_root_page; |
|||
@@innodb_persistent_stats_root_page = @@global.innodb_persistent_stats_root_page |
|||
1 |
|||
SELECT COUNT(@@local.innodb_persistent_stats_root_page); |
|||
ERROR HY000: Variable 'innodb_persistent_stats_root_page' is a GLOBAL variable |
|||
SELECT COUNT(@@session.innodb_persistent_stats_root_page); |
|||
ERROR HY000: Variable 'innodb_persistent_stats_root_page' is a GLOBAL variable |
|||
@ -0,0 +1,21 @@ |
|||
SELECT COUNT(@@GLOBAL.innodb_track_changed_pages); |
|||
COUNT(@@GLOBAL.innodb_track_changed_pages) |
|||
1 |
|||
SET @@GLOBAL.innodb_track_changed_pages=1; |
|||
ERROR HY000: Variable 'innodb_track_changed_pages' is a read only variable |
|||
SELECT @@GLOBAL.innodb_track_changed_pages = VARIABLE_VALUE |
|||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
|||
WHERE VARIABLE_NAME='innodb_track_changed_pages'; |
|||
@@GLOBAL.innodb_track_changed_pages = VARIABLE_VALUE |
|||
1 |
|||
Warnings: |
|||
Warning 1292 Truncated incorrect DOUBLE value: 'OFF' |
|||
SELECT @@innodb_track_changed_pages = @@GLOBAL.innodb_track_changed_pages; |
|||
@@innodb_track_changed_pages = @@GLOBAL.innodb_track_changed_pages |
|||
1 |
|||
SELECT COUNT(@@SESSION.innodb_track_changed_pages); |
|||
ERROR HY000: Variable 'innodb_track_changed_pages' is a GLOBAL variable |
|||
SELECT COUNT(@@LOCAL.innodb_track_changed_pages); |
|||
ERROR HY000: Variable 'innodb_track_changed_pages' is a GLOBAL variable |
|||
SELECT innodb_track_changed_pages = @@SESSION.innodb_track_changed_pages; |
|||
ERROR 42S22: Unknown column 'innodb_track_changed_pages' in 'field list' |
|||
@ -0,0 +1,26 @@ |
|||
--source include/have_debug.inc |
|||
--source include/have_xtradb.inc |
|||
|
|||
SELECT @@global.innodb_persistent_stats_root_page; |
|||
SELECT COUNT(@@global.innodb_persistent_stats_root_page); |
|||
|
|||
# Read-only variable |
|||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
|||
SET @@global.innodb_persistent_stats_root_page=100; |
|||
|
|||
# Check if INFORMATION_SCHEMA agrees with the var |
|||
SELECT @@global.innodb_persistent_stats_root_page = VARIABLE_VALUE |
|||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
|||
WHERE VARIABLE_NAME='innodb_persistent_stats_root_page'; |
|||
|
|||
SELECT COUNT(*) FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
|||
WHERE VARIABLE_NAME='innodb_persistent_stats_root_page'; |
|||
|
|||
# Check if accessing the var without GLOBAL points to the same |
|||
SELECT @@innodb_persistent_stats_root_page = @@global.innodb_persistent_stats_root_page; |
|||
|
|||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
|||
SELECT COUNT(@@local.innodb_persistent_stats_root_page); |
|||
|
|||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
|||
SELECT COUNT(@@session.innodb_persistent_stats_root_page); |
|||
@ -0,0 +1,21 @@ |
|||
# Tests for innodb_track_changed_pages variable |
|||
|
|||
--source include/have_xtradb.inc |
|||
|
|||
SELECT COUNT(@@GLOBAL.innodb_track_changed_pages); |
|||
|
|||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
|||
SET @@GLOBAL.innodb_track_changed_pages=1; |
|||
|
|||
SELECT @@GLOBAL.innodb_track_changed_pages = VARIABLE_VALUE |
|||
FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
|||
WHERE VARIABLE_NAME='innodb_track_changed_pages'; |
|||
|
|||
SELECT @@innodb_track_changed_pages = @@GLOBAL.innodb_track_changed_pages; |
|||
|
|||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
|||
SELECT COUNT(@@SESSION.innodb_track_changed_pages); |
|||
--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
|||
SELECT COUNT(@@LOCAL.innodb_track_changed_pages); |
|||
--error ER_BAD_FIELD_ERROR |
|||
SELECT innodb_track_changed_pages = @@SESSION.innodb_track_changed_pages; |
|||
@ -0,0 +1,111 @@ |
|||
/***************************************************************************** |
|||
|
|||
Copyright (c) 2011-2012, Percona Inc. All Rights Reserved. |
|||
|
|||
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 |
|||
Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, but WITHOUT |
|||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
|||
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License along with |
|||
this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
|||
Place, Suite 330, Boston, MA 02111-1307 USA |
|||
|
|||
*****************************************************************************/ |
|||
|
|||
/**************************************************//** |
|||
@file include/log0online.h |
|||
Online database log parsing for changed page tracking |
|||
*******************************************************/ |
|||
|
|||
#ifndef log0online_h |
|||
#define log0online_h |
|||
|
|||
#include "univ.i" |
|||
#include "os0file.h" |
|||
|
|||
/*********************************************************************//** |
|||
Initializes the online log following subsytem. */ |
|||
UNIV_INTERN |
|||
void |
|||
log_online_read_init(); |
|||
/*===================*/ |
|||
|
|||
/*********************************************************************//** |
|||
Shuts down the online log following subsystem. */ |
|||
UNIV_INTERN |
|||
void |
|||
log_online_read_shutdown(); |
|||
/*=======================*/ |
|||
|
|||
/*********************************************************************//** |
|||
Reads and parses the redo log up to last checkpoint LSN to build the changed |
|||
page bitmap which is then written to disk. */ |
|||
UNIV_INTERN |
|||
void |
|||
log_online_follow_redo_log(); |
|||
/*=========================*/ |
|||
|
|||
/** The iterator through all bits of changed pages bitmap blocks */ |
|||
struct log_bitmap_iterator_struct |
|||
{ |
|||
char in_name[FN_REFLEN]; /*!< the file name for bitmap |
|||
input */ |
|||
os_file_t in; /*!< the bitmap input file */ |
|||
ib_uint64_t in_offset; /*!< the next write position in the |
|||
bitmap output file */ |
|||
ib_uint32_t bit_offset; /*!< bit offset inside of bitmap |
|||
block*/ |
|||
ib_uint64_t start_lsn; /*!< Start lsn of the block */ |
|||
ib_uint64_t end_lsn; /*!< End lsn of the block */ |
|||
ib_uint32_t space_id; /*!< Block space id */ |
|||
ib_uint32_t first_page_id; /*!< First block page id */ |
|||
ibool changed; /*!< true if current page was changed */ |
|||
byte* page; /*!< Bitmap block */ |
|||
}; |
|||
|
|||
typedef struct log_bitmap_iterator_struct log_bitmap_iterator_t; |
|||
|
|||
#define LOG_BITMAP_ITERATOR_START_LSN(i) \ |
|||
((i).start_lsn) |
|||
#define LOG_BITMAP_ITERATOR_END_LSN(i) \ |
|||
((i).end_lsn) |
|||
#define LOG_BITMAP_ITERATOR_SPACE_ID(i) \ |
|||
((i).space_id) |
|||
#define LOG_BITMAP_ITERATOR_PAGE_NUM(i) \ |
|||
((i).first_page_id + (i).bit_offset) |
|||
#define LOG_BITMAP_ITERATOR_PAGE_CHANGED(i) \ |
|||
((i).changed) |
|||
|
|||
/*********************************************************************//** |
|||
Initializes log bitmap iterator. |
|||
@return TRUE if the iterator is initialized OK, FALSE otherwise. */ |
|||
UNIV_INTERN |
|||
ibool |
|||
log_online_bitmap_iterator_init( |
|||
/*============================*/ |
|||
log_bitmap_iterator_t *i); /*!<in/out: iterator */ |
|||
|
|||
/*********************************************************************//** |
|||
Releases log bitmap iterator. */ |
|||
UNIV_INTERN |
|||
void |
|||
log_online_bitmap_iterator_release( |
|||
/*===============================*/ |
|||
log_bitmap_iterator_t *i); /*!<in/out: iterator */ |
|||
|
|||
/*********************************************************************//** |
|||
Iterates through bits of saved bitmap blocks. |
|||
Sequentially reads blocks from bitmap file(s) and interates through |
|||
their bits. Ignores blocks with wrong checksum. |
|||
@return TRUE if iteration is successful, FALSE if all bits are iterated. */ |
|||
UNIV_INTERN |
|||
ibool |
|||
log_online_bitmap_iterator_next( |
|||
/*============================*/ |
|||
log_bitmap_iterator_t *i); /*!<in/out: iterator */ |
|||
|
|||
#endif |
|||
1085
storage/xtradb/log/log0online.c
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
Write
Preview
Loading…
Cancel
Save
Reference in new issue