Merge lp:~laurynas-biveinis/percona-server/rm-lazy-drop-table-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: 496
Proposed branch: lp:~laurynas-biveinis/percona-server/rm-lazy-drop-table-5.5
Merge into: lp:percona-server/5.5
Diff against target: 406 lines (+14/-185) (has conflicts)
10 files modified
Percona-Server/storage/innobase/buf/buf0buf.c (+0/-74)
Percona-Server/storage/innobase/buf/buf0flu.c (+1/-8)
Percona-Server/storage/innobase/buf/buf0lru.c (+0/-40)
Percona-Server/storage/innobase/fil/fil0fil.c (+0/-49)
Percona-Server/storage/innobase/handler/ha_innodb.cc (+8/-2)
Percona-Server/storage/innobase/include/buf0buf.h (+5/-0)
Percona-Server/storage/innobase/include/buf0buf.ic (+0/-1)
Percona-Server/storage/innobase/include/buf0lru.h (+0/-7)
Percona-Server/storage/innobase/include/srv0srv.h (+0/-2)
Percona-Server/storage/innobase/srv/srv0srv.c (+0/-2)
Text conflict in Percona-Server/storage/innobase/include/buf0buf.h
To merge this branch: bzr merge lp:~laurynas-biveinis/percona-server/rm-lazy-drop-table-5.5
Reviewer Review Type Date Requested Status
Alexey Kopytov (community) Approve
Review via email: mp+157036@code.launchpad.net

Description of the change

Remove the lazy drop table implementation, implementing
https://blueprints.launchpad.net/percona-server/+spec/remove-lazy-drop-table.

Coincidentally this also fixes:
- bug 1086227 (InnoDB: Assertion failure in thread <nr> in file
dict0dict.c line 1883 | in dict_index_remove_from_cache | on ALTER
TABLE (related to Bug 897258));
- bug 1128848 (InnoDB: Failing assertion: node->n_pending == 0 in file
fil0fil.c line 2415 | abort in fil_delete_tablespace).

The lazy drop table removal is implemented as follows:
- removing buf_page_struct::space_was_being_deleted and all its
checks;
- removing buf_LRU_mark_space_was_deleted();
- replacing global srv_lazy_drop_table declared/defined in
srv0srv.h/.c with a static global variable in ha_innodb.cc;
- printing a warning if lazy drop table is enabled;
- adjusting the variable help text;
- removing srv_lazy_drop_table check from fil_delete_tablespace().

http://jenkins.percona.com/job/percona-server-5.5-param/719/ does not look really good, but the failures (especially the innodb.innodb_bug60049 one) agree with the last three trunk build failures.

To post a comment you must log in.
Revision history for this message
Laurynas Biveinis (laurynas-biveinis) wrote :

