Merge lp:~laurynas-biveinis/percona-server/BT-16724-xtradb-bmp-requests-5.5 into lp:percona-server/5.5

Proposed by Laurynas Biveinis
Status: Superseded
Proposed branch: lp:~laurynas-biveinis/percona-server/BT-16724-xtradb-bmp-requests-5.5
Merge into: lp:percona-server/5.5
Prerequisite: lp:~laurynas-biveinis/percona-server/xtradb-multiple-bmp-files-5.5
Diff against target: 970 lines (+569/-18)
24 files modified
Percona-Server/include/mysql_com.h (+4/-0)
Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc (+0/-11)
Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result (+1/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result (+1/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result (+74/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result (+3/-0)
Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result (+1/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test (+3/-1)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test (+3/-1)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt (+1/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test (+194/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt (+1/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test (+7/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test (+3/-1)
Percona-Server/sql/handler.cc (+36/-0)
Percona-Server/sql/handler.h (+5/-0)
Percona-Server/sql/lex.h (+1/-0)
Percona-Server/sql/sql_parse.cc (+37/-4)
Percona-Server/sql/sql_reload.cc (+8/-0)
Percona-Server/sql/sql_yacc.yy (+12/-0)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+55/-0)
Percona-Server/storage/innobase/include/log0online.h (+13/-0)
Percona-Server/storage/innobase/include/sync0sync.h (+2/-0)
Percona-Server/storage/innobase/log/log0online.c (+104/-0)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/BT-16724-xtradb-bmp-requests-5.5
Reviewer Review Type Date Requested Status
Vlad Lesin (community) Needs Fixing
Review via email: mp+134319@code.launchpad.net

This proposal has been superseded by a proposal from 2012-11-25.

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Typo in the id - it's 16274.

Revision history for this message
Vlad Lesin (vlad-lesin) wrote :

See comments in 5.1 branch.

review: Needs Fixing

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Percona-Server/include/mysql_com.h'
--- Percona-Server/include/mysql_com.h 2012-05-10 07:49:14 +0000
+++ Percona-Server/include/mysql_com.h 2012-11-25 09:45:24 +0000
@@ -152,6 +152,10 @@
152#define REFRESH_USER_STATS 0x800000L /* Refresh user stats my_hash table */152#define REFRESH_USER_STATS 0x800000L /* Refresh user stats my_hash table */
153#define REFRESH_CLIENT_STATS 0x1000000L /* Refresh client stats my_hash table */153#define REFRESH_CLIENT_STATS 0x1000000L /* Refresh client stats my_hash table */
154#define REFRESH_THREAD_STATS 0x2000000L /* Refresh thread stats my_hash table */154#define REFRESH_THREAD_STATS 0x2000000L /* Refresh thread stats my_hash table */
155#define REFRESH_FLUSH_PAGE_BITMAPS 0x400000L
156#define REFRESH_RESET_PAGE_BITMAPS 0x800000L
157
158#define PURGE_BITMAPS_TO_LSN 1
155159
156#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */160#define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */
157#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */161#define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */
158162
=== removed file 'Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc'
--- Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc 2012-11-25 09:45:24 +0000
+++ Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
1# Remove all the InnoDB bitmap files. A temporary measure until RESET user request is implemented
2
3let $MYSQLD_DATADIR= `select @@datadir`;
4
5--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
6--shutdown_server 10
7--source include/wait_until_disconnected.inc
8remove_files_wildcard $MYSQLD_DATADIR ib_modified_log*;
9--enable_reconnect
10--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
11--source include/wait_until_connected_again.inc
120
=== modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 2012-11-25 09:45:24 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 2012-11-25 09:45:24 +0000
@@ -1,3 +1,4 @@
1RESET ALL CHANGED PAGE BITMAPS;
1DROP TABLE IF EXISTS t1, t2;2DROP TABLE IF EXISTS t1, t2;
2CREATE TABLE t1 (x INT) ENGINE=InnoDB;3CREATE TABLE t1 (x INT) ENGINE=InnoDB;
3INSERT INTO t1 VALUES (1),(2),(3),(4),(5);4INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
45
=== modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result 2012-11-25 09:45:24 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result 2012-11-25 09:45:24 +0000
@@ -1,3 +1,4 @@
1RESET ALL CHANGED PAGE BITMAPS;
1DROP TABLE IF EXISTS t1, t2;2DROP TABLE IF EXISTS t1, t2;
2CREATE TABLE t1 (x INT) ENGINE=InnoDB;3CREATE TABLE t1 (x INT) ENGINE=InnoDB;
3INSERT INTO t1 VALUES (1),(2),(3),(4),(5);4INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
45
=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result 2012-11-25 09:45:24 +0000
@@ -0,0 +1,74 @@
1RESET ALL CHANGED PAGE BITMAPS;
2DROP TABLE IF EXISTS t1;
3DELETE FROM mysql.user WHERE USER='mysqltest_1';
4FLUSH PRIVILEGES;
5CREATE TABLE t1 (x INT) ENGINE=InnoDB;
6INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
7FLUSH ALL CHANGED PAGE BITMAPS;
8Before RESET:
9ib_modified_log_1
10ib_modified_log_2
11RESET ALL CHANGED PAGE BITMAPS;
12After RESET:
13ib_modified_log_1
14RESET ALL CHANGED PAGE BITMAPS;
15After 2nd RESET
16ib_modified_log_1
17After RESETs and restart:
18ib_modified_log_1
19ib_modified_log_2
20PURGE ALL CHANGED PAGE BITMAPS BEFORE 1;
21After PURGE ... BEFORE 1:
22ib_modified_log_2
23PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000;
24PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000;
25INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
26After PURGE ... BEFORE 100000 and restart:
27ib_modified_log_2
28ib_modified_log_3
29PURGE ALL CHANGED PAGE BITMAPS BEFORE 5+5;
30ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+5' at line 1
31PURGE ALL CHANGED PAGE BITMAPS BEFORE -12;
32ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-12' at line 1
33PURGE ALL CHANGED PAGE BITMAPS BEFORE 1.2e-2;
34ERROR 42000: Only integers allowed as number here near '1.2e-2' at line 1
35PURGE ALL CHANGED PAGE BITMAPS BEFORE t1;
36ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1' at line 1
37PURGE ALL CHANGED PAGE BITMAPS BEFORE "t1";
38ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"t1"' at line 1
39PURGE ALL CHANGED PAGE BITMAPS BEFORE TRUE;
40ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRUE' at line 1
41PURGE ALL CHANGED PAGE BITMAPS BEFORE NULL;
42ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1
43CREATE USER mysqltest_1@localhost;
44GRANT ALL ON *.* TO mysqltest_1@localhost;
45REVOKE SUPER ON *.* FROM mysqltest_1@localhost;
46FLUSH ALL CHANGED PAGE BITMAPS;
47ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
48RESET ALL CHANGED PAGE BITMAPS;
49ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
50PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000;
51ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation
52DROP USER mysqltest_1@localhost;
53SELECT @@GLOBAL.innodb_track_changed_pages;
54@@GLOBAL.innodb_track_changed_pages
550
56FLUSH ALL CHANGED PAGE BITMAPS;
57Before the PURGE with tracking disabled
58ib_modified_log_2
59ib_modified_log_3
60PURGE ALL CHANGED PAGE BITMAPS BEFORE 1;
61After the PURGE that deletes nothing:
62ib_modified_log_2
63ib_modified_log_3
64PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000;
65After the PURGE that deletes everything:
66PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000;
67After the repeated PURGE:
68INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
69Before the RESET while tracking disabled:
70ib_modified_log_1
71ib_modified_log_2
72RESET ALL CHANGED PAGE BITMAPS;
73After the RESET with tracking disabled:
74DROP TABLE t1;
075
=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result 2012-11-25 09:45:24 +0000
@@ -0,0 +1,3 @@
1FLUSH ALL CHANGED PAGE BITMAPS;
2RESET ALL CHANGED PAGE BITMAPS;
3PURGE ALL CHANGED PAGE BITMAPS BEFORE 1;
04
=== modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result'
--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result 2012-11-25 09:45:24 +0000
+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result 2012-11-25 09:45:24 +0000
@@ -1,3 +1,4 @@
1RESET ALL CHANGED PAGE BITMAPS;
1DROP TABLE IF EXISTS T1;2DROP TABLE IF EXISTS T1;
2CREATE TABLE T1 (F1 CHAR(255)) ENGINE=INNODB;3CREATE TABLE T1 (F1 CHAR(255)) ENGINE=INNODB;
31st interval end LSN greater than interval start LSN:41st interval end LSN greater than interval start LSN:
45
=== modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 2012-11-25 09:45:24 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 2012-11-25 09:45:24 +0000
@@ -13,7 +13,9 @@
13# Valgrind reports useless errors on very fast server shutdowns13# Valgrind reports useless errors on very fast server shutdowns
14--source include/not_valgrind.inc14--source include/not_valgrind.inc
1515
16--source include/delete_innodb_bitmaps.inc16# Delete any existing bitmaps
17--source include/restart_mysqld.inc
18RESET ALL CHANGED PAGE BITMAPS;
1719
18--disable_warnings20--disable_warnings
19DROP TABLE IF EXISTS t1, t2;21DROP TABLE IF EXISTS t1, t2;
2022
=== modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test 2012-11-25 09:45:24 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test 2012-11-25 09:45:24 +0000
@@ -2,7 +2,9 @@
2# percona_changed_page_bmp test, which contains the full functional tests.2# percona_changed_page_bmp test, which contains the full functional tests.
3--source include/have_innodb.inc3--source include/have_innodb.inc
44
5--source include/delete_innodb_bitmaps.inc5# Delete any existing bitmaps
6--source include/restart_mysqld.inc
7RESET ALL CHANGED PAGE BITMAPS;
68
7--disable_warnings9--disable_warnings
8DROP TABLE IF EXISTS t1, t2;10DROP TABLE IF EXISTS t1, t2;
911
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt 2012-11-25 09:45:24 +0000
@@ -0,0 +1,1 @@
1--innodb_track_changed_pages=TRUE
02
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test 2012-11-25 09:45:24 +0000
@@ -0,0 +1,194 @@
1#
2# Tests for changed page tracking bitmaps: user requests.
3#
4--source include/have_innodb.inc
5
6# Delete any existing bitmaps
7--source include/restart_mysqld.inc
8RESET ALL CHANGED PAGE BITMAPS;
9
10--source include/count_sessions.inc
11
12let $MYSQLD_DATADIR= `select @@datadir`;
13
14--disable_warnings
15DROP TABLE IF EXISTS t1;
16DELETE FROM mysql.user WHERE USER='mysqltest_1';
17FLUSH PRIVILEGES;
18--enable_warnings
19
20CREATE TABLE t1 (x INT) ENGINE=InnoDB;
21INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
22
23#
24# Test FLUSH ALL CHANGED PAGE BITMAPS. Not much to test due to checkpointing non-determinism,
25# just see that it does not crash or return an error
26#
27FLUSH ALL CHANGED PAGE BITMAPS;
28
29#
30# Test that RESET ALL CHANGED PAGE BITMAPS works
31#
32
33# Have at least two bitmap files
34--source include/restart_mysqld.inc
35
36--echo Before RESET:
37--replace_regex /_[[:digit:]]+\.xdb$//
38list_files $MYSQLD_DATADIR ib_modified_log*;
39
40RESET ALL CHANGED PAGE BITMAPS;
41
42--echo After RESET:
43--replace_regex /_[[:digit:]]+\.xdb$//
44list_files $MYSQLD_DATADIR ib_modified_log*;
45
46# Test consecutive RESET
47RESET ALL CHANGED PAGE BITMAPS;
48--echo After 2nd RESET
49--replace_regex /_[[:digit:]]+\.xdb$//
50list_files $MYSQLD_DATADIR ib_modified_log*;
51
52# Check that the file sequence after RESET starts with 1 again
53--source include/restart_mysqld.inc
54
55--echo After RESETs and restart:
56--replace_regex /_[[:digit:]]+\.xdb$//
57list_files $MYSQLD_DATADIR ib_modified_log*;
58
59#
60# Test that PURGE ALL CHANGED PAGE BITMAPS BEFORE works. We don't test partial PURGE
61# because it's hard to extract good LSN value for that.
62#
63
64# PURGE that deletes nothing
65PURGE ALL CHANGED PAGE BITMAPS BEFORE 1;
66--echo After PURGE ... BEFORE 1:
67--replace_regex /_[[:digit:]]+\.xdb$//
68list_files $MYSQLD_DATADIR ib_modified_log*;
69
70# PURGE that deletes everything
71PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000;
72# Test consecutive PURGE
73PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000;
74
75# Check that file sequence continues
76INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
77--source include/restart_mysqld.inc
78--echo After PURGE ... BEFORE 100000 and restart:
79--replace_regex /_[[:digit:]]+\.xdb$//
80list_files $MYSQLD_DATADIR ib_modified_log*;
81
82#
83# Test malformed PURGE ... BEFORE
84#
85--error ER_PARSE_ERROR
86PURGE ALL CHANGED PAGE BITMAPS BEFORE 5+5;
87
88--error ER_PARSE_ERROR
89PURGE ALL CHANGED PAGE BITMAPS BEFORE -12;
90
91--error ER_PARSE_ERROR
92PURGE ALL CHANGED PAGE BITMAPS BEFORE 1.2e-2;
93
94--error ER_PARSE_ERROR
95PURGE ALL CHANGED PAGE BITMAPS BEFORE t1;
96
97--error ER_PARSE_ERROR
98PURGE ALL CHANGED PAGE BITMAPS BEFORE "t1";
99
100--error ER_PARSE_ERROR
101PURGE ALL CHANGED PAGE BITMAPS BEFORE TRUE;
102
103--error ER_PARSE_ERROR
104PURGE ALL CHANGED PAGE BITMAPS BEFORE NULL;
105
106#
107# Test that non-privileged users cannot issue user requests
108#
109CREATE USER mysqltest_1@localhost;
110GRANT ALL ON *.* TO mysqltest_1@localhost;
111REVOKE SUPER ON *.* FROM mysqltest_1@localhost;
112
113connect (conn1,localhost,mysqltest_1,,);
114
115--error ER_SPECIFIC_ACCESS_DENIED_ERROR
116FLUSH ALL CHANGED PAGE BITMAPS;
117
118--error ER_SPECIFIC_ACCESS_DENIED_ERROR
119RESET ALL CHANGED PAGE BITMAPS;
120
121--error ER_SPECIFIC_ACCESS_DENIED_ERROR
122PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000;
123
124connection default;
125disconnect conn1;
126
127--source include/wait_until_count_sessions.inc
128
129DROP USER mysqltest_1@localhost;
130
131#
132# Test FLUSH and PURGE requests with log tracking disabled
133#
134--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
135--shutdown_server 10
136--source include/wait_until_disconnected.inc
137--enable_reconnect
138--exec echo "restart:--innodb_track_changed_pages=FALSE" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
139--source include/wait_until_connected_again.inc
140
141SELECT @@GLOBAL.innodb_track_changed_pages;
142
143FLUSH ALL CHANGED PAGE BITMAPS;
144
145# The previous bitmap files should be present
146--echo Before the PURGE with tracking disabled
147--replace_regex /_[[:digit:]]+\.xdb$//
148list_files $MYSQLD_DATADIR ib_modified_log*;
149
150PURGE ALL CHANGED PAGE BITMAPS BEFORE 1;
151
152--echo After the PURGE that deletes nothing:
153--replace_regex /_[[:digit:]]+\.xdb$//
154list_files $MYSQLD_DATADIR ib_modified_log*;
155
156PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000;
157
158--echo After the PURGE that deletes everything:
159--replace_regex /_[[:digit:]]+\.xdb$//
160list_files $MYSQLD_DATADIR ib_modified_log*;
161
162PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000;
163
164--echo After the repeated PURGE:
165--replace_regex /_[[:digit:]]+\.xdb$//
166list_files $MYSQLD_DATADIR ib_modified_log*;
167
168#
169# Test RESET request with log tracking disabled
170#
171
172# Generate some bitmap data again
173--source include/restart_mysqld.inc
174INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
175--source include/restart_mysqld.inc
176
177--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
178--shutdown_server 10
179--source include/wait_until_disconnected.inc
180--enable_reconnect
181--exec echo "restart:--innodb_track_changed_pages=FALSE" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
182--source include/wait_until_connected_again.inc
183
184--echo Before the RESET while tracking disabled:
185--replace_regex /_[[:digit:]]+\.xdb$//
186list_files $MYSQLD_DATADIR ib_modified_log*;
187
188RESET ALL CHANGED PAGE BITMAPS;
189
190--echo After the RESET with tracking disabled:
191--replace_regex /_[[:digit:]]+\.xdb$//
192list_files $MYSQLD_DATADIR ib_modified_log*;
193
194DROP TABLE t1;
0195
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt 2012-11-25 09:45:24 +0000
@@ -0,0 +1,1 @@
1--skip-innodb
02
=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test 1970-01-01 00:00:00 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test 2012-11-25 09:45:24 +0000
@@ -0,0 +1,7 @@
1#
2# Test that changed page tracking user requests are parsed without InnoDB
3#
4FLUSH ALL CHANGED PAGE BITMAPS;
5RESET ALL CHANGED PAGE BITMAPS;
6PURGE ALL CHANGED PAGE BITMAPS BEFORE 1;
7
08
=== modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test'
--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test 2012-11-25 09:45:24 +0000
+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test 2012-11-25 09:45:24 +0000
@@ -4,7 +4,9 @@
44
5--source include/have_innodb.inc5--source include/have_innodb.inc
66
7--source include/delete_innodb_bitmaps.inc7# Delete any existing bitmaps
8--source include/restart_mysqld.inc
9RESET ALL CHANGED PAGE BITMAPS;
810
9--disable_warnings11--disable_warnings
10DROP TABLE IF EXISTS T1;12DROP TABLE IF EXISTS T1;
1113
=== modified file 'Percona-Server/sql/handler.cc'
--- Percona-Server/sql/handler.cc 2012-10-17 03:47:45 +0000
+++ Percona-Server/sql/handler.cc 2012-11-25 09:45:24 +0000
@@ -5096,6 +5096,42 @@
5096 return result;5096 return result;
5097}5097}
50985098
5099static my_bool flush_changed_page_bitmaps_handlerton(THD *unused1,
5100 plugin_ref plugin,
5101 void *unused2)
5102{
5103 handlerton *hton= plugin_data(plugin, handlerton *);
5104
5105 if (hton->flush_changed_page_bitmaps == NULL)
5106 return FALSE;
5107
5108 return hton->flush_changed_page_bitmaps();
5109}
5110
5111bool ha_flush_changed_page_bitmaps()
5112{
5113 return plugin_foreach(NULL, flush_changed_page_bitmaps_handlerton,
5114 MYSQL_STORAGE_ENGINE_PLUGIN, NULL);
5115}
5116
5117static my_bool purge_changed_page_bitmaps_handlerton(THD *unused1,
5118 plugin_ref plugin,
5119 void *lsn)
5120{
5121 handlerton *hton= plugin_data(plugin, handlerton *);
5122
5123 if (hton->purge_changed_page_bitmaps == NULL)
5124 return FALSE;
5125
5126 return hton->purge_changed_page_bitmaps(*(ulonglong *)lsn);
5127}
5128
5129bool ha_purge_changed_page_bitmaps(ulonglong lsn)
5130{
5131 return plugin_foreach(NULL, purge_changed_page_bitmaps_handlerton,
5132 MYSQL_STORAGE_ENGINE_PLUGIN, &lsn);
5133}
5134
5099/*5135/*
5100 Function to check if the conditions for row-based binlogging is5136 Function to check if the conditions for row-based binlogging is
5101 correct for the table.5137 correct for the table.
51025138
=== modified file 'Percona-Server/sql/handler.h'
--- Percona-Server/sql/handler.h 2012-10-11 15:03:12 +0000
+++ Percona-Server/sql/handler.h 2012-11-25 09:45:24 +0000
@@ -842,6 +842,8 @@
842 int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables, 842 int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables,
843 class Item *cond, 843 class Item *cond,
844 enum enum_schema_tables);844 enum enum_schema_tables);
845 int (*flush_changed_page_bitmaps)();
846 int (*purge_changed_page_bitmaps)(ulonglong lsn);
845 uint32 flags; /* global handler flags */847 uint32 flags; /* global handler flags */
846 /*848 /*
847 Those handlerton functions below are properly initialized at handler849 Those handlerton functions below are properly initialized at handler
@@ -2388,6 +2390,9 @@
2388int ha_prepare(THD *thd);2390int ha_prepare(THD *thd);
2389int ha_recover(HASH *commit_list);2391int ha_recover(HASH *commit_list);
23902392
2393bool ha_flush_changed_page_bitmaps();
2394bool ha_purge_changed_page_bitmaps(ulonglong lsn);
2395
2391/* transactions: these functions never call handlerton functions directly */2396/* transactions: these functions never call handlerton functions directly */
2392int ha_enable_transaction(THD *thd, bool on);2397int ha_enable_transaction(THD *thd, bool on);
23932398
23942399
=== modified file 'Percona-Server/sql/lex.h'
--- Percona-Server/sql/lex.h 2012-05-10 07:49:14 +0000
+++ Percona-Server/sql/lex.h 2012-11-25 09:45:24 +0000
@@ -86,6 +86,7 @@
86 { "BINARY", SYM(BINARY)},86 { "BINARY", SYM(BINARY)},
87 { "BINLOG", SYM(BINLOG_SYM)},87 { "BINLOG", SYM(BINLOG_SYM)},
88 { "BIT", SYM(BIT_SYM)},88 { "BIT", SYM(BIT_SYM)},
89 { "BITMAPS", SYM(BITMAPS_SYM)},
89 { "BLOB", SYM(BLOB_SYM)},90 { "BLOB", SYM(BLOB_SYM)},
90 { "BLOCK", SYM(BLOCK_SYM)},91 { "BLOCK", SYM(BLOCK_SYM)},
91 { "BOOL", SYM(BOOL_SYM)},92 { "BOOL", SYM(BOOL_SYM)},
9293
=== modified file 'Percona-Server/sql/sql_parse.cc'
--- Percona-Server/sql/sql_parse.cc 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/sql_parse.cc 2012-11-25 09:45:24 +0000
@@ -2320,9 +2320,35 @@
2320 {2320 {
2321 if (check_global_access(thd, SUPER_ACL))2321 if (check_global_access(thd, SUPER_ACL))
2322 goto error;2322 goto error;
2323 /* PURGE MASTER LOGS TO 'file' */2323 if (lex->type == 0)
2324 res = purge_master_logs(thd, lex->to_log);2324 {
2325 break;2325 /* PURGE MASTER LOGS TO 'file' */
2326 res = purge_master_logs(thd, lex->to_log);
2327 break;
2328 }
2329 if (lex->type == PURGE_BITMAPS_TO_LSN)
2330 {
2331 /* PURGE INNODB CHANGED PAGE BITMAPS BEFORE lsn */
2332 ulonglong lsn= 0;
2333 Item *it= (Item *)lex->value_list.head();
2334 if ((!it->fixed && it->fix_fields(lex->thd, &it)) || it->check_cols(1)
2335 || it->null_value)
2336 {
2337 my_error(ER_WRONG_ARGUMENTS, MYF(0),
2338 "PURGE INNODB CHANGED PAGE BITMAPS BEFORE");
2339 goto error;
2340 }
2341 lsn= it->val_uint();
2342 res= ha_purge_changed_page_bitmaps(lsn);
2343 if (res)
2344 {
2345 my_error(ER_LOG_PURGE_UNKNOWN_ERR, MYF(0),
2346 "PURGE INNODB CHANGED PAGE BITMAPS BEFORE");
2347 goto error;
2348 }
2349 my_ok(thd);
2350 break;
2351 }
2326 }2352 }
2327 case SQLCOM_PURGE_BEFORE:2353 case SQLCOM_PURGE_BEFORE:
2328 {2354 {
@@ -3782,7 +3808,14 @@
3782 case SQLCOM_FLUSH:3808 case SQLCOM_FLUSH:
3783 {3809 {
3784 int write_to_binlog;3810 int write_to_binlog;
3785 if (check_global_access(thd,RELOAD_ACL))3811
3812 if (lex->type & REFRESH_FLUSH_PAGE_BITMAPS
3813 || lex->type & REFRESH_RESET_PAGE_BITMAPS)
3814 {
3815 if (check_global_access(thd, SUPER_ACL))
3816 goto error;
3817 }
3818 else if (check_global_access(thd, RELOAD_ACL))
3786 goto error;3819 goto error;
37873820
3788 if (first_table && lex->type & REFRESH_READ_LOCK)3821 if (first_table && lex->type & REFRESH_READ_LOCK)
37893822
=== modified file 'Percona-Server/sql/sql_reload.cc'
--- Percona-Server/sql/sql_reload.cc 2012-04-18 23:26:01 +0000
+++ Percona-Server/sql/sql_reload.cc 2012-11-25 09:45:24 +0000
@@ -362,6 +362,14 @@
362 }362 }
363 mysql_mutex_unlock(&LOCK_global_user_client_stats);363 mysql_mutex_unlock(&LOCK_global_user_client_stats);
364 }364 }
365 if (options & REFRESH_FLUSH_PAGE_BITMAPS)
366 {
367 result= ha_flush_changed_page_bitmaps();
368 }
369 if (options & REFRESH_RESET_PAGE_BITMAPS)
370 {
371 result= ha_purge_changed_page_bitmaps(0);
372 }
365 if (*write_to_binlog != -1)373 if (*write_to_binlog != -1)
366 *write_to_binlog= tmp_write_to_binlog;374 *write_to_binlog= tmp_write_to_binlog;
367 /*375 /*
368376
=== modified file 'Percona-Server/sql/sql_yacc.yy'
--- Percona-Server/sql/sql_yacc.yy 2012-09-17 13:08:32 +0000
+++ Percona-Server/sql/sql_yacc.yy 2012-11-25 09:45:24 +0000
@@ -840,6 +840,7 @@
840%token BIT_OR /* MYSQL-FUNC */840%token BIT_OR /* MYSQL-FUNC */
841%token BIT_SYM /* MYSQL-FUNC */841%token BIT_SYM /* MYSQL-FUNC */
842%token BIT_XOR /* MYSQL-FUNC */842%token BIT_XOR /* MYSQL-FUNC */
843%token BITMAPS_SYM /* MYSQL */
843%token BLOB_SYM /* SQL-2003-R */844%token BLOB_SYM /* SQL-2003-R */
844%token BLOCK_SYM845%token BLOCK_SYM
845%token BOOLEAN_SYM /* SQL-2003-R */846%token BOOLEAN_SYM /* SQL-2003-R */
@@ -11449,6 +11450,8 @@
11449 { Lex->type|= REFRESH_DES_KEY_FILE; }11450 { Lex->type|= REFRESH_DES_KEY_FILE; }
11450 | RESOURCES11451 | RESOURCES
11451 { Lex->type|= REFRESH_USER_RESOURCES; }11452 { Lex->type|= REFRESH_USER_RESOURCES; }
11453 | ALL CHANGED PAGE_SYM BITMAPS_SYM
11454 { Lex->type|= REFRESH_FLUSH_PAGE_BITMAPS; }
11452 ;11455 ;
1145311456
11454opt_table_list:11457opt_table_list:
@@ -11476,6 +11479,8 @@
11476 slave_reset_options { }11479 slave_reset_options { }
11477 | MASTER_SYM { Lex->type|= REFRESH_MASTER; }11480 | MASTER_SYM { Lex->type|= REFRESH_MASTER; }
11478 | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;}11481 | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;}
11482 | ALL CHANGED PAGE_SYM BITMAPS_SYM
11483 { Lex->type |= REFRESH_RESET_PAGE_BITMAPS; }
11479 ;11484 ;
1148011485
11481slave_reset_options:11486slave_reset_options:
@@ -11496,6 +11501,13 @@
1149611501
11497purge_options:11502purge_options:
11498 master_or_binary LOGS_SYM purge_option11503 master_or_binary LOGS_SYM purge_option
11504 | ALL CHANGED PAGE_SYM BITMAPS_SYM BEFORE_SYM real_ulonglong_num
11505 {
11506 LEX *lex= Lex;
11507 lex->value_list.empty();
11508 lex->value_list.push_front(new Item_uint($6));
11509 lex->type= PURGE_BITMAPS_TO_LSN;
11510 }
11499 ;11511 ;
1150011512
11501purge_option:11513purge_option:
1150211514
=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-11-25 09:45:24 +0000
+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-11-25 09:45:24 +0000
@@ -85,6 +85,7 @@
85#include "row0sel.h"85#include "row0sel.h"
86#include "row0upd.h"86#include "row0upd.h"
87#include "log0log.h"87#include "log0log.h"
88#include "log0online.h"
88#include "lock0lock.h"89#include "lock0lock.h"
89#include "dict0crea.h"90#include "dict0crea.h"
90#include "btr0cur.h"91#include "btr0cur.h"
@@ -297,6 +298,7 @@
297 {&ibuf_pessimistic_insert_mutex_key,298 {&ibuf_pessimistic_insert_mutex_key,
298 "ibuf_pessimistic_insert_mutex", 0},299 "ibuf_pessimistic_insert_mutex", 0},
299 {&kernel_mutex_key, "kernel_mutex", 0},300 {&kernel_mutex_key, "kernel_mutex", 0},
301 {&log_bmp_sys_mutex_key, "log_bmp_sys_mutex", 0},
300 {&log_sys_mutex_key, "log_sys_mutex", 0},302 {&log_sys_mutex_key, "log_sys_mutex", 0},
301# ifdef UNIV_MEM_DEBUG303# ifdef UNIV_MEM_DEBUG
302 {&mem_hash_mutex_key, "mem_hash_mutex", 0},304 {&mem_hash_mutex_key, "mem_hash_mutex", 0},
@@ -438,6 +440,25 @@
438innobase_alter_table_flags(440innobase_alter_table_flags(
439/*=======================*/441/*=======================*/
440 uint flags);442 uint flags);
443/************************************************************//**
444Synchronously read and parse the redo log up to the last
445checkpoint to write the changed page bitmap.
446@return 0 to indicate success. Current implementation cannot fail. */
447static
448int
449innobase_flush_changed_page_bitmaps();
450/*==================================*/
451/************************************************************//**
452Delete all the bitmap files for data less than the specified LSN.
453If called with lsn == 0 (i.e. set by RESET request) or
454IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise
455continue it.
456@return 0 to indicate success, 1 for failure. */
457static
458int
459innobase_purge_changed_page_bitmaps(
460/*================================*/
461 ulonglong lsn); /*!< in: LSN to purge files up to */
441462
442static const char innobase_hton_name[]= "InnoDB";463static const char innobase_hton_name[]= "InnoDB";
443464
@@ -2651,6 +2672,10 @@
2651 innobase_hton->flags=HTON_NO_FLAGS;2672 innobase_hton->flags=HTON_NO_FLAGS;
2652 innobase_hton->release_temporary_latches=innobase_release_temporary_latches;2673 innobase_hton->release_temporary_latches=innobase_release_temporary_latches;
2653 innobase_hton->alter_table_flags = innobase_alter_table_flags;2674 innobase_hton->alter_table_flags = innobase_alter_table_flags;
2675 innobase_hton->flush_changed_page_bitmaps
2676 = innobase_flush_changed_page_bitmaps;
2677 innobase_hton->purge_changed_page_bitmaps
2678 = innobase_purge_changed_page_bitmaps;
26542679
2655 ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);2680 ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR);
26562681
@@ -3270,6 +3295,36 @@
3270 | HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE);3295 | HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE);
3271}3296}
32723297
3298/************************************************************//**
3299Synchronously read and parse the redo log up to the last
3300checkpoint to write the changed page bitmap.
3301@return 0 to indicate success. Current implementation cannot fail. */
3302static
3303int
3304innobase_flush_changed_page_bitmaps()
3305/*=================================*/
3306{
3307 if (srv_track_changed_pages) {
3308 os_event_reset(srv_checkpoint_completed_event);
3309 log_online_follow_redo_log();
3310 }
3311 return 0;
3312}
3313
3314/************************************************************//**
3315Delete all the bitmap files for data less than the specified LSN.
3316If called with lsn == IB_ULONGLONG_MAX (i.e. set by RESET request),
3317restart the bitmap file sequence, otherwise continue it.
3318@return 0 to indicate success, 1 for failure. */
3319static
3320int
3321innobase_purge_changed_page_bitmaps(
3322/*================================*/
3323 ulonglong lsn) /*!< in: LSN to purge files up to */
3324{
3325 return log_online_purge_changed_page_bitmaps(lsn);
3326}
3327
3273/****************************************************************//**3328/****************************************************************//**
3274Copy the current replication position from MySQL to a transaction. */3329Copy the current replication position from MySQL to a transaction. */
3275static3330static
32763331
=== modified file 'Percona-Server/storage/innobase/include/log0online.h'
--- Percona-Server/storage/innobase/include/log0online.h 2012-11-25 09:45:24 +0000
+++ Percona-Server/storage/innobase/include/log0online.h 2012-11-25 09:45:24 +0000
@@ -59,6 +59,19 @@
59log_online_follow_redo_log();59log_online_follow_redo_log();
60/*=========================*/60/*=========================*/
6161
62/************************************************************//**
63Delete all the bitmap files for data less than the specified LSN.
64If called with lsn == 0 (i.e. set by RESET request) or
65IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise
66continue it.
67
68@return FALSE to indicate success, TRUE for failure. */
69UNIV_INTERN
70ibool
71log_online_purge_changed_page_bitmaps(
72/*==================================*/
73 ib_uint64_t lsn); /*!<in: LSN to purge files up to */
74
62#define LOG_BITMAP_ITERATOR_START_LSN(i) \75#define LOG_BITMAP_ITERATOR_START_LSN(i) \
63 ((i).start_lsn)76 ((i).start_lsn)
64#define LOG_BITMAP_ITERATOR_END_LSN(i) \77#define LOG_BITMAP_ITERATOR_END_LSN(i) \
6578
=== modified file 'Percona-Server/storage/innobase/include/sync0sync.h'
--- Percona-Server/storage/innobase/include/sync0sync.h 2012-05-10 07:49:14 +0000
+++ Percona-Server/storage/innobase/include/sync0sync.h 2012-11-25 09:45:24 +0000
@@ -89,6 +89,7 @@
89extern mysql_pfs_key_t ibuf_bitmap_mutex_key;89extern mysql_pfs_key_t ibuf_bitmap_mutex_key;
90extern mysql_pfs_key_t ibuf_mutex_key;90extern mysql_pfs_key_t ibuf_mutex_key;
91extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key;91extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key;
92extern mysql_pfs_key_t log_bmp_sys_mutex_key;
92extern mysql_pfs_key_t log_sys_mutex_key;93extern mysql_pfs_key_t log_sys_mutex_key;
93extern mysql_pfs_key_t log_flush_order_mutex_key;94extern mysql_pfs_key_t log_flush_order_mutex_key;
94extern mysql_pfs_key_t kernel_mutex_key;95extern mysql_pfs_key_t kernel_mutex_key;
@@ -672,6 +673,7 @@
672#define SYNC_TRX_LOCK_HEAP 298673#define SYNC_TRX_LOCK_HEAP 298
673#define SYNC_TRX_SYS_HEADER 290674#define SYNC_TRX_SYS_HEADER 290
674#define SYNC_PURGE_QUEUE 200675#define SYNC_PURGE_QUEUE 200
676#define SYNC_LOG_ONLINE 175
675#define SYNC_LOG 170677#define SYNC_LOG 170
676#define SYNC_LOG_FLUSH_ORDER 156678#define SYNC_LOG_FLUSH_ORDER 156
677#define SYNC_RECV 168679#define SYNC_RECV 168
678680
=== modified file 'Percona-Server/storage/innobase/log/log0online.c'
--- Percona-Server/storage/innobase/log/log0online.c 2012-11-25 09:45:24 +0000
+++ Percona-Server/storage/innobase/log/log0online.c 2012-11-25 09:45:24 +0000
@@ -36,6 +36,11 @@
3636
37enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) };37enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) };
3838
39#ifdef UNIV_PFS_MUTEX
40/* Key to register log_bmp_sys->mutex with PFS */
41UNIV_INTERN mysql_pfs_key_t log_bmp_sys_mutex_key;
42#endif /* UNIV_PFS_MUTEX */
43
39/** Log parsing and bitmap output data structure */44/** Log parsing and bitmap output data structure */
40struct log_bitmap_struct {45struct log_bitmap_struct {
41 byte read_buf[FOLLOW_SCAN_SIZE];46 byte read_buf[FOLLOW_SCAN_SIZE];
@@ -69,6 +74,7 @@
69 both the correct type and the tree does74 both the correct type and the tree does
70 not mind its overwrite during75 not mind its overwrite during
71 rbt_next() tree traversal. */76 rbt_next() tree traversal. */
77 mutex_t mutex; /*!< mutex protecting all the fields.*/
72};78};
7379
74/* The log parsing and bitmap output struct instance */80/* The log parsing and bitmap output struct instance */
@@ -172,6 +178,8 @@
172 byte search_page[MODIFIED_PAGE_BLOCK_SIZE];178 byte search_page[MODIFIED_PAGE_BLOCK_SIZE];
173 byte *page_ptr;179 byte *page_ptr;
174180
181 ut_ad(mutex_own(&log_bmp_sys->mutex));
182
175 ut_a(space != ULINT_UNDEFINED);183 ut_a(space != ULINT_UNDEFINED);
176 ut_a(page_no != ULINT_UNDEFINED);184 ut_a(page_no != ULINT_UNDEFINED);
177185
@@ -573,6 +581,9 @@
573581
574 log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys));582 log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys));
575583
584 mutex_create(log_bmp_sys_mutex_key, &log_bmp_sys->mutex,
585 SYNC_LOG_ONLINE);
586
576 /* Enumerate existing bitmap files to either open the last one to get587 /* Enumerate existing bitmap files to either open the last one to get
577 the last tracked LSN either to find that there are none and start588 the last tracked LSN either to find that there are none and start
578 tracking from scratch. */589 tracking from scratch. */
@@ -716,6 +727,8 @@
716 free_list_node = next;727 free_list_node = next;
717 }728 }
718729
730 mutex_free(&log_bmp_sys->mutex);
731
719 ut_free(log_bmp_sys);732 ut_free(log_bmp_sys);
720}733}
721734
@@ -767,6 +780,8 @@
767780
768 ulint len = 0;781 ulint len = 0;
769782
783 ut_ad(mutex_own(&log_bmp_sys->mutex));
784
770 while (ptr != end785 while (ptr != end
771 && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) {786 && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) {
772787
@@ -857,6 +872,8 @@
857 ulint actual_data_len = (end_offset >= start_offset)872 ulint actual_data_len = (end_offset >= start_offset)
858 ? end_offset - start_offset : 0;873 ? end_offset - start_offset : 0;
859874
875 ut_ad(mutex_own(&log_bmp_sys->mutex));
876
860 ut_memcpy(log_bmp_sys->parse_buf_end, log_block + start_offset,877 ut_memcpy(log_bmp_sys->parse_buf_end, log_block + start_offset,
861 actual_data_len);878 actual_data_len);
862879
@@ -881,6 +898,8 @@
881{898{
882 ulint block_data_len;899 ulint block_data_len;
883900
901 ut_ad(mutex_own(&log_bmp_sys->mutex));
902
884 block_data_len = log_block_get_data_len(log_block);903 block_data_len = log_block_get_data_len(log_block);
885904
886 ut_ad(block_data_len % OS_FILE_LOG_BLOCK_SIZE == 0905 ut_ad(block_data_len % OS_FILE_LOG_BLOCK_SIZE == 0
@@ -907,6 +926,8 @@
907 byte* log_block_end = log_bmp_sys->read_buf926 byte* log_block_end = log_bmp_sys->read_buf
908 + (block_end_lsn - block_start_lsn);927 + (block_end_lsn - block_start_lsn);
909928
929 ut_ad(mutex_own(&log_bmp_sys->mutex));
930
910 mutex_enter(&log_sys->mutex);931 mutex_enter(&log_sys->mutex);
911 log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf,932 log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf,
912 group, block_start_lsn, block_end_lsn);933 group, block_start_lsn, block_end_lsn);
@@ -969,6 +990,8 @@
969 ib_uint64_t block_start_lsn = contiguous_lsn;990 ib_uint64_t block_start_lsn = contiguous_lsn;
970 ib_uint64_t block_end_lsn;991 ib_uint64_t block_end_lsn;
971992
993 ut_ad(mutex_own(&log_bmp_sys->mutex));
994
972 log_bmp_sys->next_parse_lsn = log_bmp_sys->start_lsn;995 log_bmp_sys->next_parse_lsn = log_bmp_sys->start_lsn;
973 log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf;996 log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf;
974997
@@ -1005,6 +1028,8 @@
1005{1028{
1006 ibool success;1029 ibool success;
10071030
1031 ut_ad(mutex_own(&log_bmp_sys->mutex));
1032
1008 success = os_file_write(log_bmp_sys->out.name, log_bmp_sys->out.file,1033 success = os_file_write(log_bmp_sys->out.name, log_bmp_sys->out.file,
1009 block,1034 block,
1010 (ulint)(log_bmp_sys->out.offset & 0xFFFFFFFF),1035 (ulint)(log_bmp_sys->out.offset & 0xFFFFFFFF),
@@ -1044,6 +1069,8 @@
1044 ib_rbt_node_t *bmp_tree_node;1069 ib_rbt_node_t *bmp_tree_node;
1045 const ib_rbt_node_t *last_bmp_tree_node;1070 const ib_rbt_node_t *last_bmp_tree_node;
10461071
1072 ut_ad(mutex_own(&log_bmp_sys->mutex));
1073
1047 if (log_bmp_sys->out.offset >= srv_max_bitmap_file_size) {1074 if (log_bmp_sys->out.offset >= srv_max_bitmap_file_size) {
1048 log_online_rotate_bitmap_file(log_bmp_sys->start_lsn);1075 log_online_rotate_bitmap_file(log_bmp_sys->start_lsn);
1049 }1076 }
@@ -1090,12 +1117,15 @@
1090 ib_uint64_t contiguous_start_lsn;1117 ib_uint64_t contiguous_start_lsn;
1091 log_group_t* group;1118 log_group_t* group;
10921119
1120 mutex_enter(&log_bmp_sys->mutex);
1121
1093 /* Grab the LSN of the last checkpoint, we will parse up to it */1122 /* Grab the LSN of the last checkpoint, we will parse up to it */
1094 mutex_enter(&(log_sys->mutex));1123 mutex_enter(&(log_sys->mutex));
1095 log_bmp_sys->end_lsn = log_sys->last_checkpoint_lsn;1124 log_bmp_sys->end_lsn = log_sys->last_checkpoint_lsn;
1096 mutex_exit(&(log_sys->mutex));1125 mutex_exit(&(log_sys->mutex));
10971126
1098 if (log_bmp_sys->end_lsn == log_bmp_sys->start_lsn) {1127 if (log_bmp_sys->end_lsn == log_bmp_sys->start_lsn) {
1128 mutex_exit(&log_bmp_sys->mutex);
1099 return;1129 return;
1100 }1130 }
11011131
@@ -1117,6 +1147,8 @@
1117 log_online_write_bitmap();1147 log_online_write_bitmap();
1118 log_bmp_sys->start_lsn = log_bmp_sys->end_lsn;1148 log_bmp_sys->start_lsn = log_bmp_sys->end_lsn;
1119 log_set_tracked_lsn(log_bmp_sys->start_lsn);1149 log_set_tracked_lsn(log_bmp_sys->start_lsn);
1150
1151 mutex_exit(&log_bmp_sys->mutex);
1120}1152}
11211153
1122/*********************************************************************//**1154/*********************************************************************//**
@@ -1514,3 +1546,75 @@
15141546
1515 return TRUE;1547 return TRUE;
1516}1548}
1549
1550/************************************************************//**
1551Delete all the bitmap files for data less than the specified LSN.
1552If called with lsn == 0 (i.e. set by RESET request) or
1553IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise
1554continue it.
1555
1556@return FALSE to indicate success, TRUE for failure. */
1557UNIV_INTERN
1558ibool
1559log_online_purge_changed_page_bitmaps(
1560/*==================================*/
1561 ib_uint64_t lsn) /*!< in: LSN to purge files up to */
1562{
1563 log_online_bitmap_file_range_t bitmap_files;
1564 size_t i;
1565 ibool result = FALSE;
1566
1567 if (lsn == 0) {
1568 lsn = IB_ULONGLONG_MAX;
1569 }
1570
1571 if (srv_track_changed_pages) {
1572 /* User requests might happen with both enabled and disabled
1573 tracking */
1574 mutex_enter(&log_bmp_sys->mutex);
1575 }
1576
1577 if (!log_online_setup_bitmap_file_range(&bitmap_files, 0, lsn)) {
1578 if (srv_track_changed_pages) {
1579 mutex_exit(&log_bmp_sys->mutex);
1580 }
1581 return TRUE;
1582 }
1583
1584 if (srv_track_changed_pages && lsn >= log_bmp_sys->end_lsn) {
1585 /* If we have to delete the current output file, close it
1586 first. */
1587 os_file_close(log_bmp_sys->out.file);
1588 }
1589
1590 for (i = 0; i < bitmap_files.count; i++) {
1591 if (bitmap_files.files[i].seq_num == 0
1592 || bitmap_files.files[i].start_lsn >= lsn) {
1593 break;
1594 }
1595 if (!os_file_delete_if_exists(bitmap_files.files[i].name)) {
1596 os_file_get_last_error(TRUE);
1597 result = TRUE;
1598 break;
1599 }
1600 }
1601
1602 if (srv_track_changed_pages) {
1603 if (lsn > log_bmp_sys->end_lsn) {
1604 if (lsn == IB_ULONGLONG_MAX) {
1605 /* RESET restarts the sequence */
1606 log_bmp_sys->out_seq_num = 1;
1607 log_online_make_bitmap_name(0);
1608 } else {
1609 /* PURGE continues the sequence */
1610 log_bmp_sys->out_seq_num++;
1611 }
1612 log_online_start_bitmap_file(log_bmp_sys->end_lsn);
1613 }
1614
1615 mutex_exit(&log_bmp_sys->mutex);
1616 }
1617
1618 free(bitmap_files.files);
1619 return result;
1620}

Subscribers

People subscribed via source and target branches