Merge lp:~laurynas-biveinis/percona-server/BT-16724-xtradb-bmp-requests-5.5 into lp:percona-server/5.5
- BT-16724-xtradb-bmp-requests-5.5
- Merge into 5.5
Proposed by
Laurynas Biveinis
Status: | Superseded |
---|---|
Proposed branch: | lp:~laurynas-biveinis/percona-server/BT-16724-xtradb-bmp-requests-5.5 |
Merge into: | lp:percona-server/5.5 |
Diff against target: |
1132 lines (+632/-44) 24 files modified
Percona-Server/include/mysql_com.h (+4/-0) Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc (+0/-11) Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result (+1/-0) Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result (+1/-0) Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result (+76/-0) Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result (+3/-0) Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result (+1/-0) Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test (+3/-1) Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test (+3/-1) Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt (+1/-0) Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test (+200/-0) Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt (+1/-0) Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test (+7/-0) Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test (+3/-1) Percona-Server/sql/handler.cc (+36/-0) Percona-Server/sql/handler.h (+5/-0) Percona-Server/sql/lex.h (+1/-0) Percona-Server/sql/sql_parse.cc (+37/-4) Percona-Server/sql/sql_reload.cc (+16/-0) Percona-Server/sql/sql_yacc.yy (+13/-0) Percona-Server/storage/innobase/handler/ha_innodb.cc (+55/-0) Percona-Server/storage/innobase/include/log0online.h (+32/-6) Percona-Server/storage/innobase/include/sync0sync.h (+2/-0) Percona-Server/storage/innobase/log/log0online.c (+131/-20) |
To merge this branch: | bzr merge lp:~laurynas-biveinis/percona-server/BT-16724-xtradb-bmp-requests-5.5 |
Related bugs: | |
Related blueprints: |
User requests for XtraDB changed page tracking
(Undefined)
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Alexey Kopytov (community) | Needs Fixing | ||
Stewart Smith (community) | Needs Fixing | ||
Vlad Lesin (community) | Approve | ||
Review via email: mp+136847@code.launchpad.net |
This proposal supersedes a proposal from 2012-11-25.
This proposal has been superseded by a proposal from 2013-01-22.
Commit message
Description of the change
Merge of implementation of https:/
http://
To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : Posted in a previous version of this proposal | # |
Revision history for this message
Vlad Lesin (vlad-lesin) wrote : Posted in a previous version of this proposal | # |
See comments in 5.1 branch.
review:
Needs Fixing
Revision history for this message
Vlad Lesin (vlad-lesin) : | # |
review:
Approve
Revision history for this message
Stewart Smith (stewart) wrote : | # |
This reserves BITMAPS so that "create table bitmaps (a int)" no longer works. This probably isn't the intent (it would be better ,and keep better compatibility if we didn't do this)
review:
Needs Fixing
Revision history for this message
Alexey Kopytov (akopytov) wrote : | # |
Same comments/questions as in the 5.1 MP.
review:
Needs Fixing
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'Percona-Server/include/mysql_com.h' | |||
2 | --- Percona-Server/include/mysql_com.h 2012-05-10 07:49:14 +0000 | |||
3 | +++ Percona-Server/include/mysql_com.h 2013-01-22 16:40:34 +0000 | |||
4 | @@ -152,6 +152,10 @@ | |||
5 | 152 | #define REFRESH_USER_STATS 0x800000L /* Refresh user stats my_hash table */ | 152 | #define REFRESH_USER_STATS 0x800000L /* Refresh user stats my_hash table */ |
6 | 153 | #define REFRESH_CLIENT_STATS 0x1000000L /* Refresh client stats my_hash table */ | 153 | #define REFRESH_CLIENT_STATS 0x1000000L /* Refresh client stats my_hash table */ |
7 | 154 | #define REFRESH_THREAD_STATS 0x2000000L /* Refresh thread stats my_hash table */ | 154 | #define REFRESH_THREAD_STATS 0x2000000L /* Refresh thread stats my_hash table */ |
8 | 155 | #define REFRESH_FLUSH_PAGE_BITMAPS 0x400000L | ||
9 | 156 | #define REFRESH_RESET_PAGE_BITMAPS 0x800000L | ||
10 | 157 | |||
11 | 158 | #define PURGE_BITMAPS_TO_LSN 1 | ||
12 | 155 | 159 | ||
13 | 156 | #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ | 160 | #define CLIENT_LONG_PASSWORD 1 /* new more secure passwords */ |
14 | 157 | #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ | 161 | #define CLIENT_FOUND_ROWS 2 /* Found instead of affected rows */ |
15 | 158 | 162 | ||
16 | === removed file 'Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc' | |||
17 | --- Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc 2012-11-25 09:30:58 +0000 | |||
18 | +++ Percona-Server/mysql-test/include/delete_innodb_bitmaps.inc 1970-01-01 00:00:00 +0000 | |||
19 | @@ -1,11 +0,0 @@ | |||
20 | 1 | # Remove all the InnoDB bitmap files. A temporary measure until RESET user request is implemented | ||
21 | 2 | |||
22 | 3 | let $MYSQLD_DATADIR= `select @@datadir`; | ||
23 | 4 | |||
24 | 5 | --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
25 | 6 | --shutdown_server 10 | ||
26 | 7 | --source include/wait_until_disconnected.inc | ||
27 | 8 | remove_files_wildcard $MYSQLD_DATADIR ib_modified_log*; | ||
28 | 9 | --enable_reconnect | ||
29 | 10 | --exec echo "restart" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
30 | 11 | --source include/wait_until_connected_again.inc | ||
31 | 12 | 0 | ||
32 | === modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result' | |||
33 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 2012-11-25 09:30:58 +0000 | |||
34 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp.result 2013-01-22 16:40:34 +0000 | |||
35 | @@ -1,3 +1,4 @@ | |||
36 | 1 | RESET CHANGED_PAGE_BITMAPS; | ||
37 | 1 | DROP TABLE IF EXISTS t1, t2; | 2 | DROP TABLE IF EXISTS t1, t2; |
38 | 2 | CREATE TABLE t1 (x INT) ENGINE=InnoDB; | 3 | CREATE TABLE t1 (x INT) ENGINE=InnoDB; |
39 | 3 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); | 4 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); |
40 | 4 | 5 | ||
41 | === modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result' | |||
42 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result 2012-11-25 09:30:58 +0000 | |||
43 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_no_restart.result 2013-01-22 16:40:34 +0000 | |||
44 | @@ -1,3 +1,4 @@ | |||
45 | 1 | RESET CHANGED_PAGE_BITMAPS; | ||
46 | 1 | DROP TABLE IF EXISTS t1, t2; | 2 | DROP TABLE IF EXISTS t1, t2; |
47 | 2 | CREATE TABLE t1 (x INT) ENGINE=InnoDB; | 3 | CREATE TABLE t1 (x INT) ENGINE=InnoDB; |
48 | 3 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); | 4 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); |
49 | 4 | 5 | ||
50 | === added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result' | |||
51 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result 1970-01-01 00:00:00 +0000 | |||
52 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests.result 2013-01-22 16:40:34 +0000 | |||
53 | @@ -0,0 +1,76 @@ | |||
54 | 1 | RESET CHANGED_PAGE_BITMAPS; | ||
55 | 2 | DROP TABLE IF EXISTS t1; | ||
56 | 3 | DELETE FROM mysql.user WHERE USER='mysqltest_1'; | ||
57 | 4 | FLUSH PRIVILEGES; | ||
58 | 5 | CREATE TABLE t1 (x INT) ENGINE=InnoDB; | ||
59 | 6 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); | ||
60 | 7 | FLUSH CHANGED_PAGE_BITMAPS; | ||
61 | 8 | Before RESET: | ||
62 | 9 | ib_modified_log_1 | ||
63 | 10 | ib_modified_log_2 | ||
64 | 11 | RESET CHANGED_PAGE_BITMAPS; | ||
65 | 12 | After RESET: | ||
66 | 13 | ib_modified_log_1 | ||
67 | 14 | RESET CHANGED_PAGE_BITMAPS; | ||
68 | 15 | After 2nd RESET | ||
69 | 16 | ib_modified_log_1 | ||
70 | 17 | After RESETs and restart: | ||
71 | 18 | ib_modified_log_1 | ||
72 | 19 | ib_modified_log_2 | ||
73 | 20 | PURGE CHANGED_PAGE_BITMAPS BEFORE 1; | ||
74 | 21 | After PURGE ... BEFORE 1: | ||
75 | 22 | ib_modified_log_2 | ||
76 | 23 | PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000; | ||
77 | 24 | PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000; | ||
78 | 25 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); | ||
79 | 26 | After PURGE ... BEFORE 100000000 and restart: | ||
80 | 27 | ib_modified_log_4 | ||
81 | 28 | ib_modified_log_5 | ||
82 | 29 | PURGE CHANGED_PAGE_BITMAPS BEFORE 5+5; | ||
83 | 30 | ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '+5' at line 1 | ||
84 | 31 | PURGE CHANGED_PAGE_BITMAPS BEFORE -12; | ||
85 | 32 | ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-12' at line 1 | ||
86 | 33 | PURGE CHANGED_PAGE_BITMAPS BEFORE 1.2e-2; | ||
87 | 34 | ERROR 42000: Only integers allowed as number here near '1.2e-2' at line 1 | ||
88 | 35 | PURGE CHANGED_PAGE_BITMAPS BEFORE t1; | ||
89 | 36 | ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 't1' at line 1 | ||
90 | 37 | PURGE CHANGED_PAGE_BITMAPS BEFORE "t1"; | ||
91 | 38 | ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"t1"' at line 1 | ||
92 | 39 | PURGE CHANGED_PAGE_BITMAPS BEFORE TRUE; | ||
93 | 40 | ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'TRUE' at line 1 | ||
94 | 41 | PURGE CHANGED_PAGE_BITMAPS BEFORE NULL; | ||
95 | 42 | ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'NULL' at line 1 | ||
96 | 43 | CREATE USER mysqltest_1@localhost; | ||
97 | 44 | GRANT ALL ON *.* TO mysqltest_1@localhost; | ||
98 | 45 | REVOKE SUPER ON *.* FROM mysqltest_1@localhost; | ||
99 | 46 | FLUSH CHANGED_PAGE_BITMAPS; | ||
100 | 47 | ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation | ||
101 | 48 | RESET CHANGED_PAGE_BITMAPS; | ||
102 | 49 | ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation | ||
103 | 50 | PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000; | ||
104 | 51 | ERROR 42000: Access denied; you need (at least one of) the SUPER privilege(s) for this operation | ||
105 | 52 | DROP USER mysqltest_1@localhost; | ||
106 | 53 | SELECT @@GLOBAL.innodb_track_changed_pages; | ||
107 | 54 | @@GLOBAL.innodb_track_changed_pages | ||
108 | 55 | 0 | ||
109 | 56 | FLUSH CHANGED_PAGE_BITMAPS; | ||
110 | 57 | Before the PURGE with tracking disabled | ||
111 | 58 | ib_modified_log_4 | ||
112 | 59 | ib_modified_log_5 | ||
113 | 60 | PURGE CHANGED_PAGE_BITMAPS BEFORE 1; | ||
114 | 61 | After the PURGE that deletes nothing: | ||
115 | 62 | ib_modified_log_4 | ||
116 | 63 | ib_modified_log_5 | ||
117 | 64 | PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000; | ||
118 | 65 | After the PURGE that deletes everything: | ||
119 | 66 | PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000; | ||
120 | 67 | After the repeated PURGE: | ||
121 | 68 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); | ||
122 | 69 | Before the RESET while tracking disabled: | ||
123 | 70 | ib_modified_log_1 | ||
124 | 71 | ib_modified_log_2 | ||
125 | 72 | RESET CHANGED_PAGE_BITMAPS; | ||
126 | 73 | After the RESET with tracking disabled: | ||
127 | 74 | DROP TABLE t1; | ||
128 | 75 | CREATE TABLE CHANGED_PAGE_BITMAPS (a INT); | ||
129 | 76 | DROP TABLE CHANGED_PAGE_BITMAPS; | ||
130 | 0 | 77 | ||
131 | === added file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result' | |||
132 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result 1970-01-01 00:00:00 +0000 | |||
133 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_page_bmp_requests_no_innodb.result 2013-01-22 16:40:34 +0000 | |||
134 | @@ -0,0 +1,3 @@ | |||
135 | 1 | FLUSH CHANGED_PAGE_BITMAPS; | ||
136 | 2 | RESET CHANGED_PAGE_BITMAPS; | ||
137 | 3 | PURGE CHANGED_PAGE_BITMAPS BEFORE 1; | ||
138 | 0 | 4 | ||
139 | === modified file 'Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result' | |||
140 | --- Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result 2012-11-25 09:30:58 +0000 | |||
141 | +++ Percona-Server/mysql-test/suite/innodb/r/percona_changed_pages.result 2013-01-22 16:40:34 +0000 | |||
142 | @@ -1,3 +1,4 @@ | |||
143 | 1 | RESET CHANGED_PAGE_BITMAPS; | ||
144 | 1 | DROP TABLE IF EXISTS T1; | 2 | DROP TABLE IF EXISTS T1; |
145 | 2 | CREATE TABLE T1 (F1 CHAR(255)) ENGINE=INNODB; | 3 | CREATE TABLE T1 (F1 CHAR(255)) ENGINE=INNODB; |
146 | 3 | 1st interval end LSN greater than interval start LSN: | 4 | 1st interval end LSN greater than interval start LSN: |
147 | 4 | 5 | ||
148 | === modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test' | |||
149 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 2012-11-25 09:30:58 +0000 | |||
150 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp.test 2013-01-22 16:40:34 +0000 | |||
151 | @@ -13,7 +13,9 @@ | |||
152 | 13 | # Valgrind reports useless errors on very fast server shutdowns | 13 | # Valgrind reports useless errors on very fast server shutdowns |
153 | 14 | --source include/not_valgrind.inc | 14 | --source include/not_valgrind.inc |
154 | 15 | 15 | ||
156 | 16 | --source include/delete_innodb_bitmaps.inc | 16 | # Delete any existing bitmaps |
157 | 17 | --source include/restart_mysqld.inc | ||
158 | 18 | RESET CHANGED_PAGE_BITMAPS; | ||
159 | 17 | 19 | ||
160 | 18 | --disable_warnings | 20 | --disable_warnings |
161 | 19 | DROP TABLE IF EXISTS t1, t2; | 21 | DROP TABLE IF EXISTS t1, t2; |
162 | 20 | 22 | ||
163 | === modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test' | |||
164 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test 2012-11-25 09:30:58 +0000 | |||
165 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_no_restart.test 2013-01-22 16:40:34 +0000 | |||
166 | @@ -2,7 +2,9 @@ | |||
167 | 2 | # percona_changed_page_bmp test, which contains the full functional tests. | 2 | # percona_changed_page_bmp test, which contains the full functional tests. |
168 | 3 | --source include/have_innodb.inc | 3 | --source include/have_innodb.inc |
169 | 4 | 4 | ||
171 | 5 | --source include/delete_innodb_bitmaps.inc | 5 | # Delete any existing bitmaps |
172 | 6 | --source include/restart_mysqld.inc | ||
173 | 7 | RESET CHANGED_PAGE_BITMAPS; | ||
174 | 6 | 8 | ||
175 | 7 | --disable_warnings | 9 | --disable_warnings |
176 | 8 | DROP TABLE IF EXISTS t1, t2; | 10 | DROP TABLE IF EXISTS t1, t2; |
177 | 9 | 11 | ||
178 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt' | |||
179 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt 1970-01-01 00:00:00 +0000 | |||
180 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests-master.opt 2013-01-22 16:40:34 +0000 | |||
181 | @@ -0,0 +1,1 @@ | |||
182 | 1 | --innodb_track_changed_pages=TRUE | ||
183 | 0 | 2 | ||
184 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test' | |||
185 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test 1970-01-01 00:00:00 +0000 | |||
186 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests.test 2013-01-22 16:40:34 +0000 | |||
187 | @@ -0,0 +1,200 @@ | |||
188 | 1 | # | ||
189 | 2 | # Tests for changed page tracking bitmaps: user requests. | ||
190 | 3 | # | ||
191 | 4 | --source include/have_innodb.inc | ||
192 | 5 | |||
193 | 6 | # Delete any existing bitmaps | ||
194 | 7 | --source include/restart_mysqld.inc | ||
195 | 8 | RESET CHANGED_PAGE_BITMAPS; | ||
196 | 9 | |||
197 | 10 | --source include/count_sessions.inc | ||
198 | 11 | |||
199 | 12 | let $MYSQLD_DATADIR= `select @@datadir`; | ||
200 | 13 | |||
201 | 14 | --disable_warnings | ||
202 | 15 | DROP TABLE IF EXISTS t1; | ||
203 | 16 | DELETE FROM mysql.user WHERE USER='mysqltest_1'; | ||
204 | 17 | FLUSH PRIVILEGES; | ||
205 | 18 | --enable_warnings | ||
206 | 19 | |||
207 | 20 | CREATE TABLE t1 (x INT) ENGINE=InnoDB; | ||
208 | 21 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); | ||
209 | 22 | |||
210 | 23 | # | ||
211 | 24 | # Test FLUSH CHANGED_PAGE_BITMAPS. Not much to test due to checkpointing non-determinism, | ||
212 | 25 | # just see that it does not crash or return an error | ||
213 | 26 | # | ||
214 | 27 | FLUSH CHANGED_PAGE_BITMAPS; | ||
215 | 28 | |||
216 | 29 | # | ||
217 | 30 | # Test that RESET CHANGED_PAGE_BITMAPS works | ||
218 | 31 | # | ||
219 | 32 | |||
220 | 33 | # Have at least two bitmap files | ||
221 | 34 | --source include/restart_mysqld.inc | ||
222 | 35 | |||
223 | 36 | --echo Before RESET: | ||
224 | 37 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
225 | 38 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
226 | 39 | |||
227 | 40 | RESET CHANGED_PAGE_BITMAPS; | ||
228 | 41 | |||
229 | 42 | --echo After RESET: | ||
230 | 43 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
231 | 44 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
232 | 45 | |||
233 | 46 | # Test consecutive RESET | ||
234 | 47 | RESET CHANGED_PAGE_BITMAPS; | ||
235 | 48 | --echo After 2nd RESET | ||
236 | 49 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
237 | 50 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
238 | 51 | |||
239 | 52 | # Check that the file sequence after RESET starts with 1 again | ||
240 | 53 | --source include/restart_mysqld.inc | ||
241 | 54 | |||
242 | 55 | --echo After RESETs and restart: | ||
243 | 56 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
244 | 57 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
245 | 58 | |||
246 | 59 | # | ||
247 | 60 | # Test that PURGE CHANGED_PAGE_BITMAPS BEFORE works. We don't test partial PURGE | ||
248 | 61 | # because it's hard to extract good LSN value for that. | ||
249 | 62 | # | ||
250 | 63 | |||
251 | 64 | # PURGE that deletes nothing | ||
252 | 65 | PURGE CHANGED_PAGE_BITMAPS BEFORE 1; | ||
253 | 66 | --echo After PURGE ... BEFORE 1: | ||
254 | 67 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
255 | 68 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
256 | 69 | |||
257 | 70 | # PURGE that deletes everything | ||
258 | 71 | PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000; | ||
259 | 72 | # Test consecutive PURGE | ||
260 | 73 | PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000; | ||
261 | 74 | |||
262 | 75 | # Check that file sequence continues | ||
263 | 76 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); | ||
264 | 77 | --source include/restart_mysqld.inc | ||
265 | 78 | --echo After PURGE ... BEFORE 100000000 and restart: | ||
266 | 79 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
267 | 80 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
268 | 81 | |||
269 | 82 | # | ||
270 | 83 | # Test malformed PURGE ... BEFORE | ||
271 | 84 | # | ||
272 | 85 | --error ER_PARSE_ERROR | ||
273 | 86 | PURGE CHANGED_PAGE_BITMAPS BEFORE 5+5; | ||
274 | 87 | |||
275 | 88 | --error ER_PARSE_ERROR | ||
276 | 89 | PURGE CHANGED_PAGE_BITMAPS BEFORE -12; | ||
277 | 90 | |||
278 | 91 | --error ER_PARSE_ERROR | ||
279 | 92 | PURGE CHANGED_PAGE_BITMAPS BEFORE 1.2e-2; | ||
280 | 93 | |||
281 | 94 | --error ER_PARSE_ERROR | ||
282 | 95 | PURGE CHANGED_PAGE_BITMAPS BEFORE t1; | ||
283 | 96 | |||
284 | 97 | --error ER_PARSE_ERROR | ||
285 | 98 | PURGE CHANGED_PAGE_BITMAPS BEFORE "t1"; | ||
286 | 99 | |||
287 | 100 | --error ER_PARSE_ERROR | ||
288 | 101 | PURGE CHANGED_PAGE_BITMAPS BEFORE TRUE; | ||
289 | 102 | |||
290 | 103 | --error ER_PARSE_ERROR | ||
291 | 104 | PURGE CHANGED_PAGE_BITMAPS BEFORE NULL; | ||
292 | 105 | |||
293 | 106 | # | ||
294 | 107 | # Test that non-privileged users cannot issue user requests | ||
295 | 108 | # | ||
296 | 109 | CREATE USER mysqltest_1@localhost; | ||
297 | 110 | GRANT ALL ON *.* TO mysqltest_1@localhost; | ||
298 | 111 | REVOKE SUPER ON *.* FROM mysqltest_1@localhost; | ||
299 | 112 | |||
300 | 113 | connect (conn1,localhost,mysqltest_1,,); | ||
301 | 114 | |||
302 | 115 | --error ER_SPECIFIC_ACCESS_DENIED_ERROR | ||
303 | 116 | FLUSH CHANGED_PAGE_BITMAPS; | ||
304 | 117 | |||
305 | 118 | --error ER_SPECIFIC_ACCESS_DENIED_ERROR | ||
306 | 119 | RESET CHANGED_PAGE_BITMAPS; | ||
307 | 120 | |||
308 | 121 | --error ER_SPECIFIC_ACCESS_DENIED_ERROR | ||
309 | 122 | PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000; | ||
310 | 123 | |||
311 | 124 | connection default; | ||
312 | 125 | disconnect conn1; | ||
313 | 126 | |||
314 | 127 | --source include/wait_until_count_sessions.inc | ||
315 | 128 | |||
316 | 129 | DROP USER mysqltest_1@localhost; | ||
317 | 130 | |||
318 | 131 | # | ||
319 | 132 | # Test FLUSH and PURGE requests with log tracking disabled | ||
320 | 133 | # | ||
321 | 134 | --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
322 | 135 | --shutdown_server 10 | ||
323 | 136 | --source include/wait_until_disconnected.inc | ||
324 | 137 | --enable_reconnect | ||
325 | 138 | --exec echo "restart:--innodb_track_changed_pages=FALSE" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
326 | 139 | --source include/wait_until_connected_again.inc | ||
327 | 140 | |||
328 | 141 | SELECT @@GLOBAL.innodb_track_changed_pages; | ||
329 | 142 | |||
330 | 143 | FLUSH CHANGED_PAGE_BITMAPS; | ||
331 | 144 | |||
332 | 145 | # The previous bitmap files should be present | ||
333 | 146 | --echo Before the PURGE with tracking disabled | ||
334 | 147 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
335 | 148 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
336 | 149 | |||
337 | 150 | PURGE CHANGED_PAGE_BITMAPS BEFORE 1; | ||
338 | 151 | |||
339 | 152 | --echo After the PURGE that deletes nothing: | ||
340 | 153 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
341 | 154 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
342 | 155 | |||
343 | 156 | PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000; | ||
344 | 157 | |||
345 | 158 | --echo After the PURGE that deletes everything: | ||
346 | 159 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
347 | 160 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
348 | 161 | |||
349 | 162 | PURGE CHANGED_PAGE_BITMAPS BEFORE 100000000; | ||
350 | 163 | |||
351 | 164 | --echo After the repeated PURGE: | ||
352 | 165 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
353 | 166 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
354 | 167 | |||
355 | 168 | # | ||
356 | 169 | # Test RESET request with log tracking disabled | ||
357 | 170 | # | ||
358 | 171 | |||
359 | 172 | # Generate some bitmap data again | ||
360 | 173 | --source include/restart_mysqld.inc | ||
361 | 174 | INSERT INTO t1 VALUES (1),(2),(3),(4),(5); | ||
362 | 175 | --source include/restart_mysqld.inc | ||
363 | 176 | |||
364 | 177 | --exec echo "wait" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
365 | 178 | --shutdown_server 10 | ||
366 | 179 | --source include/wait_until_disconnected.inc | ||
367 | 180 | --enable_reconnect | ||
368 | 181 | --exec echo "restart:--innodb_track_changed_pages=FALSE" > $MYSQLTEST_VARDIR/tmp/mysqld.1.expect | ||
369 | 182 | --source include/wait_until_connected_again.inc | ||
370 | 183 | |||
371 | 184 | --echo Before the RESET while tracking disabled: | ||
372 | 185 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
373 | 186 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
374 | 187 | |||
375 | 188 | RESET CHANGED_PAGE_BITMAPS; | ||
376 | 189 | |||
377 | 190 | --echo After the RESET with tracking disabled: | ||
378 | 191 | --replace_regex /_[[:digit:]]+\.xdb$// | ||
379 | 192 | list_files $MYSQLD_DATADIR ib_modified_log*; | ||
380 | 193 | |||
381 | 194 | DROP TABLE t1; | ||
382 | 195 | |||
383 | 196 | # | ||
384 | 197 | # Test that the new keyword does not preclude its use as identifier | ||
385 | 198 | # | ||
386 | 199 | CREATE TABLE CHANGED_PAGE_BITMAPS (a INT); | ||
387 | 200 | DROP TABLE CHANGED_PAGE_BITMAPS; | ||
388 | 0 | 201 | ||
389 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt' | |||
390 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt 1970-01-01 00:00:00 +0000 | |||
391 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb-master.opt 2013-01-22 16:40:34 +0000 | |||
392 | @@ -0,0 +1,1 @@ | |||
393 | 1 | --skip-innodb | ||
394 | 0 | 2 | ||
395 | === added file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test' | |||
396 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test 1970-01-01 00:00:00 +0000 | |||
397 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_page_bmp_requests_no_innodb.test 2013-01-22 16:40:34 +0000 | |||
398 | @@ -0,0 +1,7 @@ | |||
399 | 1 | # | ||
400 | 2 | # Test that changed page tracking user requests are parsed without InnoDB | ||
401 | 3 | # | ||
402 | 4 | FLUSH CHANGED_PAGE_BITMAPS; | ||
403 | 5 | RESET CHANGED_PAGE_BITMAPS; | ||
404 | 6 | PURGE CHANGED_PAGE_BITMAPS BEFORE 1; | ||
405 | 7 | |||
406 | 0 | 8 | ||
407 | === modified file 'Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test' | |||
408 | --- Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test 2012-11-25 09:30:58 +0000 | |||
409 | +++ Percona-Server/mysql-test/suite/innodb/t/percona_changed_pages.test 2013-01-22 16:40:34 +0000 | |||
410 | @@ -4,7 +4,9 @@ | |||
411 | 4 | 4 | ||
412 | 5 | --source include/have_innodb.inc | 5 | --source include/have_innodb.inc |
413 | 6 | 6 | ||
415 | 7 | --source include/delete_innodb_bitmaps.inc | 7 | # Delete any existing bitmaps |
416 | 8 | --source include/restart_mysqld.inc | ||
417 | 9 | RESET CHANGED_PAGE_BITMAPS; | ||
418 | 8 | 10 | ||
419 | 9 | --disable_warnings | 11 | --disable_warnings |
420 | 10 | DROP TABLE IF EXISTS T1; | 12 | DROP TABLE IF EXISTS T1; |
421 | 11 | 13 | ||
422 | === modified file 'Percona-Server/sql/handler.cc' | |||
423 | --- Percona-Server/sql/handler.cc 2013-01-17 22:50:22 +0000 | |||
424 | +++ Percona-Server/sql/handler.cc 2013-01-22 16:40:34 +0000 | |||
425 | @@ -5125,6 +5125,42 @@ | |||
426 | 5125 | return result; | 5125 | return result; |
427 | 5126 | } | 5126 | } |
428 | 5127 | 5127 | ||
429 | 5128 | static my_bool flush_changed_page_bitmaps_handlerton(THD *unused1, | ||
430 | 5129 | plugin_ref plugin, | ||
431 | 5130 | void *unused2) | ||
432 | 5131 | { | ||
433 | 5132 | handlerton *hton= plugin_data(plugin, handlerton *); | ||
434 | 5133 | |||
435 | 5134 | if (hton->flush_changed_page_bitmaps == NULL) | ||
436 | 5135 | return FALSE; | ||
437 | 5136 | |||
438 | 5137 | return hton->flush_changed_page_bitmaps(); | ||
439 | 5138 | } | ||
440 | 5139 | |||
441 | 5140 | bool ha_flush_changed_page_bitmaps() | ||
442 | 5141 | { | ||
443 | 5142 | return plugin_foreach(NULL, flush_changed_page_bitmaps_handlerton, | ||
444 | 5143 | MYSQL_STORAGE_ENGINE_PLUGIN, NULL); | ||
445 | 5144 | } | ||
446 | 5145 | |||
447 | 5146 | static my_bool purge_changed_page_bitmaps_handlerton(THD *unused1, | ||
448 | 5147 | plugin_ref plugin, | ||
449 | 5148 | void *lsn) | ||
450 | 5149 | { | ||
451 | 5150 | handlerton *hton= plugin_data(plugin, handlerton *); | ||
452 | 5151 | |||
453 | 5152 | if (hton->purge_changed_page_bitmaps == NULL) | ||
454 | 5153 | return FALSE; | ||
455 | 5154 | |||
456 | 5155 | return hton->purge_changed_page_bitmaps(*(ulonglong *)lsn); | ||
457 | 5156 | } | ||
458 | 5157 | |||
459 | 5158 | bool ha_purge_changed_page_bitmaps(ulonglong lsn) | ||
460 | 5159 | { | ||
461 | 5160 | return plugin_foreach(NULL, purge_changed_page_bitmaps_handlerton, | ||
462 | 5161 | MYSQL_STORAGE_ENGINE_PLUGIN, &lsn); | ||
463 | 5162 | } | ||
464 | 5163 | |||
465 | 5128 | /* | 5164 | /* |
466 | 5129 | Function to check if the conditions for row-based binlogging is | 5165 | Function to check if the conditions for row-based binlogging is |
467 | 5130 | correct for the table. | 5166 | correct for the table. |
468 | 5131 | 5167 | ||
469 | === modified file 'Percona-Server/sql/handler.h' | |||
470 | --- Percona-Server/sql/handler.h 2013-01-09 23:45:25 +0000 | |||
471 | +++ Percona-Server/sql/handler.h 2013-01-22 16:40:34 +0000 | |||
472 | @@ -842,6 +842,8 @@ | |||
473 | 842 | int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables, | 842 | int (*fill_is_table)(handlerton *hton, THD *thd, TABLE_LIST *tables, |
474 | 843 | class Item *cond, | 843 | class Item *cond, |
475 | 844 | enum enum_schema_tables); | 844 | enum enum_schema_tables); |
476 | 845 | my_bool (*flush_changed_page_bitmaps)(void); | ||
477 | 846 | my_bool (*purge_changed_page_bitmaps)(ulonglong lsn); | ||
478 | 845 | uint32 flags; /* global handler flags */ | 847 | uint32 flags; /* global handler flags */ |
479 | 846 | /* | 848 | /* |
480 | 847 | Those handlerton functions below are properly initialized at handler | 849 | Those handlerton functions below are properly initialized at handler |
481 | @@ -2390,6 +2392,9 @@ | |||
482 | 2390 | int ha_prepare(THD *thd); | 2392 | int ha_prepare(THD *thd); |
483 | 2391 | int ha_recover(HASH *commit_list); | 2393 | int ha_recover(HASH *commit_list); |
484 | 2392 | 2394 | ||
485 | 2395 | bool ha_flush_changed_page_bitmaps(); | ||
486 | 2396 | bool ha_purge_changed_page_bitmaps(ulonglong lsn); | ||
487 | 2397 | |||
488 | 2393 | /* transactions: these functions never call handlerton functions directly */ | 2398 | /* transactions: these functions never call handlerton functions directly */ |
489 | 2394 | int ha_enable_transaction(THD *thd, bool on); | 2399 | int ha_enable_transaction(THD *thd, bool on); |
490 | 2395 | 2400 | ||
491 | 2396 | 2401 | ||
492 | === modified file 'Percona-Server/sql/lex.h' | |||
493 | --- Percona-Server/sql/lex.h 2012-05-10 07:49:14 +0000 | |||
494 | +++ Percona-Server/sql/lex.h 2013-01-22 16:40:34 +0000 | |||
495 | @@ -103,6 +103,7 @@ | |||
496 | 103 | { "CHAIN", SYM(CHAIN_SYM)}, | 103 | { "CHAIN", SYM(CHAIN_SYM)}, |
497 | 104 | { "CHANGE", SYM(CHANGE)}, | 104 | { "CHANGE", SYM(CHANGE)}, |
498 | 105 | { "CHANGED", SYM(CHANGED)}, | 105 | { "CHANGED", SYM(CHANGED)}, |
499 | 106 | { "CHANGED_PAGE_BITMAPS", SYM(CHANGED_PAGE_BITMAPS_SYM)}, | ||
500 | 106 | { "CHAR", SYM(CHAR_SYM)}, | 107 | { "CHAR", SYM(CHAR_SYM)}, |
501 | 107 | { "CHARACTER", SYM(CHAR_SYM)}, | 108 | { "CHARACTER", SYM(CHAR_SYM)}, |
502 | 108 | { "CHARSET", SYM(CHARSET)}, | 109 | { "CHARSET", SYM(CHARSET)}, |
503 | 109 | 110 | ||
504 | === modified file 'Percona-Server/sql/sql_parse.cc' | |||
505 | --- Percona-Server/sql/sql_parse.cc 2013-01-09 23:45:25 +0000 | |||
506 | +++ Percona-Server/sql/sql_parse.cc 2013-01-22 16:40:34 +0000 | |||
507 | @@ -2320,9 +2320,35 @@ | |||
508 | 2320 | { | 2320 | { |
509 | 2321 | if (check_global_access(thd, SUPER_ACL)) | 2321 | if (check_global_access(thd, SUPER_ACL)) |
510 | 2322 | goto error; | 2322 | goto error; |
514 | 2323 | /* PURGE MASTER LOGS TO 'file' */ | 2323 | if (lex->type == 0) |
515 | 2324 | res = purge_master_logs(thd, lex->to_log); | 2324 | { |
516 | 2325 | break; | 2325 | /* PURGE MASTER LOGS TO 'file' */ |
517 | 2326 | res = purge_master_logs(thd, lex->to_log); | ||
518 | 2327 | break; | ||
519 | 2328 | } | ||
520 | 2329 | if (lex->type == PURGE_BITMAPS_TO_LSN) | ||
521 | 2330 | { | ||
522 | 2331 | /* PURGE CHANGED_PAGE_BITMAPS BEFORE lsn */ | ||
523 | 2332 | ulonglong lsn= 0; | ||
524 | 2333 | Item *it= (Item *)lex->value_list.head(); | ||
525 | 2334 | if ((!it->fixed && it->fix_fields(lex->thd, &it)) || it->check_cols(1) | ||
526 | 2335 | || it->null_value) | ||
527 | 2336 | { | ||
528 | 2337 | my_error(ER_WRONG_ARGUMENTS, MYF(0), | ||
529 | 2338 | "PURGE CHANGED_PAGE_BITMAPS BEFORE"); | ||
530 | 2339 | goto error; | ||
531 | 2340 | } | ||
532 | 2341 | lsn= it->val_uint(); | ||
533 | 2342 | res= ha_purge_changed_page_bitmaps(lsn); | ||
534 | 2343 | if (res) | ||
535 | 2344 | { | ||
536 | 2345 | my_error(ER_LOG_PURGE_UNKNOWN_ERR, MYF(0), | ||
537 | 2346 | "PURGE CHANGED_PAGE_BITMAPS BEFORE"); | ||
538 | 2347 | goto error; | ||
539 | 2348 | } | ||
540 | 2349 | my_ok(thd); | ||
541 | 2350 | break; | ||
542 | 2351 | } | ||
543 | 2326 | } | 2352 | } |
544 | 2327 | case SQLCOM_PURGE_BEFORE: | 2353 | case SQLCOM_PURGE_BEFORE: |
545 | 2328 | { | 2354 | { |
546 | @@ -3782,7 +3808,14 @@ | |||
547 | 3782 | case SQLCOM_FLUSH: | 3808 | case SQLCOM_FLUSH: |
548 | 3783 | { | 3809 | { |
549 | 3784 | int write_to_binlog; | 3810 | int write_to_binlog; |
551 | 3785 | if (check_global_access(thd,RELOAD_ACL)) | 3811 | |
552 | 3812 | if (lex->type & REFRESH_FLUSH_PAGE_BITMAPS | ||
553 | 3813 | || lex->type & REFRESH_RESET_PAGE_BITMAPS) | ||
554 | 3814 | { | ||
555 | 3815 | if (check_global_access(thd, SUPER_ACL)) | ||
556 | 3816 | goto error; | ||
557 | 3817 | } | ||
558 | 3818 | else if (check_global_access(thd, RELOAD_ACL)) | ||
559 | 3786 | goto error; | 3819 | goto error; |
560 | 3787 | 3820 | ||
561 | 3788 | if (first_table && lex->type & REFRESH_READ_LOCK) | 3821 | if (first_table && lex->type & REFRESH_READ_LOCK) |
562 | 3789 | 3822 | ||
563 | === modified file 'Percona-Server/sql/sql_reload.cc' | |||
564 | --- Percona-Server/sql/sql_reload.cc 2012-04-18 23:26:01 +0000 | |||
565 | +++ Percona-Server/sql/sql_reload.cc 2013-01-22 16:40:34 +0000 | |||
566 | @@ -362,6 +362,22 @@ | |||
567 | 362 | } | 362 | } |
568 | 363 | mysql_mutex_unlock(&LOCK_global_user_client_stats); | 363 | mysql_mutex_unlock(&LOCK_global_user_client_stats); |
569 | 364 | } | 364 | } |
570 | 365 | if (options & REFRESH_FLUSH_PAGE_BITMAPS) | ||
571 | 366 | { | ||
572 | 367 | result= ha_flush_changed_page_bitmaps(); | ||
573 | 368 | if (result) | ||
574 | 369 | { | ||
575 | 370 | my_error(ER_UNKNOWN_ERROR, MYF(0), "FLUSH CHANGED_PAGE_BITMAPS"); | ||
576 | 371 | } | ||
577 | 372 | } | ||
578 | 373 | if (options & REFRESH_RESET_PAGE_BITMAPS) | ||
579 | 374 | { | ||
580 | 375 | result= ha_purge_changed_page_bitmaps(0); | ||
581 | 376 | if (result) | ||
582 | 377 | { | ||
583 | 378 | my_error(ER_UNKNOWN_ERROR, MYF(0), "RESET CHANGED_PAGE_BITMAPS"); | ||
584 | 379 | } | ||
585 | 380 | } | ||
586 | 365 | if (*write_to_binlog != -1) | 381 | if (*write_to_binlog != -1) |
587 | 366 | *write_to_binlog= tmp_write_to_binlog; | 382 | *write_to_binlog= tmp_write_to_binlog; |
588 | 367 | /* | 383 | /* |
589 | 368 | 384 | ||
590 | === modified file 'Percona-Server/sql/sql_yacc.yy' | |||
591 | --- Percona-Server/sql/sql_yacc.yy 2013-01-09 23:45:25 +0000 | |||
592 | +++ Percona-Server/sql/sql_yacc.yy 2013-01-22 16:40:34 +0000 | |||
593 | @@ -858,6 +858,7 @@ | |||
594 | 858 | %token CHAIN_SYM /* SQL-2003-N */ | 858 | %token CHAIN_SYM /* SQL-2003-N */ |
595 | 859 | %token CHANGE | 859 | %token CHANGE |
596 | 860 | %token CHANGED | 860 | %token CHANGED |
597 | 861 | %token CHANGED_PAGE_BITMAPS_SYM /* MYSQL */ | ||
598 | 861 | %token CHARSET | 862 | %token CHARSET |
599 | 862 | %token CHAR_SYM /* SQL-2003-R */ | 863 | %token CHAR_SYM /* SQL-2003-R */ |
600 | 863 | %token CHECKSUM_SYM | 864 | %token CHECKSUM_SYM |
601 | @@ -11457,6 +11458,8 @@ | |||
602 | 11457 | { Lex->type|= REFRESH_DES_KEY_FILE; } | 11458 | { Lex->type|= REFRESH_DES_KEY_FILE; } |
603 | 11458 | | RESOURCES | 11459 | | RESOURCES |
604 | 11459 | { Lex->type|= REFRESH_USER_RESOURCES; } | 11460 | { Lex->type|= REFRESH_USER_RESOURCES; } |
605 | 11461 | | CHANGED_PAGE_BITMAPS_SYM | ||
606 | 11462 | { Lex->type|= REFRESH_FLUSH_PAGE_BITMAPS; } | ||
607 | 11460 | ; | 11463 | ; |
608 | 11461 | 11464 | ||
609 | 11462 | opt_table_list: | 11465 | opt_table_list: |
610 | @@ -11484,6 +11487,8 @@ | |||
611 | 11484 | slave_reset_options { } | 11487 | slave_reset_options { } |
612 | 11485 | | MASTER_SYM { Lex->type|= REFRESH_MASTER; } | 11488 | | MASTER_SYM { Lex->type|= REFRESH_MASTER; } |
613 | 11486 | | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;} | 11489 | | QUERY_SYM CACHE_SYM { Lex->type|= REFRESH_QUERY_CACHE;} |
614 | 11490 | | CHANGED_PAGE_BITMAPS_SYM | ||
615 | 11491 | { Lex->type |= REFRESH_RESET_PAGE_BITMAPS; } | ||
616 | 11487 | ; | 11492 | ; |
617 | 11488 | 11493 | ||
618 | 11489 | slave_reset_options: | 11494 | slave_reset_options: |
619 | @@ -11504,6 +11509,13 @@ | |||
620 | 11504 | 11509 | ||
621 | 11505 | purge_options: | 11510 | purge_options: |
622 | 11506 | master_or_binary LOGS_SYM purge_option | 11511 | master_or_binary LOGS_SYM purge_option |
623 | 11512 | | CHANGED_PAGE_BITMAPS_SYM BEFORE_SYM real_ulonglong_num | ||
624 | 11513 | { | ||
625 | 11514 | LEX *lex= Lex; | ||
626 | 11515 | lex->value_list.empty(); | ||
627 | 11516 | lex->value_list.push_front(new Item_uint($3)); | ||
628 | 11517 | lex->type= PURGE_BITMAPS_TO_LSN; | ||
629 | 11518 | } | ||
630 | 11507 | ; | 11519 | ; |
631 | 11508 | 11520 | ||
632 | 11509 | purge_option: | 11521 | purge_option: |
633 | @@ -12594,6 +12606,7 @@ | |||
634 | 12594 | | CATALOG_NAME_SYM {} | 12606 | | CATALOG_NAME_SYM {} |
635 | 12595 | | CHAIN_SYM {} | 12607 | | CHAIN_SYM {} |
636 | 12596 | | CHANGED {} | 12608 | | CHANGED {} |
637 | 12609 | | CHANGED_PAGE_BITMAPS_SYM {} | ||
638 | 12597 | | CIPHER_SYM {} | 12610 | | CIPHER_SYM {} |
639 | 12598 | | CLIENT_STATS_SYM {} | 12611 | | CLIENT_STATS_SYM {} |
640 | 12599 | | CLIENT_SYM {} | 12612 | | CLIENT_SYM {} |
641 | 12600 | 12613 | ||
642 | === modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc' | |||
643 | --- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-01-18 03:34:53 +0000 | |||
644 | +++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-01-22 16:40:34 +0000 | |||
645 | @@ -85,6 +85,7 @@ | |||
646 | 85 | #include "row0sel.h" | 85 | #include "row0sel.h" |
647 | 86 | #include "row0upd.h" | 86 | #include "row0upd.h" |
648 | 87 | #include "log0log.h" | 87 | #include "log0log.h" |
649 | 88 | #include "log0online.h" | ||
650 | 88 | #include "lock0lock.h" | 89 | #include "lock0lock.h" |
651 | 89 | #include "dict0crea.h" | 90 | #include "dict0crea.h" |
652 | 90 | #include "btr0cur.h" | 91 | #include "btr0cur.h" |
653 | @@ -297,6 +298,7 @@ | |||
654 | 297 | {&ibuf_pessimistic_insert_mutex_key, | 298 | {&ibuf_pessimistic_insert_mutex_key, |
655 | 298 | "ibuf_pessimistic_insert_mutex", 0}, | 299 | "ibuf_pessimistic_insert_mutex", 0}, |
656 | 299 | {&kernel_mutex_key, "kernel_mutex", 0}, | 300 | {&kernel_mutex_key, "kernel_mutex", 0}, |
657 | 301 | {&log_bmp_sys_mutex_key, "log_bmp_sys_mutex", 0}, | ||
658 | 300 | {&log_sys_mutex_key, "log_sys_mutex", 0}, | 302 | {&log_sys_mutex_key, "log_sys_mutex", 0}, |
659 | 301 | # ifdef UNIV_MEM_DEBUG | 303 | # ifdef UNIV_MEM_DEBUG |
660 | 302 | {&mem_hash_mutex_key, "mem_hash_mutex", 0}, | 304 | {&mem_hash_mutex_key, "mem_hash_mutex", 0}, |
661 | @@ -438,6 +440,25 @@ | |||
662 | 438 | innobase_alter_table_flags( | 440 | innobase_alter_table_flags( |
663 | 439 | /*=======================*/ | 441 | /*=======================*/ |
664 | 440 | uint flags); | 442 | uint flags); |
665 | 443 | /************************************************************//** | ||
666 | 444 | Synchronously read and parse the redo log up to the last | ||
667 | 445 | checkpoint to write the changed page bitmap. | ||
668 | 446 | @return 0 to indicate success. Current implementation cannot fail. */ | ||
669 | 447 | static | ||
670 | 448 | my_bool | ||
671 | 449 | innobase_flush_changed_page_bitmaps(); | ||
672 | 450 | /*==================================*/ | ||
673 | 451 | /************************************************************//** | ||
674 | 452 | Delete all the bitmap files for data less than the specified LSN. | ||
675 | 453 | If called with lsn == 0 (i.e. set by RESET request) or | ||
676 | 454 | IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise | ||
677 | 455 | continue it. | ||
678 | 456 | @return 0 to indicate success, 1 for failure. */ | ||
679 | 457 | static | ||
680 | 458 | my_bool | ||
681 | 459 | innobase_purge_changed_page_bitmaps( | ||
682 | 460 | /*================================*/ | ||
683 | 461 | ulonglong lsn); /*!< in: LSN to purge files up to */ | ||
684 | 441 | 462 | ||
685 | 442 | static const char innobase_hton_name[]= "InnoDB"; | 463 | static const char innobase_hton_name[]= "InnoDB"; |
686 | 443 | 464 | ||
687 | @@ -2663,6 +2684,10 @@ | |||
688 | 2663 | innobase_hton->flags=HTON_NO_FLAGS; | 2684 | innobase_hton->flags=HTON_NO_FLAGS; |
689 | 2664 | innobase_hton->release_temporary_latches=innobase_release_temporary_latches; | 2685 | innobase_hton->release_temporary_latches=innobase_release_temporary_latches; |
690 | 2665 | innobase_hton->alter_table_flags = innobase_alter_table_flags; | 2686 | innobase_hton->alter_table_flags = innobase_alter_table_flags; |
691 | 2687 | innobase_hton->flush_changed_page_bitmaps | ||
692 | 2688 | = innobase_flush_changed_page_bitmaps; | ||
693 | 2689 | innobase_hton->purge_changed_page_bitmaps | ||
694 | 2690 | = innobase_purge_changed_page_bitmaps; | ||
695 | 2666 | 2691 | ||
696 | 2667 | ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); | 2692 | ut_a(DATA_MYSQL_TRUE_VARCHAR == (ulint)MYSQL_TYPE_VARCHAR); |
697 | 2668 | 2693 | ||
698 | @@ -3282,6 +3307,36 @@ | |||
699 | 3282 | | HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE); | 3307 | | HA_INPLACE_ADD_PK_INDEX_NO_READ_WRITE); |
700 | 3283 | } | 3308 | } |
701 | 3284 | 3309 | ||
702 | 3310 | /************************************************************//** | ||
703 | 3311 | Synchronously read and parse the redo log up to the last | ||
704 | 3312 | checkpoint to write the changed page bitmap. | ||
705 | 3313 | @return 0 to indicate success. Current implementation cannot fail. */ | ||
706 | 3314 | static | ||
707 | 3315 | my_bool | ||
708 | 3316 | innobase_flush_changed_page_bitmaps() | ||
709 | 3317 | /*=================================*/ | ||
710 | 3318 | { | ||
711 | 3319 | if (srv_track_changed_pages) { | ||
712 | 3320 | os_event_reset(srv_checkpoint_completed_event); | ||
713 | 3321 | log_online_follow_redo_log(); | ||
714 | 3322 | } | ||
715 | 3323 | return FALSE; | ||
716 | 3324 | } | ||
717 | 3325 | |||
718 | 3326 | /************************************************************//** | ||
719 | 3327 | Delete all the bitmap files for data less than the specified LSN. | ||
720 | 3328 | If called with lsn == IB_ULONGLONG_MAX (i.e. set by RESET request), | ||
721 | 3329 | restart the bitmap file sequence, otherwise continue it. | ||
722 | 3330 | @return 0 to indicate success, 1 for failure. */ | ||
723 | 3331 | static | ||
724 | 3332 | my_bool | ||
725 | 3333 | innobase_purge_changed_page_bitmaps( | ||
726 | 3334 | /*================================*/ | ||
727 | 3335 | ulonglong lsn) /*!< in: LSN to purge files up to */ | ||
728 | 3336 | { | ||
729 | 3337 | return (my_bool)log_online_purge_changed_page_bitmaps(lsn); | ||
730 | 3338 | } | ||
731 | 3339 | |||
732 | 3285 | /****************************************************************//** | 3340 | /****************************************************************//** |
733 | 3286 | Copy the current replication position from MySQL to a transaction. */ | 3341 | Copy the current replication position from MySQL to a transaction. */ |
734 | 3287 | static | 3342 | static |
735 | 3288 | 3343 | ||
736 | === modified file 'Percona-Server/storage/innobase/include/log0online.h' | |||
737 | --- Percona-Server/storage/innobase/include/log0online.h 2012-11-25 09:29:43 +0000 | |||
738 | +++ Percona-Server/storage/innobase/include/log0online.h 2013-01-22 16:40:34 +0000 | |||
739 | @@ -41,23 +41,49 @@ | |||
740 | 41 | Initializes the online log following subsytem. */ | 41 | Initializes the online log following subsytem. */ |
741 | 42 | UNIV_INTERN | 42 | UNIV_INTERN |
742 | 43 | void | 43 | void |
745 | 44 | log_online_read_init(); | 44 | log_online_read_init(void); |
746 | 45 | /*===================*/ | 45 | /*=======================*/ |
747 | 46 | 46 | ||
748 | 47 | /*********************************************************************//** | 47 | /*********************************************************************//** |
749 | 48 | Shuts down the online log following subsystem. */ | 48 | Shuts down the online log following subsystem. */ |
750 | 49 | UNIV_INTERN | 49 | UNIV_INTERN |
751 | 50 | void | 50 | void |
754 | 51 | log_online_read_shutdown(); | 51 | log_online_read_shutdown(void); |
755 | 52 | /*=======================*/ | 52 | /*===========================*/ |
756 | 53 | 53 | ||
757 | 54 | /*********************************************************************//** | 54 | /*********************************************************************//** |
758 | 55 | Reads and parses the redo log up to last checkpoint LSN to build the changed | 55 | Reads and parses the redo log up to last checkpoint LSN to build the changed |
759 | 56 | page bitmap which is then written to disk. */ | 56 | page bitmap which is then written to disk. */ |
760 | 57 | UNIV_INTERN | 57 | UNIV_INTERN |
761 | 58 | void | 58 | void |
764 | 59 | log_online_follow_redo_log(); | 59 | log_online_follow_redo_log(void); |
765 | 60 | /*=========================*/ | 60 | /*=============================*/ |
766 | 61 | |||
767 | 62 | /************************************************************//** | ||
768 | 63 | Delete all the bitmap files for data less than the specified LSN. | ||
769 | 64 | If called with lsn == 0 (i.e. set by RESET request) or | ||
770 | 65 | IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise | ||
771 | 66 | continue it. | ||
772 | 67 | |||
773 | 68 | @return FALSE to indicate success, TRUE for failure. */ | ||
774 | 69 | UNIV_INTERN | ||
775 | 70 | ibool | ||
776 | 71 | log_online_purge_changed_page_bitmaps( | ||
777 | 72 | /*==================================*/ | ||
778 | 73 | ib_uint64_t lsn); /*!<in: LSN to purge files up to */ | ||
779 | 74 | |||
780 | 75 | /************************************************************//** | ||
781 | 76 | Delete all the bitmap files for data less than the specified LSN. | ||
782 | 77 | If called with lsn == 0 (i.e. set by RESET request) or | ||
783 | 78 | IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise | ||
784 | 79 | continue it. | ||
785 | 80 | |||
786 | 81 | @return FALSE to indicate success, TRUE for failure. */ | ||
787 | 82 | UNIV_INTERN | ||
788 | 83 | ibool | ||
789 | 84 | log_online_purge_changed_page_bitmaps( | ||
790 | 85 | /*==================================*/ | ||
791 | 86 | ib_uint64_t lsn); /*!<in: LSN to purge files up to */ | ||
792 | 61 | 87 | ||
793 | 62 | #define LOG_BITMAP_ITERATOR_START_LSN(i) \ | 88 | #define LOG_BITMAP_ITERATOR_START_LSN(i) \ |
794 | 63 | ((i).start_lsn) | 89 | ((i).start_lsn) |
795 | 64 | 90 | ||
796 | === modified file 'Percona-Server/storage/innobase/include/sync0sync.h' | |||
797 | --- Percona-Server/storage/innobase/include/sync0sync.h 2012-05-10 07:49:14 +0000 | |||
798 | +++ Percona-Server/storage/innobase/include/sync0sync.h 2013-01-22 16:40:34 +0000 | |||
799 | @@ -89,6 +89,7 @@ | |||
800 | 89 | extern mysql_pfs_key_t ibuf_bitmap_mutex_key; | 89 | extern mysql_pfs_key_t ibuf_bitmap_mutex_key; |
801 | 90 | extern mysql_pfs_key_t ibuf_mutex_key; | 90 | extern mysql_pfs_key_t ibuf_mutex_key; |
802 | 91 | extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; | 91 | extern mysql_pfs_key_t ibuf_pessimistic_insert_mutex_key; |
803 | 92 | extern mysql_pfs_key_t log_bmp_sys_mutex_key; | ||
804 | 92 | extern mysql_pfs_key_t log_sys_mutex_key; | 93 | extern mysql_pfs_key_t log_sys_mutex_key; |
805 | 93 | extern mysql_pfs_key_t log_flush_order_mutex_key; | 94 | extern mysql_pfs_key_t log_flush_order_mutex_key; |
806 | 94 | extern mysql_pfs_key_t kernel_mutex_key; | 95 | extern mysql_pfs_key_t kernel_mutex_key; |
807 | @@ -672,6 +673,7 @@ | |||
808 | 672 | #define SYNC_TRX_LOCK_HEAP 298 | 673 | #define SYNC_TRX_LOCK_HEAP 298 |
809 | 673 | #define SYNC_TRX_SYS_HEADER 290 | 674 | #define SYNC_TRX_SYS_HEADER 290 |
810 | 674 | #define SYNC_PURGE_QUEUE 200 | 675 | #define SYNC_PURGE_QUEUE 200 |
811 | 676 | #define SYNC_LOG_ONLINE 175 | ||
812 | 675 | #define SYNC_LOG 170 | 677 | #define SYNC_LOG 170 |
813 | 676 | #define SYNC_LOG_FLUSH_ORDER 156 | 678 | #define SYNC_LOG_FLUSH_ORDER 156 |
814 | 677 | #define SYNC_RECV 168 | 679 | #define SYNC_RECV 168 |
815 | 678 | 680 | ||
816 | === modified file 'Percona-Server/storage/innobase/log/log0online.c' | |||
817 | --- Percona-Server/storage/innobase/log/log0online.c 2013-01-04 15:24:45 +0000 | |||
818 | +++ Percona-Server/storage/innobase/log/log0online.c 2013-01-22 16:40:34 +0000 | |||
819 | @@ -36,6 +36,11 @@ | |||
820 | 36 | 36 | ||
821 | 37 | enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) }; | 37 | enum { FOLLOW_SCAN_SIZE = 4 * (UNIV_PAGE_SIZE_MAX) }; |
822 | 38 | 38 | ||
823 | 39 | #ifdef UNIV_PFS_MUTEX | ||
824 | 40 | /* Key to register log_bmp_sys->mutex with PFS */ | ||
825 | 41 | UNIV_INTERN mysql_pfs_key_t log_bmp_sys_mutex_key; | ||
826 | 42 | #endif /* UNIV_PFS_MUTEX */ | ||
827 | 43 | |||
828 | 39 | /** Log parsing and bitmap output data structure */ | 44 | /** Log parsing and bitmap output data structure */ |
829 | 40 | struct log_bitmap_struct { | 45 | struct log_bitmap_struct { |
830 | 41 | byte read_buf[FOLLOW_SCAN_SIZE]; | 46 | byte read_buf[FOLLOW_SCAN_SIZE]; |
831 | @@ -69,6 +74,7 @@ | |||
832 | 69 | both the correct type and the tree does | 74 | both the correct type and the tree does |
833 | 70 | not mind its overwrite during | 75 | not mind its overwrite during |
834 | 71 | rbt_next() tree traversal. */ | 76 | rbt_next() tree traversal. */ |
835 | 77 | mutex_t mutex; /*!< mutex protecting all the fields.*/ | ||
836 | 72 | }; | 78 | }; |
837 | 73 | 79 | ||
838 | 74 | /* The log parsing and bitmap output struct instance */ | 80 | /* The log parsing and bitmap output struct instance */ |
839 | @@ -172,6 +178,8 @@ | |||
840 | 172 | byte search_page[MODIFIED_PAGE_BLOCK_SIZE]; | 178 | byte search_page[MODIFIED_PAGE_BLOCK_SIZE]; |
841 | 173 | byte *page_ptr; | 179 | byte *page_ptr; |
842 | 174 | 180 | ||
843 | 181 | ut_ad(mutex_own(&log_bmp_sys->mutex)); | ||
844 | 182 | |||
845 | 175 | ut_a(space != ULINT_UNDEFINED); | 183 | ut_a(space != ULINT_UNDEFINED); |
846 | 176 | ut_a(page_no != ULINT_UNDEFINED); | 184 | ut_a(page_no != ULINT_UNDEFINED); |
847 | 177 | 185 | ||
848 | @@ -312,8 +320,8 @@ | |||
849 | 312 | @return the last fully tracked LSN */ | 320 | @return the last fully tracked LSN */ |
850 | 313 | static | 321 | static |
851 | 314 | ib_uint64_t | 322 | ib_uint64_t |
854 | 315 | log_online_read_last_tracked_lsn() | 323 | log_online_read_last_tracked_lsn(void) |
855 | 316 | /*==============================*/ | 324 | /*==================================*/ |
856 | 317 | { | 325 | { |
857 | 318 | byte page[MODIFIED_PAGE_BLOCK_SIZE]; | 326 | byte page[MODIFIED_PAGE_BLOCK_SIZE]; |
858 | 319 | ibool is_last_page = FALSE; | 327 | ibool is_last_page = FALSE; |
859 | @@ -487,8 +495,8 @@ | |||
860 | 487 | Create a new empty bitmap output file. */ | 495 | Create a new empty bitmap output file. */ |
861 | 488 | static | 496 | static |
862 | 489 | void | 497 | void |
865 | 490 | log_online_start_bitmap_file() | 498 | log_online_start_bitmap_file(void) |
866 | 491 | /*==========================*/ | 499 | /*==============================*/ |
867 | 492 | { | 500 | { |
868 | 493 | ibool success; | 501 | ibool success; |
869 | 494 | 502 | ||
870 | @@ -518,7 +526,10 @@ | |||
871 | 518 | ib_uint64_t next_file_start_lsn) /*!<in: the start LSN name | 526 | ib_uint64_t next_file_start_lsn) /*!<in: the start LSN name |
872 | 519 | part */ | 527 | part */ |
873 | 520 | { | 528 | { |
875 | 521 | os_file_close(log_bmp_sys->out.file); | 529 | if (log_bmp_sys->out.file != -1) { |
876 | 530 | os_file_close(log_bmp_sys->out.file); | ||
877 | 531 | log_bmp_sys->out.file = -1; | ||
878 | 532 | } | ||
879 | 522 | log_bmp_sys->out_seq_num++; | 533 | log_bmp_sys->out_seq_num++; |
880 | 523 | log_online_make_bitmap_name(next_file_start_lsn); | 534 | log_online_make_bitmap_name(next_file_start_lsn); |
881 | 524 | log_online_start_bitmap_file(); | 535 | log_online_start_bitmap_file(); |
882 | @@ -556,8 +567,8 @@ | |||
883 | 556 | Initialize the online log following subsytem. */ | 567 | Initialize the online log following subsytem. */ |
884 | 557 | UNIV_INTERN | 568 | UNIV_INTERN |
885 | 558 | void | 569 | void |
888 | 559 | log_online_read_init() | 570 | log_online_read_init(void) |
889 | 560 | /*==================*/ | 571 | /*======================*/ |
890 | 561 | { | 572 | { |
891 | 562 | ibool success; | 573 | ibool success; |
892 | 563 | ib_uint64_t tracking_start_lsn | 574 | ib_uint64_t tracking_start_lsn |
893 | @@ -566,13 +577,16 @@ | |||
894 | 566 | os_file_stat_t bitmap_dir_file_info; | 577 | os_file_stat_t bitmap_dir_file_info; |
895 | 567 | ib_uint64_t last_file_start_lsn = MIN_TRACKED_LSN; | 578 | ib_uint64_t last_file_start_lsn = MIN_TRACKED_LSN; |
896 | 568 | 579 | ||
901 | 569 | /* Assert (could be compile-time assert) that bitmap data start and end | 580 | /* Bitmap data start and end in a bitmap block must be 8-byte |
902 | 570 | in a bitmap block is 8-byte aligned */ | 581 | aligned. */ |
903 | 571 | ut_a(MODIFIED_PAGE_BLOCK_BITMAP % 8 == 0); | 582 | compile_time_assert(MODIFIED_PAGE_BLOCK_BITMAP % 8 == 0); |
904 | 572 | ut_a(MODIFIED_PAGE_BLOCK_BITMAP_LEN % 8 == 0); | 583 | compile_time_assert(MODIFIED_PAGE_BLOCK_BITMAP_LEN % 8 == 0); |
905 | 573 | 584 | ||
906 | 574 | log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys)); | 585 | log_bmp_sys = ut_malloc(sizeof(*log_bmp_sys)); |
907 | 575 | 586 | ||
908 | 587 | mutex_create(log_bmp_sys_mutex_key, &log_bmp_sys->mutex, | ||
909 | 588 | SYNC_LOG_ONLINE); | ||
910 | 589 | |||
911 | 576 | /* Enumerate existing bitmap files to either open the last one to get | 590 | /* Enumerate existing bitmap files to either open the last one to get |
912 | 577 | the last tracked LSN either to find that there are none and start | 591 | the last tracked LSN either to find that there are none and start |
913 | 578 | tracking from scratch. */ | 592 | tracking from scratch. */ |
914 | @@ -701,12 +715,15 @@ | |||
915 | 701 | Shut down the online log following subsystem. */ | 715 | Shut down the online log following subsystem. */ |
916 | 702 | UNIV_INTERN | 716 | UNIV_INTERN |
917 | 703 | void | 717 | void |
920 | 704 | log_online_read_shutdown() | 718 | log_online_read_shutdown(void) |
921 | 705 | /*======================*/ | 719 | /*==========================*/ |
922 | 706 | { | 720 | { |
923 | 707 | ib_rbt_node_t *free_list_node = log_bmp_sys->page_free_list; | 721 | ib_rbt_node_t *free_list_node = log_bmp_sys->page_free_list; |
924 | 708 | 722 | ||
926 | 709 | os_file_close(log_bmp_sys->out.file); | 723 | if (log_bmp_sys->out.file != -1) { |
927 | 724 | os_file_close(log_bmp_sys->out.file); | ||
928 | 725 | log_bmp_sys->out.file = -1; | ||
929 | 726 | } | ||
930 | 710 | 727 | ||
931 | 711 | rbt_free(log_bmp_sys->modified_pages); | 728 | rbt_free(log_bmp_sys->modified_pages); |
932 | 712 | 729 | ||
933 | @@ -716,6 +733,8 @@ | |||
934 | 716 | free_list_node = next; | 733 | free_list_node = next; |
935 | 717 | } | 734 | } |
936 | 718 | 735 | ||
937 | 736 | mutex_free(&log_bmp_sys->mutex); | ||
938 | 737 | |||
939 | 719 | ut_free(log_bmp_sys); | 738 | ut_free(log_bmp_sys); |
940 | 720 | } | 739 | } |
941 | 721 | 740 | ||
942 | @@ -759,14 +778,16 @@ | |||
943 | 759 | buffer. */ | 778 | buffer. */ |
944 | 760 | static | 779 | static |
945 | 761 | void | 780 | void |
948 | 762 | log_online_parse_redo_log() | 781 | log_online_parse_redo_log(void) |
949 | 763 | /*=======================*/ | 782 | /*===========================*/ |
950 | 764 | { | 783 | { |
951 | 765 | byte *ptr = log_bmp_sys->parse_buf; | 784 | byte *ptr = log_bmp_sys->parse_buf; |
952 | 766 | byte *end = log_bmp_sys->parse_buf_end; | 785 | byte *end = log_bmp_sys->parse_buf_end; |
953 | 767 | 786 | ||
954 | 768 | ulint len = 0; | 787 | ulint len = 0; |
955 | 769 | 788 | ||
956 | 789 | ut_ad(mutex_own(&log_bmp_sys->mutex)); | ||
957 | 790 | |||
958 | 770 | while (ptr != end | 791 | while (ptr != end |
959 | 771 | && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) { | 792 | && log_bmp_sys->next_parse_lsn < log_bmp_sys->end_lsn) { |
960 | 772 | 793 | ||
961 | @@ -857,6 +878,8 @@ | |||
962 | 857 | ulint actual_data_len = (end_offset >= start_offset) | 878 | ulint actual_data_len = (end_offset >= start_offset) |
963 | 858 | ? end_offset - start_offset : 0; | 879 | ? end_offset - start_offset : 0; |
964 | 859 | 880 | ||
965 | 881 | ut_ad(mutex_own(&log_bmp_sys->mutex)); | ||
966 | 882 | |||
967 | 860 | ut_memcpy(log_bmp_sys->parse_buf_end, log_block + start_offset, | 883 | ut_memcpy(log_bmp_sys->parse_buf_end, log_block + start_offset, |
968 | 861 | actual_data_len); | 884 | actual_data_len); |
969 | 862 | 885 | ||
970 | @@ -881,6 +904,8 @@ | |||
971 | 881 | { | 904 | { |
972 | 882 | ulint block_data_len; | 905 | ulint block_data_len; |
973 | 883 | 906 | ||
974 | 907 | ut_ad(mutex_own(&log_bmp_sys->mutex)); | ||
975 | 908 | |||
976 | 884 | block_data_len = log_block_get_data_len(log_block); | 909 | block_data_len = log_block_get_data_len(log_block); |
977 | 885 | 910 | ||
978 | 886 | ut_ad(block_data_len % OS_FILE_LOG_BLOCK_SIZE == 0 | 911 | ut_ad(block_data_len % OS_FILE_LOG_BLOCK_SIZE == 0 |
979 | @@ -907,6 +932,8 @@ | |||
980 | 907 | byte* log_block_end = log_bmp_sys->read_buf | 932 | byte* log_block_end = log_bmp_sys->read_buf |
981 | 908 | + (block_end_lsn - block_start_lsn); | 933 | + (block_end_lsn - block_start_lsn); |
982 | 909 | 934 | ||
983 | 935 | ut_ad(mutex_own(&log_bmp_sys->mutex)); | ||
984 | 936 | |||
985 | 910 | mutex_enter(&log_sys->mutex); | 937 | mutex_enter(&log_sys->mutex); |
986 | 911 | log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf, | 938 | log_group_read_log_seg(LOG_RECOVER, log_bmp_sys->read_buf, |
987 | 912 | group, block_start_lsn, block_end_lsn); | 939 | group, block_start_lsn, block_end_lsn); |
988 | @@ -969,6 +996,8 @@ | |||
989 | 969 | ib_uint64_t block_start_lsn = contiguous_lsn; | 996 | ib_uint64_t block_start_lsn = contiguous_lsn; |
990 | 970 | ib_uint64_t block_end_lsn; | 997 | ib_uint64_t block_end_lsn; |
991 | 971 | 998 | ||
992 | 999 | ut_ad(mutex_own(&log_bmp_sys->mutex)); | ||
993 | 1000 | |||
994 | 972 | log_bmp_sys->next_parse_lsn = log_bmp_sys->start_lsn; | 1001 | log_bmp_sys->next_parse_lsn = log_bmp_sys->start_lsn; |
995 | 973 | log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf; | 1002 | log_bmp_sys->parse_buf_end = log_bmp_sys->parse_buf; |
996 | 974 | 1003 | ||
997 | @@ -1005,6 +1034,8 @@ | |||
998 | 1005 | { | 1034 | { |
999 | 1006 | ibool success; | 1035 | ibool success; |
1000 | 1007 | 1036 | ||
1001 | 1037 | ut_ad(mutex_own(&log_bmp_sys->mutex)); | ||
1002 | 1038 | |||
1003 | 1008 | success = os_file_write(log_bmp_sys->out.name, log_bmp_sys->out.file, | 1039 | success = os_file_write(log_bmp_sys->out.name, log_bmp_sys->out.file, |
1004 | 1009 | block, | 1040 | block, |
1005 | 1010 | (ulint)(log_bmp_sys->out.offset & 0xFFFFFFFF), | 1041 | (ulint)(log_bmp_sys->out.offset & 0xFFFFFFFF), |
1006 | @@ -1038,12 +1069,14 @@ | |||
1007 | 1038 | bitmap tree and recycles its nodes to the free list. */ | 1069 | bitmap tree and recycles its nodes to the free list. */ |
1008 | 1039 | static | 1070 | static |
1009 | 1040 | void | 1071 | void |
1012 | 1041 | log_online_write_bitmap() | 1072 | log_online_write_bitmap(void) |
1013 | 1042 | /*=====================*/ | 1073 | /*=========================*/ |
1014 | 1043 | { | 1074 | { |
1015 | 1044 | ib_rbt_node_t *bmp_tree_node; | 1075 | ib_rbt_node_t *bmp_tree_node; |
1016 | 1045 | const ib_rbt_node_t *last_bmp_tree_node; | 1076 | const ib_rbt_node_t *last_bmp_tree_node; |
1017 | 1046 | 1077 | ||
1018 | 1078 | ut_ad(mutex_own(&log_bmp_sys->mutex)); | ||
1019 | 1079 | |||
1020 | 1047 | if (log_bmp_sys->out.offset >= srv_max_bitmap_file_size) { | 1080 | if (log_bmp_sys->out.offset >= srv_max_bitmap_file_size) { |
1021 | 1048 | log_online_rotate_bitmap_file(log_bmp_sys->start_lsn); | 1081 | log_online_rotate_bitmap_file(log_bmp_sys->start_lsn); |
1022 | 1049 | } | 1082 | } |
1023 | @@ -1084,18 +1117,21 @@ | |||
1024 | 1084 | page bitmap which is then written to disk. */ | 1117 | page bitmap which is then written to disk. */ |
1025 | 1085 | UNIV_INTERN | 1118 | UNIV_INTERN |
1026 | 1086 | void | 1119 | void |
1029 | 1087 | log_online_follow_redo_log() | 1120 | log_online_follow_redo_log(void) |
1030 | 1088 | /*========================*/ | 1121 | /*============================*/ |
1031 | 1089 | { | 1122 | { |
1032 | 1090 | ib_uint64_t contiguous_start_lsn; | 1123 | ib_uint64_t contiguous_start_lsn; |
1033 | 1091 | log_group_t* group; | 1124 | log_group_t* group; |
1034 | 1092 | 1125 | ||
1035 | 1126 | mutex_enter(&log_bmp_sys->mutex); | ||
1036 | 1127 | |||
1037 | 1093 | /* Grab the LSN of the last checkpoint, we will parse up to it */ | 1128 | /* Grab the LSN of the last checkpoint, we will parse up to it */ |
1038 | 1094 | mutex_enter(&(log_sys->mutex)); | 1129 | mutex_enter(&(log_sys->mutex)); |
1039 | 1095 | log_bmp_sys->end_lsn = log_sys->last_checkpoint_lsn; | 1130 | log_bmp_sys->end_lsn = log_sys->last_checkpoint_lsn; |
1040 | 1096 | mutex_exit(&(log_sys->mutex)); | 1131 | mutex_exit(&(log_sys->mutex)); |
1041 | 1097 | 1132 | ||
1042 | 1098 | if (log_bmp_sys->end_lsn == log_bmp_sys->start_lsn) { | 1133 | if (log_bmp_sys->end_lsn == log_bmp_sys->start_lsn) { |
1043 | 1134 | mutex_exit(&log_bmp_sys->mutex); | ||
1044 | 1099 | return; | 1135 | return; |
1045 | 1100 | } | 1136 | } |
1046 | 1101 | 1137 | ||
1047 | @@ -1117,6 +1153,8 @@ | |||
1048 | 1117 | log_online_write_bitmap(); | 1153 | log_online_write_bitmap(); |
1049 | 1118 | log_bmp_sys->start_lsn = log_bmp_sys->end_lsn; | 1154 | log_bmp_sys->start_lsn = log_bmp_sys->end_lsn; |
1050 | 1119 | log_set_tracked_lsn(log_bmp_sys->start_lsn); | 1155 | log_set_tracked_lsn(log_bmp_sys->start_lsn); |
1051 | 1156 | |||
1052 | 1157 | mutex_exit(&log_bmp_sys->mutex); | ||
1053 | 1120 | } | 1158 | } |
1054 | 1121 | 1159 | ||
1055 | 1122 | /*********************************************************************//** | 1160 | /*********************************************************************//** |
1056 | @@ -1514,3 +1552,76 @@ | |||
1057 | 1514 | 1552 | ||
1058 | 1515 | return TRUE; | 1553 | return TRUE; |
1059 | 1516 | } | 1554 | } |
1060 | 1555 | |||
1061 | 1556 | /************************************************************//** | ||
1062 | 1557 | Delete all the bitmap files for data less than the specified LSN. | ||
1063 | 1558 | If called with lsn == 0 (i.e. set by RESET request) or | ||
1064 | 1559 | IB_ULONGLONG_MAX, restart the bitmap file sequence, otherwise | ||
1065 | 1560 | continue it. | ||
1066 | 1561 | |||
1067 | 1562 | @return FALSE to indicate success, TRUE for failure. */ | ||
1068 | 1563 | UNIV_INTERN | ||
1069 | 1564 | ibool | ||
1070 | 1565 | log_online_purge_changed_page_bitmaps( | ||
1071 | 1566 | /*==================================*/ | ||
1072 | 1567 | ib_uint64_t lsn) /*!< in: LSN to purge files up to */ | ||
1073 | 1568 | { | ||
1074 | 1569 | log_online_bitmap_file_range_t bitmap_files; | ||
1075 | 1570 | size_t i; | ||
1076 | 1571 | ibool result = FALSE; | ||
1077 | 1572 | |||
1078 | 1573 | if (lsn == 0) { | ||
1079 | 1574 | lsn = IB_ULONGLONG_MAX; | ||
1080 | 1575 | } | ||
1081 | 1576 | |||
1082 | 1577 | if (srv_track_changed_pages) { | ||
1083 | 1578 | /* User requests might happen with both enabled and disabled | ||
1084 | 1579 | tracking */ | ||
1085 | 1580 | mutex_enter(&log_bmp_sys->mutex); | ||
1086 | 1581 | } | ||
1087 | 1582 | |||
1088 | 1583 | if (!log_online_setup_bitmap_file_range(&bitmap_files, 0, lsn)) { | ||
1089 | 1584 | if (srv_track_changed_pages) { | ||
1090 | 1585 | mutex_exit(&log_bmp_sys->mutex); | ||
1091 | 1586 | } | ||
1092 | 1587 | return TRUE; | ||
1093 | 1588 | } | ||
1094 | 1589 | |||
1095 | 1590 | if (srv_track_changed_pages && lsn >= log_bmp_sys->end_lsn) { | ||
1096 | 1591 | /* If we have to delete the current output file, close it | ||
1097 | 1592 | first. */ | ||
1098 | 1593 | os_file_close(log_bmp_sys->out.file); | ||
1099 | 1594 | log_bmp_sys->out.file = -1; | ||
1100 | 1595 | } | ||
1101 | 1596 | |||
1102 | 1597 | for (i = 0; i < bitmap_files.count; i++) { | ||
1103 | 1598 | if (bitmap_files.files[i].seq_num == 0 | ||
1104 | 1599 | || bitmap_files.files[i].start_lsn >= lsn) { | ||
1105 | 1600 | break; | ||
1106 | 1601 | } | ||
1107 | 1602 | if (!os_file_delete_if_exists(bitmap_files.files[i].name)) { | ||
1108 | 1603 | os_file_get_last_error(TRUE); | ||
1109 | 1604 | result = TRUE; | ||
1110 | 1605 | break; | ||
1111 | 1606 | } | ||
1112 | 1607 | } | ||
1113 | 1608 | |||
1114 | 1609 | if (srv_track_changed_pages) { | ||
1115 | 1610 | if (lsn > log_bmp_sys->end_lsn) { | ||
1116 | 1611 | if (lsn == IB_ULONGLONG_MAX) { | ||
1117 | 1612 | /* RESET restarts the sequence */ | ||
1118 | 1613 | log_bmp_sys->out_seq_num = 0; | ||
1119 | 1614 | log_online_rotate_bitmap_file(0); | ||
1120 | 1615 | } else { | ||
1121 | 1616 | /* PURGE continues the sequence */ | ||
1122 | 1617 | log_online_rotate_bitmap_file | ||
1123 | 1618 | (log_bmp_sys->end_lsn); | ||
1124 | 1619 | } | ||
1125 | 1620 | } | ||
1126 | 1621 | |||
1127 | 1622 | mutex_exit(&log_bmp_sys->mutex); | ||
1128 | 1623 | } | ||
1129 | 1624 | |||
1130 | 1625 | free(bitmap_files.files); | ||
1131 | 1626 | return result; | ||
1132 | 1627 | } |
Typo in the id - it's 16274.