Merge lp:~laurynas-biveinis/percona-server/bug1260035-5.1 into lp:percona-server/5.1

Proposed by Laurynas Biveinis
Status: Superseded
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1260035-5.1
Merge into: lp:percona-server/5.1
Diff against target: 184 lines (+73/-10)
3 files modified
Percona-Server/mysql-test/suite/innodb_plugin/r/percona_changed_page_bmp_requests.result (+23/-1)
Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_requests.test (+34/-6)
Percona-Server/storage/innodb_plugin/log/log0online.c (+16/-3)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1260035-5.1
Reviewer Review Type Date Requested Status
Laurynas Biveinis (community) Needs Fixing
George Ormond Lorch III g2 Approve
Review via email: mp+198816@code.launchpad.net

This proposal has been superseded by a proposal from 2013-12-15.

Description of the change

Fix bug 1260035 (PURGE CHANGED_PAGE_BITMAPS BEFORE purges too many
bitmap files).

PURGE CHANGED_PAGE_BITMAPS BEFORE <lsn> would remove bitmap files up
to the file containing the data for <lsn>. If it is in the middle of
a bitmap file, the file is removed, destroying the bitmap data from
<lsn> up to the file end.

Fix by applying a modified patch by Andrew Gaul: in
log_online_purge_changed_page_bitmaps() check the next file in the
sequence after the current one to see if the end LSN falls into a
middle of the current file. Make an exception for end LSN ==
IB_ULONGLONG_MAX, as there can be no next file then.

Add a test to percona_changed_page_bmp_requests.

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :
Revision history for this message
George Ormond Lorch III (gl-az) :
review: Approve (g2)
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

Comments #2 and # on bug 1260035.

review: Needs Fixing
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

...and #3...

586. By Laurynas Biveinis

Fix bug 1260035 (PURGE CHANGED_PAGE_BITMAPS BEFORE purges too many
bitmap files).

PURGE CHANGED_PAGE_BITMAPS BEFORE <lsn> would remove bitmap files up
to the file containing the data for <lsn>. If it is in the middle of
a bitmap file, the file is removed, destroying the bitmap data from
<lsn> up to the file end.

Fix by applying a modified patch by Andrew Gaul: in
log_online_purge_changed_page_bitmaps() check the next file in the
sequence after the current one to see if the end LSN falls into a
middle of the current file. Make an exception for end LSN ==
IB_ULONGLONG_MAX, as there can be no next file then. Setup the file
range up to the maximum LSN value instead of purge LSN value so that
we seen the next file after the purge LSN to make a decision whether
the one file before it should be deleted.

Add a test to percona_changed_page_bmp_requests.

