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: 503
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.
Alexey Kopytov (akopytov) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'Percona-Server/storage/innodb_plugin/buf/buf0lru.c'
2--- Percona-Server/storage/innodb_plugin/buf/buf0lru.c 2012-09-19 21:24:21 +0000
3+++ Percona-Server/storage/innodb_plugin/buf/buf0lru.c 2012-11-23 15:28:22 +0000
4@@ -236,9 +236,11 @@
5 When doing a DROP TABLE/DISCARD TABLESPACE we have to drop all page
6 hash index entries belonging to that table. This function tries to
7 do that in batch. Note that this is a 'best effort' attempt and does
8-not guarantee that ALL hash entries will be removed. */
9+not guarantee that ALL hash entries will be removed.
10+
11+@return number of hashed pages found*/
12 static
13-void
14+ulint
15 buf_LRU_drop_page_hash_for_tablespace(
16 /*==================================*/
17 ulint id) /*!< in: space id */
18@@ -247,13 +249,14 @@
19 ulint* page_arr;
20 ulint num_entries;
21 ulint zip_size;
22+ ulint num_found = 0;
23
24 zip_size = fil_space_get_zip_size(id);
25
26 if (UNIV_UNLIKELY(zip_size == ULINT_UNDEFINED)) {
27 /* Somehow, the tablespace does not exist. Nothing to drop. */
28 ut_ad(0);
29- return;
30+ return num_found;
31 }
32
33 page_arr = ut_malloc(sizeof(ulint)
34@@ -308,6 +311,7 @@
35
36 ut_a(num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE);
37 ++num_entries;
38+ ++num_found;
39
40 if (num_entries < BUF_LRU_DROP_SEARCH_HASH_SIZE) {
41 goto next_page;
42@@ -360,6 +364,8 @@
43 /* Drop any remaining batch of search hashed pages. */
44 buf_LRU_drop_page_hash_batch(id, zip_size, page_arr, num_entries);
45 ut_free(page_arr);
46+
47+ return num_found;
48 }
49
50 /******************************************************************//**
51@@ -515,8 +521,6 @@
52 ulint id) /*!< in: space id */
53 {
54 buf_page_t* bpage;
55- buf_chunk_t* chunk;
56- ulint i, j;
57
58 mutex_enter(&LRU_list_mutex);
59
60@@ -531,28 +535,9 @@
61
62 mutex_exit(&LRU_list_mutex);
63
64- rw_lock_s_lock(&btr_search_latch);
65- chunk = buf_pool->chunks;
66- for (i = buf_pool->n_chunks; i--; chunk++) {
67- buf_block_t* block = chunk->blocks;
68- for (j = chunk->size; j--; block++) {
69- if (buf_block_get_state(block)
70- != BUF_BLOCK_FILE_PAGE
71- || !(block->index != NULL)
72- || buf_page_get_space(&block->page) != id) {
73- continue;
74- }
75-
76- rw_lock_s_unlock(&btr_search_latch);
77-
78- rw_lock_x_lock(&block->lock);
79- btr_search_drop_page_hash_index(block);
80- rw_lock_x_unlock(&block->lock);
81-
82- rw_lock_s_lock(&btr_search_latch);
83- }
84- }
85- rw_lock_s_unlock(&btr_search_latch);
86+ /* The AHI entries for the tablespace being deleted should be removed
87+ by now. */
88+ ut_ad(buf_LRU_drop_page_hash_for_tablespace(id) == 0);
89 }
90
91 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG

Subscribers

People subscribed via source and target branches