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