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
=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/r/percona_changed_page_bmp_requests.result'
--- Percona-Server/mysql-test/suite/innodb_plugin/r/percona_changed_page_bmp_requests.result 2013-01-22 16:28:47 +0000
+++ Percona-Server/mysql-test/suite/innodb_plugin/r/percona_changed_page_bmp_requests.result 2013-12-13 08:12:48 +0000
@@ -19,11 +19,13 @@
19ib_modified_log_219ib_modified_log_2
20PURGE CHANGED_PAGE_BITMAPS BEFORE 1;20PURGE CHANGED_PAGE_BITMAPS BEFORE 1;
21After PURGE ... BEFORE 1:21After PURGE ... BEFORE 1:
22ib_modified_log_1
22ib_modified_log_223ib_modified_log_2
23PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;24PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
24PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;25PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
25INSERT INTO t1 VALUES (1),(2),(3),(4),(5);26INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
26After PURGE ... BEFORE 100000000 and restart:27After PURGE ... BEFORE 100000000 and restart:
28ib_modified_log_3
27ib_modified_log_429ib_modified_log_4
28ib_modified_log_530ib_modified_log_5
29PURGE CHANGED_PAGE_BITMAPS BEFORE 5+5;31PURGE CHANGED_PAGE_BITMAPS BEFORE 5+5;
@@ -55,22 +57,42 @@
550570
56FLUSH CHANGED_PAGE_BITMAPS;58FLUSH CHANGED_PAGE_BITMAPS;
57Before the PURGE with tracking disabled59Before the PURGE with tracking disabled
60ib_modified_log_3
58ib_modified_log_461ib_modified_log_4
59ib_modified_log_562ib_modified_log_5
60PURGE CHANGED_PAGE_BITMAPS BEFORE 1;63PURGE CHANGED_PAGE_BITMAPS BEFORE 1;
61After the PURGE that deletes nothing:64After the PURGE that deletes nothing:
65ib_modified_log_3
62ib_modified_log_466ib_modified_log_4
63ib_modified_log_567ib_modified_log_5
64PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;68PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
65After the PURGE that deletes everything:69After the PURGE that deletes everything but the last file:
70ib_modified_log_5
66PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;71PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
67After the repeated PURGE:72After the repeated PURGE:
73ib_modified_log_5
68INSERT INTO t1 VALUES (1),(2),(3),(4),(5);74INSERT INTO t1 VALUES (1),(2),(3),(4),(5);
69Before the RESET while tracking disabled:75Before the RESET while tracking disabled:
70ib_modified_log_176ib_modified_log_1
71ib_modified_log_277ib_modified_log_2
78ib_modified_log_5
72RESET CHANGED_PAGE_BITMAPS;79RESET CHANGED_PAGE_BITMAPS;
73After the RESET with tracking disabled:80After the RESET with tracking disabled:
81Created dummy bitmap files
82ib_modified_log_1_0.xdb
83ib_modified_log_2_100.xdb
84ib_modified_log_3_200.xdb
85ib_modified_log_4_300.xdb
86PURGE CHANGED_PAGE_BITMAPS BEFORE 99;
87ib_modified_log_1_0.xdb
88ib_modified_log_2_100.xdb
89ib_modified_log_3_200.xdb
90ib_modified_log_4_300.xdb
91PURGE CHANGED_PAGE_BITMAPS BEFORE 200;
92ib_modified_log_3_200.xdb
93ib_modified_log_4_300.xdb
94PURGE CHANGED_PAGE_BITMAPS BEFORE 500;
95ib_modified_log_4_300.xdb
74DROP TABLE t1;96DROP TABLE t1;
75CREATE TABLE CHANGED_PAGE_BITMAPS (a INT);97CREATE TABLE CHANGED_PAGE_BITMAPS (a INT);
76DROP TABLE CHANGED_PAGE_BITMAPS;98DROP TABLE CHANGED_PAGE_BITMAPS;
7799
=== modified file 'Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_requests.test'
--- Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_requests.test 2013-01-22 16:28:47 +0000
+++ Percona-Server/mysql-test/suite/innodb_plugin/t/percona_changed_page_bmp_requests.test 2013-12-13 08:12:48 +0000
@@ -4,7 +4,7 @@
4--source include/have_innodb_plugin.inc4--source include/have_innodb_plugin.inc
55
6# Delete any existing bitmaps6# Delete any existing bitmaps
7--source include/restart_mysqld.inc7
8RESET CHANGED_PAGE_BITMAPS;8RESET CHANGED_PAGE_BITMAPS;
99
10--source include/count_sessions.inc10--source include/count_sessions.inc
@@ -57,8 +57,7 @@
57list_files $MYSQLD_DATADIR ib_modified_log*;57list_files $MYSQLD_DATADIR ib_modified_log*;
5858
59#59#
60# Test that PURGE CHANGED_PAGE_BITMAPS BEFORE works. We don't test partial PURGE60# Test that PURGE CHANGED_PAGE_BITMAPS BEFORE works.
61# because it's hard to extract good LSN value for that.
62#61#
6362
64# PURGE that deletes nothing63# PURGE that deletes nothing
@@ -67,7 +66,7 @@
67--replace_regex /_[[:digit:]]+\.xdb$//66--replace_regex /_[[:digit:]]+\.xdb$//
68list_files $MYSQLD_DATADIR ib_modified_log*;67list_files $MYSQLD_DATADIR ib_modified_log*;
6968
70# PURGE that deletes everything69# PURGE that deletes everything but the last file
71PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;70PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
72# Test consecutive PURGE71# Test consecutive PURGE
73PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;72PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
@@ -155,7 +154,7 @@
155154
156PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;155PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000;
157156
158--echo After the PURGE that deletes everything:157--echo After the PURGE that deletes everything but the last file:
159--replace_regex /_[[:digit:]]+\.xdb$//158--replace_regex /_[[:digit:]]+\.xdb$//
160list_files $MYSQLD_DATADIR ib_modified_log*;159list_files $MYSQLD_DATADIR ib_modified_log*;
161160
@@ -166,7 +165,7 @@
166list_files $MYSQLD_DATADIR ib_modified_log*;165list_files $MYSQLD_DATADIR ib_modified_log*;
167166
168#167#
169# Test RESET request with log tracking disabled168# Test requests with log tracking disabled
170#169#
171170
172# Generate some bitmap data again171# Generate some bitmap data again
@@ -191,6 +190,35 @@
191--replace_regex /_[[:digit:]]+\.xdb$//190--replace_regex /_[[:digit:]]+\.xdb$//
192list_files $MYSQLD_DATADIR ib_modified_log*;191list_files $MYSQLD_DATADIR ib_modified_log*;
193192
193#
194# Bug 1260035: test PURGE with a range end in a middle of a file.
195#
196
197# Create some dummy bitmaps
198write_file $MYSQLD_DATADIR/ib_modified_log_1_0.xdb;
199EOF
200write_file $MYSQLD_DATADIR/ib_modified_log_2_100.xdb;
201EOF
202write_file $MYSQLD_DATADIR/ib_modified_log_3_200.xdb;
203EOF
204write_file $MYSQLD_DATADIR/ib_modified_log_4_300.xdb;
205EOF
206
207--echo Created dummy bitmap files
208list_files $MYSQLD_DATADIR ib_modified_log*;
209
210PURGE CHANGED_PAGE_BITMAPS BEFORE 99;
211list_files $MYSQLD_DATADIR ib_modified_log*;
212
213PURGE CHANGED_PAGE_BITMAPS BEFORE 200;
214list_files $MYSQLD_DATADIR ib_modified_log*;
215
216PURGE CHANGED_PAGE_BITMAPS BEFORE 500;
217list_files $MYSQLD_DATADIR ib_modified_log*;
218
219# Cleanup
220remove_file $MYSQLD_DATADIR/ib_modified_log_4_300.xdb;
221
194DROP TABLE t1;222DROP TABLE t1;
195223
196#224#
197225
=== modified file 'Percona-Server/storage/innodb_plugin/log/log0online.c'
--- Percona-Server/storage/innodb_plugin/log/log0online.c 2013-09-25 05:40:18 +0000
+++ Percona-Server/storage/innodb_plugin/log/log0online.c 2013-12-13 08:12:48 +0000
@@ -1782,7 +1782,8 @@
1782 mutex_enter(&log_bmp_sys->mutex);1782 mutex_enter(&log_bmp_sys->mutex);
1783 }1783 }
17841784
1785 if (!log_online_setup_bitmap_file_range(&bitmap_files, 0, lsn)) {1785 if (!log_online_setup_bitmap_file_range(&bitmap_files, 0,
1786 IB_ULONGLONG_MAX)) {
1786 if (srv_track_changed_pages) {1787 if (srv_track_changed_pages) {
1787 mutex_exit(&log_bmp_sys->mutex);1788 mutex_exit(&log_bmp_sys->mutex);
1788 }1789 }
@@ -1797,8 +1798,20 @@
1797 }1798 }
17981799
1799 for (i = 0; i < bitmap_files.count; i++) {1800 for (i = 0; i < bitmap_files.count; i++) {
1800 if (bitmap_files.files[i].seq_num == 01801
1801 || bitmap_files.files[i].start_lsn >= lsn) {1802 /* We consider the end LSN of the current bitmap, derived from
1803 the start LSN of the subsequent bitmap file, to determine
1804 whether to remove the current bitmap. Note that bitmap_files
1805 does not contain an entry for the bitmap past the given LSN so
1806 we must check the boundary conditions as well. For example,
1807 consider 1_0.xdb and 2_10.xdb and querying LSN 5. bitmap_files
1808 will only contain 1_0.xdb and we must not delete it since it
1809 represents LSNs 0-9. */
1810 if ((i + 1 == bitmap_files.count
1811 || bitmap_files.files[i + 1].seq_num == 0
1812 || bitmap_files.files[i + 1].start_lsn > lsn)
1813 && (lsn != IB_ULONGLONG_MAX)) {
1814
1802 break;1815 break;
1803 }1816 }
1804 if (!os_file_delete_if_exists(bitmap_files.files[i].name)) {1817 if (!os_file_delete_if_exists(bitmap_files.files[i].name)) {

Subscribers

People subscribed via source and target branches