Unmerged revisions

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_requests.result'
2--- Percona-Server/mysql-test/suite/innodb_plugin/r/percona_changed_page_bmp_requests.result 2013-01-22 16:28:47 +0000
3+++ Percona-Server/mysql-test/suite/innodb_plugin/r/percona_changed_page_bmp_requests.result 2013-12-13 08:12:48 +0000
4@@ -19,11 +19,13 @@
5 ib_modified_log_2
6 PURGE CHANGED_PAGE_BITMAPS BEFORE 1;
7 After PURGE ... BEFORE 1:
8+ib_modified_log_1
9 ib_modified_log_2
10 PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
11 PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
12 INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
13 After PURGE ... BEFORE 100000000 and restart:
14+ib_modified_log_3
15 ib_modified_log_4
16 ib_modified_log_5
17 PURGE CHANGED_PAGE_BITMAPS BEFORE 5+5;
18@@ -55,22 +57,42 @@
19 0
20 FLUSH CHANGED_PAGE_BITMAPS;
21 Before the PURGE with tracking disabled
22+ib_modified_log_3
23 ib_modified_log_4
24 ib_modified_log_5
25 PURGE CHANGED_PAGE_BITMAPS BEFORE 1;
26 After the PURGE that deletes nothing:
27+ib_modified_log_3
28 ib_modified_log_4
29 ib_modified_log_5
30 PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
31-After the PURGE that deletes everything:
32+After the PURGE that deletes everything but the last file:
33+ib_modified_log_5
34 PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
35 After the repeated PURGE:
36+ib_modified_log_5
37 INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
38 Before the RESET while tracking disabled:
39 ib_modified_log_1
40 ib_modified_log_2
41+ib_modified_log_5
42 RESET CHANGED_PAGE_BITMAPS;
43 After the RESET with tracking disabled:
44+Created dummy bitmap files
45+ib_modified_log_1_0.xdb
46+ib_modified_log_2_100.xdb
47+ib_modified_log_3_200.xdb
48+ib_modified_log_4_300.xdb
49+PURGE CHANGED_PAGE_BITMAPS BEFORE 99;
50+ib_modified_log_1_0.xdb
51+ib_modified_log_2_100.xdb
52+ib_modified_log_3_200.xdb
53+ib_modified_log_4_300.xdb
54+PURGE CHANGED_PAGE_BITMAPS BEFORE 200;
55+ib_modified_log_3_200.xdb
56+ib_modified_log_4_300.xdb
57+PURGE CHANGED_PAGE_BITMAPS BEFORE 500;
58+ib_modified_log_4_300.xdb
59 DROP TABLE t1;
60 CREATE TABLE CHANGED_PAGE_BITMAPS (a INT);
61 DROP TABLE CHANGED_PAGE_BITMAPS;
62
63=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_requests.test'
64--- Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_requests.test 2013-01-22 16:28:47 +0000
65+++ Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_requests.test 2013-12-13 08:12:48 +0000
66@@ -4,7 +4,7 @@
67 --source include/have_innodb_plugin.inc
68
69 # Delete any existing bitmaps
70---source include/restart_mysqld.inc
71+
72 RESET CHANGED_PAGE_BITMAPS;
73
74 --source include/count_sessions.inc
75@@ -57,8 +57,7 @@
76 list_files $MYSQLD_DATADIR ib_modified_log*;
77
78 #
79-# Test that PURGE CHANGED_PAGE_BITMAPS BEFORE works. We don't test partial PURGE
80-# because it's hard to extract good LSN value for that.
81+# Test that PURGE CHANGED_PAGE_BITMAPS BEFORE works.
82 #
83
84 # PURGE that deletes nothing
85@@ -67,7 +66,7 @@
86 --replace_regex /_[[:digit:]]+\.xdb$//
87 list_files $MYSQLD_DATADIR ib_modified_log*;
88
89-# PURGE that deletes everything
90+# PURGE that deletes everything but the last file
91 PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
92 # Test consecutive PURGE
93 PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
94@@ -155,7 +154,7 @@
95
96 PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
97
98---echo After the PURGE that deletes everything:
99+--echo After the PURGE that deletes everything but the last file:
100 --replace_regex /_[[:digit:]]+\.xdb$//
101 list_files $MYSQLD_DATADIR ib_modified_log*;
102
103@@ -166,7 +165,7 @@
104 list_files $MYSQLD_DATADIR ib_modified_log*;
105
106 #
107-# Test RESET request with log tracking disabled
108+# Test requests with log tracking disabled
109 #
110
111 # Generate some bitmap data again
112@@ -191,6 +190,35 @@
113 --replace_regex /_[[:digit:]]+\.xdb$//
114 list_files $MYSQLD_DATADIR ib_modified_log*;
115
116+#
117+# Bug 1260035: test PURGE with a range end in a middle of a file.
118+#
119+
120+# Create some dummy bitmaps
121+write_file $MYSQLD_DATADIR/ib_modified_log_1_0.xdb;
122+EOF
123+write_file $MYSQLD_DATADIR/ib_modified_log_2_100.xdb;
124+EOF
125+write_file $MYSQLD_DATADIR/ib_modified_log_3_200.xdb;
126+EOF
127+write_file $MYSQLD_DATADIR/ib_modified_log_4_300.xdb;
128+EOF
129+
130+--echo Created dummy bitmap files
131+list_files $MYSQLD_DATADIR ib_modified_log*;
132+
133+PURGE CHANGED_PAGE_BITMAPS BEFORE 99;
134+list_files $MYSQLD_DATADIR ib_modified_log*;
135+
136+PURGE CHANGED_PAGE_BITMAPS BEFORE 200;
137+list_files $MYSQLD_DATADIR ib_modified_log*;
138+
139+PURGE CHANGED_PAGE_BITMAPS BEFORE 500;
140+list_files $MYSQLD_DATADIR ib_modified_log*;
141+
142+# Cleanup
143+remove_file $MYSQLD_DATADIR/ib_modified_log_4_300.xdb;
144+
145 DROP TABLE t1;
146
147 #
148
149=== modified file 'Percona-Server/storage/innodb_plugin/log/log0online.c'
150--- Percona-Server/storage/innodb_plugin/log/log0online.c 2013-09-25 05:40:18 +0000
151+++ Percona-Server/storage/innodb_plugin/log/log0online.c 2013-12-13 08:12:48 +0000
152@@ -1782,7 +1782,8 @@
153 mutex_enter(&log_bmp_sys->mutex);
154 }
155
156- if (!log_online_setup_bitmap_file_range(&bitmap_files, 0, lsn)) {
157+ if (!log_online_setup_bitmap_file_range(&bitmap_files, 0,
158+ IB_ULONGLONG_MAX)) {
159 if (srv_track_changed_pages) {
160 mutex_exit(&log_bmp_sys->mutex);
161 }
162@@ -1797,8 +1798,20 @@
163 }
164
165 for (i = 0; i < bitmap_files.count; i++) {
166- if (bitmap_files.files[i].seq_num == 0
167- || bitmap_files.files[i].start_lsn >= lsn) {
168+
169+ /* We consider the end LSN of the current bitmap, derived from
170+ the start LSN of the subsequent bitmap file, to determine
171+ whether to remove the current bitmap. Note that bitmap_files
172+ does not contain an entry for the bitmap past the given LSN so
173+ we must check the boundary conditions as well. For example,
174+ consider 1_0.xdb and 2_10.xdb and querying LSN 5. bitmap_files
175+ will only contain 1_0.xdb and we must not delete it since it
176+ represents LSNs 0-9. */
177+ if ((i + 1 == bitmap_files.count
178+ || bitmap_files.files[i + 1].seq_num == 0
179+ || bitmap_files.files[i + 1].start_lsn > lsn)
180+ && (lsn != IB_ULONGLONG_MAX)) {
181+
182 break;
183 }
184 if (!os_file_delete_if_exists(bitmap_files.files[i].name)) {

Subscribers

People subscribed via source and target branches