Merge lp:~laurynas-biveinis/percona-server/bug1105709-5.5 into lp:percona-server/5.5

Proposed by Laurynas Biveinis on 2013-01-31
Status: Merged
Approved by: Stewart Smith on 2013-02-06
Approved revision: no longer in the source branch.
Merged at revision: 424
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1105709-5.5
Merge into: lp:percona-server/5.5
Prerequisite: lp:~laurynas-biveinis/percona-server/BT-16274-bug1083669-5.5
Diff against target: 190 lines (+150/-6)
3 files modified
Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_flush.result (+19/-0)
Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_flush.test (+93/-0)
Percona-Server/storage/innobase/log/log0online.c (+38/-6)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1105709-5.5
Reviewer Review Type Date Requested Status
Stewart Smith (community) Approve on 2013-02-06
George Ormond Lorch III g2 2013-01-31 Approve on 2013-02-05
Review via email: mp+145802@code.launchpad.net

Description of the change

To post a comment you must log in.
George Ormond Lorch III (gl-az) wrote :

Minor comment spelling on diff line 162 /shoul/should

review: Approve (g2)

Will fix, thanks.

Stewart Smith (stewart) :
review: Approve
413. By Laurynas Biveinis on 2013-02-06

Merge bug 1105709 and bug 1111144 fixes from 5.1.