The diff conflict will have to be resolved at the time of the branch merge to the trunk. It does not block reviews.

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/buf0buf.c'
2--- Percona-Server/storage/innobase/buf/buf0buf.c 2013-03-26 07:16:53 +0000
3+++ Percona-Server/storage/innobase/buf/buf0buf.c 2013-04-04 07:23:28 +0000
4@@ -2002,27 +2002,6 @@
5 #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */
6 }
7
8- if (UNIV_UNLIKELY(bpage->space_was_being_deleted)) {
9- /* This page is obsoleted, should discard and retry */
10- rw_lock_s_unlock(&buf_pool->page_hash_latch);
11-
12- mutex_enter(&buf_pool->LRU_list_mutex);
13- block_mutex = buf_page_get_mutex_enter(bpage);
14-
15- if (UNIV_UNLIKELY(!block_mutex)) {
16- mutex_exit(&buf_pool->LRU_list_mutex);
17- goto lookup;
18- }
19-
20- buf_LRU_free_block(bpage, TRUE, TRUE);
21-
22- mutex_exit(&buf_pool->LRU_list_mutex);
23- mutex_exit(block_mutex);
24- block_mutex = NULL;
25-
26- goto lookup;
27- }
28-
29 if (UNIV_UNLIKELY(!bpage->zip.data)) {
30 /* There is no compressed page. */
31 err_exit:
32@@ -2533,26 +2512,6 @@
33 block = (buf_block_t*) buf_page_hash_get_low(
34 buf_pool, space, offset, fold);
35 if (block) {
36- if (UNIV_UNLIKELY(block->page.space_was_being_deleted)) {
37- /* This page is obsoleted, should discard and retry */
38- rw_lock_s_unlock(&buf_pool->page_hash_latch);
39-
40- mutex_enter(&buf_pool->LRU_list_mutex);
41- block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
42-
43- if (UNIV_UNLIKELY(!block_mutex)) {
44- mutex_exit(&buf_pool->LRU_list_mutex);
45- goto loop;
46- }
47-
48- buf_LRU_free_block((buf_page_t*)block, TRUE, TRUE);
49-
50- mutex_exit(&buf_pool->LRU_list_mutex);
51- mutex_exit(block_mutex);
52- block_mutex = NULL;
53-
54- goto loop;
55- }
56
57 block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
58 ut_a(block_mutex);
59@@ -3488,28 +3447,12 @@
60
61 fold = buf_page_address_fold(space, offset);
62
63-retry:
64 //buf_pool_mutex_enter(buf_pool);
65 mutex_enter(&buf_pool->LRU_list_mutex);
66 rw_lock_x_lock(&buf_pool->page_hash_latch);
67
68 watch_page = buf_page_hash_get_low(buf_pool, space, offset, fold);
69
70- if (UNIV_UNLIKELY(watch_page && watch_page->space_was_being_deleted)) {
71- mutex_t* block_mutex = buf_page_get_mutex_enter(watch_page);
72-
73- /* This page is obsoleted, should discard and retry */
74- rw_lock_x_unlock(&buf_pool->page_hash_latch);
75- ut_a(block_mutex);
76-
77- buf_LRU_free_block(watch_page, TRUE, TRUE);
78-
79- mutex_exit(&buf_pool->LRU_list_mutex);
80- mutex_exit(block_mutex);
81-
82- goto retry;
83- }
84-
85 if (watch_page && !buf_pool_watch_is_sentinel(buf_pool, watch_page)) {
86 /* The page is already in the buffer pool. */
87 watch_page = NULL;
88@@ -3638,7 +3581,6 @@
89 bpage->state = BUF_BLOCK_ZIP_PAGE;
90 bpage->space = space;
91 bpage->offset = offset;
92- bpage->space_was_being_deleted = FALSE;
93
94 #ifdef UNIV_DEBUG
95 bpage->in_page_hash = FALSE;
96@@ -3723,7 +3665,6 @@
97
98 fold = buf_page_address_fold(space, offset);
99
100-retry:
101 //buf_pool_mutex_enter(buf_pool);
102 mutex_enter(&buf_pool->LRU_list_mutex);
103 rw_lock_x_lock(&buf_pool->page_hash_latch);
104@@ -3731,21 +3672,6 @@
105 block = (buf_block_t*) buf_page_hash_get_low(
106 buf_pool, space, offset, fold);
107
108- if (UNIV_UNLIKELY(block && block->page.space_was_being_deleted)) {
109- mutex_t* block_mutex = buf_page_get_mutex_enter((buf_page_t*)block);
110-
111- /* This page is obsoleted, should discard and retry */
112- rw_lock_x_unlock(&buf_pool->page_hash_latch);
113- ut_a(block_mutex);
114-
115- buf_LRU_free_block((buf_page_t*)block, TRUE, TRUE);
116-
117- mutex_exit(&buf_pool->LRU_list_mutex);
118- mutex_exit(block_mutex);
119-
120- goto retry;
121- }
122-
123 if (block
124 && buf_page_in_file(&block->page)
125 && !buf_pool_watch_is_sentinel(buf_pool, &block->page)) {
126
127=== modified file 'Percona-Server/storage/innobase/buf/buf0flu.c'
128--- Percona-Server/storage/innobase/buf/buf0flu.c 2013-02-18 04:48:10 +0000
129+++ Percona-Server/storage/innobase/buf/buf0flu.c 2013-04-04 07:23:28 +0000
130@@ -459,7 +459,7 @@
131
132 if (UNIV_LIKELY(bpage->in_LRU_list && buf_page_in_file(bpage))) {
133
134- return((bpage->oldest_modification == 0 || bpage->space_was_being_deleted)
135+ return(bpage->oldest_modification == 0
136 && buf_page_get_io_fix(bpage) == BUF_IO_NONE
137 && bpage->buf_fix_count == 0);
138 }
139@@ -501,13 +501,6 @@
140 && buf_page_get_io_fix(bpage) == BUF_IO_NONE) {
141 ut_ad(bpage->in_flush_list);
142
143- if (bpage->space_was_being_deleted) {
144- /* should be removed from flush_list here */
145- /* because buf_flush_try_neighbors() cannot flush without fil_space_get_size(space) */
146- buf_flush_remove(bpage);
147- return(FALSE);
148- }
149-
150 if (flush_type != BUF_FLUSH_LRU) {
151
152 return(TRUE);
153
154=== modified file 'Percona-Server/storage/innobase/buf/buf0lru.c'
155--- Percona-Server/storage/innobase/buf/buf0lru.c 2013-03-26 07:16:53 +0000
156+++ Percona-Server/storage/innobase/buf/buf0lru.c 2013-04-04 07:23:28 +0000
157@@ -884,42 +884,6 @@
158 }
159 }
160
161-/******************************************************************//**
162-*/
163-UNIV_INTERN
164-void
165-buf_LRU_mark_space_was_deleted(
166-/*===========================*/
167- ulint id) /*!< in: space id */
168-{
169- ulint i;
170-
171- for (i = 0; i < srv_buf_pool_instances; i++) {
172- buf_pool_t* buf_pool;
173- buf_page_t* bpage;
174-
175- buf_pool = buf_pool_from_array(i);
176-
177- mutex_enter(&buf_pool->LRU_list_mutex);
178-
179- bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
180-
181- while (bpage != NULL) {
182- if (buf_page_get_space(bpage) == id) {
183- bpage->space_was_being_deleted = TRUE;
184- }
185- bpage = UT_LIST_GET_NEXT(LRU, bpage);
186- }
187-
188- mutex_exit(&buf_pool->LRU_list_mutex);
189-
190- /* The AHI entries for the tablespace being deleted should be
191- removed by now. */
192- ut_ad(buf_LRU_drop_page_hash_for_tablespace(buf_pool, id)
193- == 0);
194- }
195-}
196-
197 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
198 /********************************************************************//**
199 Insert a compressed block into buf_pool->zip_clean in the LRU order. */
200@@ -1891,10 +1855,6 @@
201 return(FALSE);
202 }
203
204- if (bpage->space_was_being_deleted && bpage->oldest_modification != 0) {
205- buf_flush_remove(bpage);
206- }
207-
208 #ifdef UNIV_IBUF_COUNT_DEBUG
209 ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0);
210 #endif /* UNIV_IBUF_COUNT_DEBUG */
211
212=== modified file 'Percona-Server/storage/innobase/fil/fil0fil.c'
213--- Percona-Server/storage/innobase/fil/fil0fil.c 2013-03-23 01:08:22 +0000
214+++ Percona-Server/storage/innobase/fil/fil0fil.c 2013-04-04 07:23:28 +0000
215@@ -2426,15 +2426,11 @@
216 To deal with potential read requests by checking the
217 ::stop_new_ops flag in fil_io() */
218
219- if (srv_lazy_drop_table) {
220- buf_LRU_mark_space_was_deleted(id);
221- } else {
222 buf_LRU_flush_or_remove_pages(
223 id, evict_all
224 ? BUF_REMOVE_ALL_NO_WRITE
225 : BUF_REMOVE_FLUSH_NO_WRITE);
226
227- }
228 #endif
229 /* printf("Deleting tablespace %s id %lu\n", space->name, id); */
230
231@@ -5304,22 +5300,6 @@
232 srv_data_written+= len;
233 }
234
235- /* if the table space was already deleted, space might not exist already. */
236- if (message
237- && space_id < SRV_LOG_SPACE_FIRST_ID
238- && ((buf_page_t*)message)->space_was_being_deleted) {
239-
240- if (mode == OS_AIO_NORMAL) {
241- buf_page_io_complete(message);
242- return(DB_SUCCESS); /*fake*/
243- }
244- if (type == OS_FILE_READ) {
245- return(DB_TABLESPACE_DELETED);
246- } else {
247- return(DB_SUCCESS); /*fake*/
248- }
249- }
250-
251 /* Reserve the fil_system mutex and make sure that we can open at
252 least one file while holding it, if the file is not already open */
253
254@@ -5465,20 +5445,6 @@
255 }
256 #endif
257
258- /* if the table space was already deleted, space might not exist already. */
259- if (message
260- && space_id < SRV_LOG_SPACE_FIRST_ID
261- && ((buf_page_t*)message)->space_was_being_deleted) {
262-
263- if (mode == OS_AIO_SYNC) {
264- if (type == OS_FILE_READ) {
265- return(DB_TABLESPACE_DELETED);
266- } else {
267- return(DB_SUCCESS); /*fake*/
268- }
269- }
270- }
271-
272 ut_a(ret);
273
274 if (mode == OS_AIO_SYNC) {
275@@ -5601,21 +5567,6 @@
276 &message, &type, &space_id);
277 }
278
279- /* if the table space was already deleted, fil_node might not exist already. */
280- if (message
281- && space_id < SRV_LOG_SPACE_FIRST_ID
282- && ((buf_page_t*)message)->space_was_being_deleted) {
283-
284- /* intended not to be uncompress read page */
285- ut_a(buf_page_get_io_fix_unlocked(message) == BUF_IO_WRITE
286- || !buf_page_get_zip_size(message)
287- || buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE);
288-
289- srv_set_io_thread_op_info(segment, "complete io for buf page");
290- buf_page_io_complete(message);
291- return;
292- }
293-
294 ut_a(ret);
295 if (UNIV_UNLIKELY(fil_node == NULL)) {
296 ut_ad(srv_shutdown_state == SRV_SHUTDOWN_EXIT_THREADS);
297
298=== modified file 'Percona-Server/storage/innobase/handler/ha_innodb.cc'
299--- Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-03-26 07:16:53 +0000
300+++ Percona-Server/storage/innobase/handler/ha_innodb.cc 2013-04-04 07:23:28 +0000
301@@ -202,6 +202,7 @@
302 #endif
303 static my_bool innobase_buffer_pool_shm_checksum = TRUE;
304 static uint innobase_buffer_pool_shm_key = 0;
305+static ulong srv_lazy_drop_table = 0;
306
307
308 static char* internal_innobase_data_file_path = NULL;
309@@ -3009,6 +3010,12 @@
310 "InnoDB: innodb_buffer_pool_shm_key was ignored.\n");
311 }
312
313+ if (srv_lazy_drop_table) {
314+ fprintf(stderr,
315+ "InnoDB: Warning: "
316+ "innodb_lazy_drop_table is deprecated and ignored.\n");
317+ }
318+
319 srv_mem_pool_size = (ulint) innobase_additional_mem_pool_size;
320
321 srv_n_file_io_threads = (ulint) innobase_file_io_threads;
322@@ -13027,8 +13034,7 @@
323
324 static MYSQL_SYSVAR_ULONG(lazy_drop_table, srv_lazy_drop_table,
325 PLUGIN_VAR_RQCMDARG,
326- "At deleting tablespace, only miminum needed processes at the time are done. "
327- "e.g. for http://bugs.mysql.com/51325",
328+ "[Deprecated option] no effect",
329 NULL, NULL, 0, 0, 1, 0);
330
331 static MYSQL_SYSVAR_BOOL(locking_fake_changes, srv_fake_changes_locks,
332
333=== modified file 'Percona-Server/storage/innobase/include/buf0buf.h'
334--- Percona-Server/storage/innobase/include/buf0buf.h 2013-02-18 04:48:10 +0000
335+++ Percona-Server/storage/innobase/include/buf0buf.h 2013-04-04 07:23:28 +0000
336@@ -1585,9 +1585,14 @@
337 /* @} */
338 unsigned access_time; /*!< time of first access, or
339 0 if the block was never accessed
340+<<<<<<< TREE
341 in the buffer pool. Protected by
342 block mutex */
343 ibool space_was_being_deleted;
344+=======
345+ in the buffer pool */
346+ /* @} */
347+>>>>>>> MERGE-SOURCE
348 ibool is_corrupt;
349 # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
350 ibool file_page_was_freed;
351
352=== modified file 'Percona-Server/storage/innobase/include/buf0buf.ic'
353--- Percona-Server/storage/innobase/include/buf0buf.ic 2013-03-23 01:08:22 +0000
354+++ Percona-Server/storage/innobase/include/buf0buf.ic 2013-04-04 07:23:28 +0000
355@@ -430,7 +430,6 @@
356 buf_block_set_state(block, BUF_BLOCK_FILE_PAGE);
357 block->page.space = space;
358 block->page.offset = page_no;
359- block->page.space_was_being_deleted = FALSE;
360 }
361
362 /*********************************************************************//**
363
364=== modified file 'Percona-Server/storage/innobase/include/buf0lru.h'
365--- Percona-Server/storage/innobase/include/buf0lru.h 2013-02-18 04:48:10 +0000
366+++ Percona-Server/storage/innobase/include/buf0lru.h 2013-04-04 07:23:28 +0000
367@@ -73,13 +73,6 @@
368 enum buf_remove_t buf_remove);/*!< in: remove or flush
369 strategy */
370
371-/******************************************************************//**
372-*/
373-UNIV_INTERN
374-void
375-buf_LRU_mark_space_was_deleted(
376-/*===========================*/
377- ulint id); /*!< in: space id */
378 #if defined UNIV_DEBUG || defined UNIV_BUF_DEBUG
379 /********************************************************************//**
380 Insert a compressed block into buf_pool->zip_clean in the LRU order. */
381
382=== modified file 'Percona-Server/storage/innobase/include/srv0srv.h'
383--- Percona-Server/storage/innobase/include/srv0srv.h 2013-03-23 01:08:22 +0000
384+++ Percona-Server/storage/innobase/include/srv0srv.h 2013-04-04 07:23:28 +0000
385@@ -282,8 +282,6 @@
386 } while(0)
387
388 extern ulint srv_dict_size_limit;
389-
390-extern ulint srv_lazy_drop_table;
391 /*-------------------------------------------*/
392
393 extern ulint srv_n_rows_inserted;
394
395=== modified file 'Percona-Server/storage/innobase/srv/srv0srv.c'
396--- Percona-Server/storage/innobase/srv/srv0srv.c 2013-03-26 01:40:02 +0000
397+++ Percona-Server/storage/innobase/srv/srv0srv.c 2013-04-04 07:23:28 +0000
398@@ -430,8 +430,6 @@
399 UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
400
401 UNIV_INTERN ulint srv_dict_size_limit = 0;
402-
403-UNIV_INTERN ulint srv_lazy_drop_table = 0;
404 /*-------------------------------------------*/
405 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
406 UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;

Subscribers

People subscribed via source and target branches