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

Proposed by Laurynas Biveinis
Status: Merged
Approved by: Alexey Kopytov
Approved revision: no longer in the source branch.
Merged at revision: 356
Proposed branch: lp:~laurynas-biveinis/percona-server/bug1076215-5.5
Merge into: lp:percona-server/5.5
Diff against target: 91 lines (+13/-27)
1 file modified
Percona-Server/storage/innobase/buf/buf0lru.c (+13/-27)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug1076215-5.5
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+135933@code.launchpad.net

Description of the change

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
1=== modified file 'Percona-Server/storage/innobase/buf/buf0lru.c'
2--- Percona-Server/storage/innobase/buf/buf0lru.c 2012-10-19 05:15:29 +0000
3+++ Percona-Server/storage/innobase/buf/buf0lru.c 2012-11-23 15:29:29 +0000
4@@ -239,9 +239,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 buf_pool_t* buf_pool, /*!< in: buffer pool instance */
18@@ -251,13 +253,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(
34@@ -315,6 +318,7 @@
35 ut_a(num_entries < BUF_LRU_DROP_SEARCH_SIZE);
36
37 ++num_entries;
38+ ++num_found;
39
40 if (num_entries < BUF_LRU_DROP_SEARCH_SIZE) {
41 goto next_page;
42@@ -370,6 +374,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@@ -814,8 +820,6 @@
52 for (i = 0; i < srv_buf_pool_instances; i++) {
53 buf_pool_t* buf_pool;
54 buf_page_t* bpage;
55- buf_chunk_t* chunk;
56- ulint j, k;
57
58 buf_pool = buf_pool_from_array(i);
59
60@@ -832,28 +836,10 @@
61
62 mutex_exit(&buf_pool->LRU_list_mutex);
63
64- btr_search_s_lock_all();
65- chunk = buf_pool->chunks;
66- for (j = buf_pool->n_chunks; j--; chunk++) {
67- buf_block_t* block = chunk->blocks;
68- for (k = chunk->size; k--; block++) {
69- if (buf_block_get_state(block)
70- != BUF_BLOCK_FILE_PAGE
71- || !block->index
72- || buf_page_get_space(&block->page) != id) {
73- continue;
74- }
75-
76- btr_search_s_unlock_all();
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- btr_search_s_lock_all();
83- }
84- }
85- btr_search_s_unlock_all();
86+ /* The AHI entries for the tablespace being deleted should be
87+ removed by now. */
88+ ut_ad(buf_LRU_drop_page_hash_for_tablespace(buf_pool, id)
89+ == 0);
90 }
91 }
92

Subscribers

People subscribed via source and target branches