Merge lp:~percona-dev/percona-server/5.1.57-remove_zip_clean into lp:percona-server/5.1
- 5.1.57-remove_zip_clean
- Merge into 5.1
Proposed by
Yasufumi Kinoshita
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Stewart Smith | ||||
Approved revision: | no longer in the source branch. | ||||
Merged at revision: | 247 | ||||
Proposed branch: | lp:~percona-dev/percona-server/5.1.57-remove_zip_clean | ||||
Merge into: | lp:percona-server/5.1 | ||||
Diff against target: |
628 lines (+540/-5) 1 file modified
innodb_fix_misc.patch (+540/-5) |
||||
To merge this branch: | bzr merge lp:~percona-dev/percona-server/5.1.57-remove_zip_clean | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Stewart Smith | Pending | ||
Review via email: mp+65632@code.launchpad.net |
Commit message
Description of the change
fix for
http://
is added innodb_
To post a comment you must log in.
Revision history for this message
Stewart Smith (stewart) wrote : | # |
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'innodb_fix_misc.patch' | |||
2 | --- innodb_fix_misc.patch 2011-05-10 07:31:20 +0000 | |||
3 | +++ innodb_fix_misc.patch 2011-06-23 09:16:34 +0000 | |||
4 | @@ -5,15 +5,466 @@ | |||
5 | 5 | # Bug fix for | 5 | # Bug fix for |
6 | 6 | # http://bugs.mysql.com/56433 (always: because good for all users, and safe) | 6 | # http://bugs.mysql.com/56433 (always: because good for all users, and safe) |
7 | 7 | # and http://bugs.mysql.com/51325 (optional: innodb_lazy_drop_table) | 7 | # and http://bugs.mysql.com/51325 (optional: innodb_lazy_drop_table) |
8 | 8 | # and http://bugs.mysql.com/61341 (always for not-debug build) | ||
9 | 8 | # were added. They may be removed in the future when will be fixed officially. | 9 | # were added. They may be removed in the future when will be fixed officially. |
10 | 9 | # | 10 | # |
11 | 10 | #!!! notice !!! | 11 | #!!! notice !!! |
12 | 11 | # Any small change to this file in the main branch | 12 | # Any small change to this file in the main branch |
13 | 12 | # should be done or reviewed by the maintainer! | 13 | # should be done or reviewed by the maintainer! |
14 | 14 | diff -ruN a/storage/innodb_plugin/buf/buf0buddy.c b/storage/innodb_plugin/buf/buf0buddy.c | ||
15 | 15 | --- a/storage/innodb_plugin/buf/buf0buddy.c 2011-06-23 17:58:32.811788353 +0900 | ||
16 | 16 | +++ b/storage/innodb_plugin/buf/buf0buddy.c 2011-06-23 17:59:22.291827133 +0900 | ||
17 | 17 | @@ -377,7 +377,9 @@ | ||
18 | 18 | buf_page_t* bpage, /*!< in: block to relocate */ | ||
19 | 19 | buf_page_t* dpage) /*!< in: free block to relocate to */ | ||
20 | 20 | { | ||
21 | 21 | +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG | ||
22 | 22 | buf_page_t* b; | ||
23 | 23 | +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ | ||
24 | 24 | |||
25 | 25 | //ut_ad(buf_pool_mutex_own()); | ||
26 | 26 | #ifdef UNIV_SYNC_DEBUG | ||
27 | 27 | @@ -418,6 +420,7 @@ | ||
28 | 28 | buf_relocate(bpage, dpage); | ||
29 | 29 | ut_d(bpage->state = BUF_BLOCK_ZIP_FREE); | ||
30 | 30 | |||
31 | 31 | +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG | ||
32 | 32 | /* relocate buf_pool->zip_clean */ | ||
33 | 33 | mutex_enter(&flush_list_mutex); | ||
34 | 34 | b = UT_LIST_GET_PREV(zip_list, dpage); | ||
35 | 35 | @@ -429,6 +432,7 @@ | ||
36 | 36 | UT_LIST_ADD_FIRST(zip_list, buf_pool->zip_clean, dpage); | ||
37 | 37 | } | ||
38 | 38 | mutex_exit(&flush_list_mutex); | ||
39 | 39 | +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ | ||
40 | 40 | |||
41 | 41 | UNIV_MEM_INVALID(bpage, sizeof *bpage); | ||
42 | 42 | |||
43 | 13 | diff -ruN a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c | 43 | diff -ruN a/storage/innodb_plugin/buf/buf0buf.c b/storage/innodb_plugin/buf/buf0buf.c |
44 | 14 | --- a/storage/innodb_plugin/buf/buf0buf.c 2011-02-21 20:31:57.781983359 +0900 | 44 | --- a/storage/innodb_plugin/buf/buf0buf.c 2011-02-21 20:31:57.781983359 +0900 |
45 | 15 | +++ b/storage/innodb_plugin/buf/buf0buf.c 2011-02-21 20:32:39.523946003 +0900 | 45 | +++ b/storage/innodb_plugin/buf/buf0buf.c 2011-02-21 20:32:39.523946003 +0900 |
47 | 16 | @@ -3243,6 +3243,7 @@ | 46 | @@ -949,74 +949,6 @@ |
48 | 47 | return(NULL); | ||
49 | 48 | } | ||
50 | 49 | |||
51 | 50 | -/*********************************************************************//** | ||
52 | 51 | -Checks that all blocks in the buffer chunk are in BUF_BLOCK_NOT_USED state. | ||
53 | 52 | -@return TRUE if all freed */ | ||
54 | 53 | -static | ||
55 | 54 | -ibool | ||
56 | 55 | -buf_chunk_all_free( | ||
57 | 56 | -/*===============*/ | ||
58 | 57 | - const buf_chunk_t* chunk) /*!< in: chunk being checked */ | ||
59 | 58 | -{ | ||
60 | 59 | - const buf_block_t* block; | ||
61 | 60 | - ulint i; | ||
62 | 61 | - | ||
63 | 62 | - ut_ad(buf_pool); | ||
64 | 63 | - ut_ad(buf_pool_mutex_own()); /* but we need all mutex here */ | ||
65 | 64 | - | ||
66 | 65 | - block = chunk->blocks; | ||
67 | 66 | - | ||
68 | 67 | - for (i = chunk->size; i--; block++) { | ||
69 | 68 | - | ||
70 | 69 | - if (buf_block_get_state(block) != BUF_BLOCK_NOT_USED) { | ||
71 | 70 | - | ||
72 | 71 | - return(FALSE); | ||
73 | 72 | - } | ||
74 | 73 | - } | ||
75 | 74 | - | ||
76 | 75 | - return(TRUE); | ||
77 | 76 | -} | ||
78 | 77 | - | ||
79 | 78 | -/********************************************************************//** | ||
80 | 79 | -Frees a chunk of buffer frames. */ | ||
81 | 80 | -static | ||
82 | 81 | -void | ||
83 | 82 | -buf_chunk_free( | ||
84 | 83 | -/*===========*/ | ||
85 | 84 | - buf_chunk_t* chunk) /*!< out: chunk of buffers */ | ||
86 | 85 | -{ | ||
87 | 86 | - buf_block_t* block; | ||
88 | 87 | - const buf_block_t* block_end; | ||
89 | 88 | - | ||
90 | 89 | - ut_ad(buf_pool_mutex_own()); /* but we need all mutex here */ | ||
91 | 90 | - | ||
92 | 91 | - block_end = chunk->blocks + chunk->size; | ||
93 | 92 | - | ||
94 | 93 | - for (block = chunk->blocks; block < block_end; block++) { | ||
95 | 94 | - ut_a(buf_block_get_state(block) == BUF_BLOCK_NOT_USED); | ||
96 | 95 | - ut_a(!block->page.zip.data); | ||
97 | 96 | - | ||
98 | 97 | - ut_ad(!block->page.in_LRU_list); | ||
99 | 98 | - ut_ad(!block->in_unzip_LRU_list); | ||
100 | 99 | - ut_ad(!block->page.in_flush_list); | ||
101 | 100 | - /* Remove the block from the free list. */ | ||
102 | 101 | - mutex_enter(&free_list_mutex); | ||
103 | 102 | - ut_ad(block->page.in_free_list); | ||
104 | 103 | - UT_LIST_REMOVE(free, buf_pool->free, (&block->page)); | ||
105 | 104 | - mutex_exit(&free_list_mutex); | ||
106 | 105 | - | ||
107 | 106 | - /* Free the latches. */ | ||
108 | 107 | - mutex_free(&block->mutex); | ||
109 | 108 | - rw_lock_free(&block->lock); | ||
110 | 109 | -#ifdef UNIV_SYNC_DEBUG | ||
111 | 110 | - rw_lock_free(&block->debug_latch); | ||
112 | 111 | -#endif /* UNIV_SYNC_DEBUG */ | ||
113 | 112 | - UNIV_MEM_UNDESC(block); | ||
114 | 113 | - } | ||
115 | 114 | - | ||
116 | 115 | - os_mem_free_large(chunk->mem, chunk->mem_size); | ||
117 | 116 | -} | ||
118 | 117 | - | ||
119 | 118 | /********************************************************************//** | ||
120 | 119 | Creates the buffer pool. | ||
121 | 120 | @return own: buf_pool object, NULL if not enough memory or error */ | ||
122 | 121 | @@ -1106,8 +1038,6 @@ | ||
123 | 122 | chunk = chunks + buf_pool->n_chunks; | ||
124 | 123 | |||
125 | 124 | while (--chunk >= chunks) { | ||
126 | 125 | - /* Bypass the checks of buf_chunk_free(), since they | ||
127 | 126 | - would fail at shutdown. */ | ||
128 | 127 | os_mem_free_large(chunk->mem, chunk->mem_size); | ||
129 | 128 | } | ||
130 | 129 | |||
131 | 130 | @@ -1287,325 +1217,6 @@ | ||
132 | 131 | } | ||
133 | 132 | |||
134 | 133 | /********************************************************************//** | ||
135 | 134 | -Shrinks the buffer pool. */ | ||
136 | 135 | -static | ||
137 | 136 | -void | ||
138 | 137 | -buf_pool_shrink( | ||
139 | 138 | -/*============*/ | ||
140 | 139 | - ulint chunk_size) /*!< in: number of pages to remove */ | ||
141 | 140 | -{ | ||
142 | 141 | - buf_chunk_t* chunks; | ||
143 | 142 | - buf_chunk_t* chunk; | ||
144 | 143 | - ulint max_size; | ||
145 | 144 | - ulint max_free_size; | ||
146 | 145 | - buf_chunk_t* max_chunk; | ||
147 | 146 | - buf_chunk_t* max_free_chunk; | ||
148 | 147 | - | ||
149 | 148 | - ut_ad(!buf_pool_mutex_own()); | ||
150 | 149 | - | ||
151 | 150 | -try_again: | ||
152 | 151 | - btr_search_disable(); /* Empty the adaptive hash index again */ | ||
153 | 152 | - //buf_pool_mutex_enter(); | ||
154 | 153 | - mutex_enter(&LRU_list_mutex); | ||
155 | 154 | - | ||
156 | 155 | -shrink_again: | ||
157 | 156 | - if (buf_pool->n_chunks <= 1) { | ||
158 | 157 | - | ||
159 | 158 | - /* Cannot shrink if there is only one chunk */ | ||
160 | 159 | - goto func_done; | ||
161 | 160 | - } | ||
162 | 161 | - | ||
163 | 162 | - /* Search for the largest free chunk | ||
164 | 163 | - not larger than the size difference */ | ||
165 | 164 | - chunks = buf_pool->chunks; | ||
166 | 165 | - chunk = chunks + buf_pool->n_chunks; | ||
167 | 166 | - max_size = max_free_size = 0; | ||
168 | 167 | - max_chunk = max_free_chunk = NULL; | ||
169 | 168 | - | ||
170 | 169 | - while (--chunk >= chunks) { | ||
171 | 170 | - if (chunk->size <= chunk_size | ||
172 | 171 | - && chunk->size > max_free_size) { | ||
173 | 172 | - if (chunk->size > max_size) { | ||
174 | 173 | - max_size = chunk->size; | ||
175 | 174 | - max_chunk = chunk; | ||
176 | 175 | - } | ||
177 | 176 | - | ||
178 | 177 | - if (buf_chunk_all_free(chunk)) { | ||
179 | 178 | - max_free_size = chunk->size; | ||
180 | 179 | - max_free_chunk = chunk; | ||
181 | 180 | - } | ||
182 | 181 | - } | ||
183 | 182 | - } | ||
184 | 183 | - | ||
185 | 184 | - if (!max_free_size) { | ||
186 | 185 | - | ||
187 | 186 | - ulint dirty = 0; | ||
188 | 187 | - ulint nonfree = 0; | ||
189 | 188 | - buf_block_t* block; | ||
190 | 189 | - buf_block_t* bend; | ||
191 | 190 | - | ||
192 | 191 | - /* Cannot shrink: try again later | ||
193 | 192 | - (do not assign srv_buf_pool_old_size) */ | ||
194 | 193 | - if (!max_chunk) { | ||
195 | 194 | - | ||
196 | 195 | - goto func_exit; | ||
197 | 196 | - } | ||
198 | 197 | - | ||
199 | 198 | - block = max_chunk->blocks; | ||
200 | 199 | - bend = block + max_chunk->size; | ||
201 | 200 | - | ||
202 | 201 | - /* Move the blocks of chunk to the end of the | ||
203 | 202 | - LRU list and try to flush them. */ | ||
204 | 203 | - for (; block < bend; block++) { | ||
205 | 204 | - switch (buf_block_get_state(block)) { | ||
206 | 205 | - case BUF_BLOCK_NOT_USED: | ||
207 | 206 | - continue; | ||
208 | 207 | - case BUF_BLOCK_FILE_PAGE: | ||
209 | 208 | - break; | ||
210 | 209 | - default: | ||
211 | 210 | - nonfree++; | ||
212 | 211 | - continue; | ||
213 | 212 | - } | ||
214 | 213 | - | ||
215 | 214 | - mutex_enter(&block->mutex); | ||
216 | 215 | - /* The following calls will temporarily | ||
217 | 216 | - release block->mutex and buf_pool_mutex. | ||
218 | 217 | - Therefore, we have to always retry, | ||
219 | 218 | - even if !dirty && !nonfree. */ | ||
220 | 219 | - | ||
221 | 220 | - if (!buf_flush_ready_for_replace(&block->page)) { | ||
222 | 221 | - | ||
223 | 222 | - buf_LRU_make_block_old(&block->page); | ||
224 | 223 | - dirty++; | ||
225 | 224 | - } else if (buf_LRU_free_block(&block->page, TRUE, FALSE) | ||
226 | 225 | - != BUF_LRU_FREED) { | ||
227 | 226 | - nonfree++; | ||
228 | 227 | - } | ||
229 | 228 | - | ||
230 | 229 | - mutex_exit(&block->mutex); | ||
231 | 230 | - } | ||
232 | 231 | - | ||
233 | 232 | - //buf_pool_mutex_exit(); | ||
234 | 233 | - mutex_exit(&LRU_list_mutex); | ||
235 | 234 | - | ||
236 | 235 | - /* Request for a flush of the chunk if it helps. | ||
237 | 236 | - Do not flush if there are non-free blocks, since | ||
238 | 237 | - flushing will not make the chunk freeable. */ | ||
239 | 238 | - if (nonfree) { | ||
240 | 239 | - /* Avoid busy-waiting. */ | ||
241 | 240 | - os_thread_sleep(100000); | ||
242 | 241 | - } else if (dirty | ||
243 | 242 | - && buf_flush_batch(BUF_FLUSH_LRU, dirty, 0) | ||
244 | 243 | - == ULINT_UNDEFINED) { | ||
245 | 244 | - | ||
246 | 245 | - buf_flush_wait_batch_end(BUF_FLUSH_LRU); | ||
247 | 246 | - } | ||
248 | 247 | - | ||
249 | 248 | - goto try_again; | ||
250 | 249 | - } | ||
251 | 250 | - | ||
252 | 251 | - max_size = max_free_size; | ||
253 | 252 | - max_chunk = max_free_chunk; | ||
254 | 253 | - | ||
255 | 254 | - srv_buf_pool_old_size = srv_buf_pool_size; | ||
256 | 255 | - | ||
257 | 256 | - /* Rewrite buf_pool->chunks. Copy everything but max_chunk. */ | ||
258 | 257 | - chunks = mem_alloc((buf_pool->n_chunks - 1) * sizeof *chunks); | ||
259 | 258 | - memcpy(chunks, buf_pool->chunks, | ||
260 | 259 | - (max_chunk - buf_pool->chunks) * sizeof *chunks); | ||
261 | 260 | - memcpy(chunks + (max_chunk - buf_pool->chunks), | ||
262 | 261 | - max_chunk + 1, | ||
263 | 262 | - buf_pool->chunks + buf_pool->n_chunks | ||
264 | 263 | - - (max_chunk + 1)); | ||
265 | 264 | - ut_a(buf_pool->curr_size > max_chunk->size); | ||
266 | 265 | - buf_pool->curr_size -= max_chunk->size; | ||
267 | 266 | - srv_buf_pool_curr_size = buf_pool->curr_size * UNIV_PAGE_SIZE; | ||
268 | 267 | - chunk_size -= max_chunk->size; | ||
269 | 268 | - buf_chunk_free(max_chunk); | ||
270 | 269 | - mem_free(buf_pool->chunks); | ||
271 | 270 | - buf_pool->chunks = chunks; | ||
272 | 271 | - buf_pool->n_chunks--; | ||
273 | 272 | - | ||
274 | 273 | - /* Allow a slack of one megabyte. */ | ||
275 | 274 | - if (chunk_size > 1048576 / UNIV_PAGE_SIZE) { | ||
276 | 275 | - | ||
277 | 276 | - goto shrink_again; | ||
278 | 277 | - } | ||
279 | 278 | - | ||
280 | 279 | -func_done: | ||
281 | 280 | - srv_buf_pool_old_size = srv_buf_pool_size; | ||
282 | 281 | -func_exit: | ||
283 | 282 | - //buf_pool_mutex_exit(); | ||
284 | 283 | - mutex_exit(&LRU_list_mutex); | ||
285 | 284 | - btr_search_enable(); | ||
286 | 285 | -} | ||
287 | 286 | - | ||
288 | 287 | -/********************************************************************//** | ||
289 | 288 | -Rebuild buf_pool->page_hash. */ | ||
290 | 289 | -static | ||
291 | 290 | -void | ||
292 | 291 | -buf_pool_page_hash_rebuild(void) | ||
293 | 292 | -/*============================*/ | ||
294 | 293 | -{ | ||
295 | 294 | - ulint i; | ||
296 | 295 | - ulint n_chunks; | ||
297 | 296 | - buf_chunk_t* chunk; | ||
298 | 297 | - hash_table_t* page_hash; | ||
299 | 298 | - hash_table_t* zip_hash; | ||
300 | 299 | - buf_page_t* b; | ||
301 | 300 | - | ||
302 | 301 | - //buf_pool_mutex_enter(); | ||
303 | 302 | - mutex_enter(&LRU_list_mutex); | ||
304 | 303 | - rw_lock_x_lock(&page_hash_latch); | ||
305 | 304 | - mutex_enter(&flush_list_mutex); | ||
306 | 305 | - | ||
307 | 306 | - | ||
308 | 307 | - /* Free, create, and populate the hash table. */ | ||
309 | 308 | - hash_table_free(buf_pool->page_hash); | ||
310 | 309 | - buf_pool->page_hash = page_hash = hash_create(2 * buf_pool->curr_size); | ||
311 | 310 | - zip_hash = hash_create(2 * buf_pool->curr_size); | ||
312 | 311 | - | ||
313 | 312 | - HASH_MIGRATE(buf_pool->zip_hash, zip_hash, buf_page_t, hash, | ||
314 | 313 | - BUF_POOL_ZIP_FOLD_BPAGE); | ||
315 | 314 | - | ||
316 | 315 | - hash_table_free(buf_pool->zip_hash); | ||
317 | 316 | - buf_pool->zip_hash = zip_hash; | ||
318 | 317 | - | ||
319 | 318 | - /* Insert the uncompressed file pages to buf_pool->page_hash. */ | ||
320 | 319 | - | ||
321 | 320 | - chunk = buf_pool->chunks; | ||
322 | 321 | - n_chunks = buf_pool->n_chunks; | ||
323 | 322 | - | ||
324 | 323 | - for (i = 0; i < n_chunks; i++, chunk++) { | ||
325 | 324 | - ulint j; | ||
326 | 325 | - buf_block_t* block = chunk->blocks; | ||
327 | 326 | - | ||
328 | 327 | - for (j = 0; j < chunk->size; j++, block++) { | ||
329 | 328 | - if (buf_block_get_state(block) | ||
330 | 329 | - == BUF_BLOCK_FILE_PAGE) { | ||
331 | 330 | - ut_ad(!block->page.in_zip_hash); | ||
332 | 331 | - ut_ad(block->page.in_page_hash); | ||
333 | 332 | - | ||
334 | 333 | - HASH_INSERT(buf_page_t, hash, page_hash, | ||
335 | 334 | - buf_page_address_fold( | ||
336 | 335 | - block->page.space, | ||
337 | 336 | - block->page.offset), | ||
338 | 337 | - &block->page); | ||
339 | 338 | - } | ||
340 | 339 | - } | ||
341 | 340 | - } | ||
342 | 341 | - | ||
343 | 342 | - /* Insert the compressed-only pages to buf_pool->page_hash. | ||
344 | 343 | - All such blocks are either in buf_pool->zip_clean or | ||
345 | 344 | - in buf_pool->flush_list. */ | ||
346 | 345 | - | ||
347 | 346 | - for (b = UT_LIST_GET_FIRST(buf_pool->zip_clean); b; | ||
348 | 347 | - b = UT_LIST_GET_NEXT(zip_list, b)) { | ||
349 | 348 | - ut_a(buf_page_get_state(b) == BUF_BLOCK_ZIP_PAGE); | ||
350 | 349 | - ut_ad(!b->in_flush_list); | ||
351 | 350 | - ut_ad(b->in_LRU_list); | ||
352 | 351 | - ut_ad(b->in_page_hash); | ||
353 | 352 | - ut_ad(!b->in_zip_hash); | ||
354 | 353 | - | ||
355 | 354 | - HASH_INSERT(buf_page_t, hash, page_hash, | ||
356 | 355 | - buf_page_address_fold(b->space, b->offset), b); | ||
357 | 356 | - } | ||
358 | 357 | - | ||
359 | 358 | - for (b = UT_LIST_GET_FIRST(buf_pool->flush_list); b; | ||
360 | 359 | - b = UT_LIST_GET_NEXT(flush_list, b)) { | ||
361 | 360 | - ut_ad(b->in_flush_list); | ||
362 | 361 | - ut_ad(b->in_LRU_list); | ||
363 | 362 | - ut_ad(b->in_page_hash); | ||
364 | 363 | - ut_ad(!b->in_zip_hash); | ||
365 | 364 | - | ||
366 | 365 | - switch (buf_page_get_state(b)) { | ||
367 | 366 | - case BUF_BLOCK_ZIP_DIRTY: | ||
368 | 367 | - HASH_INSERT(buf_page_t, hash, page_hash, | ||
369 | 368 | - buf_page_address_fold(b->space, | ||
370 | 369 | - b->offset), b); | ||
371 | 370 | - break; | ||
372 | 371 | - case BUF_BLOCK_FILE_PAGE: | ||
373 | 372 | - /* uncompressed page */ | ||
374 | 373 | - break; | ||
375 | 374 | - case BUF_BLOCK_ZIP_FREE: | ||
376 | 375 | - case BUF_BLOCK_ZIP_PAGE: | ||
377 | 376 | - case BUF_BLOCK_NOT_USED: | ||
378 | 377 | - case BUF_BLOCK_READY_FOR_USE: | ||
379 | 378 | - case BUF_BLOCK_MEMORY: | ||
380 | 379 | - case BUF_BLOCK_REMOVE_HASH: | ||
381 | 380 | - ut_error; | ||
382 | 381 | - break; | ||
383 | 382 | - } | ||
384 | 383 | - } | ||
385 | 384 | - | ||
386 | 385 | - //buf_pool_mutex_exit(); | ||
387 | 386 | - mutex_exit(&LRU_list_mutex); | ||
388 | 387 | - rw_lock_x_unlock(&page_hash_latch); | ||
389 | 388 | - mutex_exit(&flush_list_mutex); | ||
390 | 389 | -} | ||
391 | 390 | - | ||
392 | 391 | -/********************************************************************//** | ||
393 | 392 | -Resizes the buffer pool. */ | ||
394 | 393 | -UNIV_INTERN | ||
395 | 394 | -void | ||
396 | 395 | -buf_pool_resize(void) | ||
397 | 396 | -/*=================*/ | ||
398 | 397 | -{ | ||
399 | 398 | - //buf_pool_mutex_enter(); | ||
400 | 399 | - mutex_enter(&LRU_list_mutex); | ||
401 | 400 | - | ||
402 | 401 | - if (srv_buf_pool_old_size == srv_buf_pool_size) { | ||
403 | 402 | - | ||
404 | 403 | - //buf_pool_mutex_exit(); | ||
405 | 404 | - mutex_exit(&LRU_list_mutex); | ||
406 | 405 | - return; | ||
407 | 406 | - } | ||
408 | 407 | - | ||
409 | 408 | - if (srv_buf_pool_curr_size + 1048576 > srv_buf_pool_size) { | ||
410 | 409 | - | ||
411 | 410 | - //buf_pool_mutex_exit(); | ||
412 | 411 | - mutex_exit(&LRU_list_mutex); | ||
413 | 412 | - | ||
414 | 413 | - /* Disable adaptive hash indexes and empty the index | ||
415 | 414 | - in order to free up memory in the buffer pool chunks. */ | ||
416 | 415 | - buf_pool_shrink((srv_buf_pool_curr_size - srv_buf_pool_size) | ||
417 | 416 | - / UNIV_PAGE_SIZE); | ||
418 | 417 | - } else if (srv_buf_pool_curr_size + 1048576 < srv_buf_pool_size) { | ||
419 | 418 | - | ||
420 | 419 | - /* Enlarge the buffer pool by at least one megabyte */ | ||
421 | 420 | - | ||
422 | 421 | - ulint mem_size | ||
423 | 422 | - = srv_buf_pool_size - srv_buf_pool_curr_size; | ||
424 | 423 | - buf_chunk_t* chunks; | ||
425 | 424 | - buf_chunk_t* chunk; | ||
426 | 425 | - | ||
427 | 426 | - chunks = mem_alloc((buf_pool->n_chunks + 1) * sizeof *chunks); | ||
428 | 427 | - | ||
429 | 428 | - memcpy(chunks, buf_pool->chunks, buf_pool->n_chunks | ||
430 | 429 | - * sizeof *chunks); | ||
431 | 430 | - | ||
432 | 431 | - chunk = &chunks[buf_pool->n_chunks]; | ||
433 | 432 | - | ||
434 | 433 | - if (!buf_chunk_init(chunk, mem_size)) { | ||
435 | 434 | - mem_free(chunks); | ||
436 | 435 | - } else { | ||
437 | 436 | - buf_pool->curr_size += chunk->size; | ||
438 | 437 | - srv_buf_pool_curr_size = buf_pool->curr_size | ||
439 | 438 | - * UNIV_PAGE_SIZE; | ||
440 | 439 | - mem_free(buf_pool->chunks); | ||
441 | 440 | - buf_pool->chunks = chunks; | ||
442 | 441 | - buf_pool->n_chunks++; | ||
443 | 442 | - } | ||
444 | 443 | - | ||
445 | 444 | - srv_buf_pool_old_size = srv_buf_pool_size; | ||
446 | 445 | - //buf_pool_mutex_exit(); | ||
447 | 446 | - mutex_exit(&LRU_list_mutex); | ||
448 | 447 | - } | ||
449 | 448 | - | ||
450 | 449 | - buf_pool_page_hash_rebuild(); | ||
451 | 450 | -} | ||
452 | 451 | - | ||
453 | 452 | -/********************************************************************//** | ||
454 | 453 | Moves a page to the start of the buffer pool LRU list. This high-level | ||
455 | 454 | function can be used to prevent an important page from slipping out of | ||
456 | 455 | the buffer pool. */ | ||
457 | 456 | @@ -2448,8 +2059,10 @@ | ||
458 | 457 | |||
459 | 458 | if (buf_page_get_state(&block->page) | ||
460 | 459 | == BUF_BLOCK_ZIP_PAGE) { | ||
461 | 460 | +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG | ||
462 | 461 | UT_LIST_REMOVE(zip_list, buf_pool->zip_clean, | ||
463 | 462 | &block->page); | ||
464 | 463 | +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ | ||
465 | 464 | ut_ad(!block->page.in_flush_list); | ||
466 | 465 | } else { | ||
467 | 466 | /* Relocate buf_pool->flush_list. */ | ||
468 | 467 | @@ -3243,6 +2856,7 @@ | ||
469 | 17 | bpage->state = BUF_BLOCK_ZIP_PAGE; | 468 | bpage->state = BUF_BLOCK_ZIP_PAGE; |
470 | 18 | bpage->space = space; | 469 | bpage->space = space; |
471 | 19 | bpage->offset = offset; | 470 | bpage->offset = offset; |
472 | @@ -21,6 +472,18 @@ | |||
473 | 21 | 472 | ||
474 | 22 | #ifdef UNIV_DEBUG | 473 | #ifdef UNIV_DEBUG |
475 | 23 | bpage->in_page_hash = FALSE; | 474 | bpage->in_page_hash = FALSE; |
476 | 475 | @@ -3260,9 +2874,11 @@ | ||
477 | 476 | |||
478 | 477 | /* The block must be put to the LRU list, to the old blocks */ | ||
479 | 478 | buf_LRU_add_block(bpage, TRUE/* to old blocks */); | ||
480 | 479 | +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG | ||
481 | 480 | mutex_enter(&flush_list_mutex); | ||
482 | 481 | buf_LRU_insert_zip_clean(bpage); | ||
483 | 482 | mutex_exit(&flush_list_mutex); | ||
484 | 483 | +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ | ||
485 | 484 | |||
486 | 485 | mutex_exit(&LRU_list_mutex); | ||
487 | 486 | |||
488 | 24 | diff -ruN a/storage/innodb_plugin/buf/buf0flu.c b/storage/innodb_plugin/buf/buf0flu.c | 487 | diff -ruN a/storage/innodb_plugin/buf/buf0flu.c b/storage/innodb_plugin/buf/buf0flu.c |
489 | 25 | --- a/storage/innodb_plugin/buf/buf0flu.c 2011-02-21 20:31:57.784983260 +0900 | 488 | --- a/storage/innodb_plugin/buf/buf0flu.c 2011-02-21 20:31:57.784983260 +0900 |
490 | 26 | +++ b/storage/innodb_plugin/buf/buf0flu.c 2011-02-21 20:32:39.524915732 +0900 | 489 | +++ b/storage/innodb_plugin/buf/buf0flu.c 2011-02-21 20:32:39.524915732 +0900 |
491 | @@ -47,10 +510,20 @@ | |||
492 | 47 | if (flush_type != BUF_FLUSH_LRU) { | 510 | if (flush_type != BUF_FLUSH_LRU) { |
493 | 48 | 511 | ||
494 | 49 | return(TRUE); | 512 | return(TRUE); |
495 | 513 | @@ -452,7 +459,9 @@ | ||
496 | 514 | case BUF_BLOCK_ZIP_DIRTY: | ||
497 | 515 | buf_page_set_state(bpage, BUF_BLOCK_ZIP_PAGE); | ||
498 | 516 | UT_LIST_REMOVE(flush_list, buf_pool->flush_list, bpage); | ||
499 | 517 | +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG | ||
500 | 518 | buf_LRU_insert_zip_clean(bpage); | ||
501 | 519 | +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ | ||
502 | 520 | break; | ||
503 | 521 | case BUF_BLOCK_FILE_PAGE: | ||
504 | 522 | UT_LIST_REMOVE(flush_list, buf_pool->flush_list, bpage); | ||
505 | 50 | diff -ruN a/storage/innodb_plugin/buf/buf0lru.c b/storage/innodb_plugin/buf/buf0lru.c | 523 | diff -ruN a/storage/innodb_plugin/buf/buf0lru.c b/storage/innodb_plugin/buf/buf0lru.c |
506 | 51 | --- a/storage/innodb_plugin/buf/buf0lru.c 2011-02-21 20:31:57.451983310 +0900 | 524 | --- a/storage/innodb_plugin/buf/buf0lru.c 2011-02-21 20:31:57.451983310 +0900 |
507 | 52 | +++ b/storage/innodb_plugin/buf/buf0lru.c 2011-02-21 20:32:39.526949096 +0900 | 525 | +++ b/storage/innodb_plugin/buf/buf0lru.c 2011-02-21 20:32:39.526949096 +0900 |
509 | 53 | @@ -550,6 +550,30 @@ | 526 | @@ -550,6 +550,31 @@ |
510 | 54 | } | 527 | } |
511 | 55 | } | 528 | } |
512 | 56 | 529 | ||
513 | @@ -78,10 +551,19 @@ | |||
514 | 78 | + mutex_exit(&LRU_list_mutex); | 551 | + mutex_exit(&LRU_list_mutex); |
515 | 79 | +} | 552 | +} |
516 | 80 | + | 553 | + |
517 | 554 | +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG | ||
518 | 81 | /********************************************************************//** | 555 | /********************************************************************//** |
519 | 82 | Insert a compressed block into buf_pool->zip_clean in the LRU order. */ | 556 | Insert a compressed block into buf_pool->zip_clean in the LRU order. */ |
520 | 83 | UNIV_INTERN | 557 | UNIV_INTERN |
522 | 84 | @@ -1492,6 +1516,10 @@ | 558 | @@ -583,6 +608,7 @@ |
523 | 559 | UT_LIST_ADD_FIRST(zip_list, buf_pool->zip_clean, bpage); | ||
524 | 560 | } | ||
525 | 561 | } | ||
526 | 562 | +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ | ||
527 | 563 | |||
528 | 564 | /******************************************************************//** | ||
529 | 565 | Try to free an uncompressed page of a compressed block from the unzip | ||
530 | 566 | @@ -1492,6 +1518,10 @@ | ||
531 | 85 | return(BUF_LRU_NOT_FREED); | 567 | return(BUF_LRU_NOT_FREED); |
532 | 86 | } | 568 | } |
533 | 87 | 569 | ||
534 | @@ -92,6 +574,26 @@ | |||
535 | 92 | #ifdef UNIV_IBUF_COUNT_DEBUG | 574 | #ifdef UNIV_IBUF_COUNT_DEBUG |
536 | 93 | ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0); | 575 | ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0); |
537 | 94 | #endif /* UNIV_IBUF_COUNT_DEBUG */ | 576 | #endif /* UNIV_IBUF_COUNT_DEBUG */ |
538 | 577 | @@ -1662,7 +1692,9 @@ | ||
539 | 578 | |||
540 | 579 | mutex_enter(&flush_list_mutex); | ||
541 | 580 | if (b->state == BUF_BLOCK_ZIP_PAGE) { | ||
542 | 581 | +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG | ||
543 | 582 | buf_LRU_insert_zip_clean(b); | ||
544 | 583 | +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ | ||
545 | 584 | } else { | ||
546 | 585 | /* Relocate on buf_pool->flush_list. */ | ||
547 | 586 | buf_flush_relocate_on_flush_list(bpage, b); | ||
548 | 587 | @@ -1959,7 +1991,9 @@ | ||
549 | 588 | ut_a(bpage->zip.data); | ||
550 | 589 | ut_a(buf_page_get_zip_size(bpage)); | ||
551 | 590 | |||
552 | 591 | +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG | ||
553 | 592 | UT_LIST_REMOVE(zip_list, buf_pool->zip_clean, bpage); | ||
554 | 593 | +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ | ||
555 | 594 | |||
556 | 595 | mutex_exit(&buf_pool_zip_mutex); | ||
557 | 596 | //buf_pool_mutex_exit_forbid(); | ||
558 | 95 | diff -ruN a/storage/innodb_plugin/fil/fil0fil.c b/storage/innodb_plugin/fil/fil0fil.c | 597 | diff -ruN a/storage/innodb_plugin/fil/fil0fil.c b/storage/innodb_plugin/fil/fil0fil.c |
559 | 96 | --- a/storage/innodb_plugin/fil/fil0fil.c 2011-02-21 20:31:57.838984412 +0900 | 598 | --- a/storage/innodb_plugin/fil/fil0fil.c 2011-02-21 20:31:57.838984412 +0900 |
560 | 97 | +++ b/storage/innodb_plugin/fil/fil0fil.c 2011-02-21 20:32:39.528914782 +0900 | 599 | +++ b/storage/innodb_plugin/fil/fil0fil.c 2011-02-21 20:32:39.528914782 +0900 |
561 | @@ -324,7 +826,20 @@ | |||
562 | 324 | diff -ruN a/storage/innodb_plugin/include/buf0buf.h b/storage/innodb_plugin/include/buf0buf.h | 826 | diff -ruN a/storage/innodb_plugin/include/buf0buf.h b/storage/innodb_plugin/include/buf0buf.h |
563 | 325 | --- a/storage/innodb_plugin/include/buf0buf.h 2011-02-21 20:31:57.863983187 +0900 | 827 | --- a/storage/innodb_plugin/include/buf0buf.h 2011-02-21 20:31:57.863983187 +0900 |
564 | 326 | +++ b/storage/innodb_plugin/include/buf0buf.h 2011-02-21 20:32:39.537912716 +0900 | 828 | +++ b/storage/innodb_plugin/include/buf0buf.h 2011-02-21 20:32:39.537912716 +0900 |
566 | 327 | @@ -1156,6 +1156,7 @@ | 829 | @@ -141,12 +141,6 @@ |
567 | 830 | BUF_BLOCK_ZIP_DIRTY or BUF_BLOCK_ZIP_PAGE */ | ||
568 | 831 | buf_page_t* dpage) /*!< in/out: destination control block */ | ||
569 | 832 | __attribute__((nonnull)); | ||
570 | 833 | -/********************************************************************//** | ||
571 | 834 | -Resizes the buffer pool. */ | ||
572 | 835 | -UNIV_INTERN | ||
573 | 836 | -void | ||
574 | 837 | -buf_pool_resize(void); | ||
575 | 838 | -/*=================*/ | ||
576 | 839 | /*********************************************************************//** | ||
577 | 840 | Gets the current size of buffer buf_pool in bytes. | ||
578 | 841 | @return size in bytes */ | ||
579 | 842 | @@ -1156,6 +1150,7 @@ | ||
580 | 328 | 0 if the block was never accessed | 843 | 0 if the block was never accessed |
581 | 329 | in the buffer pool */ | 844 | in the buffer pool */ |
582 | 330 | /* @} */ | 845 | /* @} */ |
583 | @@ -332,6 +847,17 @@ | |||
584 | 332 | ibool is_corrupt; | 847 | ibool is_corrupt; |
585 | 333 | # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG | 848 | # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG |
586 | 334 | ibool file_page_was_freed; | 849 | ibool file_page_was_freed; |
587 | 850 | @@ -1450,8 +1445,10 @@ | ||
588 | 851 | frames and buf_page_t descriptors of blocks that exist | ||
589 | 852 | in the buffer pool only in compressed form. */ | ||
590 | 853 | /* @{ */ | ||
591 | 854 | +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG | ||
592 | 855 | UT_LIST_BASE_NODE_T(buf_page_t) zip_clean; | ||
593 | 856 | /*!< unmodified compressed pages */ | ||
594 | 857 | +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ | ||
595 | 858 | UT_LIST_BASE_NODE_T(buf_page_t) zip_free[BUF_BUDDY_SIZES_MAX]; | ||
596 | 859 | /*!< buddy free lists */ | ||
597 | 860 | //#if BUF_BUDDY_HIGH != UNIV_PAGE_SIZE | ||
598 | 335 | diff -ruN a/storage/innodb_plugin/include/buf0buf.ic b/storage/innodb_plugin/include/buf0buf.ic | 861 | diff -ruN a/storage/innodb_plugin/include/buf0buf.ic b/storage/innodb_plugin/include/buf0buf.ic |
599 | 336 | --- a/storage/innodb_plugin/include/buf0buf.ic 2011-02-21 20:31:57.725983812 +0900 | 862 | --- a/storage/innodb_plugin/include/buf0buf.ic 2011-02-21 20:31:57.725983812 +0900 |
600 | 337 | +++ b/storage/innodb_plugin/include/buf0buf.ic 2011-02-21 20:32:39.538913061 +0900 | 863 | +++ b/storage/innodb_plugin/include/buf0buf.ic 2011-02-21 20:32:39.538913061 +0900 |
601 | @@ -346,7 +872,7 @@ | |||
602 | 346 | diff -ruN a/storage/innodb_plugin/include/buf0lru.h b/storage/innodb_plugin/include/buf0lru.h | 872 | diff -ruN a/storage/innodb_plugin/include/buf0lru.h b/storage/innodb_plugin/include/buf0lru.h |
603 | 347 | --- a/storage/innodb_plugin/include/buf0lru.h 2011-02-21 20:31:57.480924269 +0900 | 873 | --- a/storage/innodb_plugin/include/buf0lru.h 2011-02-21 20:31:57.480924269 +0900 |
604 | 348 | +++ b/storage/innodb_plugin/include/buf0lru.h 2011-02-21 20:32:39.539912965 +0900 | 874 | +++ b/storage/innodb_plugin/include/buf0lru.h 2011-02-21 20:32:39.539912965 +0900 |
606 | 349 | @@ -84,6 +84,13 @@ | 875 | @@ -84,6 +84,14 @@ |
607 | 350 | buf_LRU_invalidate_tablespace( | 876 | buf_LRU_invalidate_tablespace( |
608 | 351 | /*==========================*/ | 877 | /*==========================*/ |
609 | 352 | ulint id); /*!< in: space id */ | 878 | ulint id); /*!< in: space id */ |
610 | @@ -357,9 +883,18 @@ | |||
611 | 357 | +buf_LRU_mark_space_was_deleted( | 883 | +buf_LRU_mark_space_was_deleted( |
612 | 358 | +/*===========================*/ | 884 | +/*===========================*/ |
613 | 359 | + ulint id); /*!< in: space id */ | 885 | + ulint id); /*!< in: space id */ |
614 | 886 | +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG | ||
615 | 360 | /********************************************************************//** | 887 | /********************************************************************//** |
616 | 361 | Insert a compressed block into buf_pool->zip_clean in the LRU order. */ | 888 | Insert a compressed block into buf_pool->zip_clean in the LRU order. */ |
617 | 362 | UNIV_INTERN | 889 | UNIV_INTERN |
618 | 890 | @@ -91,6 +99,7 @@ | ||
619 | 891 | buf_LRU_insert_zip_clean( | ||
620 | 892 | /*=====================*/ | ||
621 | 893 | buf_page_t* bpage); /*!< in: pointer to the block in question */ | ||
622 | 894 | +#endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ | ||
623 | 895 | |||
624 | 896 | /******************************************************************//** | ||
625 | 897 | Try to free a block. If bpage is a descriptor of a compressed-only | ||
626 | 363 | diff -ruN a/storage/innodb_plugin/include/os0file.h b/storage/innodb_plugin/include/os0file.h | 898 | diff -ruN a/storage/innodb_plugin/include/os0file.h b/storage/innodb_plugin/include/os0file.h |
627 | 364 | --- a/storage/innodb_plugin/include/os0file.h 2011-02-21 20:31:57.870987755 +0900 | 899 | --- a/storage/innodb_plugin/include/os0file.h 2011-02-21 20:31:57.870987755 +0900 |
628 | 365 | +++ b/storage/innodb_plugin/include/os0file.h 2011-02-21 20:32:39.540912738 +0900 | 900 | +++ b/storage/innodb_plugin/include/os0file.h 2011-02-21 20:32:39.540912738 +0900 |
running this branch merged with trunk through param build: http:// jenkins. percona. com/view/ Percona% 20Server% 205.1/job/ percona- server- 5.1-param/ 31/
(to have extra check of my conflict resolution)