Merge lp:~percona-dev/percona-server/5.1.57-fix_bug798371 into lp:percona-server/5.1

Proposed by Yasufumi Kinoshita
Status: Merged
Approved by: Stewart Smith
Approved revision: no longer in the source branch.
Merged at revision: 256
Proposed branch: lp:~percona-dev/percona-server/5.1.57-fix_bug798371
Merge into: lp:percona-server/5.1
Diff against target: 301 lines (+207/-8)
1 file modified
innodb_fix_misc.patch (+207/-8)
To merge this branch: bzr merge lp:~percona-dev/percona-server/5.1.57-fix_bug798371
Reviewer Review Type Date Requested Status
Stewart Smith Pending
Review via email: mp+66754@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :

Stewart,

I don't understand why this bug fix which is wanted by customer at issue (#17014)
is blocked.
It is also blocking my porting to 5.1.58

Revision history for this message
Yasufumi Kinoshita (yasufumi-kinoshita) wrote :

I will merge during porting 5.1.58 as the other pending bug fixes
Please test at the time.
No need to review this.

Revision history for this message
Stewart Smith (stewart) wrote :

as for 5.5 patch, mark as merged when porting done.

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-06-29 08:37:20 +0000
3+++ innodb_fix_misc.patch 2011-07-04 08:12:35 +0000
4@@ -453,7 +453,63 @@
5 Moves a page to the start of the buffer pool LRU list. This high-level
6 function can be used to prevent an important page from slipping out of
7 the buffer pool. */
8-@@ -2471,8 +2082,10 @@
9+@@ -1843,6 +1454,27 @@
10+ #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
11+ }
12+
13++ if (UNIV_UNLIKELY(bpage->space_was_being_deleted)) {
14++ /* This page is obsoleted, should discard and retry */
15++ rw_lock_s_unlock(&page_hash_latch);
16++
17++ mutex_enter(&LRU_list_mutex);
18++ block_mutex = buf_page_get_mutex_enter(bpage);
19++
20++ if (UNIV_UNLIKELY(!block_mutex)) {
21++ mutex_exit(&LRU_list_mutex);
22++ goto lookup;
23++ }
24++
25++ buf_LRU_free_block(bpage, TRUE, TRUE);
26++
27++ mutex_exit(&LRU_list_mutex);
28++ mutex_exit(block_mutex);
29++ block_mutex = NULL;
30++
31++ goto lookup;
32++ }
33++
34+ if (UNIV_UNLIKELY(!bpage->zip.data)) {
35+ /* There is no compressed page. */
36+ err_exit:
37+@@ -2292,6 +1924,27 @@
38+ rw_lock_s_lock(&page_hash_latch);
39+ block = (buf_block_t*) buf_page_hash_get(space, offset);
40+ if (block) {
41++ if (UNIV_UNLIKELY(block->page.space_was_being_deleted)) {
42++ /* This page is obsoleted, should discard and retry */
43++ rw_lock_s_unlock(&page_hash_latch);
44++
45++ mutex_enter(&LRU_list_mutex);
46++ block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
47++
48++ if (UNIV_UNLIKELY(!block_mutex)) {
49++ mutex_exit(&LRU_list_mutex);
50++ goto loop;
51++ }
52++
53++ buf_LRU_free_block((buf_page_t*)block, TRUE, TRUE);
54++
55++ mutex_exit(&LRU_list_mutex);
56++ mutex_exit(block_mutex);
57++ block_mutex = NULL;
58++
59++ goto loop;
60++ }
61++
62+ block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
63+ ut_a(block_mutex);
64+ }
65+@@ -2471,8 +2124,10 @@
66
67 if (buf_page_get_state(&block->page)
68 == BUF_BLOCK_ZIP_PAGE) {
69@@ -464,7 +520,46 @@
70 ut_ad(!block->page.in_flush_list);
71 } else {
72 /* Relocate buf_pool->flush_list. */
73-@@ -3266,6 +2879,7 @@
74+@@ -3108,6 +2763,7 @@
75+ {
76+ buf_block_t* block;
77+ buf_page_t* bpage;
78++ buf_page_t* bpage_in_bp;
79+ mtr_t mtr;
80+ ibool lru = FALSE;
81+ void* data;
82+@@ -3143,11 +2799,29 @@
83+ ut_ad(block);
84+ }
85+
86++retry:
87+ //buf_pool_mutex_enter();
88+ mutex_enter(&LRU_list_mutex);
89+ rw_lock_x_lock(&page_hash_latch);
90+
91+- if (buf_page_hash_get(space, offset)) {
92++ bpage_in_bp = buf_page_hash_get(space, offset);
93++
94++ if (UNIV_UNLIKELY(bpage_in_bp && bpage_in_bp->space_was_being_deleted)) {
95++ mutex_t* block_mutex = buf_page_get_mutex_enter(bpage_in_bp);
96++
97++ /* This page is obsoleted, should discard and retry */
98++ rw_lock_x_unlock(&page_hash_latch);
99++ ut_a(block_mutex);
100++
101++ buf_LRU_free_block(bpage_in_bp, TRUE, TRUE);
102++
103++ mutex_exit(&LRU_list_mutex);
104++ mutex_exit(block_mutex);
105++
106++ goto retry;
107++ }
108++
109++ if (bpage_in_bp) {
110+ /* The page is already in the buffer pool. */
111+ err_exit:
112+ if (block) {
113+@@ -3266,6 +2940,7 @@
114 bpage->state = BUF_BLOCK_ZIP_PAGE;
115 bpage->space = space;
116 bpage->offset = offset;
117@@ -472,7 +567,7 @@
118
119 #ifdef UNIV_DEBUG
120 bpage->in_page_hash = FALSE;
121-@@ -3283,9 +2897,11 @@
122+@@ -3283,9 +2958,11 @@
123
124 /* The block must be put to the LRU list, to the old blocks */
125 buf_LRU_add_block(bpage, TRUE/* to old blocks */);
126@@ -484,6 +579,35 @@
127
128 mutex_exit(&LRU_list_mutex);
129
130+@@ -3336,12 +3013,28 @@
131+
132+ free_block = buf_LRU_get_free_block();
133+
134++retry:
135+ //buf_pool_mutex_enter();
136+ mutex_enter(&LRU_list_mutex);
137+ rw_lock_x_lock(&page_hash_latch);
138+
139+ block = (buf_block_t*) buf_page_hash_get(space, offset);
140+
141++ if (UNIV_UNLIKELY(block && block->page.space_was_being_deleted)) {
142++ mutex_t* block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
143++
144++ /* This page is obsoleted, should discard and retry */
145++ rw_lock_x_unlock(&page_hash_latch);
146++ ut_a(block_mutex);
147++
148++ buf_LRU_free_block((buf_page_t*)block, TRUE, TRUE);
149++
150++ mutex_exit(&LRU_list_mutex);
151++ mutex_exit(block_mutex);
152++
153++ goto retry;
154++ }
155++
156+ if (block && buf_page_in_file(&block->page)) {
157+ #ifdef UNIV_IBUF_COUNT_DEBUG
158+ ut_a(ibuf_count_get(space, offset) == 0);
159 diff -ruN a/storage/innodb_plugin/buf/buf0flu.c b/storage/innodb_plugin/buf/buf0flu.c
160 --- a/storage/innodb_plugin/buf/buf0flu.c 2011-02-21 20:31:57.784983260 +0900
161 +++ b/storage/innodb_plugin/buf/buf0flu.c 2011-02-21 20:32:39.524915732 +0900
162@@ -523,7 +647,7 @@
163 diff -ruN a/storage/innodb_plugin/buf/buf0lru.c b/storage/innodb_plugin/buf/buf0lru.c
164 --- a/storage/innodb_plugin/buf/buf0lru.c 2011-02-21 20:31:57.451983310 +0900
165 +++ b/storage/innodb_plugin/buf/buf0lru.c 2011-02-21 20:32:39.526949096 +0900
166-@@ -550,6 +550,31 @@
167+@@ -550,6 +550,56 @@
168 }
169 }
170
171@@ -536,6 +660,8 @@
172 + ulint id) /*!< in: space id */
173 +{
174 + buf_page_t* bpage;
175++ buf_chunk_t* chunk;
176++ ulint i, j;
177 +
178 + mutex_enter(&LRU_list_mutex);
179 +
180@@ -549,13 +675,36 @@
181 + }
182 +
183 + mutex_exit(&LRU_list_mutex);
184++
185++ rw_lock_s_lock(&btr_search_latch);
186++ chunk = buf_pool->chunks;
187++ for (i = buf_pool->n_chunks; i--; chunk++) {
188++ buf_block_t* block = chunk->blocks;
189++ for (j = chunk->size; j--; block++) {
190++ if (buf_block_get_state(block)
191++ != BUF_BLOCK_FILE_PAGE
192++ || !block->is_hashed
193++ || buf_page_get_space(&block->page) != id) {
194++ continue;
195++ }
196++
197++ rw_lock_s_unlock(&btr_search_latch);
198++
199++ rw_lock_x_lock(&block->lock);
200++ btr_search_drop_page_hash_index(block);
201++ rw_lock_x_unlock(&block->lock);
202++
203++ rw_lock_s_lock(&btr_search_latch);
204++ }
205++ }
206++ rw_lock_s_unlock(&btr_search_latch);
207 +}
208 +
209 +#if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
210 /********************************************************************//**
211 Insert a compressed block into buf_pool->zip_clean in the LRU order. */
212 UNIV_INTERN
213-@@ -583,6 +608,7 @@
214+@@ -583,6 +633,7 @@
215 UT_LIST_ADD_FIRST(zip_list, buf_pool->zip_clean, bpage);
216 }
217 }
218@@ -563,7 +712,7 @@
219
220 /******************************************************************//**
221 Try to free an uncompressed page of a compressed block from the unzip
222-@@ -1492,6 +1518,10 @@
223+@@ -1492,6 +1543,10 @@
224 return(BUF_LRU_NOT_FREED);
225 }
226
227@@ -574,7 +723,7 @@
228 #ifdef UNIV_IBUF_COUNT_DEBUG
229 ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0);
230 #endif /* UNIV_IBUF_COUNT_DEBUG */
231-@@ -1662,7 +1692,9 @@
232+@@ -1662,7 +1717,9 @@
233
234 mutex_enter(&flush_list_mutex);
235 if (b->state == BUF_BLOCK_ZIP_PAGE) {
236@@ -584,7 +733,7 @@
237 } else {
238 /* Relocate on buf_pool->flush_list. */
239 buf_flush_relocate_on_flush_list(bpage, b);
240-@@ -1959,7 +1991,9 @@
241+@@ -1959,7 +2016,9 @@
242 ut_a(bpage->zip.data);
243 ut_a(buf_page_get_zip_size(bpage));
244
245@@ -1090,6 +1239,56 @@
246 if (prebuilt->sql_stat_start) {
247 node->state = INS_NODE_SET_IX_LOCK;
248 prebuilt->sql_stat_start = FALSE;
249+@@ -2547,10 +2555,29 @@
250+
251+ err = DB_ERROR;
252+ } else {
253++ dict_index_t* index;
254++
255+ /* Set the flag which tells that now it is legal to
256+ IMPORT a tablespace for this table */
257+ table->tablespace_discarded = TRUE;
258+ table->ibd_file_missing = TRUE;
259++
260++ /* check adaptive hash entries */
261++ index = dict_table_get_first_index(table);
262++ while (index) {
263++ ulint ref_count = btr_search_info_get_ref_count(index->search_info);
264++ if (ref_count) {
265++ fprintf(stderr, "InnoDB: Warning:"
266++ " hash index ref_count (%lu) is not zero"
267++ " after fil_discard_tablespace().\n"
268++ "index: \"%s\""
269++ " table: \"%s\"\n",
270++ ref_count,
271++ index->name,
272++ table->name);
273++ }
274++ index = dict_table_get_next_index(index);
275++ }
276+ }
277+ }
278+
279+@@ -2892,6 +2919,19 @@
280+ table->space = space;
281+ index = dict_table_get_first_index(table);
282+ do {
283++ ulint ref_count = btr_search_info_get_ref_count(index->search_info);
284++ /* check adaptive hash entries */
285++ if (ref_count) {
286++ fprintf(stderr, "InnoDB: Warning:"
287++ " hash index ref_count (%lu) is not zero"
288++ " after fil_discard_tablespace().\n"
289++ "index: \"%s\""
290++ " table: \"%s\"\n",
291++ ref_count,
292++ index->name,
293++ table->name);
294++ }
295++
296+ index->space = space;
297+ index = dict_table_get_next_index(index);
298+ } while (index);
299 diff -ruN a/storage/innodb_plugin/row/row0sel.c b/storage/innodb_plugin/row/row0sel.c
300 --- a/storage/innodb_plugin/row/row0sel.c 2010-07-20 16:33:04.204866103 +0900
301 +++ b/storage/innodb_plugin/row/row0sel.c 2010-07-20 16:33:53.998864025 +0900

Subscribers

People subscribed via source and target branches