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