Merge lp:~laurynas-biveinis/percona-server/BT-16724-xtradb-bmp-requests-5.5 into lp:percona-server/5.5
- BT-16724-xtradb-bmp-requests-5.5
- Merge into 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 |
Related bugs: | |
Related blueprints: |
User requests for XtraDB changed page tracking
(Undefined)
|
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.
Commit message
Description of the change
Merge of implementation of https:/
Jenkins: http://
To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
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
1 | === modified file 'Percona-Server/include/mysql_com.h' |
2 | --- Percona-Server/include/mysql_com.h 2012-05-10 07:49:14 +0000 |
3 | +++ Percona-Server/include/mysql_com.h 2012-11-25 09:45:24 +0000 |
4 | @@ -152,6 +152,10 @@ |
5 | #define REFRESH_USER_STATS 0x800000L /* Refresh user stats my_hash table */ |
6 | #define REFRESH_CLIENT_STATS 0x1000000L /* Refresh client stats my_hash table */ |
7 | #define REFRESH_THREAD_STATS 0x2000000L /* Refresh thread stats my_hash table */ |
8 | +#define REFRESH_FLUSH_PAGE_BITMAPS 0x400000L |
9 | +#define REFRESH_RESET_PAGE_BITMAPS 0x800000L |
10 | + |
11 | +#define PURGE_BITMAPS_TO_LSN 1 |
12 | |
13 | #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ |
14 | #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ |
15 | |
16 | === removed file 'Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc' |
17 | --- Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc 2012-11-25 09:45:24 +0000 |
18 | +++ Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc 1970-01-01 00:00:00 +0000 |
19 | @@ -1,11 +0,0 @@ |
20 | -# Remove all the InnoDB bitmap files. A temporary measure until RESET user request is implemented |
21 | - |
22 | -let $MYSQLD_DATADIR= `select @@datadir`; |
23 | - |
24 | ---exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
25 | ---shutdown_server 10 |
26 | ---source include/wait_until_disconnected.inc |
27 | -remove_files_wildcard $MYSQLD_DATADIR ib_modified_log*; |
28 | ---enable_reconnect |
29 | ---exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
30 | ---source include/wait_until_connected_again.inc |
31 | |
32 | === modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result' |
33 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 2012-11-25 09:45:24 +0000 |
34 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 2012-11-25 09:45:24 +0000 |
35 | @@ -1,3 +1,4 @@ |
36 | +RESET ALL CHANGED PAGE BITMAPS; |
37 | DROP TABLE IF EXISTS t1, t2; |
38 | CREATE TABLE t1 (x INT) ENGINE=InnoDB; |
39 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); |
40 | |
41 | === modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result' |
42 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result 2012-11-25 09:45:24 +0000 |
43 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result 2012-11-25 09:45:24 +0000 |
44 | @@ -1,3 +1,4 @@ |
45 | +RESET ALL CHANGED PAGE BITMAPS; |
46 | DROP TABLE IF EXISTS t1, t2; |
47 | CREATE TABLE t1 (x INT) ENGINE=InnoDB; |
48 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); |
49 | |
50 | === added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result' |
51 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result 1970-01-01 00:00:00 +0000 |
52 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result 2012-11-25 09:45:24 +0000 |
53 | @@ -0,0 +1,74 @@ |
54 | +RESET ALL CHANGED PAGE BITMAPS; |
55 | +DROP TABLE IF EXISTS t1; |
56 | +DELETE FROM mysql.user WHERE USER='mysqltest_1'; |
57 | +FLUSH PRIVILEGES; |
58 | +CREATE TABLE t1 (x INT) ENGINE=InnoDB; |
59 | +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); |
60 | +FLUSH ALL CHANGED PAGE BITMAPS; |
61 | +Before RESET: |
62 | +ib_modified_log_1 |
63 | +ib_modified_log_2 |
64 | +RESET ALL CHANGED PAGE BITMAPS; |
65 | +After RESET: |
66 | +ib_modified_log_1 |
67 | +RESET ALL CHANGED PAGE BITMAPS; |
68 | +After 2nd RESET |
69 | +ib_modified_log_1 |
70 | +After RESETs and restart: |
71 | +ib_modified_log_1 |
72 | +ib_modified_log_2 |
73 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 1; |
74 | +After PURGE ... BEFORE 1: |
75 | +ib_modified_log_2 |
76 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000; |
77 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000; |
78 | +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); |
79 | +After PURGE ... BEFORE 100000 and restart: |
80 | +ib_modified_log_2 |
81 | +ib_modified_log_3 |
82 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 5+5; |
83 | +ERROR 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 |
84 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE -12; |
85 | +ERROR 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 |
86 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 1.2e-2; |
87 | +ERROR 42000: Only integers allowed as number here near '1.2e-2' at line 1 |
88 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE t1; |
89 | +ERROR 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 |
90 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE "t1"; |
91 | +ERROR 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 |
92 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE TRUE; |
93 | +ERROR 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 |
94 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE NULL; |
95 | +ERROR 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 |
96 | +CREATE USER mysqltest_1@localhost; |
97 | +GRANT ALL ON *.* TO mysqltest_1@localhost; |
98 | +REVOKE SUPER ON *.* FROM mysqltest_1@localhost; |
99 | +FLUSH ALL CHANGED PAGE BITMAPS; |
100 | +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation |
101 | +RESET ALL CHANGED PAGE BITMAPS; |
102 | +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation |
103 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000; |
104 | +ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation |
105 | +DROP USER mysqltest_1@localhost; |
106 | +SELECT @@GLOBAL.innodb_track_changed_pages; |
107 | +@@GLOBAL.innodb_track_changed_pages |
108 | +0 |
109 | +FLUSH ALL CHANGED PAGE BITMAPS; |
110 | +Before the PURGE with tracking disabled |
111 | +ib_modified_log_2 |
112 | +ib_modified_log_3 |
113 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 1; |
114 | +After the PURGE that deletes nothing: |
115 | +ib_modified_log_2 |
116 | +ib_modified_log_3 |
117 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000; |
118 | +After the PURGE that deletes everything: |
119 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000; |
120 | +After the repeated PURGE: |
121 | +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); |
122 | +Before the RESET while tracking disabled: |
123 | +ib_modified_log_1 |
124 | +ib_modified_log_2 |
125 | +RESET ALL CHANGED PAGE BITMAPS; |
126 | +After the RESET with tracking disabled: |
127 | +DROP TABLE t1; |
128 | |
129 | === added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result' |
130 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result 1970-01-01 00:00:00 +0000 |
131 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result 2012-11-25 09:45:24 +0000 |
132 | @@ -0,0 +1,3 @@ |
133 | +FLUSH ALL CHANGED PAGE BITMAPS; |
134 | +RESET ALL CHANGED PAGE BITMAPS; |
135 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 1; |
136 | |
137 | === modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result' |
138 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result 2012-11-25 09:45:24 +0000 |
139 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result 2012-11-25 09:45:24 +0000 |
140 | @@ -1,3 +1,4 @@ |
141 | +RESET ALL CHANGED PAGE BITMAPS; |
142 | DROP TABLE IF EXISTS T1; |
143 | CREATE TABLE T1 (F1 CHAR(255)) ENGINE=INNODB; |
144 | 1st interval end LSN greater than interval start LSN: |
145 | |
146 | === modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test' |
147 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 2012-11-25 09:45:24 +0000 |
148 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 2012-11-25 09:45:24 +0000 |
149 | @@ -13,7 +13,9 @@ |
150 | # Valgrind reports useless errors on very fast server shutdowns |
151 | --source include/not_valgrind.inc |
152 | |
153 | ---source include/delete_innodb_bitmaps.inc |
154 | +# Delete any existing bitmaps |
155 | +--source include/restart_mysqld.inc |
156 | +RESET ALL CHANGED PAGE BITMAPS; |
157 | |
158 | --disable_warnings |
159 | DROP TABLE IF EXISTS t1, t2; |
160 | |
161 | === modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test' |
162 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test 2012-11-25 09:45:24 +0000 |
163 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test 2012-11-25 09:45:24 +0000 |
164 | @@ -2,7 +2,9 @@ |
165 | # percona_changed_page_bmp test, which contains the full functional tests. |
166 | --source include/have_innodb.inc |
167 | |
168 | ---source include/delete_innodb_bitmaps.inc |
169 | +# Delete any existing bitmaps |
170 | +--source include/restart_mysqld.inc |
171 | +RESET ALL CHANGED PAGE BITMAPS; |
172 | |
173 | --disable_warnings |
174 | DROP TABLE IF EXISTS t1, t2; |
175 | |
176 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt' |
177 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt 1970-01-01 00:00:00 +0000 |
178 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt 2012-11-25 09:45:24 +0000 |
179 | @@ -0,0 +1,1 @@ |
180 | +--innodb_track_changed_pages=TRUE |
181 | |
182 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test' |
183 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test 1970-01-01 00:00:00 +0000 |
184 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test 2012-11-25 09:45:24 +0000 |
185 | @@ -0,0 +1,194 @@ |
186 | +# |
187 | +# Tests for changed page tracking bitmaps: user requests. |
188 | +# |
189 | +--source include/have_innodb.inc |
190 | + |
191 | +# Delete any existing bitmaps |
192 | +--source include/restart_mysqld.inc |
193 | +RESET ALL CHANGED PAGE BITMAPS; |
194 | + |
195 | +--source include/count_sessions.inc |
196 | + |
197 | +let $MYSQLD_DATADIR= `select @@datadir`; |
198 | + |
199 | +--disable_warnings |
200 | +DROP TABLE IF EXISTS t1; |
201 | +DELETE FROM mysql.user WHERE USER='mysqltest_1'; |
202 | +FLUSH PRIVILEGES; |
203 | +--enable_warnings |
204 | + |
205 | +CREATE TABLE t1 (x INT) ENGINE=InnoDB; |
206 | +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); |
207 | + |
208 | +# |
209 | +# Test FLUSH ALL CHANGED PAGE BITMAPS. Not much to test due to checkpointing non-determinism, |
210 | +# just see that it does not crash or return an error |
211 | +# |
212 | +FLUSH ALL CHANGED PAGE BITMAPS; |
213 | + |
214 | +# |
215 | +# Test that RESET ALL CHANGED PAGE BITMAPS works |
216 | +# |
217 | + |
218 | +# Have at least two bitmap files |
219 | +--source include/restart_mysqld.inc |
220 | + |
221 | +--echo Before RESET: |
222 | +--replace_regex /_[[:digit:]]+\.xdb$// |
223 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
224 | + |
225 | +RESET ALL CHANGED PAGE BITMAPS; |
226 | + |
227 | +--echo After RESET: |
228 | +--replace_regex /_[[:digit:]]+\.xdb$// |
229 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
230 | + |
231 | +# Test consecutive RESET |
232 | +RESET ALL CHANGED PAGE BITMAPS; |
233 | +--echo After 2nd RESET |
234 | +--replace_regex /_[[:digit:]]+\.xdb$// |
235 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
236 | + |
237 | +# Check that the file sequence after RESET starts with 1 again |
238 | +--source include/restart_mysqld.inc |
239 | + |
240 | +--echo After RESETs and restart: |
241 | +--replace_regex /_[[:digit:]]+\.xdb$// |
242 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
243 | + |
244 | +# |
245 | +# Test that PURGE ALL CHANGED PAGE BITMAPS BEFORE works. We don't test partial PURGE |
246 | +# because it's hard to extract good LSN value for that. |
247 | +# |
248 | + |
249 | +# PURGE that deletes nothing |
250 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 1; |
251 | +--echo After PURGE ... BEFORE 1: |
252 | +--replace_regex /_[[:digit:]]+\.xdb$// |
253 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
254 | + |
255 | +# PURGE that deletes everything |
256 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000; |
257 | +# Test consecutive PURGE |
258 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000; |
259 | + |
260 | +# Check that file sequence continues |
261 | +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); |
262 | +--source include/restart_mysqld.inc |
263 | +--echo After PURGE ... BEFORE 100000 and restart: |
264 | +--replace_regex /_[[:digit:]]+\.xdb$// |
265 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
266 | + |
267 | +# |
268 | +# Test malformed PURGE ... BEFORE |
269 | +# |
270 | +--error ER_PARSE_ERROR |
271 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 5+5; |
272 | + |
273 | +--error ER_PARSE_ERROR |
274 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE -12; |
275 | + |
276 | +--error ER_PARSE_ERROR |
277 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 1.2e-2; |
278 | + |
279 | +--error ER_PARSE_ERROR |
280 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE t1; |
281 | + |
282 | +--error ER_PARSE_ERROR |
283 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE "t1"; |
284 | + |
285 | +--error ER_PARSE_ERROR |
286 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE TRUE; |
287 | + |
288 | +--error ER_PARSE_ERROR |
289 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE NULL; |
290 | + |
291 | +# |
292 | +# Test that non-privileged users cannot issue user requests |
293 | +# |
294 | +CREATE USER mysqltest_1@localhost; |
295 | +GRANT ALL ON *.* TO mysqltest_1@localhost; |
296 | +REVOKE SUPER ON *.* FROM mysqltest_1@localhost; |
297 | + |
298 | +connect (conn1,localhost,mysqltest_1,,); |
299 | + |
300 | +--error ER_SPECIFIC_ACCESS_DENIED_ERROR |
301 | +FLUSH ALL CHANGED PAGE BITMAPS; |
302 | + |
303 | +--error ER_SPECIFIC_ACCESS_DENIED_ERROR |
304 | +RESET ALL CHANGED PAGE BITMAPS; |
305 | + |
306 | +--error ER_SPECIFIC_ACCESS_DENIED_ERROR |
307 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000; |
308 | + |
309 | +connection default; |
310 | +disconnect conn1; |
311 | + |
312 | +--source include/wait_until_count_sessions.inc |
313 | + |
314 | +DROP USER mysqltest_1@localhost; |
315 | + |
316 | +# |
317 | +# Test FLUSH and PURGE requests with log tracking disabled |
318 | +# |
319 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
320 | +--shutdown_server 10 |
321 | +--source include/wait_until_disconnected.inc |
322 | +--enable_reconnect |
323 | +--exec echo "restart:--innodb_track_changed_pages=FALSE" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
324 | +--source include/wait_until_connected_again.inc |
325 | + |
326 | +SELECT @@GLOBAL.innodb_track_changed_pages; |
327 | + |
328 | +FLUSH ALL CHANGED PAGE BITMAPS; |
329 | + |
330 | +# The previous bitmap files should be present |
331 | +--echo Before the PURGE with tracking disabled |
332 | +--replace_regex /_[[:digit:]]+\.xdb$// |
333 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
334 | + |
335 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 1; |
336 | + |
337 | +--echo After the PURGE that deletes nothing: |
338 | +--replace_regex /_[[:digit:]]+\.xdb$// |
339 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
340 | + |
341 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000; |
342 | + |
343 | +--echo After the PURGE that deletes everything: |
344 | +--replace_regex /_[[:digit:]]+\.xdb$// |
345 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
346 | + |
347 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 100000000; |
348 | + |
349 | +--echo After the repeated PURGE: |
350 | +--replace_regex /_[[:digit:]]+\.xdb$// |
351 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
352 | + |
353 | +# |
354 | +# Test RESET request with log tracking disabled |
355 | +# |
356 | + |
357 | +# Generate some bitmap data again |
358 | +--source include/restart_mysqld.inc |
359 | +INSERT INTO t1 VALUES (1),(2),(3),(4),(5); |
360 | +--source include/restart_mysqld.inc |
361 | + |
362 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
363 | +--shutdown_server 10 |
364 | +--source include/wait_until_disconnected.inc |
365 | +--enable_reconnect |
366 | +--exec echo "restart:--innodb_track_changed_pages=FALSE" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
367 | +--source include/wait_until_connected_again.inc |
368 | + |
369 | +--echo Before the RESET while tracking disabled: |
370 | +--replace_regex /_[[:digit:]]+\.xdb$// |
371 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
372 | + |
373 | +RESET ALL CHANGED PAGE BITMAPS; |
374 | + |
375 | +--echo After the RESET with tracking disabled: |
376 | +--replace_regex /_[[:digit:]]+\.xdb$// |
377 | +list_files $MYSQLD_DATADIR ib_modified_log*; |
378 | + |
379 | +DROP TABLE t1; |
380 | |
381 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt' |
382 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt 1970-01-01 00:00:00 +0000 |
383 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt 2012-11-25 09:45:24 +0000 |
384 | @@ -0,0 +1,1 @@ |
385 | +--skip-innodb |
386 | |
387 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test' |
388 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test 1970-01-01 00:00:00 +0000 |
389 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test 2012-11-25 09:45:24 +0000 |
390 | @@ -0,0 +1,7 @@ |
391 | +# |
392 | +# Test that changed page tracking user requests are parsed without InnoDB |
393 | +# |
394 | +FLUSH ALL CHANGED PAGE BITMAPS; |
395 | +RESET ALL CHANGED PAGE BITMAPS; |
396 | +PURGE ALL CHANGED PAGE BITMAPS BEFORE 1; |
397 | + |
398 | |
399 | === modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test' |
400 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test 2012-11-25 09:45:24 +0000 |
401 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test 2012-11-25 09:45:24 +0000 |
402 | @@ -4,7 +4,9 @@ |
403 | |
404 | --source include/have_innodb.inc |
405 | |
406 | ---source include/delete_innodb_bitmaps.inc |
407 | +# Delete any existing bitmaps |
408 | +--source include/restart_mysqld.inc |
409 | +RESET ALL CHANGED PAGE BITMAPS; |
410 | |
411 | --disable_warnings |
412 | DROP TABLE IF EXISTS T1; |
413 | |
414 | === modified file 'Percona-Server/sql/handler.cc' |
415 | --- Percona-Server/sql/handler.cc 2012-10-17 03:47:45 +0000 |
416 | +++ Percona-Server/sql/handler.cc 2012-11-25 09:45:24 +0000 |
417 | @@ -5096,6 +5096,42 @@ |
418 | return result; |
419 | } |
420 | |
421 | +static my_bool flush_changed_page_bitmaps_handlerton(THD *unused1, |
422 | + plugin_ref plugin, |
423 | + void *unused2) |
424 | +{ |
425 | + handlerton *hton= plugin_data(plugin, handlerton *); |
426 | + |
427 | + if (hton->flush_changed_page_bitmaps == NULL) |
428 | + return FALSE; |
429 | + |
430 | + return hton->flush_changed_page_bitmaps(); |
431 | +} |
432 | + |
433 | +bool ha_flush_changed_page_bitmaps() |
434 | +{ |
435 | + return plugin_foreach(NULL, flush_changed_page_bitmaps_handlerton, |
436 | + MYSQL_STORAGE_ENGINE_PLUGIN, NULL); |
437 | +} |
438 | + |
439 | +static my_bool purge_changed_page_bitmaps_handlerton(THD *unused1, |
440 | + plugin_ref plugin, |
441 | + void *lsn) |
442 | +{ |
443 | + handlerton *hton= plugin_data(plugin, handlerton *); |
444 | + |
445 | + if (hton->purge_changed_page_bitmaps == NULL) |
446 | + return FALSE; |
447 | + |
448 | + return hton->purge_changed_page_bitmaps(*(ulonglong *)lsn); |
449 | +} |
450 | + |
451 | +bool ha_purge_changed_page_bitmaps(ulonglong lsn) |
452 | +{ |
453 | + return plugin_foreach(NULL, purge_changed_page_bitmaps_handlerton, |
454 | + MYSQL_STORAGE_ENGINE_PLUGIN, &lsn); |
455 | +} |
456 | + |
457 | /* |
458 | Function to check if the conditions for row-based binlogging is |
459 | correct for the table. |
460 | |
461 | === modified file 'Percona-Server/sql/handler.h' |
462 | --- Percona-Server/sql/handler.h 2012-10-11 15:03:12 +0000 |
463 | +++ Percona-Server/sql/handler.h 2012-11-25 09:45:24 +0000 |
464 | @@ -842,6 +842,8 @@ |
465 | int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables, |
466 | class Item *cond, |
467 | enum enum_schema_tables); |
468 | + int (*flush_changed_page_bitmaps)(); |
469 | + int (*purge_changed_page_bitmaps)(ulonglong lsn); |
470 | uint32 flags; /* global handler flags */ |
471 | /* |
472 | Those handlerton functions below are properly initialized at handler |
473 | @@ -2388,6 +2390,9 @@ |
474 | int ha_prepare(THD *thd); |
475 | int ha_recover(HASH *commit_list); |
476 | |
477 | +bool ha_flush_changed_page_bitmaps(); |
478 | +bool ha_purge_changed_page_bitmaps(ulonglong lsn); |
479 | + |
480 | /* transactions: these functions never call handlerton functions directly */ |
481 | int ha_enable_transaction(THD *thd, bool on); |
482 | |
483 | |
484 | === modified file 'Percona-Server/sql/lex.h' |
485 | --- Percona-Server/sql/lex.h 2012-05-10 07:49:14 +0000 |
486 | +++ Percona-Server/sql/lex.h 2012-11-25 09:45:24 +0000 |
487 | @@ -86,6 +86,7 @@ |
488 | { "BINARY", SYM(BINARY)}, |
489 | { "BINLOG", SYM(BINLOG_SYM)}, |
490 | { "BIT", SYM(BIT_SYM)}, |
491 | + { "BITMAPS", SYM(BITMAPS_SYM)}, |
492 | { "BLOB", SYM(BLOB_SYM)}, |
493 | { "BLOCK", SYM(BLOCK_SYM)}, |
494 | { "BOOL", SYM(BOOL_SYM)}, |
495 | |
496 | === modified file 'Percona-Server/sql/sql_parse.cc' |
497 | --- Percona-Server/sql/sql_parse.cc 2012-09-17 13:08:32 +0000 |
498 | +++ Percona-Server/sql/sql_parse.cc 2012-11-25 09:45:24 +0000 |
499 | @@ -2320,9 +2320,35 @@ |
500 | { |
501 | if (check_global_access(thd, SUPER_ACL)) |
502 | goto error; |
503 | - /* PURGE MASTER LOGS TO 'file' */ |
504 | - res = purge_master_logs(thd, lex->to_log); |
505 | - break; |
506 | + if (lex->type == 0) |
507 | + { |
508 | + /* PURGE MASTER LOGS TO 'file' */ |
509 | + res = purge_master_logs(thd, lex->to_log); |
510 | + break; |
511 | + } |
512 | + if (lex->type == PURGE_BITMAPS_TO_LSN) |
513 | + { |
514 | + /* PURGE INNODB CHANGED PAGE BITMAPS BEFORE lsn */ |
515 | + ulonglong lsn= 0; |
516 | + Item *it= (Item *)lex->value_list.head(); |
517 | + if ((!it->fixed && it->fix_fields(lex->thd, &it)) || it->check_cols(1) |
518 | + || it->null_value) |
519 | + { |
520 | + my_error(ER_WRONG_ARGUMENTS, MYF(0), |
521 | + "PURGE INNODB CHANGED PAGE BITMAPS BEFORE"); |
522 | + goto error; |
523 | + } |
524 | + lsn= it->val_uint(); |
525 | + res= ha_purge_changed_page_bitmaps(lsn); |
526 | + if (res) |
527 | + { |
528 | + my_error(ER_LOG_PURGE_UNKNOWN_ERR, MYF(0), |
529 | + "PURGE INNODB CHANGED PAGE BITMAPS BEFORE"); |
530 | + goto error; |
531 | + } |
532 | + my_ok(thd); |
533 | + break; |
534 | + } |
535 | } |
536 | case SQLCOM_PURGE_BEFORE: |
537 | { |
538 | @@ -3782,7 +3808,14 @@ |
539 | case SQLCOM_FLUSH: |
540 | { |
541 | int write_to_binlog; |
542 | - if (check_global_access(thd,RELOAD_ACL)) |
543 | + |
544 | + if (lex->type & REFRESH_FLUSH_PAGE_BITMAPS |
545 | + || lex->type & REFRESH_RESET_PAGE_BITMAPS) |
546 | + { |
547 | + if (check_global_access(thd, SUPER_ACL)) |
548 | + goto error; |
549 | + } |
550 | + else if (check_global_access(thd, RELOAD_ACL)) |
551 | goto error; |
552 | |
553 | if (first_table && lex->type & REFRESH_READ_LOCK) |
554 | |
555 | === modified file 'Percona-Server/sql/sql_reload.cc' |
556 | --- Percona-Server/sql/sql_reload.cc 2012-04-18 23:26:01 +0000 |
557 | +++ Percona-Server/sql/sql_reload.cc 2012-11-25 09:45:24 +0000 |
558 | @@ -362,6 +362,14 @@ |
559 | } |
560 | mysql_mutex_unlock(&LOCK_global_user_client_stats); |
561 | } |
562 | + if (options & REFRESH_FLUSH_PAGE_BITMAPS) |
563 | + { |
564 | + result= ha_flush_changed_page_bitmaps(); |
565 | + } |
566 | + if (options & REFRESH_RESET_PAGE_BITMAPS) |
567 | + { |
568 | + result= ha_purge_changed_page_bitmaps(0); |
569 | + } |
570 | if (*write_to_binlog != -1) |
571 | *write_to_binlog= tmp_write_to_binlog; |
572 | /* |
573 | |
574 | === modified file 'Percona-Server/sql/sql_yacc.yy' |
575 | --- Percona-Server/sql/sql_yacc.yy 2012-09-17 13:08:32 +0000 |
576 | +++ Percona-Server/sql/sql_yacc.yy 2012-11-25 09:45:24 +0000 |
577 | @@ -840,6 +840,7 @@ |
578 | %token BIT_OR /* MYSQL-FUNC */ |
579 | %token BIT_SYM /* MYSQL-FUNC */ |
580 | %token BIT_XOR /* MYSQL-FUNC */ |
581 | +%token BITMAPS_SYM /* MYSQL */ |
582 | %token BLOB_SYM /* SQL-2003-R */ |
583 | %token BLOCK_SYM |
584 | %token BOOLEAN_SYM /* SQL-2003-R */ |
585 | @@ -11449,6 +11450,8 @@ |
586 | { Lex->type|= REFRESH_DES_KEY_FILE; } |
587 | | RESOURCES |
588 | { Lex->type|= REFRESH_USER_RESOURCES; } |
589 | + | ALL CHANGED PAGE_SYM BITMAPS_SYM |
590 | + { Lex->type|= REFRESH_FLUSH_PAGE_BITMAPS; } |
591 | ; |
592 | |
593 | opt_table_list: |
594 | @@ -11476,6 +11479,8 @@ |
595 | slave_reset_options { } |
596 | | MASTER_SYM { Lex->type|= REFRESH_MASTER; } |
597 | | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;} |
598 | + | ALL CHANGED PAGE_SYM BITMAPS_SYM |
599 | + { Lex->type |= REFRESH_RESET_PAGE_BITMAPS; } |
600 | ; |
601 | |
602 | slave_reset_options: |
603 | @@ -11496,6 +11501,13 @@ |
604 | |
605 | purge_options: |
606 | master_or_binary LOGS_SYM purge_option |
607 | + | ALL CHANGED PAGE_SYM BITMAPS_SYM BEFORE_SYM real_ulonglong_num |
608 | + { |
609 | + LEX *lex= Lex; |
610 | + lex->value_list.empty(); |
611 | + lex->value_list.push_front(new Item_uint($6)); |
612 | + lex->type= PURGE_BITMAPS_TO_LSN; |
613 | + } |
614 | ; |
615 | |
616 | purge_option: |
617 | |
618 | === modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc' |
619 | --- Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-11-25 09:45:24 +0000 |
620 | +++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2012-11-25 09:45:24 +0000 |
621 | @@ -85,6 +85,7 @@ |
622 | #include "row0sel.h" |
623 | #include "row0upd.h" |
624 | #include "log0log.h" |
625 | +#include "log0online.h" |
626 | #include "lock0lock.h" |
627 | #include "dict0crea.h" |
628 | #include "btr0cur.h" |
629 | @@ -297,6 +298,7 @@ |
630 | {&ibuf_pessimistic_insert_mutex_key, |
631 | "ibuf_pessimistic_insert_mutex", 0}, |
632 | {&kernel_mutex_key, "kernel_mutex", 0}, |
633 | + {&log_bmp_sys_mutex_key, "log_bmp_sys_mutex", 0}, |
634 | {&log_sys_mutex_key, "log_sys_mutex", 0}, |
635 | # ifdef UNIV_MEM_DEBUG |
636 | {&mem_hash_mutex_key, "mem_hash_mutex", 0}, |
637 | @@ -438,6 +440,25 @@ |
638 | innobase_alter_table_flags( |
639 | /*=======================*/ |
640 | uint flags); |
641 | +/************************************************************//** |
642 | +Synchronously read and parse the redo log up to the last |
643 | +checkpoint to write the changed page bitmap. |
644 | +@return 0 to indicate success. Current implementation cannot fail. */ |
645 | +static |
646 | +int |
647 | +innobase_flush_changed_page_bitmaps(); |
648 | +/*==================================*/ |
649 | +/************************************************************//** |
650 | +Delete all the bitmap files for data less than the specified LSN. |
651 | +If called with lsn == 0 (i.e. set by RESET request) or |
652 | +IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise |
653 | +continue it. |
654 | +@return 0 to indicate success, 1 for failure. */ |
655 | +static |
656 | +int |
657 | +innobase_purge_changed_page_bitmaps( |
658 | +/*================================*/ |
659 | + ulonglong lsn); /*!< in: LSN to purge files up to */ |
660 | |
661 | static const char innobase_hton_name[]= "InnoDB"; |
662 | |
663 | @@ -2651,6 +2672,10 @@ |
664 | innobase_hton->flags=HTON_NO_FLAGS; |
665 | innobase_hton->release_temporary_latches=innobase_release_temporary_latches; |
666 | innobase_hton->alter_table_flags = innobase_alter_table_flags; |
667 | + innobase_hton->flush_changed_page_bitmaps |
668 | + = innobase_flush_changed_page_bitmaps; |
669 | + innobase_hton->purge_changed_page_bitmaps |
670 | + = innobase_purge_changed_page_bitmaps; |
671 | |
672 | ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); |
673 | |
674 | @@ -3270,6 +3295,36 @@ |
675 | | HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE); |
676 | } |
677 | |
678 | +/************************************************************//** |
679 | +Synchronously read and parse the redo log up to the last |
680 | +checkpoint to write the changed page bitmap. |
681 | +@return 0 to indicate success. Current implementation cannot fail. */ |
682 | +static |
683 | +int |
684 | +innobase_flush_changed_page_bitmaps() |
685 | +/*=================================*/ |
686 | +{ |
687 | + if (srv_track_changed_pages) { |
688 | + os_event_reset(srv_checkpoint_completed_event); |
689 | + log_online_follow_redo_log(); |
690 | + } |
691 | + return 0; |
692 | +} |
693 | + |
694 | +/************************************************************//** |
695 | +Delete all the bitmap files for data less than the specified LSN. |
696 | +If called with lsn == IB_ULONGLONG_MAX (i.e. set by RESET request), |
697 | +restart the bitmap file sequence, otherwise continue it. |
698 | +@return 0 to indicate success, 1 for failure. */ |
699 | +static |
700 | +int |
701 | +innobase_purge_changed_page_bitmaps( |
702 | +/*================================*/ |
703 | + ulonglong lsn) /*!< in: LSN to purge files up to */ |
704 | +{ |
705 | + return log_online_purge_changed_page_bitmaps(lsn); |
706 | +} |
707 | + |
708 | /****************************************************************//** |
709 | Copy the current replication position from MySQL to a transaction. */ |
710 | static |
711 | |
712 | === modified file 'Percona-Server/storage/innobase/include/log0online.h' |
713 | --- Percona-Server/storage/innobase/include/log0online.h 2012-11-25 09:45:24 +0000 |
714 | +++ Percona-Server/storage/innobase/include/log0online.h 2012-11-25 09:45:24 +0000 |
715 | @@ -59,6 +59,19 @@ |
716 | log_online_follow_redo_log(); |
717 | /*=========================*/ |
718 | |
719 | +/************************************************************//** |
720 | +Delete all the bitmap files for data less than the specified LSN. |
721 | +If called with lsn == 0 (i.e. set by RESET request) or |
722 | +IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise |
723 | +continue it. |
724 | + |
725 | +@return FALSE to indicate success, TRUE for failure. */ |
726 | +UNIV_INTERN |
727 | +ibool |
728 | +log_online_purge_changed_page_bitmaps( |
729 | +/*==================================*/ |
730 | + ib_uint64_t lsn); /*!<in: LSN to purge files up to */ |
731 | + |
732 | #define LOG_BITMAP_ITERATOR_START_LSN(i) \ |
733 | ((i).start_lsn) |
734 | #define LOG_BITMAP_ITERATOR_END_LSN(i) \ |
735 | |
736 | === modified file 'Percona-Server/storage/innobase/include/sync0sync.h' |
737 | --- Percona-Server/storage/innobase/include/sync0sync.h 2012-05-10 07:49:14 +0000 |
738 | +++ Percona-Server/storage/innobase/include/sync0sync.h 2012-11-25 09:45:24 +0000 |
739 | @@ -89,6 +89,7 @@ |
740 | extern mysql_pfs_key_t ibuf_bitmap_mutex_key; |
741 | extern mysql_pfs_key_t ibuf_mutex_key; |
742 | extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; |
743 | +extern mysql_pfs_key_t log_bmp_sys_mutex_key; |
744 | extern mysql_pfs_key_t log_sys_mutex_key; |
745 | extern mysql_pfs_key_t log_flush_order_mutex_key; |
746 | extern mysql_pfs_key_t kernel_mutex_key; |
747 | @@ -672,6 +673,7 @@ |
748 | #define SYNC_TRX_LOCK_HEAP 298 |
749 | #define SYNC_TRX_SYS_HEADER 290 |
750 | #define SYNC_PURGE_QUEUE 200 |
751 | +#define SYNC_LOG_ONLINE 175 |
752 | #define SYNC_LOG 170 |
753 | #define SYNC_LOG_FLUSH_ORDER 156 |
754 | #define SYNC_RECV 168 |
755 | |
756 | === modified file 'Percona-Server/storage/innobase/log/log0online.c' |
757 | --- Percona-Server/storage/innobase/log/log0online.c 2012-11-25 09:45:24 +0000 |
758 | +++ Percona-Server/storage/innobase/log/log0online.c 2012-11-25 09:45:24 +0000 |
759 | @@ -36,6 +36,11 @@ |
760 | |
761 | enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) }; |
762 | |
763 | +#ifdef UNIV_PFS_MUTEX |
764 | +/* Key to register log_bmp_sys->mutex with PFS */ |
765 | +UNIV_INTERN mysql_pfs_key_t log_bmp_sys_mutex_key; |
766 | +#endif /* UNIV_PFS_MUTEX */ |
767 | + |
768 | /** Log parsing and bitmap output data structure */ |
769 | struct log_bitmap_struct { |
770 | byte read_buf[FOLLOW_SCAN_SIZE]; |
771 | @@ -69,6 +74,7 @@ |
772 | both the correct type and the tree does |
773 | not mind its overwrite during |
774 | rbt_next() tree traversal. */ |
775 | + mutex_t mutex; /*!< mutex protecting all the fields.*/ |
776 | }; |
777 | |
778 | /* The log parsing and bitmap output struct instance */ |
779 | @@ -172,6 +178,8 @@ |
780 | byte search_page[MODIFIED_PAGE_BLOCK_SIZE]; |
781 | byte *page_ptr; |
782 | |
783 | + ut_ad(mutex_own(&log_bmp_sys->mutex)); |
784 | + |
785 | ut_a(space != ULINT_UNDEFINED); |
786 | ut_a(page_no != ULINT_UNDEFINED); |
787 | |
788 | @@ -573,6 +581,9 @@ |
789 | |
790 | log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys)); |
791 | |
792 | + mutex_create(log_bmp_sys_mutex_key, &log_bmp_sys->mutex, |
793 | + SYNC_LOG_ONLINE); |
794 | + |
795 | /* Enumerate existing bitmap files to either open the last one to get |
796 | the last tracked LSN either to find that there are none and start |
797 | tracking from scratch. */ |
798 | @@ -716,6 +727,8 @@ |
799 | free_list_node = next; |
800 | } |
801 | |
802 | + mutex_free(&log_bmp_sys->mutex); |
803 | + |
804 | ut_free(log_bmp_sys); |
805 | } |
806 | |
807 | @@ -767,6 +780,8 @@ |
808 | |
809 | ulint len = 0; |
810 | |
811 | + ut_ad(mutex_own(&log_bmp_sys->mutex)); |
812 | + |
813 | while (ptr != end |
814 | && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) { |
815 | |
816 | @@ -857,6 +872,8 @@ |
817 | ulint actual_data_len = (end_offset >= start_offset) |
818 | ? end_offset - start_offset : 0; |
819 | |
820 | + ut_ad(mutex_own(&log_bmp_sys->mutex)); |
821 | + |
822 | ut_memcpy(log_bmp_sys->parse_buf_end, log_block + start_offset, |
823 | actual_data_len); |
824 | |
825 | @@ -881,6 +898,8 @@ |
826 | { |
827 | ulint block_data_len; |
828 | |
829 | + ut_ad(mutex_own(&log_bmp_sys->mutex)); |
830 | + |
831 | block_data_len = log_block_get_data_len(log_block); |
832 | |
833 | ut_ad(block_data_len % OS_FILE_LOG_BLOCK_SIZE == 0 |
834 | @@ -907,6 +926,8 @@ |
835 | byte* log_block_end = log_bmp_sys->read_buf |
836 | + (block_end_lsn - block_start_lsn); |
837 | |
838 | + ut_ad(mutex_own(&log_bmp_sys->mutex)); |
839 | + |
840 | mutex_enter(&log_sys->mutex); |
841 | log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf, |
842 | group, block_start_lsn, block_end_lsn); |
843 | @@ -969,6 +990,8 @@ |
844 | ib_uint64_t block_start_lsn = contiguous_lsn; |
845 | ib_uint64_t block_end_lsn; |
846 | |
847 | + ut_ad(mutex_own(&log_bmp_sys->mutex)); |
848 | + |
849 | log_bmp_sys->next_parse_lsn = log_bmp_sys->start_lsn; |
850 | log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf; |
851 | |
852 | @@ -1005,6 +1028,8 @@ |
853 | { |
854 | ibool success; |
855 | |
856 | + ut_ad(mutex_own(&log_bmp_sys->mutex)); |
857 | + |
858 | success = os_file_write(log_bmp_sys->out.name, log_bmp_sys->out.file, |
859 | block, |
860 | (ulint)(log_bmp_sys->out.offset & 0xFFFFFFFF), |
861 | @@ -1044,6 +1069,8 @@ |
862 | ib_rbt_node_t *bmp_tree_node; |
863 | const ib_rbt_node_t *last_bmp_tree_node; |
864 | |
865 | + ut_ad(mutex_own(&log_bmp_sys->mutex)); |
866 | + |
867 | if (log_bmp_sys->out.offset >= srv_max_bitmap_file_size) { |
868 | log_online_rotate_bitmap_file(log_bmp_sys->start_lsn); |
869 | } |
870 | @@ -1090,12 +1117,15 @@ |
871 | ib_uint64_t contiguous_start_lsn; |
872 | log_group_t* group; |
873 | |
874 | + mutex_enter(&log_bmp_sys->mutex); |
875 | + |
876 | /* Grab the LSN of the last checkpoint, we will parse up to it */ |
877 | mutex_enter(&(log_sys->mutex)); |
878 | log_bmp_sys->end_lsn = log_sys->last_checkpoint_lsn; |
879 | mutex_exit(&(log_sys->mutex)); |
880 | |
881 | if (log_bmp_sys->end_lsn == log_bmp_sys->start_lsn) { |
882 | + mutex_exit(&log_bmp_sys->mutex); |
883 | return; |
884 | } |
885 | |
886 | @@ -1117,6 +1147,8 @@ |
887 | log_online_write_bitmap(); |
888 | log_bmp_sys->start_lsn = log_bmp_sys->end_lsn; |
889 | log_set_tracked_lsn(log_bmp_sys->start_lsn); |
890 | + |
891 | + mutex_exit(&log_bmp_sys->mutex); |
892 | } |
893 | |
894 | /*********************************************************************//** |
895 | @@ -1514,3 +1546,75 @@ |
896 | |
897 | return TRUE; |
898 | } |
899 | + |
900 | +/************************************************************//** |
901 | +Delete all the bitmap files for data less than the specified LSN. |
902 | +If called with lsn == 0 (i.e. set by RESET request) or |
903 | +IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise |
904 | +continue it. |
905 | + |
906 | +@return FALSE to indicate success, TRUE for failure. */ |
907 | +UNIV_INTERN |
908 | +ibool |
909 | +log_online_purge_changed_page_bitmaps( |
910 | +/*==================================*/ |
911 | + ib_uint64_t lsn) /*!< in: LSN to purge files up to */ |
912 | +{ |
913 | + log_online_bitmap_file_range_t bitmap_files; |
914 | + size_t i; |
915 | + ibool result = FALSE; |
916 | + |
917 | + if (lsn == 0) { |
918 | + lsn = IB_ULONGLONG_MAX; |
919 | + } |
920 | + |
921 | + if (srv_track_changed_pages) { |
922 | + /* User requests might happen with both enabled and disabled |
923 | + tracking */ |
924 | + mutex_enter(&log_bmp_sys->mutex); |
925 | + } |
926 | + |
927 | + if (!log_online_setup_bitmap_file_range(&bitmap_files, 0, lsn)) { |
928 | + if (srv_track_changed_pages) { |
929 | + mutex_exit(&log_bmp_sys->mutex); |
930 | + } |
931 | + return TRUE; |
932 | + } |
933 | + |
934 | + if (srv_track_changed_pages && lsn >= log_bmp_sys->end_lsn) { |
935 | + /* If we have to delete the current output file, close it |
936 | + first. */ |
937 | + os_file_close(log_bmp_sys->out.file); |
938 | + } |
939 | + |
940 | + for (i = 0; i < bitmap_files.count; i++) { |
941 | + if (bitmap_files.files[i].seq_num == 0 |
942 | + || bitmap_files.files[i].start_lsn >= lsn) { |
943 | + break; |
944 | + } |
945 | + if (!os_file_delete_if_exists(bitmap_files.files[i].name)) { |
946 | + os_file_get_last_error(TRUE); |
947 | + result = TRUE; |
948 | + break; |
949 | + } |
950 | + } |
951 | + |
952 | + if (srv_track_changed_pages) { |
953 | + if (lsn > log_bmp_sys->end_lsn) { |
954 | + if (lsn == IB_ULONGLONG_MAX) { |
955 | + /* RESET restarts the sequence */ |
956 | + log_bmp_sys->out_seq_num = 1; |
957 | + log_online_make_bitmap_name(0); |
958 | + } else { |
959 | + /* PURGE continues the sequence */ |
960 | + log_bmp_sys->out_seq_num++; |
961 | + } |
962 | + log_online_start_bitmap_file(log_bmp_sys->end_lsn); |
963 | + } |
964 | + |
965 | + mutex_exit(&log_bmp_sys->mutex); |
966 | + } |
967 | + |
968 | + free(bitmap_files.files); |
969 | + return result; |
970 | +} |
Typo in the id - it's 16274.