Merge lp:~laurynas-biveinis/percona-server/bug791849 into lp:~percona-dev/percona-server/5.5.11

Proposed by Laurynas Biveinis
Status: Superseded
Proposed branch: lp:~laurynas-biveinis/percona-server/bug791849
Merge into: lp:~percona-dev/percona-server/5.5.11
Prerequisite: lp:~percona-dev/percona-server/release-5.5.12-20.3
Diff against target: 444 lines (+50/-48)
1 file modified
innodb_adaptive_hash_index_partitions.patch (+50/-48)
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/bug791849
Reviewer Review Type Date Requested Status
Percona developers Pending
Review via email: mp+63374@code.launchpad.net

Description of the change

Fix LP bug 791849: valgrind reported memory leaks in XtraDB
initialization.

The patch innodb_adaptive_hash_index_partitions.patch introduces
btr_search_latch_part and btr_search_sys->hash_index variables, which
are allocated in btr_search_sys_create, however corresponding
deallocation in btr_search_sys_free was incomplete. The fix is
straightforward.

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'innodb_adaptive_hash_index_partitions.patch'
2--- innodb_adaptive_hash_index_partitions.patch 2011-06-03 13:04:36 +0000
3+++ innodb_adaptive_hash_index_partitions.patch 2011-06-03 13:04:37 +0000
4@@ -262,7 +262,7 @@
5 }
6
7 /*****************************************************************//**
8-@@ -195,11 +211,20 @@
9+@@ -195,11 +211,22 @@
10 btr_search_sys_free(void)
11 /*=====================*/
12 {
13@@ -281,6 +281,8 @@
14 +
15 + mem_free(btr_search_latch_part[i]);
16 + }
17++ mem_free(btr_search_sys->hash_index);
18++ mem_free(btr_search_latch_part);
19 +
20 + //rw_lock_free(&btr_search_latch);
21 + //mem_free(btr_search_latch_temp);
22@@ -288,7 +290,7 @@
23 mem_free(btr_search_sys);
24 btr_search_sys = NULL;
25 }
26-@@ -212,7 +237,7 @@
27+@@ -212,7 +239,7 @@
28 /*====================*/
29 {
30 mutex_enter(&btr_search_enabled_mutex);
31@@ -297,7 +299,7 @@
32
33 /* Disable access to hash index, also tell ha_insert_for_fold()
34 stop adding new nodes to hash index, but still allow updating
35-@@ -230,7 +255,7 @@
36+@@ -230,7 +257,7 @@
37 /* btr_search_enabled_mutex should guarantee this. */
38 ut_ad(!btr_search_enabled);
39
40@@ -306,7 +308,7 @@
41 mutex_exit(&btr_search_enabled_mutex);
42 }
43
44-@@ -242,12 +267,12 @@
45+@@ -242,12 +269,12 @@
46 /*====================*/
47 {
48 mutex_enter(&btr_search_enabled_mutex);
49@@ -321,7 +323,7 @@
50 mutex_exit(&btr_search_enabled_mutex);
51 }
52
53-@@ -300,20 +325,21 @@
54+@@ -300,20 +327,21 @@
55 ulint
56 btr_search_info_get_ref_count(
57 /*==========================*/
58@@ -348,7 +350,7 @@
59
60 return(ret);
61 }
62-@@ -334,8 +360,8 @@
63+@@ -334,8 +362,8 @@
64 int cmp;
65
66 #ifdef UNIV_SYNC_DEBUG
67@@ -359,7 +361,7 @@
68 #endif /* UNIV_SYNC_DEBUG */
69
70 index = cursor->index;
71-@@ -453,8 +479,8 @@
72+@@ -453,8 +481,8 @@
73 /*!< in: cursor */
74 {
75 #ifdef UNIV_SYNC_DEBUG
76@@ -370,7 +372,7 @@
77 ut_ad(rw_lock_own(&block->lock, RW_LOCK_SHARED)
78 || rw_lock_own(&block->lock, RW_LOCK_EX));
79 #endif /* UNIV_SYNC_DEBUG */
80-@@ -538,7 +564,7 @@
81+@@ -538,7 +566,7 @@
82
83 ut_ad(cursor->flag == BTR_CUR_HASH_FAIL);
84 #ifdef UNIV_SYNC_DEBUG
85@@ -379,7 +381,7 @@
86 ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
87 || rw_lock_own(&(block->lock), RW_LOCK_EX));
88 #endif /* UNIV_SYNC_DEBUG */
89-@@ -578,10 +604,10 @@
90+@@ -578,10 +606,10 @@
91 mem_heap_free(heap);
92 }
93 #ifdef UNIV_SYNC_DEBUG
94@@ -392,7 +394,7 @@
95 block, rec);
96 }
97 }
98-@@ -601,8 +627,8 @@
99+@@ -601,8 +629,8 @@
100 ulint* params2;
101
102 #ifdef UNIV_SYNC_DEBUG
103@@ -403,7 +405,7 @@
104 #endif /* UNIV_SYNC_DEBUG */
105
106 block = btr_cur_get_block(cursor);
107-@@ -623,7 +649,7 @@
108+@@ -623,7 +651,7 @@
109
110 if (build_index || (cursor->flag == BTR_CUR_HASH_FAIL)) {
111
112@@ -412,7 +414,7 @@
113 }
114
115 if (cursor->flag == BTR_CUR_HASH_FAIL) {
116-@@ -633,11 +659,11 @@
117+@@ -633,11 +661,11 @@
118 btr_search_n_hash_fail++;
119 #endif /* UNIV_SEARCH_PERF_STAT */
120
121@@ -426,7 +428,7 @@
122 }
123
124 if (build_index) {
125-@@ -881,17 +907,17 @@
126+@@ -881,17 +909,17 @@
127 cursor->flag = BTR_CUR_HASH;
128
129 if (UNIV_LIKELY(!has_search_latch)) {
130@@ -448,7 +450,7 @@
131
132 if (UNIV_UNLIKELY(!rec)) {
133 goto failure_unlock;
134-@@ -909,7 +935,7 @@
135+@@ -909,7 +937,7 @@
136 goto failure_unlock;
137 }
138
139@@ -457,7 +459,7 @@
140
141 buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
142 }
143-@@ -1006,7 +1032,7 @@
144+@@ -1006,7 +1034,7 @@
145 /*-------------------------------------------*/
146 failure_unlock:
147 if (UNIV_LIKELY(!has_search_latch)) {
148@@ -466,7 +468,7 @@
149 }
150 failure:
151 cursor->flag = BTR_CUR_HASH_FAIL;
152-@@ -1029,10 +1055,11 @@
153+@@ -1029,10 +1057,11 @@
154 void
155 btr_search_drop_page_hash_index(
156 /*============================*/
157@@ -479,7 +481,7 @@
158 {
159 hash_table_t* table;
160 ulint n_fields;
161-@@ -1051,22 +1078,60 @@
162+@@ -1051,22 +1080,60 @@
163 ulint* offsets;
164
165 #ifdef UNIV_SYNC_DEBUG
166@@ -545,7 +547,7 @@
167
168 #ifdef UNIV_SYNC_DEBUG
169 ut_ad(rw_lock_own(&(block->lock), RW_LOCK_SHARED)
170-@@ -1076,14 +1141,14 @@
171+@@ -1076,14 +1143,14 @@
172
173 n_fields = block->curr_n_fields;
174 n_bytes = block->curr_n_bytes;
175@@ -562,7 +564,7 @@
176
177 ut_a(n_fields + n_bytes > 0);
178
179-@@ -1133,7 +1198,7 @@
180+@@ -1133,7 +1200,7 @@
181 mem_heap_free(heap);
182 }
183
184@@ -571,7 +573,7 @@
185
186 if (UNIV_UNLIKELY(!block->is_hashed)) {
187 /* Someone else has meanwhile dropped the hash index */
188-@@ -1149,7 +1214,7 @@
189+@@ -1149,7 +1216,7 @@
190 /* Someone else has meanwhile built a new hash index on the
191 page, with different parameters */
192
193@@ -580,7 +582,7 @@
194
195 mem_free(folds);
196 goto retry;
197-@@ -1165,6 +1230,7 @@
198+@@ -1165,6 +1232,7 @@
199
200 block->is_hashed = FALSE;
201 block->index = NULL;
202@@ -588,7 +590,7 @@
203
204 cleanup:
205 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
206-@@ -1177,14 +1243,14 @@
207+@@ -1177,14 +1245,14 @@
208 "InnoDB: the hash index to a page of %s,"
209 " still %lu hash nodes remain.\n",
210 index->name, (ulong) block->n_pointers);
211@@ -606,7 +608,7 @@
212 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
213
214 mem_free(folds);
215-@@ -1216,9 +1282,9 @@
216+@@ -1216,9 +1284,9 @@
217 ulint* offsets;
218 ibool released_search_latch;
219
220@@ -618,7 +620,7 @@
221
222 for (j = 0; j < srv_buf_pool_instances; j++) {
223 buf_pool_t* buf_pool;
224-@@ -1252,7 +1318,7 @@
225+@@ -1252,7 +1320,7 @@
226
227
228 /* keeping latch order */
229@@ -627,7 +629,7 @@
230 released_search_latch = TRUE;
231 rw_lock_x_lock(&block->lock);
232
233-@@ -1304,7 +1370,7 @@
234+@@ -1304,7 +1372,7 @@
235 mem_heap_empty(heap);
236 }
237
238@@ -636,7 +638,7 @@
239
240 if (UNIV_UNLIKELY(!block->is_hashed)) {
241 goto cleanup;
242-@@ -1314,12 +1380,12 @@
243+@@ -1314,12 +1382,12 @@
244
245 if (UNIV_UNLIKELY(block->curr_n_fields != n_fields)
246 || UNIV_UNLIKELY(block->curr_n_bytes != n_bytes)) {
247@@ -651,7 +653,7 @@
248 goto retry;
249 }
250
251-@@ -1333,6 +1399,7 @@
252+@@ -1333,6 +1401,7 @@
253
254 block->is_hashed = FALSE;
255 block->index = NULL;
256@@ -659,7 +661,7 @@
257
258 cleanup:
259 #if defined UNIV_AHI_DEBUG || defined UNIV_DEBUG
260-@@ -1345,18 +1412,18 @@
261+@@ -1345,18 +1414,18 @@
262 index->name, (ulong) block->n_pointers);
263 }
264 #endif /* UNIV_AHI_DEBUG || UNIV_DEBUG */
265@@ -681,7 +683,7 @@
266
267 if (UNIV_LIKELY_NULL(heap)) {
268 mem_heap_free(heap);
269-@@ -1403,7 +1470,7 @@
270+@@ -1403,7 +1472,7 @@
271
272 buf_block_dbg_add_level(block, SYNC_TREE_NODE_FROM_HASH);
273
274@@ -690,7 +692,7 @@
275 }
276
277 mtr_commit(&mtr);
278-@@ -1445,26 +1512,26 @@
279+@@ -1445,26 +1514,26 @@
280 ut_ad(index);
281 ut_a(!dict_index_is_ibuf(index));
282
283@@ -723,7 +725,7 @@
284 }
285
286 n_recs = page_get_n_recs(page);
287-@@ -1558,9 +1625,9 @@
288+@@ -1558,9 +1627,9 @@
289 fold = next_fold;
290 }
291
292@@ -735,7 +737,7 @@
293
294 if (UNIV_UNLIKELY(btr_search_fully_disabled)) {
295 goto exit_func;
296-@@ -1588,6 +1655,7 @@
297+@@ -1588,6 +1657,7 @@
298 block->curr_n_bytes = n_bytes;
299 block->curr_left_side = left_side;
300 block->index = index;
301@@ -743,7 +745,7 @@
302
303 for (i = 0; i < n_cached; i++) {
304
305-@@ -1595,7 +1663,7 @@
306+@@ -1595,7 +1665,7 @@
307 }
308
309 exit_func:
310@@ -752,7 +754,7 @@
311
312 mem_free(folds);
313 mem_free(recs);
314-@@ -1634,13 +1702,13 @@
315+@@ -1634,13 +1704,13 @@
316 ut_a(!(new_block->is_hashed || block->is_hashed)
317 || !dict_index_is_ibuf(index));
318
319@@ -769,7 +771,7 @@
320
321 return;
322 }
323-@@ -1655,7 +1723,7 @@
324+@@ -1655,7 +1725,7 @@
325 new_block->n_bytes = block->curr_n_bytes;
326 new_block->left_side = left_side;
327
328@@ -778,7 +780,7 @@
329
330 ut_a(n_fields + n_bytes > 0);
331
332-@@ -1667,7 +1735,7 @@
333+@@ -1667,7 +1737,7 @@
334 return;
335 }
336
337@@ -787,7 +789,7 @@
338 }
339
340 /********************************************************************//**
341-@@ -1706,7 +1774,7 @@
342+@@ -1706,7 +1776,7 @@
343 ut_a(block->curr_n_fields + block->curr_n_bytes > 0);
344 ut_a(!dict_index_is_ibuf(cursor->index));
345
346@@ -796,7 +798,7 @@
347
348 index_id = cursor->index->id;
349 fold = rec_fold(rec, rec_get_offsets(rec, cursor->index, offsets_,
350-@@ -1715,11 +1783,11 @@
351+@@ -1715,11 +1785,11 @@
352 if (UNIV_LIKELY_NULL(heap)) {
353 mem_heap_free(heap);
354 }
355@@ -810,7 +812,7 @@
356 }
357
358 /********************************************************************//**
359-@@ -1753,21 +1821,21 @@
360+@@ -1753,21 +1823,21 @@
361 ut_a(block->index == cursor->index);
362 ut_a(!dict_index_is_ibuf(cursor->index));
363
364@@ -836,7 +838,7 @@
365
366 btr_search_update_hash_on_insert(cursor);
367 }
368-@@ -1802,9 +1870,9 @@
369+@@ -1802,9 +1872,9 @@
370 ulint* offsets = offsets_;
371 rec_offs_init(offsets_);
372
373@@ -848,7 +850,7 @@
374
375 rec = btr_cur_get_rec(cursor);
376
377-@@ -1849,7 +1917,7 @@
378+@@ -1849,7 +1919,7 @@
379 } else {
380 if (left_side) {
381
382@@ -857,7 +859,7 @@
383
384 locked = TRUE;
385
386-@@ -1863,7 +1931,7 @@
387+@@ -1863,7 +1933,7 @@
388
389 if (!locked) {
390
391@@ -866,7 +868,7 @@
392
393 locked = TRUE;
394 }
395-@@ -1881,7 +1949,7 @@
396+@@ -1881,7 +1951,7 @@
397 if (!left_side) {
398
399 if (!locked) {
400@@ -875,7 +877,7 @@
401
402 locked = TRUE;
403 }
404-@@ -1896,7 +1964,7 @@
405+@@ -1896,7 +1966,7 @@
406
407 if (!locked) {
408
409@@ -884,7 +886,7 @@
410
411 locked = TRUE;
412 }
413-@@ -1919,7 +1987,7 @@
414+@@ -1919,7 +1989,7 @@
415 mem_heap_free(heap);
416 }
417 if (locked) {
418@@ -893,7 +895,7 @@
419 }
420 }
421
422-@@ -1935,7 +2003,7 @@
423+@@ -1935,7 +2005,7 @@
424 ha_node_t* node;
425 ulint n_page_dumps = 0;
426 ibool ok = TRUE;
427@@ -902,7 +904,7 @@
428 ulint cell_count;
429 mem_heap_t* heap = NULL;
430 ulint offsets_[REC_OFFS_NORMAL_SIZE];
431-@@ -1947,23 +2015,25 @@
432+@@ -1947,23 +2017,25 @@
433
434 rec_offs_init(offsets_);
435
436@@ -933,7 +935,7 @@
437
438 for (; node != NULL; node = node->next) {
439 const buf_block_t* block
440-@@ -2072,19 +2142,21 @@
441+@@ -2072,19 +2144,21 @@
442 give other queries a chance to run. */
443 if (i != 0) {
444 buf_pool_page_hash_x_unlock_all();

Subscribers

People subscribed via source and target branches