Merge lp:~laurynas-biveinis/percona-server/bmp-fixes-5.6 into lp:percona-server/5.6
- bmp-fixes-5.6
- Merge into 5.6
Proposed by
Laurynas Biveinis
Status: | Merged |
---|---|
Approved by: | Stewart Smith |
Approved revision: | no longer in the source branch. |
Merged at revision: | 368 |
Proposed branch: | lp:~laurynas-biveinis/percona-server/bmp-fixes-5.6 |
Merge into: | lp:percona-server/5.6 |
Diff against target: |
1321 lines (+545/-145) 18 files modified
Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result (+8/-1) Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result (+59/-33) Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages_empty.result (+1/-0) Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test (+34/-4) Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_flush.test (+2/-2) Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test (+100/-28) Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages_empty.test (+4/-2) Percona-Server/mysql-test/suite/sys_vars/r/all_vars.result (+0/-2) Percona-Server/mysql-test/suite/sys_vars/r/innodb_max_changed_pages_basic.result (+78/-0) Percona-Server/mysql-test/suite/sys_vars/t/innodb_max_changed_pages_basic.test (+60/-0) Percona-Server/storage/innobase/handler/i_s.cc (+8/-6) Percona-Server/storage/innobase/include/log0log.h (+3/-1) Percona-Server/storage/innobase/include/log0online.h (+2/-0) Percona-Server/storage/innobase/include/os0file.h (+4/-2) Percona-Server/storage/innobase/log/log0log.cc (+13/-3) Percona-Server/storage/innobase/log/log0online.cc (+165/-56) Percona-Server/storage/innobase/log/log0recv.cc (+4/-3) Percona-Server/storage/innobase/os/os0file.cc (+0/-2) |
To merge this branch: | bzr merge lp:~laurynas-biveinis/percona-server/bmp-fixes-5.6 |
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stewart Smith (community) | Approve | ||
Review via email: mp+166281@code.launchpad.net |
Commit message
Description of the change
Merge bitmap fixes from 5.5, add 5.6-specific fixes.
http://
To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result' |
2 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 2013-05-09 19:43:37 +0000 |
3 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 2013-05-29 15:20:41 +0000 |
4 | @@ -49,13 +49,13 @@ |
5 | ib_modified_log_1 |
6 | ib_modified_log_2 |
7 | ib_modified_log_3 |
8 | +DROP TABLE t1, t2; |
9 | call mtr.add_suppression("Failed to find tablespace for table"); |
10 | call mtr.add_suppression("Allocated tablespace [0-9]+, old maximum was"); |
11 | 8th restart |
12 | RESET CHANGED_PAGE_BITMAPS; |
13 | call mtr.add_suppression("InnoDB: Error: page [0-9]* log sequence number [0-9]*"); |
14 | 9th restart |
15 | -DROP TABLE t1, t2; |
16 | SET GLOBAL innodb_fast_shutdown=0; |
17 | 10th restart |
18 | SELECT @@innodb_read_only; |
19 | @@ -64,4 +64,11 @@ |
20 | SELECT @@innodb_track_changed_pages; |
21 | @@innodb_track_changed_pages |
22 | 0 |
23 | +call mtr.add_suppression("New log files created"); |
24 | +call mtr.add_suppression("Creating foreign key constraint system tables"); |
25 | +call mtr.add_suppression("Cannot open table mysql/[a-z_]+ from the internal data dictionary"); |
26 | +call mtr.add_suppression("Info table is not ready to be used"); |
27 | 11th restart |
28 | +ib_modified_log_1 |
29 | +12th restart |
30 | +13th restart |
31 | |
32 | === modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result' |
33 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result 2013-05-09 19:43:37 +0000 |
34 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result 2013-05-29 15:20:41 +0000 |
35 | @@ -1,5 +1,5 @@ |
36 | RESET CHANGED_PAGE_BITMAPS; |
37 | -DROP TABLE IF EXISTS T1; |
38 | +DROP TABLE IF EXISTS T1, ICP_COPY; |
39 | CREATE TABLE T1 (F1 CHAR(255)) ENGINE=INNODB; |
40 | 1st interval end LSN greater than interval start LSN: |
41 | should_be_1 |
42 | @@ -51,35 +51,35 @@ |
43 | ICP tests (all should be 1): |
44 | SELECT COUNT(*) = @cond_test_pages_count |
45 | FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
46 | -WHERE END_LSN = @cond_test_max_end_lsn; |
47 | -COUNT(*) = @cond_test_pages_count |
48 | -1 |
49 | -SELECT COUNT(*) = @cond_test_pages_count |
50 | -FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
51 | -WHERE |
52 | -END_LSN > (@cond_test_max_end_lsn - 1) AND |
53 | -END_LSN < (@cond_test_max_end_lsn + 1); |
54 | -COUNT(*) = @cond_test_pages_count |
55 | -1 |
56 | -SELECT COUNT(*) = @cond_test_pages_count |
57 | -FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
58 | -WHERE |
59 | -END_LSN >= @cond_test_max_end_lsn AND |
60 | -END_LSN <= @cond_test_max_end_lsn; |
61 | -COUNT(*) = @cond_test_pages_count |
62 | -1 |
63 | -SELECT COUNT(*) = @cond_test_pages_count |
64 | -FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
65 | -WHERE |
66 | -(@cond_test_max_end_lsn - 1) < END_LSN AND |
67 | -@cond_test_max_end_lsn >= END_LSN; |
68 | -COUNT(*) = @cond_test_pages_count |
69 | -1 |
70 | -SELECT COUNT(*) = @cond_test_pages_count |
71 | -FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
72 | -WHERE |
73 | -START_LSN <= @cond_test_max_end_lsn AND |
74 | -END_LSN >= @cond_test_max_end_lsn; |
75 | +WHERE END_LSN = @max_end_lsn; |
76 | +COUNT(*) = @cond_test_pages_count |
77 | +1 |
78 | +SELECT COUNT(*) = @cond_test_pages_count |
79 | +FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
80 | +WHERE |
81 | +END_LSN > (@max_end_lsn - 1) AND |
82 | +END_LSN < (@max_end_lsn + 1); |
83 | +COUNT(*) = @cond_test_pages_count |
84 | +1 |
85 | +SELECT COUNT(*) = @cond_test_pages_count |
86 | +FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
87 | +WHERE |
88 | +END_LSN >= @max_end_lsn AND |
89 | +END_LSN <= @max_end_lsn; |
90 | +COUNT(*) = @cond_test_pages_count |
91 | +1 |
92 | +SELECT COUNT(*) = @cond_test_pages_count |
93 | +FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
94 | +WHERE |
95 | +(@max_end_lsn - 1) < END_LSN AND |
96 | +@max_end_lsn >= END_LSN; |
97 | +COUNT(*) = @cond_test_pages_count |
98 | +1 |
99 | +SELECT COUNT(*) = @cond_test_pages_count |
100 | +FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
101 | +WHERE |
102 | +START_LSN <= @max_end_lsn AND |
103 | +END_LSN >= @max_end_lsn; |
104 | COUNT(*) = @cond_test_pages_count |
105 | 1 |
106 | SELECT COUNT(*) = @cond_test_pages_count |
107 | @@ -98,7 +98,7 @@ |
108 | FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
109 | WHERE |
110 | START_LSN >= @cond_test_max_start_lsn AND |
111 | -END_LSN <= @cond_test_max_end_lsn; |
112 | +END_LSN <= @max_end_lsn; |
113 | COUNT(*) = @cond_test_pages_count |
114 | 1 |
115 | SELECT COUNT(*) = @cond_test_pages_count |
116 | @@ -112,7 +112,7 @@ |
117 | FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
118 | WHERE |
119 | @cond_test_max_start_lsn <= START_LSN AND |
120 | -@cond_test_max_end_lsn >= END_LSN; |
121 | +@max_end_lsn >= END_LSN; |
122 | COUNT(*) = @cond_test_pages_count |
123 | 1 |
124 | SELECT COUNT(*) |
125 | @@ -150,4 +150,30 @@ |
126 | COUNT(*) |
127 | 5 |
128 | SET GLOBAL INNODB_MAX_CHANGED_PAGES = 1000000; |
129 | -DROP TABLE T1; |
130 | +CREATE TABLE ICP_COPY ( |
131 | +space_id INT(11) NOT NULL, |
132 | +page_id INT(11) NOT NULL, |
133 | +start_lsn BIGINT(21) NOT NULL, |
134 | +end_lsn BIGINT(21) NOT NULL, |
135 | +INDEX page_id(space_id, page_id)) ENGINE=InnoDB; |
136 | +INSERT INTO ICP_COPY SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
137 | +WHERE END_LSN <= @max_end_lsn; |
138 | +SELECT @@global.innodb_track_changed_pages; |
139 | +@@global.innodb_track_changed_pages |
140 | +0 |
141 | +SET @max_end_lsn= (SELECT MAX(end_lsn) FROM ICP_COPY); |
142 | +TRUNCATE TABLE ICP_COPY; |
143 | +INSERT INTO ICP_COPY SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
144 | +WHERE END_LSN <= @max_end_lsn; |
145 | +Check that INNODB_CHANGED_PAGES copies checksum the same (should be 1): |
146 | +should_be_1 |
147 | +1 |
148 | +call mtr.add_suppression("but the last checkpoint LSN is"); |
149 | +SELECT @@global.innodb_track_changed_pages; |
150 | +@@global.innodb_track_changed_pages |
151 | +1 |
152 | +ib_modified_log_4 |
153 | +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
154 | +WHERE START_LSN > 10000; |
155 | +ERROR HY000: Can't read record in system table |
156 | +DROP TABLE T1, ICP_COPY; |
157 | |
158 | === modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages_empty.result' |
159 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages_empty.result 2012-09-17 13:08:32 +0000 |
160 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages_empty.result 2013-05-29 15:20:41 +0000 |
161 | @@ -1,2 +1,3 @@ |
162 | +RESET CHANGED_PAGE_BITMAPS; |
163 | SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES; |
164 | space_id page_id start_lsn end_lsn |
165 | |
166 | === modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test' |
167 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 2013-05-09 19:43:37 +0000 |
168 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 2013-05-29 15:20:41 +0000 |
169 | @@ -209,6 +209,8 @@ |
170 | --replace_regex /_[[:digit:]]+\.xdb$// |
171 | list_files $MYSQLD_DATADIR ib_modified_log*; |
172 | |
173 | +DROP TABLE t1, t2; |
174 | + |
175 | # |
176 | # Test for log tracking compatibility with innodb_force_recovery (bug 1083596). |
177 | # |
178 | @@ -231,13 +233,10 @@ |
179 | --echo 9th restart |
180 | --source include/restart_mysqld.inc |
181 | |
182 | -DROP TABLE t1, t2; |
183 | - |
184 | # |
185 | # Test that --innodb-read-only works |
186 | # |
187 | SET GLOBAL innodb_fast_shutdown=0; |
188 | - |
189 | --echo 10th restart |
190 | --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
191 | --shutdown_server 10 |
192 | @@ -249,5 +248,36 @@ |
193 | SELECT @@innodb_read_only; |
194 | SELECT @@innodb_track_changed_pages; |
195 | |
196 | +# |
197 | +# Test that bitmap files are created correctly in innodb_data_home_dir without a trailing |
198 | +# path separator (bug 1181887) |
199 | +# |
200 | +call mtr.add_suppression("New log files created"); |
201 | +call mtr.add_suppression("Creating foreign key constraint system tables"); |
202 | +call mtr.add_suppression("Cannot open table mysql/[a-z_]+ from the internal data dictionary"); |
203 | +call mtr.add_suppression("Info table is not ready to be used"); |
204 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
205 | +--shutdown_server 10 |
206 | +--source include/wait_until_disconnected.inc |
207 | +--remove_files_wildcard $MYSQLD_DATADIR ib_logfile* |
208 | +--mkdir $MYSQLTEST_VARDIR/tmpdatadir |
209 | +--enable_reconnect |
210 | --echo 11th restart |
211 | ---source include/restart_mysqld.inc |
212 | +--exec echo "restart:--innodb-data-home-dir=$MYSQLTEST_VARDIR/tmpdatadir" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
213 | +--source include/wait_until_connected_again.inc |
214 | + |
215 | +file_exists $MYSQLTEST_VARDIR/tmpdatadir/ib_modified_log_1_0.xdb; |
216 | +--replace_regex /_[[:digit:]]+\.xdb$// |
217 | +list_files $MYSQLTEST_VARDIR/tmpdatadir ib_modified_log*; |
218 | + |
219 | +--echo 12th restart |
220 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
221 | +--shutdown_server 10 |
222 | +--source include/wait_until_disconnected.inc |
223 | +--remove_files_wildcard $MYSQLD_DATADIR ib_logfile* |
224 | +--remove_files_wildcard $MYSQLD_DATADIR ibdata* |
225 | +--remove_files_wildcard $MYSQLD_DATADIR ib_modified_log* |
226 | +--enable_reconnect |
227 | +--echo 13th restart |
228 | +--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
229 | +--source include/wait_until_connected_again.inc |
230 | |
231 | === modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_flush.test' |
232 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_flush.test 2013-05-09 19:43:37 +0000 |
233 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_flush.test 2013-05-29 15:20:41 +0000 |
234 | @@ -64,7 +64,7 @@ |
235 | INSERT INTO t1 VALUES (3, REPEAT("c", 20000)); |
236 | |
237 | # |
238 | -# Test innodb_flush_method=O_DIRECT |
239 | +# Test innodb_flush_method=O_DIRECT_NO_FSYNC |
240 | # Check that the previous test produced bitmap data while the server is down. |
241 | # |
242 | --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
243 | @@ -74,7 +74,7 @@ |
244 | --replace_regex /_[[:digit:]]+\.xdb$// |
245 | list_files $MYSQLD_DATADIR ib_modified_log*; |
246 | --enable_reconnect |
247 | ---exec echo "restart:--innodb-track-changed-pages=1 --innodb-flush-method=O_DIRECT" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
248 | +--exec echo "restart:--innodb-track-changed-pages=1 --innodb-flush-method=O_DIRECT_NO_FSYNC" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
249 | --source include/wait_until_connected_again.inc |
250 | |
251 | INSERT INTO t1 VALUES (4, REPEAT("d", 20000)); |
252 | |
253 | === modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test' |
254 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test 2013-05-09 19:43:37 +0000 |
255 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test 2013-05-29 15:20:41 +0000 |
256 | @@ -9,7 +9,7 @@ |
257 | RESET CHANGED_PAGE_BITMAPS; |
258 | |
259 | --disable_warnings |
260 | -DROP TABLE IF EXISTS T1; |
261 | +DROP TABLE IF EXISTS T1, ICP_COPY; |
262 | --enable_warnings |
263 | |
264 | let $old_max_changed_pages= `SELECT @@GLOBAL.INNODB_MAX_CHANGED_PAGES`; |
265 | @@ -102,9 +102,9 @@ |
266 | # Gather data for condition pushdown testing not using conditions # |
267 | ################################################################### |
268 | --disable_result_log |
269 | -SET @cond_test_max_end_lsn= |
270 | - (SELECT MAX(end_lsn) |
271 | - FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES); |
272 | +SET @max_end_lsn= |
273 | + (SELECT MAX(end_lsn) |
274 | + FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES); |
275 | |
276 | SET @cond_test_max_start_lsn= |
277 | (SELECT MAX(start_lsn) |
278 | @@ -150,31 +150,31 @@ |
279 | # Baseline as ICP currently does not support equality |
280 | SELECT COUNT(*) = @cond_test_pages_count |
281 | FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
282 | - WHERE END_LSN = @cond_test_max_end_lsn; |
283 | + WHERE END_LSN = @max_end_lsn; |
284 | |
285 | SELECT COUNT(*) = @cond_test_pages_count |
286 | FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
287 | WHERE |
288 | - END_LSN > (@cond_test_max_end_lsn - 1) AND |
289 | - END_LSN < (@cond_test_max_end_lsn + 1); |
290 | - |
291 | -SELECT COUNT(*) = @cond_test_pages_count |
292 | - FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
293 | - WHERE |
294 | - END_LSN >= @cond_test_max_end_lsn AND |
295 | - END_LSN <= @cond_test_max_end_lsn; |
296 | - |
297 | -SELECT COUNT(*) = @cond_test_pages_count |
298 | - FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
299 | - WHERE |
300 | - (@cond_test_max_end_lsn - 1) < END_LSN AND |
301 | - @cond_test_max_end_lsn >= END_LSN; |
302 | - |
303 | -SELECT COUNT(*) = @cond_test_pages_count |
304 | - FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
305 | - WHERE |
306 | - START_LSN <= @cond_test_max_end_lsn AND |
307 | - END_LSN >= @cond_test_max_end_lsn; |
308 | + END_LSN > (@max_end_lsn - 1) AND |
309 | + END_LSN < (@max_end_lsn + 1); |
310 | + |
311 | +SELECT COUNT(*) = @cond_test_pages_count |
312 | + FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
313 | + WHERE |
314 | + END_LSN >= @max_end_lsn AND |
315 | + END_LSN <= @max_end_lsn; |
316 | + |
317 | +SELECT COUNT(*) = @cond_test_pages_count |
318 | + FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
319 | + WHERE |
320 | + (@max_end_lsn - 1) < END_LSN AND |
321 | + @max_end_lsn >= END_LSN; |
322 | + |
323 | +SELECT COUNT(*) = @cond_test_pages_count |
324 | + FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
325 | + WHERE |
326 | + START_LSN <= @max_end_lsn AND |
327 | + END_LSN >= @max_end_lsn; |
328 | |
329 | SELECT COUNT(*) = @cond_test_pages_count |
330 | FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
331 | @@ -190,7 +190,7 @@ |
332 | FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
333 | WHERE |
334 | START_LSN >= @cond_test_max_start_lsn AND |
335 | - END_LSN <= @cond_test_max_end_lsn; |
336 | + END_LSN <= @max_end_lsn; |
337 | |
338 | SELECT COUNT(*) = @cond_test_pages_count |
339 | FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
340 | @@ -202,7 +202,7 @@ |
341 | FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
342 | WHERE |
343 | @cond_test_max_start_lsn <= START_LSN AND |
344 | - @cond_test_max_end_lsn >= END_LSN; |
345 | + @max_end_lsn >= END_LSN; |
346 | |
347 | # Empty range |
348 | SELECT COUNT(*) |
349 | @@ -259,4 +259,76 @@ |
350 | |
351 | eval SET GLOBAL INNODB_MAX_CHANGED_PAGES = $old_max_changed_pages; |
352 | |
353 | -DROP TABLE T1; |
354 | +# |
355 | +# Test that I_S.INNODB_CHANGED_PAGES can be queried with the log tracking disabled |
356 | +# (bug 1185304) |
357 | +# |
358 | + |
359 | +# We have to skip ICP_COPY bitmap writes. Thus all the I_S queries from |
360 | +# this point are limited to the max_end_lsn. |
361 | + |
362 | +# Save the copy of current table contents |
363 | +CREATE TABLE ICP_COPY ( |
364 | + space_id INT(11) NOT NULL, |
365 | + page_id INT(11) NOT NULL, |
366 | + start_lsn BIGINT(21) NOT NULL, |
367 | + end_lsn BIGINT(21) NOT NULL, |
368 | + INDEX page_id(space_id, page_id)) ENGINE=InnoDB; |
369 | + |
370 | +INSERT INTO ICP_COPY SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
371 | + WHERE END_LSN <= @max_end_lsn; |
372 | + |
373 | +# Restart with log tracking disabled |
374 | +--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
375 | +--shutdown_server 10 |
376 | +--source include/wait_until_disconnected.inc |
377 | +--enable_reconnect |
378 | +--exec echo "restart:--innodb-track-changed-pages=FALSE" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect |
379 | +--source include/wait_until_connected_again.inc |
380 | + |
381 | +SELECT @@global.innodb_track_changed_pages; |
382 | + |
383 | +let $icp_1_checksum= `CHECKSUM TABLE ICP_COPY`; |
384 | + |
385 | +SET @max_end_lsn= (SELECT MAX(end_lsn) FROM ICP_COPY); |
386 | + |
387 | +# Read the table again |
388 | +TRUNCATE TABLE ICP_COPY; |
389 | + |
390 | +INSERT INTO ICP_COPY SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
391 | + WHERE END_LSN <= @max_end_lsn; |
392 | + |
393 | +# Compare the checksums of both reads |
394 | +let $icp_2_checksum= `CHECKSUM TABLE ICP_COPY`; |
395 | +--disable_query_log |
396 | +--echo Check that INNODB_CHANGED_PAGES copies checksum the same (should be 1): |
397 | +eval SELECT "$icp_1_checksum" LIKE "$icp_2_checksum" AS should_be_1; |
398 | +--enable_query_log |
399 | + |
400 | +call mtr.add_suppression("but the last checkpoint LSN is"); |
401 | +--source include/restart_mysqld.inc |
402 | + |
403 | +SELECT @@global.innodb_track_changed_pages; |
404 | + |
405 | +# |
406 | +# Test for |
407 | +# - bug 1179974 (INFORMATION_SCHEMA.INNODB_CHANGED_PAGES query fails server |
408 | +# with an I/O error if a bitmap file in the middle of requested range is missing) |
409 | +# - bug 1185040 (INFORMATION_SCHEMA.INNODB_CHANGED_PAGES_QUERY should return a |
410 | +# warning if the result set is partial) |
411 | +# |
412 | + |
413 | +let $MYSQLD_DATADIR= `select @@datadir`; |
414 | +--replace_regex /_[[:digit:]]+\.xdb$// |
415 | +list_files $MYSQLD_DATADIR ib_modified_log_4_*; |
416 | + |
417 | +remove_files_wildcard $MYSQLD_DATADIR ib_modified_log_4_*.xdb; |
418 | + |
419 | +--replace_regex /_[[:digit:]]+\.xdb$// |
420 | +list_files $MYSQLD_DATADIR ib_modified_log_4_*; |
421 | + |
422 | +--error ER_CANT_FIND_SYSTEM_REC |
423 | +SELECT COUNT(*) FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES |
424 | + WHERE START_LSN > 10000; |
425 | + |
426 | +DROP TABLE T1, ICP_COPY; |
427 | |
428 | === modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages_empty.test' |
429 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages_empty.test 2012-09-17 13:08:32 +0000 |
430 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages_empty.test 2013-05-29 15:20:41 +0000 |
431 | @@ -1,8 +1,10 @@ |
432 | ############################################################################### |
433 | -# Test for empty I_S.INNODB_CHANGED_PAGES table. The table should be empty if# |
434 | -# innodb_track_changed_pages is false. # |
435 | +# Test for empty I_S.INNODB_CHANGED_PAGES table. The table should be empty if # |
436 | +# no bitmap files exist # |
437 | ############################################################################### |
438 | |
439 | --source include/have_innodb.inc |
440 | |
441 | +RESET CHANGED_PAGE_BITMAPS; |
442 | + |
443 | SELECT * FROM INFORMATION_SCHEMA.INNODB_CHANGED_PAGES; |
444 | |
445 | === modified file 'Percona-Server/mysql-test/suite/sys_vars/r/all_vars.result' |
446 | --- Percona-Server/mysql-test/suite/sys_vars/r/all_vars.result 2013-05-10 09:39:17 +0000 |
447 | +++ Percona-Server/mysql-test/suite/sys_vars/r/all_vars.result 2013-05-29 15:20:41 +0000 |
448 | @@ -16,7 +16,5 @@ |
449 | INNODB_FAKE_CHANGES |
450 | INNODB_KILL_IDLE_TRANSACTION |
451 | INNODB_KILL_IDLE_TRANSACTION |
452 | -INNODB_MAX_CHANGED_PAGES |
453 | -INNODB_MAX_CHANGED_PAGES |
454 | drop table t1; |
455 | drop table t2; |
456 | |
457 | === added file 'Percona-Server/mysql-test/suite/sys_vars/r/innodb_max_changed_pages_basic.result' |
458 | --- Percona-Server/mysql-test/suite/sys_vars/r/innodb_max_changed_pages_basic.result 1970-01-01 00:00:00 +0000 |
459 | +++ Percona-Server/mysql-test/suite/sys_vars/r/innodb_max_changed_pages_basic.result 2013-05-29 15:20:41 +0000 |
460 | @@ -0,0 +1,78 @@ |
461 | +SET @start_value = @@global.innodb_max_changed_pages; |
462 | +SELECT @start_value; |
463 | +@start_value |
464 | +1000000 |
465 | +SET @@global.innodb_max_changed_pages = 5000; |
466 | +SET @@global.innodb_max_changed_pages = DEFAULT; |
467 | +SELECT @@global.innodb_max_changed_pages; |
468 | +@@global.innodb_max_changed_pages |
469 | +1000000 |
470 | +SET @@global.innodb_max_changed_pages = 0; |
471 | +SELECT @@global.innodb_max_changed_pages; |
472 | +@@global.innodb_max_changed_pages |
473 | +0 |
474 | +SET @@global.innodb_max_changed_pages = 1; |
475 | +SELECT @@global.innodb_max_changed_pages; |
476 | +@@global.innodb_max_changed_pages |
477 | +1 |
478 | +SET @@global.innodb_max_changed_pages = 18446744073709551614; |
479 | +SELECT @@global.innodb_max_changed_pages; |
480 | +@@global.innodb_max_changed_pages |
481 | +18446744073709551614 |
482 | +SET @@global.innodb_max_changed_pages = 18446744073709551615; |
483 | +SELECT @@global.innodb_max_changed_pages; |
484 | +@@global.innodb_max_changed_pages |
485 | +18446744073709551615 |
486 | +SET @@global.innodb_max_changed_pages = 18446744073709551616; |
487 | +ERROR 42000: Incorrect argument type to variable 'innodb_max_changed_pages' |
488 | +SELECT @@global.innodb_max_changed_pages; |
489 | +@@global.innodb_max_changed_pages |
490 | +18446744073709551615 |
491 | +SET @@global.innodb_max_changed_pages = 18446744073709551617; |
492 | +ERROR 42000: Incorrect argument type to variable 'innodb_max_changed_pages' |
493 | +SELECT @@global.innodb_max_changed_pages; |
494 | +@@global.innodb_max_changed_pages |
495 | +18446744073709551615 |
496 | +SET @@global.innodb_max_changed_pages = 105.54; |
497 | +ERROR 42000: Incorrect argument type to variable 'innodb_max_changed_pages' |
498 | +SELECT @@global.innodb_max_changed_pages; |
499 | +@@global.innodb_max_changed_pages |
500 | +18446744073709551615 |
501 | +SET @@global.innodb_max_changed_pages = -200; |
502 | +Warnings: |
503 | +Warning 1292 Truncated incorrect innodb_max_changed_pages value: '-200' |
504 | +SELECT @@global.innodb_max_changed_pages; |
505 | +@@global.innodb_max_changed_pages |
506 | +0 |
507 | +SET @@global.innodb_max_changed_pages = ON; |
508 | +ERROR 42000: Incorrect argument type to variable 'innodb_max_changed_pages' |
509 | +SELECT @@global.innodb_max_changed_pages; |
510 | +@@global.innodb_max_changed_pages |
511 | +0 |
512 | +SET @@global.innodb_max_changed_pages = 'foo'; |
513 | +ERROR 42000: Incorrect argument type to variable 'innodb_max_changed_pages' |
514 | +SELECT @@global.innodb_max_changed_pages; |
515 | +@@global.innodb_max_changed_pages |
516 | +0 |
517 | +SET @@session.innodb_max_changed_pages = 4096; |
518 | +ERROR HY000: Variable 'innodb_max_changed_pages' is a GLOBAL variable and should be set with SET GLOBAL |
519 | +SELECT @@session.innodb_max_changed_pages; |
520 | +ERROR HY000: Variable 'innodb_max_changed_pages' is a GLOBAL variable |
521 | +SELECT @@global.innodb_max_changed_pages = VARIABLE_VALUE |
522 | +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
523 | +WHERE VARIABLE_NAME='innodb_max_changed_pages'; |
524 | +@@global.innodb_max_changed_pages = VARIABLE_VALUE |
525 | +1 |
526 | +SELECT @@global.innodb_max_changed_pages = VARIABLE_VALUE |
527 | +FROM INFORMATION_SCHEMA.SESSION_VARIABLES |
528 | +WHERE VARIABLE_NAME='innodb_max_changed_pages'; |
529 | +@@global.innodb_max_changed_pages = VARIABLE_VALUE |
530 | +1 |
531 | +SET @@global.innodb_max_changed_pages=6789; |
532 | +SELECT @@global.innodb_max_changed_pages=@@innodb_max_changed_pages; |
533 | +@@global.innodb_max_changed_pages=@@innodb_max_changed_pages |
534 | +1 |
535 | +SET @@global.innodb_max_changed_pages=@start_value; |
536 | +SELECT @@global.innodb_max_changed_pages; |
537 | +@@global.innodb_max_changed_pages |
538 | +1000000 |
539 | |
540 | === added file 'Percona-Server/mysql-test/suite/sys_vars/t/innodb_max_changed_pages_basic.test' |
541 | --- Percona-Server/mysql-test/suite/sys_vars/t/innodb_max_changed_pages_basic.test 1970-01-01 00:00:00 +0000 |
542 | +++ Percona-Server/mysql-test/suite/sys_vars/t/innodb_max_changed_pages_basic.test 2013-05-29 15:20:41 +0000 |
543 | @@ -0,0 +1,60 @@ |
544 | +# Tests for innodb_max_changed_pages variable |
545 | +--source include/have_innodb.inc |
546 | + |
547 | +SET @start_value = @@global.innodb_max_changed_pages; |
548 | +SELECT @start_value; |
549 | + |
550 | +SET @@global.innodb_max_changed_pages = 5000; |
551 | +SET @@global.innodb_max_changed_pages = DEFAULT; |
552 | +SELECT @@global.innodb_max_changed_pages; |
553 | + |
554 | +# Valid boundary values |
555 | +SET @@global.innodb_max_changed_pages = 0; |
556 | +SELECT @@global.innodb_max_changed_pages; |
557 | +SET @@global.innodb_max_changed_pages = 1; |
558 | +SELECT @@global.innodb_max_changed_pages; |
559 | +SET @@global.innodb_max_changed_pages = 18446744073709551614; |
560 | +SELECT @@global.innodb_max_changed_pages; |
561 | +SET @@global.innodb_max_changed_pages = 18446744073709551615; |
562 | +SELECT @@global.innodb_max_changed_pages; |
563 | + |
564 | +# Invalid values |
565 | +--error ER_WRONG_TYPE_FOR_VAR |
566 | +SET @@global.innodb_max_changed_pages = 18446744073709551616; |
567 | +SELECT @@global.innodb_max_changed_pages; |
568 | +--error ER_WRONG_TYPE_FOR_VAR |
569 | +SET @@global.innodb_max_changed_pages = 18446744073709551617; |
570 | +SELECT @@global.innodb_max_changed_pages; |
571 | +--error ER_WRONG_TYPE_FOR_VAR |
572 | +SET @@global.innodb_max_changed_pages = 105.54; |
573 | +SELECT @@global.innodb_max_changed_pages; |
574 | +SET @@global.innodb_max_changed_pages = -200; |
575 | +SELECT @@global.innodb_max_changed_pages; |
576 | +--error ER_WRONG_TYPE_FOR_VAR |
577 | +SET @@global.innodb_max_changed_pages = ON; |
578 | +SELECT @@global.innodb_max_changed_pages; |
579 | +--error ER_WRONG_TYPE_FOR_VAR |
580 | +SET @@global.innodb_max_changed_pages = 'foo'; |
581 | +SELECT @@global.innodb_max_changed_pages; |
582 | + |
583 | +# Accessing as session variable forbidden |
584 | +--error ER_GLOBAL_VARIABLE |
585 | +SET @@session.innodb_max_changed_pages = 4096; |
586 | +--error ER_INCORRECT_GLOBAL_LOCAL_VAR |
587 | +SELECT @@session.innodb_max_changed_pages; |
588 | + |
589 | +# Verify INFORMATION_SCHEMA access |
590 | +SELECT @@global.innodb_max_changed_pages = VARIABLE_VALUE |
591 | +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES |
592 | +WHERE VARIABLE_NAME='innodb_max_changed_pages'; |
593 | + |
594 | +SELECT @@global.innodb_max_changed_pages = VARIABLE_VALUE |
595 | +FROM INFORMATION_SCHEMA.SESSION_VARIABLES |
596 | +WHERE VARIABLE_NAME='innodb_max_changed_pages'; |
597 | + |
598 | +# Check default scope |
599 | +SET @@global.innodb_max_changed_pages=6789; |
600 | +SELECT @@global.innodb_max_changed_pages=@@innodb_max_changed_pages; |
601 | + |
602 | +SET @@global.innodb_max_changed_pages=@start_value; |
603 | +SELECT @@global.innodb_max_changed_pages; |
604 | |
605 | === modified file 'Percona-Server/storage/innobase/handler/i_s.cc' |
606 | --- Percona-Server/storage/innobase/handler/i_s.cc 2013-05-12 06:24:46 +0000 |
607 | +++ Percona-Server/storage/innobase/handler/i_s.cc 2013-05-29 15:20:41 +0000 |
608 | @@ -53,7 +53,7 @@ |
609 | #include "dict0types.h" |
610 | #include "ha_prototypes.h" /* for innobase_convert_name() */ |
611 | #include "srv0start.h" /* for srv_was_started */ |
612 | -#include "srv0srv.h" /* for srv_track_changed_pages */ |
613 | +#include "srv0srv.h" /* for srv_max_changed_pages */ |
614 | #include "trx0i_s.h" |
615 | #include "trx0trx.h" /* for TRX_QUE_STATE_STR_MAX_LEN */ |
616 | #include "srv0mon.h" |
617 | @@ -8183,6 +8183,7 @@ |
618 | ib_uint64_t output_rows_num = 0UL; |
619 | ib_uint64_t max_lsn = IB_ULONGLONG_MAX; |
620 | ib_uint64_t min_lsn = 0ULL; |
621 | + int ret = 0; |
622 | |
623 | DBUG_ENTER("i_s_innodb_changed_pages_fill"); |
624 | |
625 | @@ -8194,10 +8195,6 @@ |
626 | |
627 | RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name); |
628 | |
629 | - if (!srv_track_changed_pages) { |
630 | - DBUG_RETURN(0); |
631 | - } |
632 | - |
633 | if (cond) { |
634 | limit_lsn_range_from_condition(table, cond, &min_lsn, |
635 | &max_lsn); |
636 | @@ -8273,8 +8270,13 @@ |
637 | ++output_rows_num; |
638 | } |
639 | |
640 | + if (i.failed) { |
641 | + my_error(ER_CANT_FIND_SYSTEM_REC, MYF(0)); |
642 | + ret = 1; |
643 | + } |
644 | + |
645 | log_online_bitmap_iterator_release(&i); |
646 | - DBUG_RETURN(0); |
647 | + DBUG_RETURN(ret); |
648 | } |
649 | |
650 | static |
651 | |
652 | === modified file 'Percona-Server/storage/innobase/include/log0log.h' |
653 | --- Percona-Server/storage/innobase/include/log0log.h 2013-05-10 13:29:38 +0000 |
654 | +++ Percona-Server/storage/innobase/include/log0log.h 2013-05-29 15:20:41 +0000 |
655 | @@ -397,7 +397,9 @@ |
656 | byte* buf, /*!< in: buffer where to read */ |
657 | log_group_t* group, /*!< in: log group */ |
658 | lsn_t start_lsn, /*!< in: read area start */ |
659 | - lsn_t end_lsn); /*!< in: read area end */ |
660 | + lsn_t end_lsn, /*!< in: read area end */ |
661 | + ibool release_mutex); /*!< in: whether the log_sys->mutex |
662 | + should be released before the read */ |
663 | /******************************************************//** |
664 | Writes a buffer to a log file group. */ |
665 | UNIV_INTERN |
666 | |
667 | === modified file 'Percona-Server/storage/innobase/include/log0online.h' |
668 | --- Percona-Server/storage/innobase/include/log0online.h 2013-05-09 19:43:37 +0000 |
669 | +++ Percona-Server/storage/innobase/include/log0online.h 2013-05-29 15:20:41 +0000 |
670 | @@ -160,6 +160,8 @@ |
671 | /** Struct for an iterator through all bits of changed pages bitmap blocks */ |
672 | struct log_bitmap_iterator_struct |
673 | { |
674 | + ibool failed; /*!< Has the iteration |
675 | + stopped prematurely */ |
676 | log_online_bitmap_file_range_t in_files; /*!< The bitmap files |
677 | for this iterator */ |
678 | size_t in_i; /*!< Currently read |
679 | |
680 | === modified file 'Percona-Server/storage/innobase/include/os0file.h' |
681 | --- Percona-Server/storage/innobase/include/os0file.h 2013-05-12 06:24:46 +0000 |
682 | +++ Percona-Server/storage/innobase/include/os0file.h 2013-05-29 15:20:41 +0000 |
683 | @@ -75,15 +75,19 @@ |
684 | /** File offset in bytes */ |
685 | typedef ib_uint64_t os_offset_t; |
686 | #ifdef __WIN__ |
687 | +#define SRV_PATH_SEPARATOR '\\' |
688 | /** File handle */ |
689 | # define os_file_t HANDLE |
690 | +# define os_file_invalid INVALID_HANDLE_VALUE |
691 | /** Convert a C file descriptor to a native file handle |
692 | @param fd file descriptor |
693 | @return native file handle */ |
694 | # define OS_FILE_FROM_FD(fd) (HANDLE) _get_osfhandle(fd) |
695 | #else |
696 | +#define SRV_PATH_SEPARATOR '/' |
697 | /** File handle */ |
698 | typedef int os_file_t; |
699 | +# define os_file_invalid (-1) |
700 | /** Convert a C file descriptor to a native file handle |
701 | @param fd file descriptor |
702 | @return native file handle */ |
703 | @@ -852,7 +856,6 @@ |
704 | ulint src_line);/*!< in: line where the func invoked */ |
705 | #endif /* UNIV_PFS_IO */ |
706 | |
707 | -#ifdef UNIV_HOTBACKUP |
708 | /***********************************************************************//** |
709 | Closes a file handle. |
710 | @return TRUE if success */ |
711 | @@ -861,7 +864,6 @@ |
712 | os_file_close_no_error_handling( |
713 | /*============================*/ |
714 | os_file_t file); /*!< in, own: handle to a file */ |
715 | -#endif /* UNIV_HOTBACKUP */ |
716 | /***********************************************************************//** |
717 | Gets a file size. |
718 | @return file size, or (os_offset_t) -1 on failure */ |
719 | |
720 | === modified file 'Percona-Server/storage/innobase/log/log0log.cc' |
721 | --- Percona-Server/storage/innobase/log/log0log.cc 2013-05-10 13:29:38 +0000 |
722 | +++ Percona-Server/storage/innobase/log/log0log.cc 2013-05-29 15:20:41 +0000 |
723 | @@ -2246,7 +2246,8 @@ |
724 | } |
725 | |
726 | /******************************************************//** |
727 | -Reads a specified log segment to a buffer. */ |
728 | +Reads a specified log segment to a buffer. Optionally releases the log mutex |
729 | +before the I/O. */ |
730 | UNIV_INTERN |
731 | void |
732 | log_group_read_log_seg( |
733 | @@ -2255,7 +2256,9 @@ |
734 | byte* buf, /*!< in: buffer where to read */ |
735 | log_group_t* group, /*!< in: log group */ |
736 | lsn_t start_lsn, /*!< in: read area start */ |
737 | - lsn_t end_lsn) /*!< in: read area end */ |
738 | + lsn_t end_lsn, /*!< in: read area end */ |
739 | + ibool release_mutex) /*!< in: whether the log_sys->mutex |
740 | + should be released before the read */ |
741 | { |
742 | ulint len; |
743 | lsn_t source_offset; |
744 | @@ -2293,6 +2296,10 @@ |
745 | |
746 | ut_a(source_offset / UNIV_PAGE_SIZE <= ULINT_MAX); |
747 | |
748 | + if (release_mutex) { |
749 | + mutex_exit(&(log_sys->mutex)); |
750 | + } |
751 | + |
752 | fil_io(OS_FILE_READ | OS_FILE_LOG, sync, group->space_id, 0, |
753 | (ulint) (source_offset / UNIV_PAGE_SIZE), |
754 | (ulint) (source_offset % UNIV_PAGE_SIZE), |
755 | @@ -2303,6 +2310,9 @@ |
756 | |
757 | if (start_lsn != end_lsn) { |
758 | |
759 | + if (release_mutex) { |
760 | + mutex_enter(&(log_sys->mutex)); |
761 | + } |
762 | goto loop; |
763 | } |
764 | } |
765 | @@ -2869,7 +2879,7 @@ |
766 | |
767 | log_group_read_log_seg(LOG_ARCHIVE, log_sys->archive_buf, |
768 | UT_LIST_GET_FIRST(log_sys->log_groups), |
769 | - start_lsn, limit_lsn); |
770 | + start_lsn, limit_lsn, FALSE); |
771 | |
772 | mutex_exit(&(log_sys->mutex)); |
773 | |
774 | |
775 | === modified file 'Percona-Server/storage/innobase/log/log0online.cc' |
776 | --- Percona-Server/storage/innobase/log/log0online.cc 2013-05-12 06:24:46 +0000 |
777 | +++ Percona-Server/storage/innobase/log/log0online.cc 2013-05-29 15:20:41 +0000 |
778 | @@ -43,8 +43,8 @@ |
779 | |
780 | /** Log parsing and bitmap output data structure */ |
781 | struct log_bitmap_struct { |
782 | - byte read_buf[FOLLOW_SCAN_SIZE]; |
783 | - /*!< log read buffer */ |
784 | + byte* read_buf_ptr; /*!< Unaligned log read buffer */ |
785 | + byte* read_buf; /*!< log read buffer */ |
786 | byte parse_buf[RECV_PARSING_BUF_SIZE]; |
787 | /*!< log parse buffer */ |
788 | byte* parse_buf_end; /*!< parse buffer position where the |
789 | @@ -53,6 +53,8 @@ |
790 | parsed, it points to the start, |
791 | otherwise points immediatelly past the |
792 | end of the incomplete log record. */ |
793 | + char bmp_file_home[FN_REFLEN]; |
794 | + /*!< directory for bitmap files */ |
795 | log_online_bitmap_file_t out; /*!< The current bitmap file */ |
796 | ulint out_seq_num; /*!< the bitmap file sequence number */ |
797 | lsn_t start_lsn; /*!< the LSN of the next unparsed |
798 | @@ -489,9 +491,8 @@ |
799 | lsn_t start_lsn) /*!< in: the start LSN name part */ |
800 | { |
801 | ut_snprintf(log_bmp_sys->out.name, FN_REFLEN, bmp_file_name_template, |
802 | - srv_data_home, bmp_file_name_stem, |
803 | + log_bmp_sys->bmp_file_home, bmp_file_name_stem, |
804 | log_bmp_sys->out_seq_num, start_lsn); |
805 | - |
806 | } |
807 | |
808 | /*********************************************************************//** |
809 | @@ -503,12 +504,13 @@ |
810 | /*========================*/ |
811 | const char *path) /*!< in: path to file */ |
812 | { |
813 | - ibool success; |
814 | + dberr_t err; |
815 | os_file_stat_t file_info; |
816 | |
817 | /* Currently, it's OK to overwrite 0-sized files only */ |
818 | - success = os_file_get_status(path, &file_info, false); |
819 | - return success && file_info.size == 0LL; |
820 | + err = os_file_get_status(path, &file_info, false); |
821 | + return err == DB_SUCCESS && file_info.type == OS_FILE_TYPE_FILE |
822 | + && file_info.size == 0LL; |
823 | } |
824 | |
825 | /*********************************************************************//** |
826 | @@ -526,8 +528,8 @@ |
827 | if (log_online_should_overwrite(log_bmp_sys->out.name)) { |
828 | |
829 | success = static_cast<ibool>( |
830 | - os_file_delete(innodb_file_bmp_key, |
831 | - log_bmp_sys->out.name)); |
832 | + os_file_delete_if_exists(innodb_file_bmp_key, |
833 | + log_bmp_sys->out.name)); |
834 | } |
835 | |
836 | if (UNIV_LIKELY(success)) { |
837 | @@ -545,7 +547,6 @@ |
838 | os_file_get_last_error(TRUE); |
839 | ib_logf(IB_LOG_LEVEL_ERROR, |
840 | "cannot create \'%s\'\n", log_bmp_sys->out.name); |
841 | - log_bmp_sys->out.file = -1; |
842 | return FALSE; |
843 | } |
844 | |
845 | @@ -564,9 +565,9 @@ |
846 | lsn_t next_file_start_lsn) /*!<in: the start LSN name |
847 | part */ |
848 | { |
849 | - if (log_bmp_sys->out.file != -1) { |
850 | + if (log_bmp_sys->out.file != os_file_invalid) { |
851 | os_file_close(log_bmp_sys->out.file); |
852 | - log_bmp_sys->out.file = -1; |
853 | + log_bmp_sys->out.file = os_file_invalid; |
854 | } |
855 | log_bmp_sys->out_seq_num++; |
856 | log_online_make_bitmap_name(next_file_start_lsn); |
857 | @@ -615,6 +616,7 @@ |
858 | os_file_dir_t bitmap_dir; |
859 | os_file_stat_t bitmap_dir_file_info; |
860 | lsn_t last_file_start_lsn = MIN_TRACKED_LSN; |
861 | + size_t srv_data_home_len; |
862 | |
863 | /* Bitmap data start and end in a bitmap block must be 8-byte |
864 | aligned. */ |
865 | @@ -623,20 +625,39 @@ |
866 | |
867 | log_bmp_sys = static_cast<log_bitmap_struct *> |
868 | (ut_malloc(sizeof(*log_bmp_sys))); |
869 | + log_bmp_sys->read_buf_ptr = static_cast<byte *> |
870 | + (ut_malloc(FOLLOW_SCAN_SIZE + OS_FILE_LOG_BLOCK_SIZE)); |
871 | + log_bmp_sys->read_buf = static_cast<byte *> |
872 | + (ut_align(log_bmp_sys->read_buf_ptr, OS_FILE_LOG_BLOCK_SIZE)); |
873 | |
874 | mutex_create(log_bmp_sys_mutex_key, &log_bmp_sys->mutex, |
875 | SYNC_LOG_ONLINE); |
876 | |
877 | + /* Initialize bitmap file directory from srv_data_home and add a path |
878 | + separator if needed. */ |
879 | + srv_data_home_len = strlen(srv_data_home); |
880 | + ut_a (srv_data_home_len < FN_REFLEN); |
881 | + strcpy(log_bmp_sys->bmp_file_home, srv_data_home); |
882 | + if (srv_data_home_len |
883 | + && log_bmp_sys->bmp_file_home[srv_data_home_len - 1] |
884 | + != SRV_PATH_SEPARATOR) { |
885 | + |
886 | + ut_a (srv_data_home_len < FN_REFLEN - 1); |
887 | + log_bmp_sys->bmp_file_home[srv_data_home_len] |
888 | + = SRV_PATH_SEPARATOR; |
889 | + log_bmp_sys->bmp_file_home[srv_data_home_len + 1] = '\0'; |
890 | + } |
891 | + |
892 | /* Enumerate existing bitmap files to either open the last one to get |
893 | the last tracked LSN either to find that there are none and start |
894 | tracking from scratch. */ |
895 | log_bmp_sys->out.name[0] = '\0'; |
896 | log_bmp_sys->out_seq_num = 0; |
897 | |
898 | - bitmap_dir = os_file_opendir(srv_data_home, TRUE); |
899 | + bitmap_dir = os_file_opendir(log_bmp_sys->bmp_file_home, TRUE); |
900 | ut_a(bitmap_dir); |
901 | - while (!os_file_readdir_next_file(srv_data_home, bitmap_dir, |
902 | - &bitmap_dir_file_info)) { |
903 | + while (!os_file_readdir_next_file(log_bmp_sys->bmp_file_home, |
904 | + bitmap_dir, &bitmap_dir_file_info)) { |
905 | |
906 | ulong file_seq_num; |
907 | lsn_t file_start_lsn; |
908 | @@ -651,8 +672,8 @@ |
909 | && bitmap_dir_file_info.size > 0) { |
910 | log_bmp_sys->out_seq_num = file_seq_num; |
911 | last_file_start_lsn = file_start_lsn; |
912 | - /* No dir component (srv_data_home) here, because |
913 | - that's the cwd */ |
914 | + /* No dir component (log_bmp_sys->bmp_file_home) here, |
915 | + because that's the cwd */ |
916 | strncpy(log_bmp_sys->out.name, |
917 | bitmap_dir_file_info.name, FN_REFLEN - 1); |
918 | log_bmp_sys->out.name[FN_REFLEN - 1] = '\0'; |
919 | @@ -662,7 +683,7 @@ |
920 | if (os_file_closedir(bitmap_dir)) { |
921 | os_file_get_last_error(TRUE); |
922 | ib_logf(IB_LOG_LEVEL_ERROR, "cannot close \'%s\'\n", |
923 | - srv_data_home); |
924 | + log_bmp_sys->bmp_file_home); |
925 | exit(1); |
926 | } |
927 | |
928 | @@ -760,9 +781,9 @@ |
929 | { |
930 | ib_rbt_node_t *free_list_node = log_bmp_sys->page_free_list; |
931 | |
932 | - if (log_bmp_sys->out.file != -1) { |
933 | + if (log_bmp_sys->out.file != os_file_invalid) { |
934 | os_file_close(log_bmp_sys->out.file); |
935 | - log_bmp_sys->out.file = -1; |
936 | + log_bmp_sys->out.file = os_file_invalid; |
937 | } |
938 | |
939 | rbt_free(log_bmp_sys->modified_pages); |
940 | @@ -775,6 +796,7 @@ |
941 | |
942 | mutex_free(&log_bmp_sys->mutex); |
943 | |
944 | + ut_free(log_bmp_sys->read_buf_ptr); |
945 | ut_free(log_bmp_sys); |
946 | } |
947 | |
948 | @@ -975,8 +997,8 @@ |
949 | |
950 | mutex_enter(&log_sys->mutex); |
951 | log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf, |
952 | - group, block_start_lsn, block_end_lsn); |
953 | - mutex_exit(&log_sys->mutex); |
954 | + group, block_start_lsn, block_end_lsn, TRUE); |
955 | + /* log_group_read_log_seg will release the log_sys->mutex for us */ |
956 | |
957 | while (log_block < log_block_end |
958 | && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) { |
959 | @@ -1252,15 +1274,19 @@ |
960 | os_file_dir_t bitmap_dir; |
961 | os_file_stat_t bitmap_dir_file_info; |
962 | ulong first_file_seq_num = ULONG_MAX; |
963 | + ulong last_file_seq_num = 0; |
964 | lsn_t first_file_start_lsn = LSN_MAX; |
965 | |
966 | + ut_ad(range_end >= range_start); |
967 | + |
968 | bitmap_files->count = 0; |
969 | bitmap_files->files = NULL; |
970 | |
971 | /* 1st pass: size the info array */ |
972 | |
973 | bitmap_dir = os_file_opendir(srv_data_home, FALSE); |
974 | - if (!bitmap_dir) { |
975 | + if (UNIV_UNLIKELY(!bitmap_dir)) { |
976 | + |
977 | ib_logf(IB_LOG_LEVEL_ERROR, |
978 | "failed to open bitmap directory \'%s\'\n", |
979 | srv_data_home); |
980 | @@ -1281,12 +1307,17 @@ |
981 | continue; |
982 | } |
983 | |
984 | + if (file_seq_num > last_file_seq_num) { |
985 | + |
986 | + last_file_seq_num = file_seq_num; |
987 | + } |
988 | + |
989 | if (file_start_lsn >= range_start |
990 | || file_start_lsn == first_file_start_lsn |
991 | || first_file_start_lsn > range_start) { |
992 | |
993 | /* A file that falls into the range */ |
994 | - bitmap_files->count++; |
995 | + |
996 | if (file_start_lsn < first_file_start_lsn) { |
997 | |
998 | first_file_start_lsn = file_start_lsn; |
999 | @@ -1304,23 +1335,27 @@ |
1000 | } |
1001 | } |
1002 | |
1003 | - ut_a(first_file_seq_num != ULONG_MAX || bitmap_files->count == 0); |
1004 | + if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) { |
1005 | |
1006 | - if (os_file_closedir(bitmap_dir)) { |
1007 | os_file_get_last_error(TRUE); |
1008 | ib_logf(IB_LOG_LEVEL_ERROR, "cannot close \'%s\'\n", |
1009 | srv_data_home); |
1010 | return FALSE; |
1011 | } |
1012 | |
1013 | - if (!bitmap_files->count) { |
1014 | + if (first_file_seq_num == ULONG_MAX && last_file_seq_num == 0) { |
1015 | + |
1016 | + bitmap_files->count = 0; |
1017 | return TRUE; |
1018 | } |
1019 | |
1020 | + bitmap_files->count = last_file_seq_num - first_file_seq_num + 1; |
1021 | + |
1022 | /* 2nd pass: get the file names in the file_seq_num order */ |
1023 | |
1024 | bitmap_dir = os_file_opendir(srv_data_home, FALSE); |
1025 | - if (!bitmap_dir) { |
1026 | + if (UNIV_UNLIKELY(!bitmap_dir)) { |
1027 | + |
1028 | ib_logf(IB_LOG_LEVEL_ERROR, |
1029 | "failed to open bitmap directory \'%s\'\n", |
1030 | srv_data_home); |
1031 | @@ -1346,11 +1381,25 @@ |
1032 | &file_start_lsn) |
1033 | || file_start_lsn >= range_end |
1034 | || file_start_lsn < first_file_start_lsn) { |
1035 | + |
1036 | continue; |
1037 | } |
1038 | |
1039 | array_pos = file_seq_num - first_file_seq_num; |
1040 | + if (UNIV_UNLIKELY(array_pos >= bitmap_files->count)) { |
1041 | + |
1042 | + fprintf(stderr, |
1043 | + "InnoDB: Error: inconsistent bitmap file " |
1044 | + "directory for a " |
1045 | + "INFORMATION_SCHEMA.INNODB_CHANGED_PAGES query" |
1046 | + "\n"); |
1047 | + free(bitmap_files->files); |
1048 | + return FALSE; |
1049 | + } |
1050 | + |
1051 | + |
1052 | if (file_seq_num > bitmap_files->files[array_pos].seq_num) { |
1053 | + |
1054 | bitmap_files->files[array_pos].seq_num = file_seq_num; |
1055 | strncpy(bitmap_files->files[array_pos].name, |
1056 | bitmap_dir_file_info.name, FN_REFLEN); |
1057 | @@ -1361,7 +1410,8 @@ |
1058 | } |
1059 | } |
1060 | |
1061 | - if (os_file_closedir(bitmap_dir)) { |
1062 | + if (UNIV_UNLIKELY(os_file_closedir(bitmap_dir))) { |
1063 | + |
1064 | os_file_get_last_error(TRUE); |
1065 | ib_logf(IB_LOG_LEVEL_ERROR, "cannot close \'%s\'\n", |
1066 | srv_data_home); |
1067 | @@ -1406,6 +1456,8 @@ |
1068 | { |
1069 | ibool success = FALSE; |
1070 | |
1071 | + ut_ad(name[0] != '\0'); |
1072 | + |
1073 | ut_snprintf(bitmap_file->name, FN_REFLEN, "%s%s", srv_data_home, name); |
1074 | bitmap_file->file |
1075 | = os_file_create_simple_no_error_handling(innodb_file_bmp_key, |
1076 | @@ -1413,7 +1465,8 @@ |
1077 | OS_FILE_OPEN, |
1078 | OS_FILE_READ_ONLY, |
1079 | &success); |
1080 | - if (!success) { |
1081 | + if (UNIV_UNLIKELY(!success)) { |
1082 | + |
1083 | /* Here and below assume that bitmap file names do not |
1084 | contain apostrophes, thus no need for ut_print_filename(). */ |
1085 | ib_logf(IB_LOG_LEVEL_WARN, |
1086 | @@ -1455,7 +1508,8 @@ |
1087 | || (bitmap_file->offset |
1088 | > bitmap_file->size - MODIFIED_PAGE_BLOCK_SIZE)) { |
1089 | |
1090 | - if (bitmap_file->offset != bitmap_file->size) { |
1091 | + if (UNIV_UNLIKELY(bitmap_file->offset != bitmap_file->size)) { |
1092 | + |
1093 | /* If we are not at EOF and we have less than one page |
1094 | to read, it's junk. This error is not fatal in |
1095 | itself. */ |
1096 | @@ -1465,7 +1519,8 @@ |
1097 | "\'%s\'.\n", bitmap_file->name); |
1098 | } |
1099 | |
1100 | - if (!last_page_in_run) { |
1101 | + if (UNIV_UNLIKELY(!last_page_in_run)) { |
1102 | + |
1103 | /* We are at EOF but the last read page did not finish |
1104 | a run */ |
1105 | /* It's a "Warning" here because it's not a fatal error |
1106 | @@ -1505,18 +1560,29 @@ |
1107 | if (!log_online_setup_bitmap_file_range(&i->in_files, min_lsn, |
1108 | max_lsn)) { |
1109 | |
1110 | + i->failed = TRUE; |
1111 | return FALSE; |
1112 | } |
1113 | |
1114 | - ut_a(i->in_files.count > 0); |
1115 | + i->in_i = 0; |
1116 | + |
1117 | + if (i->in_files.count == 0) { |
1118 | + |
1119 | + /* Empty range */ |
1120 | + i->in.file = os_file_invalid; |
1121 | + i->page = NULL; |
1122 | + i->failed = FALSE; |
1123 | + return TRUE; |
1124 | + } |
1125 | |
1126 | /* Open the 1st bitmap file */ |
1127 | - i->in_i = 0; |
1128 | - if (!log_online_open_bitmap_file_read_only(i->in_files.files[i->in_i]. |
1129 | - name, |
1130 | - &i->in)) { |
1131 | + if (UNIV_UNLIKELY(!log_online_open_bitmap_file_read_only( |
1132 | + i->in_files.files[i->in_i].name, |
1133 | + &i->in))) { |
1134 | + |
1135 | i->in_i = i->in_files.count; |
1136 | free(i->in_files.files); |
1137 | + i->failed = TRUE; |
1138 | return FALSE; |
1139 | } |
1140 | |
1141 | @@ -1527,6 +1593,7 @@ |
1142 | i->first_page_id = 0; |
1143 | i->last_page_in_run = TRUE; |
1144 | i->changed = FALSE; |
1145 | + i->failed = FALSE; |
1146 | |
1147 | return TRUE; |
1148 | } |
1149 | @@ -1541,11 +1608,20 @@ |
1150 | { |
1151 | ut_a(i); |
1152 | |
1153 | - if (i->in_i < i->in_files.count) { |
1154 | + if (i->in.file != os_file_invalid) { |
1155 | + |
1156 | os_file_close(i->in.file); |
1157 | - } |
1158 | - ut_free(i->in_files.files); |
1159 | - ut_free(i->page); |
1160 | + i->in.file = os_file_invalid; |
1161 | + } |
1162 | + if (i->in_files.files) { |
1163 | + |
1164 | + ut_free(i->in_files.files); |
1165 | + } |
1166 | + if (i->page) { |
1167 | + |
1168 | + ut_free(i->page); |
1169 | + } |
1170 | + i->failed = TRUE; |
1171 | } |
1172 | |
1173 | /*********************************************************************//** |
1174 | @@ -1560,10 +1636,16 @@ |
1175 | log_bitmap_iterator_t *i) /*!<in/out: iterator */ |
1176 | { |
1177 | ibool checksum_ok = FALSE; |
1178 | + ibool success; |
1179 | |
1180 | ut_a(i); |
1181 | |
1182 | - if (i->bit_offset < MODIFIED_PAGE_BLOCK_BITMAP_LEN) |
1183 | + if (UNIV_UNLIKELY(i->in_files.count == 0)) { |
1184 | + |
1185 | + return FALSE; |
1186 | + } |
1187 | + |
1188 | + if (UNIV_LIKELY(i->bit_offset < MODIFIED_PAGE_BLOCK_BITMAP_LEN)) |
1189 | { |
1190 | ++i->bit_offset; |
1191 | i->changed = |
1192 | @@ -1580,28 +1662,55 @@ |
1193 | |
1194 | /* Advance file */ |
1195 | i->in_i++; |
1196 | - os_file_close(i->in.file); |
1197 | - log_online_diagnose_bitmap_eof(&i->in, |
1198 | - i->last_page_in_run); |
1199 | - if (i->in_i == i->in_files.count |
1200 | - || i->in_files.files[i->in_i].seq_num == 0) { |
1201 | - |
1202 | - return FALSE; |
1203 | - } |
1204 | - |
1205 | - if (!log_online_open_bitmap_file_read_only( |
1206 | + success = os_file_close_no_error_handling(i->in.file); |
1207 | + i->in.file = os_file_invalid; |
1208 | + if (UNIV_UNLIKELY(!success)) { |
1209 | + |
1210 | + os_file_get_last_error(TRUE); |
1211 | + i->failed = TRUE; |
1212 | + return FALSE; |
1213 | + } |
1214 | + |
1215 | + success = log_online_diagnose_bitmap_eof( |
1216 | + &i->in, i->last_page_in_run); |
1217 | + if (UNIV_UNLIKELY(!success)) { |
1218 | + |
1219 | + i->failed = TRUE; |
1220 | + return FALSE; |
1221 | + |
1222 | + } |
1223 | + |
1224 | + if (i->in_i == i->in_files.count) { |
1225 | + |
1226 | + return FALSE; |
1227 | + } |
1228 | + |
1229 | + if (UNIV_UNLIKELY(i->in_files.files[i->in_i].seq_num |
1230 | + == 0)) { |
1231 | + |
1232 | + i->failed = TRUE; |
1233 | + return FALSE; |
1234 | + } |
1235 | + |
1236 | + success = log_online_open_bitmap_file_read_only( |
1237 | i->in_files.files[i->in_i].name, |
1238 | - &i->in)) { |
1239 | + &i->in); |
1240 | + if (UNIV_UNLIKELY(!success)) { |
1241 | + |
1242 | + i->failed = TRUE; |
1243 | return FALSE; |
1244 | } |
1245 | } |
1246 | |
1247 | - if (!log_online_read_bitmap_page(&i->in, i->page, |
1248 | - &checksum_ok)) { |
1249 | + success = log_online_read_bitmap_page(&i->in, i->page, |
1250 | + &checksum_ok); |
1251 | + if (UNIV_UNLIKELY(!success)) { |
1252 | + |
1253 | os_file_get_last_error(TRUE); |
1254 | ib_logf(IB_LOG_LEVEL_WARN, |
1255 | "failed reading changed page bitmap file " |
1256 | "\'%s\'\n", i->in_files.files[i->in_i].name); |
1257 | + i->failed = TRUE; |
1258 | return FALSE; |
1259 | } |
1260 | } |
1261 | @@ -1657,7 +1766,7 @@ |
1262 | /* If we have to delete the current output file, close it |
1263 | first. */ |
1264 | os_file_close(log_bmp_sys->out.file); |
1265 | - log_bmp_sys->out.file = -1; |
1266 | + log_bmp_sys->out.file = os_file_invalid; |
1267 | } |
1268 | |
1269 | for (i = 0; i < bitmap_files.count; i++) { |
1270 | |
1271 | === modified file 'Percona-Server/storage/innobase/log/log0recv.cc' |
1272 | --- Percona-Server/storage/innobase/log/log0recv.cc 2013-05-13 04:25:56 +0000 |
1273 | +++ Percona-Server/storage/innobase/log/log0recv.cc 2013-05-29 15:20:41 +0000 |
1274 | @@ -611,7 +611,8 @@ |
1275 | } |
1276 | |
1277 | log_group_read_log_seg(LOG_RECOVER, log_sys->buf, |
1278 | - up_to_date_group, start_lsn, end_lsn); |
1279 | + up_to_date_group, start_lsn, end_lsn, |
1280 | + FALSE); |
1281 | |
1282 | len = (ulint) (end_lsn - start_lsn); |
1283 | |
1284 | @@ -663,7 +664,7 @@ |
1285 | #else /* UNIV_LOG_ARCHIVE */ |
1286 | UT_LIST_GET_FIRST(log_sys->log_groups), |
1287 | #endif /* UNIV_LOG_ARCHIVE */ |
1288 | - start_lsn, end_lsn); |
1289 | + start_lsn, end_lsn, FALSE); |
1290 | |
1291 | for (log_group_t* group = UT_LIST_GET_FIRST(log_sys->log_groups); |
1292 | group; |
1293 | @@ -2926,7 +2927,7 @@ |
1294 | end_lsn = start_lsn + RECV_SCAN_SIZE; |
1295 | |
1296 | log_group_read_log_seg(LOG_RECOVER, log_sys->buf, |
1297 | - group, start_lsn, end_lsn); |
1298 | + group, start_lsn, end_lsn, FALSE); |
1299 | |
1300 | finished = recv_scan_log_recs( |
1301 | (buf_pool_get_n_pages() |
1302 | |
1303 | === modified file 'Percona-Server/storage/innobase/os/os0file.cc' |
1304 | --- Percona-Server/storage/innobase/os/os0file.cc 2013-05-26 10:55:00 +0000 |
1305 | +++ Percona-Server/storage/innobase/os/os0file.cc 2013-05-29 15:20:41 +0000 |
1306 | @@ -2061,7 +2061,6 @@ |
1307 | #endif /* __WIN__ */ |
1308 | } |
1309 | |
1310 | -#ifdef UNIV_HOTBACKUP |
1311 | /***********************************************************************//** |
1312 | Closes a file handle. |
1313 | @return TRUE if success */ |
1314 | @@ -2096,7 +2095,6 @@ |
1315 | return(TRUE); |
1316 | #endif /* __WIN__ */ |
1317 | } |
1318 | -#endif /* UNIV_HOTBACKUP */ |
1319 | |
1320 | /***********************************************************************//** |
1321 | Gets a file size. |