Merge lp:~vlad-lesin/percona-server/preload_tables.5.5.16 into lp:percona-server/5.5
- preload_tables.5.5.16
- Merge into 5.5
Proposed by
Vlad Lesin
Status: | Work in progress |
---|---|
Proposed branch: | lp:~vlad-lesin/percona-server/preload_tables.5.5.16 |
Merge into: | lp:percona-server/5.5 |
Diff against target: |
801 lines (+771/-0) 3 files modified
patches/innodb_preload_tables.patch (+768/-0) patches/mysql-test.diff (+2/-0) patches/series (+1/-0) |
To merge this branch: | bzr merge lp:~vlad-lesin/percona-server/preload_tables.5.5.16 |
Related bugs: | |
Related blueprints: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Laurynas Biveinis (community) | Needs Fixing | ||
Stewart Smith | Pending | ||
Review via email: mp+80693@code.launchpad.net |
Commit message
Description of the change
The implementation of https:/
To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote : | # |
review:
Needs Fixing
Unmerged revisions
- 195. By Vlad Lesin
-
functional tests
- 194. By Vlad Lesin
-
system vars test
- 193. By Vlad Lesin
-
Preload tables code has been added. The tests will be in futher commits.
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === added file 'patches/innodb_preload_tables.patch' | |||
2 | --- patches/innodb_preload_tables.patch 1970-01-01 00:00:00 +0000 | |||
3 | +++ patches/innodb_preload_tables.patch 2011-10-28 16:11:24 +0000 | |||
4 | @@ -0,0 +1,768 @@ | |||
5 | 1 | diff -ruN a/mysql-test/suite/sys_vars/r/innodb_preload_tables_basic.result b/mysql-test/suite/sys_vars/r/innodb_preload_tables_basic.result | ||
6 | 2 | --- a/mysql-test/suite/sys_vars/r/innodb_preload_tables_basic.result 1970-01-01 03:00:00.000000000 +0300 | ||
7 | 3 | +++ b/mysql-test/suite/sys_vars/r/innodb_preload_tables_basic.result 2011-10-27 17:43:15.502166789 +0400 | ||
8 | 4 | @@ -0,0 +1,53 @@ | ||
9 | 5 | +'#---------------------BS_STVARS_035_01----------------------#' | ||
10 | 6 | +SELECT COUNT(@@GLOBAL.innodb_preload_tables); | ||
11 | 7 | +COUNT(@@GLOBAL.innodb_preload_tables) | ||
12 | 8 | +0 | ||
13 | 9 | +1 Expected | ||
14 | 10 | +'#---------------------BS_STVARS_035_02----------------------#' | ||
15 | 11 | +SET @@GLOBAL.innodb_preload_tables=1; | ||
16 | 12 | +ERROR HY000: Variable 'innodb_preload_tables' is a read only variable | ||
17 | 13 | +Expected error 'Read only variable' | ||
18 | 14 | +SELECT COUNT(@@GLOBAL.innodb_preload_tables); | ||
19 | 15 | +COUNT(@@GLOBAL.innodb_preload_tables) | ||
20 | 16 | +0 | ||
21 | 17 | +1 Expected | ||
22 | 18 | +'#---------------------BS_STVARS_035_03----------------------#' | ||
23 | 19 | +SELECT @@GLOBAL.innodb_preload_tables = VARIABLE_VALUE | ||
24 | 20 | +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
25 | 21 | +WHERE VARIABLE_NAME='innodb_preload_tables'; | ||
26 | 22 | +@@GLOBAL.innodb_preload_tables = VARIABLE_VALUE | ||
27 | 23 | +NULL | ||
28 | 24 | +1 Expected | ||
29 | 25 | +SELECT COUNT(@@GLOBAL.innodb_preload_tables); | ||
30 | 26 | +COUNT(@@GLOBAL.innodb_preload_tables) | ||
31 | 27 | +0 | ||
32 | 28 | +1 Expected | ||
33 | 29 | +SELECT COUNT(VARIABLE_VALUE) | ||
34 | 30 | +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
35 | 31 | +WHERE VARIABLE_NAME='innodb_preload_tables'; | ||
36 | 32 | +COUNT(VARIABLE_VALUE) | ||
37 | 33 | +1 | ||
38 | 34 | +1 Expected | ||
39 | 35 | +'#---------------------BS_STVARS_035_04----------------------#' | ||
40 | 36 | +SELECT @@innodb_preload_tables = @@GLOBAL.innodb_preload_tables; | ||
41 | 37 | +@@innodb_preload_tables = @@GLOBAL.innodb_preload_tables | ||
42 | 38 | +NULL | ||
43 | 39 | +1 Expected | ||
44 | 40 | +'#---------------------BS_STVARS_035_05----------------------#' | ||
45 | 41 | +SELECT COUNT(@@innodb_preload_tables); | ||
46 | 42 | +COUNT(@@innodb_preload_tables) | ||
47 | 43 | +0 | ||
48 | 44 | +1 Expected | ||
49 | 45 | +SELECT COUNT(@@local.innodb_preload_tables); | ||
50 | 46 | +ERROR HY000: Variable 'innodb_preload_tables' is a GLOBAL variable | ||
51 | 47 | +Expected error 'Variable is a GLOBAL variable' | ||
52 | 48 | +SELECT COUNT(@@SESSION.innodb_preload_tables); | ||
53 | 49 | +ERROR HY000: Variable 'innodb_preload_tables' is a GLOBAL variable | ||
54 | 50 | +Expected error 'Variable is a GLOBAL variable' | ||
55 | 51 | +SELECT COUNT(@@GLOBAL.innodb_preload_tables); | ||
56 | 52 | +COUNT(@@GLOBAL.innodb_preload_tables) | ||
57 | 53 | +0 | ||
58 | 54 | +1 Expected | ||
59 | 55 | +SELECT innodb_preload_tables = @@SESSION.innodb_preload_tables; | ||
60 | 56 | +ERROR 42S22: Unknown column 'innodb_preload_tables' in 'field list' | ||
61 | 57 | +Expected error 'Readonly variable' | ||
62 | 58 | diff -ruN a/mysql-test/suite/sys_vars/t/innodb_preload_tables_basic.test b/mysql-test/suite/sys_vars/t/innodb_preload_tables_basic.test | ||
63 | 59 | --- a/mysql-test/suite/sys_vars/t/innodb_preload_tables_basic.test 1970-01-01 03:00:00.000000000 +0300 | ||
64 | 60 | +++ b/mysql-test/suite/sys_vars/t/innodb_preload_tables_basic.test 2011-10-27 17:43:15.502166789 +0400 | ||
65 | 61 | @@ -0,0 +1,103 @@ | ||
66 | 62 | + | ||
67 | 63 | + | ||
68 | 64 | +################## mysql-test\t\innodb_preload_tables_basic.test ####### | ||
69 | 65 | +# # | ||
70 | 66 | +# Variable Name: innodb_preload_tables # | ||
71 | 67 | +# Scope: Global # | ||
72 | 68 | +# Access Type: Static # | ||
73 | 69 | +# Data Type: numeric # | ||
74 | 70 | +# # | ||
75 | 71 | +# # | ||
76 | 72 | +# Creation Date: 2011-05-06 # | ||
77 | 73 | +# Author : Vladislav Lesin # | ||
78 | 74 | +# # | ||
79 | 75 | +# # | ||
80 | 76 | +# Description:Test Cases of Dynamic System Variable # | ||
81 | 77 | +# innodb_preload_tables # | ||
82 | 78 | +# that checks the behavior of this variable in the following ways # | ||
83 | 79 | +# * Value Check # | ||
84 | 80 | +# * Scope Check # | ||
85 | 81 | +# # | ||
86 | 82 | +# Reference: http://dev.mysql.com/doc/refman/5.1/en/ # | ||
87 | 83 | +# server-system-variables.html # | ||
88 | 84 | +# # | ||
89 | 85 | +############################################################################### | ||
90 | 86 | + | ||
91 | 87 | +--source include/have_innodb.inc | ||
92 | 88 | + | ||
93 | 89 | +--echo '#---------------------BS_STVARS_035_01----------------------#' | ||
94 | 90 | +#################################################################### | ||
95 | 91 | +# Displaying default value # | ||
96 | 92 | +#################################################################### | ||
97 | 93 | +SELECT COUNT(@@GLOBAL.innodb_preload_tables); | ||
98 | 94 | +--echo 1 Expected | ||
99 | 95 | + | ||
100 | 96 | + | ||
101 | 97 | +--echo '#---------------------BS_STVARS_035_02----------------------#' | ||
102 | 98 | +#################################################################### | ||
103 | 99 | +# Check if Value can set # | ||
104 | 100 | +#################################################################### | ||
105 | 101 | + | ||
106 | 102 | +--error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
107 | 103 | +SET @@GLOBAL.innodb_preload_tables=1; | ||
108 | 104 | +--echo Expected error 'Read only variable' | ||
109 | 105 | + | ||
110 | 106 | +SELECT COUNT(@@GLOBAL.innodb_preload_tables); | ||
111 | 107 | +--echo 1 Expected | ||
112 | 108 | + | ||
113 | 109 | + | ||
114 | 110 | + | ||
115 | 111 | + | ||
116 | 112 | +--echo '#---------------------BS_STVARS_035_03----------------------#' | ||
117 | 113 | +################################################################# | ||
118 | 114 | +# Check if the value in GLOBAL Table matches value in variable # | ||
119 | 115 | +################################################################# | ||
120 | 116 | + | ||
121 | 117 | +SELECT @@GLOBAL.innodb_preload_tables = VARIABLE_VALUE | ||
122 | 118 | +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
123 | 119 | +WHERE VARIABLE_NAME='innodb_preload_tables'; | ||
124 | 120 | +--echo 1 Expected | ||
125 | 121 | + | ||
126 | 122 | +SELECT COUNT(@@GLOBAL.innodb_preload_tables); | ||
127 | 123 | +--echo 1 Expected | ||
128 | 124 | + | ||
129 | 125 | +SELECT COUNT(VARIABLE_VALUE) | ||
130 | 126 | +FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES | ||
131 | 127 | +WHERE VARIABLE_NAME='innodb_preload_tables'; | ||
132 | 128 | +--echo 1 Expected | ||
133 | 129 | + | ||
134 | 130 | + | ||
135 | 131 | + | ||
136 | 132 | +--echo '#---------------------BS_STVARS_035_04----------------------#' | ||
137 | 133 | +################################################################################ | ||
138 | 134 | +# Check if accessing variable with and without GLOBAL point to same variable # | ||
139 | 135 | +################################################################################ | ||
140 | 136 | +SELECT @@innodb_preload_tables = @@GLOBAL.innodb_preload_tables; | ||
141 | 137 | +--echo 1 Expected | ||
142 | 138 | + | ||
143 | 139 | + | ||
144 | 140 | + | ||
145 | 141 | +--echo '#---------------------BS_STVARS_035_05----------------------#' | ||
146 | 142 | +################################################################################ | ||
147 | 143 | +# Check if innodb_preload_tables can be accessed with and without @@ sign # | ||
148 | 144 | +################################################################################ | ||
149 | 145 | + | ||
150 | 146 | +SELECT COUNT(@@innodb_preload_tables); | ||
151 | 147 | +--echo 1 Expected | ||
152 | 148 | + | ||
153 | 149 | +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
154 | 150 | +SELECT COUNT(@@local.innodb_preload_tables); | ||
155 | 151 | +--echo Expected error 'Variable is a GLOBAL variable' | ||
156 | 152 | + | ||
157 | 153 | +--Error ER_INCORRECT_GLOBAL_LOCAL_VAR | ||
158 | 154 | +SELECT COUNT(@@SESSION.innodb_preload_tables); | ||
159 | 155 | +--echo Expected error 'Variable is a GLOBAL variable' | ||
160 | 156 | + | ||
161 | 157 | +SELECT COUNT(@@GLOBAL.innodb_preload_tables); | ||
162 | 158 | +--echo 1 Expected | ||
163 | 159 | + | ||
164 | 160 | +--Error ER_BAD_FIELD_ERROR | ||
165 | 161 | +SELECT innodb_preload_tables = @@SESSION.innodb_preload_tables; | ||
166 | 162 | +--echo Expected error 'Readonly variable' | ||
167 | 163 | + | ||
168 | 164 | + | ||
169 | 165 | diff -ruN a/mysql-test/include/innodb_preload_tables.inc b/mysql-test/include/innodb_preload_tables.inc | ||
170 | 166 | --- a/mysql-test/include/innodb_preload_tables.inc 1970-01-01 03:00:00.000000000 +0300 | ||
171 | 167 | +++ b/mysql-test/include/innodb_preload_tables.inc 2011-10-28 19:39:09.254999005 +0400 | ||
172 | 168 | @@ -0,0 +1,92 @@ | ||
173 | 169 | +# ==== Purpose ==== | ||
174 | 170 | +# | ||
175 | 171 | +# Test preloading tables into innodb buffer pool with | ||
176 | 172 | +# different parameters | ||
177 | 173 | +# | ||
178 | 174 | +# ==== Usage ==== | ||
179 | 175 | +# [--let $file_format= format] | ||
180 | 176 | +# [--let $create_table_tail= tail] | ||
181 | 177 | +# --source include/restart_mysqld_with_parameters.inc | ||
182 | 178 | +# | ||
183 | 179 | +# Parameters: | ||
184 | 180 | +# | ||
185 | 181 | +# $file_format | ||
186 | 182 | +# Innodb tablespace file format | ||
187 | 183 | +# $create_table_tail | ||
188 | 184 | +# This tail will be added to table creation statement | ||
189 | 185 | + | ||
190 | 186 | +# Restart server with innodb_file_per_table enabled and Antelope file format | ||
191 | 187 | +--let $server_parameters= --innodb-file-per-table --innodb-file-format=$file_format | ||
192 | 188 | +--source include/restart_mysqld_with_parameters.inc | ||
193 | 189 | + | ||
194 | 190 | +--disable_warnings | ||
195 | 191 | +drop table if exists t1, t2, t3; | ||
196 | 192 | +--enable_warnings | ||
197 | 193 | + | ||
198 | 194 | +# Create test tables | ||
199 | 195 | +eval CREATE TABLE t1 ( | ||
200 | 196 | + col1 int not null auto_increment primary key, | ||
201 | 197 | + col2 char(255) not null) ENGINE=INNODB $create_table_tail; | ||
202 | 198 | + | ||
203 | 199 | +eval CREATE TABLE t2 ( | ||
204 | 200 | + col1 int not null auto_increment primary key, | ||
205 | 201 | + col2 char(255) not null) ENGINE=INNODB $create_table_tail; | ||
206 | 202 | + | ||
207 | 203 | +eval CREATE TABLE t3 ( | ||
208 | 204 | + col1 int not null auto_increment primary key, | ||
209 | 205 | + col2 char(255) not null) ENGINE=INNODB $create_table_tail; | ||
210 | 206 | + | ||
211 | 207 | +--disable_query_log | ||
212 | 208 | +# Fill the tables with some data | ||
213 | 209 | +start transaction; | ||
214 | 210 | +--let $num= 1000 | ||
215 | 211 | +--while($num) { | ||
216 | 212 | +--eval insert into t1 set col2 = 'some value $num'; | ||
217 | 213 | +--dec $num | ||
218 | 214 | +--} | ||
219 | 215 | +--let $num= 1000 | ||
220 | 216 | +--while($num) { | ||
221 | 217 | +--eval insert into t2 set col2 = 'some value $num'; | ||
222 | 218 | +--dec $num | ||
223 | 219 | +--} | ||
224 | 220 | +--let $num= 1000 | ||
225 | 221 | +--while($num) { | ||
226 | 222 | +--eval insert into t3 set col2 = 'some value $num'; | ||
227 | 223 | +--dec $num | ||
228 | 224 | +--} | ||
229 | 225 | +commit; | ||
230 | 226 | +--enable_query_log | ||
231 | 227 | + | ||
232 | 228 | +# Restart server with preloading the whole testing tables | ||
233 | 229 | +--let $server_parameters= --innodb-file-per-table --innodb-file-format=$file_format --innodb-preload-tables=test.t1,test.t2,test.t3 | ||
234 | 230 | +--source include/restart_mysqld_with_parameters.inc | ||
235 | 231 | + | ||
236 | 232 | +# Check if the tables in the buffer pool | ||
237 | 233 | +let $t1_size= `select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
238 | 234 | + (select space from information_schema.INNODB_SYS_TABLES where name = 't1' and `schema` = 'test')`; | ||
239 | 235 | +--echo $t1_size | ||
240 | 236 | +let $t2_size= `select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
241 | 237 | + (select space from information_schema.INNODB_SYS_TABLES where name = 't2' and `schema` = 'test')`; | ||
242 | 238 | +--echo $t2_size | ||
243 | 239 | +let $t3_size= `select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
244 | 240 | + (select space from information_schema.INNODB_SYS_TABLES where name = 't3' and `schema` ='test')`; | ||
245 | 241 | +--echo $t3_size | ||
246 | 242 | + | ||
247 | 243 | +# Restart server with tails preloading | ||
248 | 244 | +--let $server_parameters= --innodb-file-per-table --innodb-file-format=$file_format --innodb-preload-tables=test.t1:1,test.t2:2,test.t3:3 | ||
249 | 245 | +--source include/restart_mysqld_with_parameters.inc | ||
250 | 246 | + | ||
251 | 247 | +# It's impossible to predict the exactly number of preloaded pages due to read ahead algorithm. | ||
252 | 248 | +# That's why only comparision between the whole size and the readed size is used. | ||
253 | 249 | +eval select $t1_size > | ||
254 | 250 | + (select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
255 | 251 | + (select space from information_schema.INNODB_SYS_TABLES where name = 't1' and `schema` = 'test')); | ||
256 | 252 | +eval select $t2_size > | ||
257 | 253 | + (select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
258 | 254 | + (select space from information_schema.INNODB_SYS_TABLES where name = 't2' and `schema` = 'test')); | ||
259 | 255 | +eval select $t3_size > | ||
260 | 256 | + (select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
261 | 257 | + (select space from information_schema.INNODB_SYS_TABLES where name = 't3' and `schema` = 'test')); | ||
262 | 258 | + | ||
263 | 259 | +drop table t1, t2, t3; | ||
264 | 260 | + | ||
265 | 261 | diff -ruN a/mysql-test/include/restart_mysqld_with_parameters.inc b/mysql-test/include/restart_mysqld_with_parameters.inc | ||
266 | 262 | --- a/mysql-test/include/restart_mysqld_with_parameters.inc 1970-01-01 03:00:00.000000000 +0300 | ||
267 | 263 | +++ b/mysql-test/include/restart_mysqld_with_parameters.inc 2011-10-28 18:47:07.095020567 +0400 | ||
268 | 264 | @@ -0,0 +1,25 @@ | ||
269 | 265 | +# ==== Purpose ==== | ||
270 | 266 | +# | ||
271 | 267 | +# Shut down and shut up a server with parameters. | ||
272 | 268 | +# | ||
273 | 269 | +# ==== Usage ==== | ||
274 | 270 | +# | ||
275 | 271 | +# [--let $server_parameters= --flag1 --flag2 ...] | ||
276 | 272 | +# --source include/restart_mysqld_with_parameters.inc | ||
277 | 273 | +# | ||
278 | 274 | +# ==== See also ==== | ||
279 | 275 | +# | ||
280 | 276 | +# restart_mysqld.inc | ||
281 | 277 | + | ||
282 | 278 | +--let $_server_id= `SELECT @@server_id` | ||
283 | 279 | +--let $_start_server_command= restart | ||
284 | 280 | +--let $_expect_file_name= $MYSQLTEST_VARDIR/tmp/mysqld.$_server_id.expect | ||
285 | 281 | + | ||
286 | 282 | +--exec echo "wait" > $_expect_file_name | ||
287 | 283 | +--shutdown_server 10 | ||
288 | 284 | +--source include/wait_until_disconnected.inc | ||
289 | 285 | +--exec echo $_start_server_command:$server_parameters > $_expect_file_name | ||
290 | 286 | +--enable_reconnect | ||
291 | 287 | +--source include/wait_until_connected_again.inc | ||
292 | 288 | + | ||
293 | 289 | + | ||
294 | 290 | diff -ruN a/mysql-test/r/innodb_preload_tables.result b/mysql-test/r/innodb_preload_tables.result | ||
295 | 291 | --- a/mysql-test/r/innodb_preload_tables.result 1970-01-01 03:00:00.000000000 +0300 | ||
296 | 292 | +++ b/mysql-test/r/innodb_preload_tables.result 2011-10-28 19:37:36.045004542 +0400 | ||
297 | 293 | @@ -0,0 +1,70 @@ | ||
298 | 294 | +drop table if exists t1, t2, t3; | ||
299 | 295 | +CREATE TABLE t1 ( | ||
300 | 296 | +col1 int not null auto_increment primary key, | ||
301 | 297 | +col2 char(255) not null) ENGINE=INNODB ; | ||
302 | 298 | +CREATE TABLE t2 ( | ||
303 | 299 | +col1 int not null auto_increment primary key, | ||
304 | 300 | +col2 char(255) not null) ENGINE=INNODB ; | ||
305 | 301 | +CREATE TABLE t3 ( | ||
306 | 302 | +col1 int not null auto_increment primary key, | ||
307 | 303 | +col2 char(255) not null) ENGINE=INNODB ; | ||
308 | 304 | +25 | ||
309 | 305 | +25 | ||
310 | 306 | +25 | ||
311 | 307 | +select 25 > | ||
312 | 308 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
313 | 309 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't1' and `schema` = 'test')); | ||
314 | 310 | +25 > | ||
315 | 311 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
316 | 312 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't1' and `schema` = 'test')) | ||
317 | 313 | +1 | ||
318 | 314 | +select 25 > | ||
319 | 315 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
320 | 316 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't2' and `schema` = 'test')); | ||
321 | 317 | +25 > | ||
322 | 318 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
323 | 319 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't2' and `schema` = 'test')) | ||
324 | 320 | +1 | ||
325 | 321 | +select 25 > | ||
326 | 322 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
327 | 323 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't3' and `schema` = 'test')); | ||
328 | 324 | +25 > | ||
329 | 325 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
330 | 326 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't3' and `schema` = 'test')) | ||
331 | 327 | +1 | ||
332 | 328 | +drop table t1, t2, t3; | ||
333 | 329 | +drop table if exists t1, t2, t3; | ||
334 | 330 | +CREATE TABLE t1 ( | ||
335 | 331 | +col1 int not null auto_increment primary key, | ||
336 | 332 | +col2 char(255) not null) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; | ||
337 | 333 | +CREATE TABLE t2 ( | ||
338 | 334 | +col1 int not null auto_increment primary key, | ||
339 | 335 | +col2 char(255) not null) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; | ||
340 | 336 | +CREATE TABLE t3 ( | ||
341 | 337 | +col1 int not null auto_increment primary key, | ||
342 | 338 | +col2 char(255) not null) ENGINE=INNODB ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4; | ||
343 | 339 | +25 | ||
344 | 340 | +25 | ||
345 | 341 | +25 | ||
346 | 342 | +select 25 > | ||
347 | 343 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
348 | 344 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't1' and `schema` = 'test')); | ||
349 | 345 | +25 > | ||
350 | 346 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
351 | 347 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't1' and `schema` = 'test')) | ||
352 | 348 | +1 | ||
353 | 349 | +select 25 > | ||
354 | 350 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
355 | 351 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't2' and `schema` = 'test')); | ||
356 | 352 | +25 > | ||
357 | 353 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
358 | 354 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't2' and `schema` = 'test')) | ||
359 | 355 | +1 | ||
360 | 356 | +select 25 > | ||
361 | 357 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
362 | 358 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't3' and `schema` = 'test')); | ||
363 | 359 | +25 > | ||
364 | 360 | +(select count(*) from information_schema.INNODB_BUFFER_POOL_PAGES where space_id = | ||
365 | 361 | +(select space from information_schema.INNODB_SYS_TABLES where name = 't3' and `schema` = 'test')) | ||
366 | 362 | +1 | ||
367 | 363 | +drop table t1, t2, t3; | ||
368 | 364 | diff -ruN a/mysql-test/t/innodb_preload_tables.test b/mysql-test/t/innodb_preload_tables.test | ||
369 | 365 | --- a/mysql-test/t/innodb_preload_tables.test 1970-01-01 03:00:00.000000000 +0300 | ||
370 | 366 | +++ b/mysql-test/t/innodb_preload_tables.test 2011-10-28 18:48:01.645213042 +0400 | ||
371 | 367 | @@ -0,0 +1,13 @@ | ||
372 | 368 | +################################################################# | ||
373 | 369 | +# Check preloading noncompressed innodb tables into buffer pool # | ||
374 | 370 | +################################################################# | ||
375 | 371 | +--let $file_format= antelope | ||
376 | 372 | +--let $create_table_tail= | ||
377 | 373 | +--source include/innodb_preload_tables.inc | ||
378 | 374 | + | ||
379 | 375 | +################################################################################ | ||
380 | 376 | +# Check preloading compressed and noncompressed innodb tables into buffer pool # | ||
381 | 377 | +################################################################################ | ||
382 | 378 | +--let $file_format= barracuda | ||
383 | 379 | +--let $create_table_tail= ROW_FORMAT=COMPRESSED KEY_BLOCK_SIZE=4 | ||
384 | 380 | +--source include/innodb_preload_tables.inc | ||
385 | 381 | |||
386 | 382 | diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc | ||
387 | 383 | --- a/storage/innobase/handler/ha_innodb.cc 2011-10-26 19:22:35.610637723 +0400 | ||
388 | 384 | +++ b/storage/innobase/handler/ha_innodb.cc 2011-10-27 17:43:15.862148091 +0400 | ||
389 | 385 | @@ -11778,6 +11778,13 @@ | ||
390 | 386 | "Stores each InnoDB table to an .ibd file in the database dir.", | ||
391 | 387 | NULL, NULL, FALSE); | ||
392 | 388 | |||
393 | 389 | +static MYSQL_SYSVAR_STR(preload_tables, srv_preload_tables, | ||
394 | 390 | + PLUGIN_VAR_RQCMDARG | PLUGIN_VAR_MEMALLOC | PLUGIN_VAR_READONLY, | ||
395 | 391 | + "A coma separated list of names of tables (db_name.tbl_name:page_no,...) which need " | ||
396 | 392 | + "to be preloaded into innodb buffer pool. page_no - a pages count to preload from " | ||
397 | 393 | + "the end of tablespace", | ||
398 | 394 | + NULL, NULL, NULL); | ||
399 | 395 | + | ||
400 | 396 | static MYSQL_SYSVAR_STR(file_format, innobase_file_format_name, | ||
401 | 397 | PLUGIN_VAR_RQCMDARG, | ||
402 | 398 | "File format to use for new tables in .ibd files.", | ||
403 | 399 | @@ -12290,6 +12297,7 @@ | ||
404 | 400 | MYSQL_SYSVAR(read_io_threads), | ||
405 | 401 | MYSQL_SYSVAR(write_io_threads), | ||
406 | 402 | MYSQL_SYSVAR(file_per_table), | ||
407 | 403 | + MYSQL_SYSVAR(preload_tables), | ||
408 | 404 | MYSQL_SYSVAR(file_format), | ||
409 | 405 | MYSQL_SYSVAR(file_format_check), | ||
410 | 406 | MYSQL_SYSVAR(file_format_max), | ||
411 | 407 | diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h | ||
412 | 408 | --- a/storage/innobase/include/srv0srv.h 2011-10-26 19:22:35.260643726 +0400 | ||
413 | 409 | +++ b/storage/innobase/include/srv0srv.h 2011-10-27 17:43:15.502166789 +0400 | ||
414 | 410 | @@ -168,6 +168,8 @@ | ||
415 | 411 | extern ulint srv_mem_pool_size; | ||
416 | 412 | extern ulint srv_lock_table_size; | ||
417 | 413 | |||
418 | 414 | +extern char *srv_preload_tables; | ||
419 | 415 | + | ||
420 | 416 | extern ibool srv_thread_concurrency_timer_based; | ||
421 | 417 | |||
422 | 418 | extern ulint srv_n_file_io_threads; | ||
423 | 419 | diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c | ||
424 | 420 | --- a/storage/innobase/srv/srv0srv.c 2011-10-26 19:22:35.260643726 +0400 | ||
425 | 421 | +++ b/storage/innobase/srv/srv0srv.c 2011-10-27 17:43:15.502166789 +0400 | ||
426 | 422 | @@ -236,6 +236,11 @@ | ||
427 | 423 | UNIV_INTERN ulint srv_mem_pool_size = ULINT_MAX; | ||
428 | 424 | UNIV_INTERN ulint srv_lock_table_size = ULINT_MAX; | ||
429 | 425 | |||
430 | 426 | +/*A coma separated list of names of tables (db_name.tbl_name:page_no,...) which need | ||
431 | 427 | + to be preloaded into innodb buffer pool. page_no - a pages count to preload from | ||
432 | 428 | + the end of tablespace */ | ||
433 | 429 | +UNIV_INTERN char *srv_preload_tables = NULL; | ||
434 | 430 | + | ||
435 | 431 | /* This parameter is deprecated. Use srv_n_io_[read|write]_threads | ||
436 | 432 | instead. */ | ||
437 | 433 | UNIV_INTERN ulint srv_n_file_io_threads = ULINT_MAX; | ||
438 | 434 | diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c | ||
439 | 435 | --- a/storage/innobase/srv/srv0start.c 2011-10-26 19:22:35.140685396 +0400 | ||
440 | 436 | +++ b/storage/innobase/srv/srv0start.c 2011-10-27 17:43:15.502166789 +0400 | ||
441 | 437 | @@ -62,6 +61,8 @@ | ||
442 | 438 | #include "ibuf0ibuf.h" | ||
443 | 439 | #include "srv0start.h" | ||
444 | 440 | #include "srv0srv.h" | ||
445 | 441 | +#include "mysql_com.h" /* NAME_LEN */ | ||
446 | 442 | +#include "dyn0dyn.h" | ||
447 | 443 | #ifndef UNIV_HOTBACKUP | ||
448 | 444 | # include "os0proc.h" | ||
449 | 445 | # include "sync0sync.h" | ||
450 | 446 | @@ -1125,6 +1126,313 @@ | ||
451 | 447 | return(DB_SUCCESS); | ||
452 | 448 | } | ||
453 | 449 | |||
454 | 450 | + | ||
455 | 451 | +/* The struct is used for preloading tables into buffer pool */ | ||
456 | 452 | +struct table_to_preload_struct { | ||
457 | 453 | + char name[NAME_LEN + 1]; /*!< table name */ | ||
458 | 454 | + ulint n_pages; /*!< number of pages to preload | ||
459 | 455 | + from the end of a tablespace */ | ||
460 | 456 | +}; | ||
461 | 457 | + | ||
462 | 458 | +typedef struct table_to_preload_struct table_to_preload_t; | ||
463 | 459 | + | ||
464 | 460 | +/******************************************************************** | ||
465 | 461 | +Removing spaces from the begining and the end of a string. | ||
466 | 462 | +@return the result string length */ | ||
467 | 463 | +UNIV_INTERN | ||
468 | 464 | +ulint | ||
469 | 465 | +remove_spaces_from_begin_and_end( | ||
470 | 466 | + char *str, /*!< in/out: the pointer to a string */ | ||
471 | 467 | + ulint str_len) /*!< in: a string length */ | ||
472 | 468 | +{ | ||
473 | 469 | + char *p; | ||
474 | 470 | + char *p_end; | ||
475 | 471 | + char *begin; | ||
476 | 472 | + char *end; | ||
477 | 473 | + | ||
478 | 474 | + ut_a(str); | ||
479 | 475 | + | ||
480 | 476 | + p_end = str + str_len; | ||
481 | 477 | + | ||
482 | 478 | + for (p = str; *p || p < p_end; ++p) | ||
483 | 479 | + if (*p != ' ') | ||
484 | 480 | + break; | ||
485 | 481 | + | ||
486 | 482 | + if (p == p_end) { | ||
487 | 483 | + *str = 0; | ||
488 | 484 | + return(0); | ||
489 | 485 | + } | ||
490 | 486 | + | ||
491 | 487 | + begin = p; | ||
492 | 488 | + | ||
493 | 489 | + for (p = p_end - 1; p >= str; --p) | ||
494 | 490 | + if (*p != ' ') | ||
495 | 491 | + break; | ||
496 | 492 | + end = p + 1; | ||
497 | 493 | + | ||
498 | 494 | + str_len = end - begin; | ||
499 | 495 | + | ||
500 | 496 | + if (begin != str) | ||
501 | 497 | + memmove(str, begin, str_len); | ||
502 | 498 | + | ||
503 | 499 | + str[str_len] = 0; | ||
504 | 500 | + | ||
505 | 501 | + return str_len; | ||
506 | 502 | +} | ||
507 | 503 | + | ||
508 | 504 | +/******************************************************************** | ||
509 | 505 | +A comma separated list of tables iteration. All dots in the names of tables | ||
510 | 506 | +is replaced with slashes. | ||
511 | 507 | +@return TRUE if there is an element to iterate and FALSE otherwise */ | ||
512 | 508 | +UNIV_INTERN | ||
513 | 509 | +ibool | ||
514 | 510 | +next_table_name( | ||
515 | 511 | + const char **begin, /*!< in/out: a beginning of a string, | ||
516 | 512 | + the *begin will point to the next table name | ||
517 | 513 | + in a list after extracting a current one */ | ||
518 | 514 | + const char *end, /*!< in: the end of the string to iterate */ | ||
519 | 515 | + table_to_preload_t *table_info) /*!< out: table space and pages number to preload */ | ||
520 | 516 | +{ | ||
521 | 517 | + | ||
522 | 518 | + const char *table_name_end; | ||
523 | 519 | + ulint table_name_len; | ||
524 | 520 | + char *p; | ||
525 | 521 | + char *n_pages_end; | ||
526 | 522 | + | ||
527 | 523 | + ut_a(begin); | ||
528 | 524 | + ut_a(end); | ||
529 | 525 | + ut_a(table_info); | ||
530 | 526 | + | ||
531 | 527 | + table_name_end = strchr(*begin, ','); | ||
532 | 528 | + if (!table_name_end) | ||
533 | 529 | + table_name_end = end; | ||
534 | 530 | + table_name_len = table_name_end - *begin; | ||
535 | 531 | + if (table_name_len > sizeof(table_info->name) - 1) { | ||
536 | 532 | + fprintf(stderr, "InnoDB: Warning:" | ||
537 | 533 | + " A full table name length is greater then %lu limit." | ||
538 | 534 | + " Skipping preloading table with wrong name.\n", | ||
539 | 535 | + sizeof(table_info->name) - 1); | ||
540 | 536 | + goto error; | ||
541 | 537 | + } | ||
542 | 538 | + | ||
543 | 539 | + memcpy(table_info->name, *begin, table_name_len); | ||
544 | 540 | + *begin = *table_name_end ? table_name_end + 1 : table_name_end; | ||
545 | 541 | + | ||
546 | 542 | + table_info->name[table_name_len] = 0; | ||
547 | 543 | + table_name_len = remove_spaces_from_begin_and_end(table_info->name, table_name_len); | ||
548 | 544 | + if (!table_name_len) { | ||
549 | 545 | + fprintf(stderr, "InnoDB: Warning:" | ||
550 | 546 | + " The list of tables names in 'innodb_preload_table'" | ||
551 | 547 | + " system variable contains an empty element.\n"); | ||
552 | 548 | + goto error; | ||
553 | 549 | + } | ||
554 | 550 | + | ||
555 | 551 | + table_info->n_pages = 0; | ||
556 | 552 | + for (p = table_info->name; *p; ++p) { | ||
557 | 553 | + if (*p == '.') | ||
558 | 554 | + *p = '/'; | ||
559 | 555 | + else if (*p == ':') { | ||
560 | 556 | + *p = 0; | ||
561 | 557 | + ++p; | ||
562 | 558 | + table_info->n_pages = strtoul(p, &n_pages_end, 10); | ||
563 | 559 | + if (n_pages_end - p < strlen(p)) { | ||
564 | 560 | + fprintf(stderr, "InnoDB: Warning:" | ||
565 | 561 | + " The number of pages of table '%s' to preload" | ||
566 | 562 | + " into innodb buffer pool can't be parsed. Skip" | ||
567 | 563 | + " the table preloading.\n", table_info->name); | ||
568 | 564 | + goto error; | ||
569 | 565 | + } | ||
570 | 566 | + break; | ||
571 | 567 | + } | ||
572 | 568 | + } | ||
573 | 569 | + | ||
574 | 570 | + return TRUE; | ||
575 | 571 | + | ||
576 | 572 | +error: | ||
577 | 573 | + table_info->n_pages = 0; | ||
578 | 574 | + table_info->name[0] = 0; | ||
579 | 575 | + return FALSE; | ||
580 | 576 | +} | ||
581 | 577 | + | ||
582 | 578 | + | ||
583 | 579 | +/******************************************************************** | ||
584 | 580 | +Finding a dup of the table in array of tables. | ||
585 | 581 | +@return TRUE if a dup was found and FALSE otherwise | ||
586 | 582 | +*/ | ||
587 | 583 | +UNIV_INTERN | ||
588 | 584 | +ibool | ||
589 | 585 | +find_dup( | ||
590 | 586 | + dyn_array_t *tables_info, /*!< in: the array of tables */ | ||
591 | 587 | + const table_to_preload_t *table_info) /*!< in: the table to find */ | ||
592 | 588 | +{ | ||
593 | 589 | + ulint tables_info_size; | ||
594 | 590 | + ulint tables_info_offset; | ||
595 | 591 | + const table_to_preload_t *current_table_info; | ||
596 | 592 | + | ||
597 | 593 | + ut_a(tables_info); | ||
598 | 594 | + ut_a(table_info); | ||
599 | 595 | + | ||
600 | 596 | + tables_info_size = dyn_array_get_data_size(tables_info); | ||
601 | 597 | + tables_info_offset = 0; | ||
602 | 598 | + | ||
603 | 599 | + while (tables_info_offset < tables_info_size) { | ||
604 | 600 | + current_table_info = | ||
605 | 601 | + (const table_to_preload_t *) | ||
606 | 602 | + dyn_array_get_element(tables_info, tables_info_offset); | ||
607 | 603 | + tables_info_offset += sizeof(table_to_preload_t); | ||
608 | 604 | + if (table_info == current_table_info) | ||
609 | 605 | + continue; | ||
610 | 606 | + if (!strcmp(current_table_info->name, table_info->name)) { | ||
611 | 607 | + fprintf(stderr, "Innodb: Warning:" | ||
612 | 608 | + " The innodb_preload_tables contains a duplicate of '%s'\n", | ||
613 | 609 | + current_table_info->name); | ||
614 | 610 | + if ((current_table_info->n_pages || table_info->n_pages) && | ||
615 | 611 | + current_table_info->n_pages != table_info->n_pages) | ||
616 | 612 | + fprintf(stderr, "Innodb: Warning:" | ||
617 | 613 | + " Ambigious declaration the number of pages to preload" | ||
618 | 614 | + " for table '%s' in preloading tables into buffer pool list." | ||
619 | 615 | + " The first declaration '%lu' will be used.\n", | ||
620 | 616 | + current_table_info->name, current_table_info->n_pages); | ||
621 | 617 | + return TRUE; | ||
622 | 618 | + } | ||
623 | 619 | + } | ||
624 | 620 | + | ||
625 | 621 | + return FALSE; | ||
626 | 622 | +} | ||
627 | 623 | + | ||
628 | 624 | +/******************************************************************** | ||
629 | 625 | +Parsing a comma separated list of names of tables into dynamic array | ||
630 | 626 | +of able_to_preload_t. The duplicated elements are ignored. | ||
631 | 627 | +*/ | ||
632 | 628 | +UNIV_INTERN | ||
633 | 629 | +void | ||
634 | 630 | +parse_tables_list( | ||
635 | 631 | + dyn_array_t *tables_info, /*!< out: the array of names of tables */ | ||
636 | 632 | + const char *str_tables_list) /*!< in: the string to parse */ | ||
637 | 633 | +{ | ||
638 | 634 | + const char *p; | ||
639 | 635 | + const char *str_tables_list_end; | ||
640 | 636 | + table_to_preload_t *table_info; | ||
641 | 637 | + | ||
642 | 638 | + ut_a(tables_info); | ||
643 | 639 | + ut_a(str_tables_list); | ||
644 | 640 | + | ||
645 | 641 | + str_tables_list_end = str_tables_list + strlen(str_tables_list); | ||
646 | 642 | + table_info = NULL; | ||
647 | 643 | + /* Using while(*p) here causes code generation error in gcc4.3 */ | ||
648 | 644 | + for (p = str_tables_list; *p; ) { | ||
649 | 645 | + if (!table_info) | ||
650 | 646 | + table_info = (table_to_preload_t *)dyn_array_open(tables_info, sizeof(table_to_preload_t));; | ||
651 | 647 | + if (!next_table_name(&p, str_tables_list_end, table_info)) | ||
652 | 648 | + break; | ||
653 | 649 | + if (table_info->name[0] && !find_dup(tables_info, table_info)) { | ||
654 | 650 | + dyn_array_close(tables_info, (byte *)(table_info + 1)); | ||
655 | 651 | + table_info = NULL; | ||
656 | 652 | + } | ||
657 | 653 | + } | ||
658 | 654 | +} | ||
659 | 655 | + | ||
660 | 656 | + | ||
661 | 657 | +/******************************************************************** | ||
662 | 658 | +Preloading needed tables into the buffer pool. The innodb_preload_tables | ||
663 | 659 | +system variable must contain a comma separated list of tables which need | ||
664 | 660 | +to be preloaded. This feature will work only if the innodb_file_per_table | ||
665 | 661 | +is enabled. Each element in the list may contain the number of pages which | ||
666 | 662 | +will be preloaded from the end of the tablespace. The number of pages may | ||
667 | 663 | +be listen through a colon (base.table:pages). If the buffer pool size is | ||
668 | 664 | +less than the total size of tables listed in the innodb_preload_tables then | ||
669 | 665 | +the preloading procedure will stop when the read size reaches the innodb | ||
670 | 666 | +buffer pool size. | ||
671 | 667 | +*/ | ||
672 | 668 | +UNIV_INTERN | ||
673 | 669 | +void | ||
674 | 670 | +preload_tables_into_buffer_pool(void) | ||
675 | 671 | +{ | ||
676 | 672 | + dict_table_t *table; | ||
677 | 673 | + unsigned space; | ||
678 | 674 | + ulint page; | ||
679 | 675 | + ulint zip_size; | ||
680 | 676 | + ulint space_size; | ||
681 | 677 | + ulint page_size; | ||
682 | 678 | + ulint readed_size; | ||
683 | 679 | + ulint buf_pool_size; | ||
684 | 680 | + mtr_t mtr; | ||
685 | 681 | + dyn_array_t tables_info; | ||
686 | 682 | + ulint tables_info_size; | ||
687 | 683 | + ulint tables_info_offset; | ||
688 | 684 | + table_to_preload_t *table_info; | ||
689 | 685 | + ulint last_page; | ||
690 | 686 | + | ||
691 | 687 | + if (!srv_preload_tables) | ||
692 | 688 | + return; | ||
693 | 689 | + | ||
694 | 690 | + if (!srv_file_per_table) { | ||
695 | 691 | + ut_print_timestamp(stderr); | ||
696 | 692 | + fprintf(stderr, " InnoDB: Warning:" | ||
697 | 693 | + " The option innodb_file_per_table is disabled," | ||
698 | 694 | + " so using innodb_preload_table does no sense.\n"); | ||
699 | 695 | + return; | ||
700 | 696 | + } | ||
701 | 697 | + | ||
702 | 698 | + ut_print_timestamp(stderr); | ||
703 | 699 | + fprintf(stderr, " InnoDB: Preloading tables into buffer pool\n"); | ||
704 | 700 | + | ||
705 | 701 | + readed_size = 0; | ||
706 | 702 | + buf_pool_size = srv_buf_pool_curr_size; | ||
707 | 703 | + | ||
708 | 704 | + dyn_array_create(&tables_info); | ||
709 | 705 | + parse_tables_list(&tables_info, (const char *)srv_preload_tables); | ||
710 | 706 | + tables_info_size = dyn_array_get_data_size(&tables_info); | ||
711 | 707 | + tables_info_offset = 0; | ||
712 | 708 | + | ||
713 | 709 | + while (tables_info_offset < tables_info_size) { | ||
714 | 710 | + table_info = (table_to_preload_t *)dyn_array_get_element(&tables_info, tables_info_offset); | ||
715 | 711 | + tables_info_offset += sizeof(table_to_preload_t); | ||
716 | 712 | + | ||
717 | 713 | + table = dict_table_get(table_info->name, 1); | ||
718 | 714 | + if (!table) { | ||
719 | 715 | + fprintf(stderr, "InnoDB: Warning:" | ||
720 | 716 | + " Can't open the table '%s' while preloading tables" | ||
721 | 717 | + " into innodb buffer pool.\n", table_info->name); | ||
722 | 718 | + continue; | ||
723 | 719 | + } | ||
724 | 720 | + | ||
725 | 721 | + ut_print_timestamp(stderr); | ||
726 | 722 | + fprintf(stderr, | ||
727 | 723 | + " InnoDB: Preloading '%s' table into buffer pool\n", | ||
728 | 724 | + table_info->name); | ||
729 | 725 | + | ||
730 | 726 | + space = table->space; | ||
731 | 727 | + space_size = fil_space_get_size(space); | ||
732 | 728 | + zip_size = fil_space_get_zip_size(space); | ||
733 | 729 | + page_size = zip_size ? zip_size : UNIV_PAGE_SIZE; | ||
734 | 730 | + last_page = (table_info->n_pages && table_info->n_pages < space_size) ? | ||
735 | 731 | + space_size - table_info->n_pages : | ||
736 | 732 | + 0; | ||
737 | 733 | + for (page = space_size; page > last_page; --page) { | ||
738 | 734 | + mtr_start(&mtr); | ||
739 | 735 | + buf_page_get_with_no_latch(space, zip_size, page - 1, &mtr); | ||
740 | 736 | + mtr_commit(&mtr); | ||
741 | 737 | + readed_size += page_size; | ||
742 | 738 | + if (readed_size >= buf_pool_size) { | ||
743 | 739 | + ut_print_timestamp(stderr); | ||
744 | 740 | + fprintf(stderr, " InnoDB: Warning:" | ||
745 | 741 | + " the buffer pool size %lu is less than" | ||
746 | 742 | + " the total size of preloaded tables," | ||
747 | 743 | + " the preloading is stopped.\n", buf_pool_size); | ||
748 | 744 | + dict_table_decrement_handle_count(table, FALSE); | ||
749 | 745 | + goto exit; | ||
750 | 746 | + } | ||
751 | 747 | + }; | ||
752 | 748 | + dict_table_decrement_handle_count(table, FALSE); | ||
753 | 749 | + } | ||
754 | 750 | + ut_print_timestamp(stderr); | ||
755 | 751 | + fprintf(stderr, " InnoDB: Preloading tables into buffer pool done\n"); | ||
756 | 752 | +exit: | ||
757 | 753 | + dyn_array_free(&tables_info); | ||
758 | 754 | +} | ||
759 | 755 | + | ||
760 | 756 | + | ||
761 | 757 | /******************************************************************** | ||
762 | 758 | Starts InnoDB and creates a new database if database files | ||
763 | 759 | are not found and the user wants. | ||
764 | 760 | @@ -2256,6 +2564,8 @@ | ||
765 | 761 | |||
766 | 762 | srv_was_started = TRUE; | ||
767 | 763 | |||
768 | 764 | + preload_tables_into_buffer_pool(); | ||
769 | 765 | + | ||
770 | 766 | return((int) DB_SUCCESS); | ||
771 | 767 | } | ||
772 | 768 | |||
773 | 0 | 769 | ||
774 | === modified file 'patches/mysql-test.diff' | |||
775 | --- patches/mysql-test.diff 2011-10-10 14:35:27 +0000 | |||
776 | +++ patches/mysql-test.diff 2011-10-28 16:11:24 +0000 | |||
777 | @@ -1255,6 +1255,7 @@ | |||
778 | 1255 | +INNODB_OLD_BLOCKS_TIME | 1255 | +INNODB_OLD_BLOCKS_TIME |
779 | 1256 | +INNODB_OPEN_FILES | 1256 | +INNODB_OPEN_FILES |
780 | 1257 | +INNODB_PAGE_SIZE | 1257 | +INNODB_PAGE_SIZE |
781 | 1258 | +INNODB_PRELOAD_TABLES | ||
782 | 1258 | +INNODB_PURGE_BATCH_SIZE | 1259 | +INNODB_PURGE_BATCH_SIZE |
783 | 1259 | +INNODB_PURGE_THREADS | 1260 | +INNODB_PURGE_THREADS |
784 | 1260 | +INNODB_RANDOM_READ_AHEAD | 1261 | +INNODB_RANDOM_READ_AHEAD |
785 | @@ -1634,6 +1635,7 @@ | |||
786 | 1634 | +INNODB_OLD_BLOCKS_TIME | 1635 | +INNODB_OLD_BLOCKS_TIME |
787 | 1635 | +INNODB_OPEN_FILES | 1636 | +INNODB_OPEN_FILES |
788 | 1636 | +INNODB_PAGE_SIZE | 1637 | +INNODB_PAGE_SIZE |
789 | 1638 | +INNODB_PRELOAD_TABLES | ||
790 | 1637 | +INNODB_PURGE_BATCH_SIZE | 1639 | +INNODB_PURGE_BATCH_SIZE |
791 | 1638 | +INNODB_PURGE_THREADS | 1640 | +INNODB_PURGE_THREADS |
792 | 1639 | +INNODB_RANDOM_READ_AHEAD | 1641 | +INNODB_RANDOM_READ_AHEAD |
793 | 1640 | 1642 | ||
794 | === modified file 'patches/series' | |||
795 | --- patches/series 2011-10-13 09:13:42 +0000 | |||
796 | +++ patches/series 2011-10-28 16:11:24 +0000 | |||
797 | @@ -59,3 +59,4 @@ | |||
798 | 59 | xtradb_bug317074.patch | 59 | xtradb_bug317074.patch |
799 | 60 | subunit.patch | 60 | subunit.patch |
800 | 61 | bug860910.patch | 61 | bug860910.patch |
801 | 62 | innodb_preload_tables.patch |
Needs update to the current branch-based lp:percona-server.