Fixed.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_flush.result'
2--- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_flush.result 1970-01-01 00:00:00 +0000
3+++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_flush.result 2013-02-06 09:09:23 +0000
4@@ -0,0 +1,19 @@
5+DROP TABLE IF EXISTS t1;
6+RESET CHANGED_PAGE_BITMAPS;
7+CREATE TABLE t1 (a INT, b BLOB) ENGINE=InnoDB;
8+INSERT INTO t1 VALUES (1, REPEAT("a", 20000));
9+ib_modified_log_1
10+INSERT INTO t1 VALUES (2, REPEAT("b", 20000));
11+ib_modified_log_1
12+ib_modified_log_2
13+INSERT INTO t1 VALUES (3, REPEAT("c", 20000));
14+ib_modified_log_1
15+ib_modified_log_2
16+ib_modified_log_3
17+INSERT INTO t1 VALUES (4, REPEAT("d", 20000));
18+ib_modified_log_1
19+ib_modified_log_2
20+ib_modified_log_3
21+ib_modified_log_4
22+RESET CHANGED_PAGE_BITMAPS;
23+DROP TABLE t1;
24
25=== added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_flush.test'
26--- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_flush.test 1970-01-01 00:00:00 +0000
27+++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_flush.test 2013-02-06 09:09:23 +0000
28@@ -0,0 +1,93 @@
29+#
30+# Test the interaction between innodb_flush_method and bitmap file writes
31+#
32+--source include/not_windows.inc
33+--source include/have_innodb.inc
34+
35+let $MYSQLD_DATADIR= `select @@datadir`;
36+let $BITMAP_FILE= $MYSQLD_DATADIR/ib_modified_log_1_0.xdb;
37+
38+--disable_warnings
39+DROP TABLE IF EXISTS t1;
40+--enable_warnings
41+
42+RESET CHANGED_PAGE_BITMAPS;
43+
44+CREATE TABLE t1 (a INT, b BLOB) ENGINE=InnoDB;
45+
46+#
47+# Test innodb_flush_method=fdatasync (the default)
48+#
49+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
50+--shutdown_server 10
51+--source include/wait_until_disconnected.inc
52+--enable_reconnect
53+--exec echo "restart:--innodb-track-changed-pages=1" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
54+--source include/wait_until_connected_again.inc
55+
56+INSERT INTO t1 VALUES (1, REPEAT("a", 20000));
57+
58+#
59+# Test innodb_flush_method=O_DSYNC
60+# Check that the previous test produced bitmap data while the server is down.
61+#
62+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
63+--shutdown_server 10
64+--source include/wait_until_disconnected.inc
65+file_exists $BITMAP_FILE;
66+# Here and below remove the LSNs from the file names on listing them
67+--replace_regex /_[[:digit:]]+\.xdb$//
68+list_files $MYSQLD_DATADIR ib_modified_log*;
69+--enable_reconnect
70+--exec echo "restart:--innodb-track-changed-pages=1 --innodb-flush-method=O_DSYNC" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
71+--source include/wait_until_connected_again.inc
72+
73+INSERT INTO t1 VALUES (2, REPEAT("b", 20000));
74+
75+#
76+# Test innodb_flush_method=O_DIRECT
77+# Check that the previous test produced bitmap data while the server is down.
78+#
79+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
80+--shutdown_server 10
81+--source include/wait_until_disconnected.inc
82+file_exists $BITMAP_FILE;
83+--replace_regex /_[[:digit:]]+\.xdb$//
84+list_files $MYSQLD_DATADIR ib_modified_log*;
85+--enable_reconnect
86+--exec echo "restart:--innodb-track-changed-pages=1 --innodb-flush-method=O_DIRECT" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
87+--source include/wait_until_connected_again.inc
88+
89+INSERT INTO t1 VALUES (3, REPEAT("c", 20000));
90+
91+#
92+# Test innodb_flush_method=O_DIRECT
93+# Check that the previous test produced bitmap data while the server is down.
94+#
95+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
96+--shutdown_server 10
97+--source include/wait_until_disconnected.inc
98+file_exists $BITMAP_FILE;
99+--replace_regex /_[[:digit:]]+\.xdb$//
100+list_files $MYSQLD_DATADIR ib_modified_log*;
101+--enable_reconnect
102+--exec echo "restart:--innodb-track-changed-pages=1 --innodb-flush-method=O_DIRECT" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
103+--source include/wait_until_connected_again.inc
104+
105+INSERT INTO t1 VALUES (4, REPEAT("d", 20000));
106+
107+#
108+# Restart the server with default options
109+#
110+--exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
111+--shutdown_server 10
112+--source include/wait_until_disconnected.inc
113+file_exists $BITMAP_FILE;
114+--replace_regex /_[[:digit:]]+\.xdb$//
115+list_files $MYSQLD_DATADIR ib_modified_log*;
116+--enable_reconnect
117+--exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect
118+--source include/wait_until_connected_again.inc
119+
120+RESET CHANGED_PAGE_BITMAPS;
121+DROP TABLE t1;
122
123=== modified file 'Percona-Server/storage/innobase/log/log0online.c'
124--- Percona-Server/storage/innobase/log/log0online.c 2013-02-05 12:08:26 +0000
125+++ Percona-Server/storage/innobase/log/log0online.c 2013-02-06 09:09:23 +0000
126@@ -496,6 +496,23 @@
127 }
128
129 /*********************************************************************//**
130+Check if an old file that has the name of a new bitmap file we are about to
131+create should be overwritten. */
132+static
133+ibool
134+log_online_should_overwrite(
135+/*========================*/
136+ const char *path) /*!< in: path to file */
137+{
138+ ibool success;
139+ os_file_stat_t file_info;
140+
141+ /* Currently, it's OK to overwrite 0-sized files only */
142+ success = os_file_get_status(path, &file_info);
143+ return success && file_info.size == 0LL;
144+}
145+
146+/*********************************************************************//**
147 Create a new empty bitmap output file.
148
149 @return TRUE if operation succeeded, FALSE if I/O error */
150@@ -504,12 +521,22 @@
151 log_online_start_bitmap_file(void)
152 /*==============================*/
153 {
154- ibool success;
155-
156- log_bmp_sys->out.file
157- = os_file_create(innodb_file_bmp_key, log_bmp_sys->out.name,
158- OS_FILE_OVERWRITE, OS_FILE_NORMAL,
159- OS_DATA_FILE, &success);
160+ ibool success = TRUE;
161+
162+ /* Check for an old file that should be deleted first */
163+ if (log_online_should_overwrite(log_bmp_sys->out.name)) {
164+ success = os_file_delete(log_bmp_sys->out.name);
165+ }
166+
167+ if (UNIV_LIKELY(success)) {
168+ log_bmp_sys->out.file
169+ = os_file_create_simple_no_error_handling(
170+ innodb_file_bmp_key,
171+ log_bmp_sys->out.name,
172+ OS_FILE_CREATE,
173+ OS_FILE_READ_WRITE,
174+ &success);
175+ }
176 if (UNIV_UNLIKELY(!success)) {
177
178 /* The following call prints an error message */
179@@ -1078,6 +1105,11 @@
180 return FALSE;
181 }
182
183+#ifdef UNIV_LINUX
184+ posix_fadvise(log_bmp_sys->out.file, log_bmp_sys->out.offset,
185+ MODIFIED_PAGE_BLOCK_SIZE, POSIX_FADV_DONTNEED);
186+#endif
187+
188 log_bmp_sys->out.offset += MODIFIED_PAGE_BLOCK_SIZE;
189 return TRUE;
190 }

Subscribers

People subscribed via source and target branches