Merge lp:~laurynas-biveinis/percona-server/bug1076215-5.1 into lp:percona-server/5.1

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 497
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1076215-5.1
Merge into: lp:percona-server/5.1
Diff against target: 91 lines (+12/-27)
1 file modified
Percona-Server/storage/innodb_plugin/buf/buf0lru.c (+12/-27)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1076215-5.1
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+135932@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Percona-Server/storage/innodb_plugin/buf/buf0lru.c'
--- Percona-Server/storage/innodb_plugin/buf/buf0lru.c 2012-09-19 21:24:21 +0000
+++ Percona-Server/storage/innodb_plugin/buf/buf0lru.c 2012-11-23 15:28:22 +0000
@@ -236,9 +236,11 @@
236When doing a DROP TABLE/DISCARD TABLESPACE we have to drop all page236When doing a DROP TABLE/DISCARD TABLESPACE we have to drop all page
237hash index entries belonging to that table. This function tries to237hash index entries belonging to that table. This function tries to
238do that in batch. Note that this is a 'best effort' attempt and does238do that in batch. Note that this is a 'best effort' attempt and does
239not guarantee that ALL hash entries will be removed. */239not guarantee that ALL hash entries will be removed.
240
241@return number of hashed pages found*/
240static242static
241void243ulint
242buf_LRU_drop_page_hash_for_tablespace(244buf_LRU_drop_page_hash_for_tablespace(
243/*==================================*/245/*==================================*/
244 ulint id) /*!< in: space id */246 ulint id) /*!< in: space id */
@@ -247,13 +249,14 @@
247 ulint* page_arr;249 ulint* page_arr;
248 ulint num_entries;250 ulint num_entries;
249 ulint zip_size;251 ulint zip_size;
252 ulint num_found = 0;
250253
251 zip_size = fil_space_get_zip_size(id);254 zip_size = fil_space_get_zip_size(id);
252255
253 if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {256 if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
254 /* Somehow, the tablespace does not exist. Nothing to drop. */257 /* Somehow, the tablespace does not exist. Nothing to drop. */
255 ut_ad(0);258 ut_ad(0);
256 return;259 return num_found;
257 }260 }
258261
259 page_arr = ut_malloc(sizeof(ulint)262 page_arr = ut_malloc(sizeof(ulint)
@@ -308,6 +311,7 @@
308311
309 ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE);312 ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE);
310 ++num_entries;313 ++num_entries;
314 ++num_found;
311315
312 if (num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE) {316 if (num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE) {
313 goto next_page;317 goto next_page;
@@ -360,6 +364,8 @@
360 /* Drop any remaining batch of search hashed pages. */364 /* Drop any remaining batch of search hashed pages. */
361 buf_LRU_drop_page_hash_batch(id, zip_size, page_arr, num_entries);365 buf_LRU_drop_page_hash_batch(id, zip_size, page_arr, num_entries);
362 ut_free(page_arr);366 ut_free(page_arr);
367
368 return num_found;
363}369}
364370
365/******************************************************************//**371/******************************************************************//**
@@ -515,8 +521,6 @@
515 ulint id) /*!< in: space id */521 ulint id) /*!< in: space id */
516{522{
517 buf_page_t* bpage;523 buf_page_t* bpage;
518 buf_chunk_t* chunk;
519 ulint i, j;
520524
521 mutex_enter(&LRU_list_mutex);525 mutex_enter(&LRU_list_mutex);
522526
@@ -531,28 +535,9 @@
531535
532 mutex_exit(&LRU_list_mutex);536 mutex_exit(&LRU_list_mutex);
533537
534 rw_lock_s_lock(&btr_search_latch);538 /* The AHI entries for the tablespace being deleted should be removed
535 chunk = buf_pool->chunks;539 by now. */
536 for (i = buf_pool->n_chunks; i--; chunk++) {540 ut_ad(buf_LRU_drop_page_hash_for_tablespace(id) == 0);
537 buf_block_t* block = chunk->blocks;
538 for (j = chunk->size; j--; block++) {
539 if (buf_block_get_state(block)
540 != BUF_BLOCK_FILE_PAGE
541 || !(block->index != NULL)
542 || buf_page_get_space(&block->page) != id) {
543 continue;
544 }
545
546 rw_lock_s_unlock(&btr_search_latch);
547
548 rw_lock_x_lock(&block->lock);
549 btr_search_drop_page_hash_index(block);
550 rw_lock_x_unlock(&block->lock);
551
552 rw_lock_s_lock(&btr_search_latch);
553 }
554 }
555 rw_lock_s_unlock(&btr_search_latch);
556}541}
557542
558#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG543#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG

Subscribers

People subscribed via source and target branches