]>
Commit | Line | Data |
---|---|---|
b4e1fa2c AM |
1 | # name : innodb_fix_misc.patch |
2 | # introduced : 11 or before | |
3 | # maintainer : Yasufumi | |
4 | # | |
a9ee80b9 ER |
5 | # Bug fix for |
6 | # http://bugs.mysql.com/56433 (always: because good for all users, and safe) | |
7 | # and http://bugs.mysql.com/51325 (optional: innodb_lazy_drop_table) | |
8 | # were added. They may be removed in the future when will be fixed officially. | |
9 | # | |
b4e1fa2c AM |
10 | #!!! notice !!! |
11 | # Any small change to this file in the main branch | |
12 | # should be done or reviewed by the maintainer! | |
a9ee80b9 ER |
13 | diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c |
14 | --- a/storage/innobase/buf/buf0buf.c 2011-02-23 19:00:48.178696354 +0900 | |
15 | +++ b/storage/innobase/buf/buf0buf.c 2011-02-23 19:01:19.138826278 +0900 | |
f7ab7acd | 16 | @@ -4084,6 +4084,7 @@ |
a9ee80b9 ER |
17 | bpage->state = BUF_BLOCK_ZIP_PAGE; |
18 | bpage->space = space; | |
19 | bpage->offset = offset; | |
20 | + bpage->space_was_being_deleted = FALSE; | |
21 | ||
22 | ||
23 | #ifdef UNIV_DEBUG | |
24 | diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c | |
25 | --- a/storage/innobase/buf/buf0flu.c 2011-02-23 19:00:48.182659256 +0900 | |
26 | +++ b/storage/innobase/buf/buf0flu.c 2011-02-23 19:01:19.138826278 +0900 | |
27 | @@ -439,7 +439,7 @@ | |
28 | ||
29 | if (UNIV_LIKELY(bpage->in_LRU_list && buf_page_in_file(bpage))) { | |
30 | ||
31 | - return(bpage->oldest_modification == 0 | |
32 | + return((bpage->oldest_modification == 0 || bpage->space_was_being_deleted) | |
33 | && buf_page_get_io_fix(bpage) == BUF_IO_NONE | |
34 | && bpage->buf_fix_count == 0); | |
35 | } | |
36 | @@ -481,6 +481,13 @@ | |
37 | && buf_page_get_io_fix(bpage) == BUF_IO_NONE) { | |
38 | ut_ad(bpage->in_flush_list); | |
39 | ||
40 | + if (bpage->space_was_being_deleted) { | |
41 | + /* should be removed from flush_list here */ | |
42 | + /* because buf_flush_try_neighbors() cannot flush without fil_space_get_size(space) */ | |
43 | + buf_flush_remove(bpage); | |
44 | + return(FALSE); | |
45 | + } | |
46 | + | |
47 | if (flush_type != BUF_FLUSH_LRU) { | |
48 | ||
49 | return(TRUE); | |
50 | diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c | |
51 | --- a/storage/innobase/buf/buf0lru.c 2011-02-23 19:00:47.939695791 +0900 | |
52 | +++ b/storage/innobase/buf/buf0lru.c 2011-02-23 19:01:19.142741970 +0900 | |
adf0fb13 | 53 | @@ -574,6 +574,37 @@ |
a9ee80b9 ER |
54 | } |
55 | } | |
56 | ||
57 | +/******************************************************************//** | |
58 | +*/ | |
59 | +UNIV_INTERN | |
60 | +void | |
61 | +buf_LRU_mark_space_was_deleted( | |
62 | +/*===========================*/ | |
63 | + ulint id) /*!< in: space id */ | |
64 | +{ | |
65 | + ulint i; | |
66 | + | |
67 | + for (i = 0; i < srv_buf_pool_instances; i++) { | |
68 | + buf_pool_t* buf_pool; | |
69 | + buf_page_t* bpage; | |
70 | + | |
71 | + buf_pool = buf_pool_from_array(i); | |
72 | + | |
73 | + mutex_enter(&buf_pool->LRU_list_mutex); | |
74 | + | |
75 | + bpage = UT_LIST_GET_FIRST(buf_pool->LRU); | |
76 | + | |
77 | + while (bpage != NULL) { | |
78 | + if (buf_page_get_space(bpage) == id) { | |
79 | + bpage->space_was_being_deleted = TRUE; | |
80 | + } | |
81 | + bpage = UT_LIST_GET_NEXT(LRU, bpage); | |
82 | + } | |
83 | + | |
84 | + mutex_exit(&buf_pool->LRU_list_mutex); | |
85 | + } | |
86 | +} | |
87 | + | |
88 | /********************************************************************//** | |
89 | Insert a compressed block into buf_pool->zip_clean in the LRU order. */ | |
90 | UNIV_INTERN | |
adf0fb13 | 91 | @@ -1558,6 +1589,10 @@ |
a9ee80b9 ER |
92 | return(BUF_LRU_NOT_FREED); |
93 | } | |
94 | ||
95 | + if (bpage->space_was_being_deleted && bpage->oldest_modification != 0) { | |
96 | + buf_flush_remove(bpage); | |
97 | + } | |
98 | + | |
99 | #ifdef UNIV_IBUF_COUNT_DEBUG | |
100 | ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0); | |
101 | #endif /* UNIV_IBUF_COUNT_DEBUG */ | |
a9ee80b9 ER |
102 | diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c |
103 | --- a/storage/innobase/fil/fil0fil.c 2011-02-23 19:00:48.223696428 +0900 | |
104 | +++ b/storage/innobase/fil/fil0fil.c 2011-02-23 19:01:19.147655510 +0900 | |
adf0fb13 | 105 | @@ -254,6 +254,7 @@ |
a9ee80b9 ER |
106 | struct fil_system_struct { |
107 | #ifndef UNIV_HOTBACKUP | |
108 | mutex_t mutex; /*!< The mutex protecting the cache */ | |
109 | + mutex_t file_extend_mutex; | |
110 | #endif /* !UNIV_HOTBACKUP */ | |
111 | hash_table_t* spaces; /*!< The hash table of spaces in the | |
112 | system; they are hashed on the space | |
adf0fb13 | 113 | @@ -863,7 +864,7 @@ |
a9ee80b9 ER |
114 | ut_ad(node && system); |
115 | ut_ad(mutex_own(&(system->mutex))); | |
116 | ut_a(node->open); | |
117 | - ut_a(node->n_pending == 0); | |
11822e22 | 118 | + ut_a(node->n_pending == 0 || node->space->is_being_deleted); |
a9ee80b9 ER |
119 | ut_a(node->n_pending_flushes == 0); |
120 | ut_a(node->modification_counter == node->flush_counter); | |
121 | ||
adf0fb13 | 122 | @@ -876,7 +877,7 @@ |
11822e22 AM |
123 | ut_a(system->n_open > 0); |
124 | system->n_open--; | |
125 | ||
126 | - if (node->space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(node->space->id)) { | |
127 | + if (node->n_pending == 0 && node->space->purpose == FIL_TABLESPACE && !trx_sys_sys_space(node->space->id)) { | |
128 | ut_a(UT_LIST_GET_LEN(system->LRU) > 0); | |
129 | ||
130 | /* The node is in the LRU list, remove it */ | |
adf0fb13 | 131 | @@ -1075,7 +1076,7 @@ |
a9ee80b9 ER |
132 | ut_ad(node && system && space); |
133 | ut_ad(mutex_own(&(system->mutex))); | |
134 | ut_a(node->magic_n == FIL_NODE_MAGIC_N); | |
135 | - ut_a(node->n_pending == 0); | |
11822e22 | 136 | + ut_a(node->n_pending == 0 || space->is_being_deleted); |
a9ee80b9 ER |
137 | |
138 | if (node->open) { | |
139 | /* We fool the assertion in fil_node_close_file() to think | |
adf0fb13 | 140 | @@ -1597,6 +1598,8 @@ |
a9ee80b9 ER |
141 | |
142 | mutex_create(fil_system_mutex_key, | |
143 | &fil_system->mutex, SYNC_ANY_LATCH); | |
144 | + mutex_create(fil_system_mutex_key, | |
145 | + &fil_system->file_extend_mutex, SYNC_OUTER_ANY_LATCH); | |
146 | ||
147 | fil_system->spaces = hash_create(hash_size); | |
148 | fil_system->name_hash = hash_create(hash_size); | |
adf0fb13 | 149 | @@ -2343,7 +2346,11 @@ |
a9ee80b9 ER |
150 | completely and permanently. The flag is_being_deleted also prevents |
151 | fil_flush() from being applied to this tablespace. */ | |
152 | ||
153 | + if (srv_lazy_drop_table) { | |
154 | + buf_LRU_mark_space_was_deleted(id); | |
155 | + } else { | |
156 | buf_LRU_invalidate_tablespace(id); | |
157 | + } | |
158 | #endif | |
159 | /* printf("Deleting tablespace %s id %lu\n", space->name, id); */ | |
160 | ||
adf0fb13 | 161 | @@ -4721,6 +4728,10 @@ |
a9ee80b9 ER |
162 | ulint page_size; |
163 | ibool success = TRUE; | |
164 | ||
165 | + /* file_extend_mutex is for http://bugs.mysql.com/56433 */ | |
166 | + /* to protect from the other fil_extend_space_to_desired_size() */ | |
167 | + /* during temprary releasing &fil_system->mutex */ | |
168 | + mutex_enter(&fil_system->file_extend_mutex); | |
169 | fil_mutex_enter_and_prepare_for_io(space_id); | |
170 | ||
171 | space = fil_space_get_by_id(space_id); | |
adf0fb13 | 172 | @@ -4732,6 +4743,7 @@ |
a9ee80b9 ER |
173 | *actual_size = space->size; |
174 | ||
175 | mutex_exit(&fil_system->mutex); | |
176 | + mutex_exit(&fil_system->file_extend_mutex); | |
177 | ||
178 | return(TRUE); | |
179 | } | |
adf0fb13 | 180 | @@ -4764,6 +4776,8 @@ |
a9ee80b9 ER |
181 | offset_low = ((start_page_no - file_start_page_no) |
182 | % (4096 * ((1024 * 1024) / page_size))) | |
183 | * page_size; | |
184 | + | |
185 | + mutex_exit(&fil_system->mutex); | |
186 | #ifdef UNIV_HOTBACKUP | |
187 | success = os_file_write(node->name, node->handle, buf, | |
188 | offset_low, offset_high, | |
adf0fb13 | 189 | @@ -4773,8 +4787,10 @@ |
a9ee80b9 ER |
190 | node->name, node->handle, buf, |
191 | offset_low, offset_high, | |
192 | page_size * n_pages, | |
193 | - NULL, NULL, NULL); | |
194 | + NULL, NULL, space_id, NULL); | |
195 | #endif | |
196 | + mutex_enter(&fil_system->mutex); | |
197 | + | |
198 | if (success) { | |
199 | node->size += n_pages; | |
200 | space->size += n_pages; | |
adf0fb13 | 201 | @@ -4820,6 +4836,7 @@ |
a9ee80b9 ER |
202 | printf("Extended %s to %lu, actual size %lu pages\n", space->name, |
203 | size_after_extend, *actual_size); */ | |
204 | mutex_exit(&fil_system->mutex); | |
205 | + mutex_exit(&fil_system->file_extend_mutex); | |
206 | ||
413cadc7 | 207 | fil_flush(space_id, TRUE); |
a9ee80b9 | 208 | |
adf0fb13 | 209 | @@ -5182,6 +5199,22 @@ |
a9ee80b9 ER |
210 | srv_data_written+= len; |
211 | } | |
212 | ||
213 | + /* if the table space was already deleted, space might not exist already. */ | |
214 | + if (message | |
215 | + && space_id < SRV_LOG_SPACE_FIRST_ID | |
216 | + && ((buf_page_t*)message)->space_was_being_deleted) { | |
217 | + | |
218 | + if (mode == OS_AIO_NORMAL) { | |
adf0fb13 | 219 | + buf_page_io_complete(message); |
a9ee80b9 ER |
220 | + return(DB_SUCCESS); /*fake*/ |
221 | + } | |
222 | + if (type == OS_FILE_READ) { | |
223 | + return(DB_TABLESPACE_DELETED); | |
224 | + } else { | |
225 | + return(DB_SUCCESS); /*fake*/ | |
226 | + } | |
227 | + } | |
228 | + | |
229 | /* Reserve the fil_system mutex and make sure that we can open at | |
230 | least one file while holding it, if the file is not already open */ | |
231 | ||
adf0fb13 | 232 | @@ -5323,10 +5356,24 @@ |
a9ee80b9 ER |
233 | #else |
234 | /* Queue the aio request */ | |
235 | ret = os_aio(type, mode | wake_later, node->name, node->handle, buf, | |
236 | - offset_low, offset_high, len, node, message, trx); | |
237 | + offset_low, offset_high, len, node, message, space_id, trx); | |
238 | #endif | |
239 | } /**/ | |
240 | ||
241 | + /* if the table space was already deleted, space might not exist already. */ | |
242 | + if (message | |
243 | + && space_id < SRV_LOG_SPACE_FIRST_ID | |
244 | + && ((buf_page_t*)message)->space_was_being_deleted) { | |
245 | + | |
246 | + if (mode == OS_AIO_SYNC) { | |
247 | + if (type == OS_FILE_READ) { | |
248 | + return(DB_TABLESPACE_DELETED); | |
249 | + } else { | |
250 | + return(DB_SUCCESS); /*fake*/ | |
251 | + } | |
252 | + } | |
253 | + } | |
254 | + | |
255 | ut_a(ret); | |
256 | ||
257 | if (mode == OS_AIO_SYNC) { | |
adf0fb13 | 258 | @@ -5426,6 +5473,7 @@ |
a9ee80b9 ER |
259 | fil_node_t* fil_node; |
260 | void* message; | |
261 | ulint type; | |
262 | + ulint space_id = 0; | |
263 | ||
264 | ut_ad(fil_validate_skip()); | |
265 | ||
adf0fb13 | 266 | @@ -5433,10 +5481,10 @@ |
a9ee80b9 ER |
267 | srv_set_io_thread_op_info(segment, "native aio handle"); |
268 | #ifdef WIN_ASYNC_IO | |
269 | ret = os_aio_windows_handle(segment, 0, &fil_node, | |
270 | - &message, &type); | |
271 | + &message, &type, &space_id); | |
272 | #elif defined(LINUX_NATIVE_AIO) | |
273 | ret = os_aio_linux_handle(segment, &fil_node, | |
274 | - &message, &type); | |
275 | + &message, &type, &space_id); | |
276 | #else | |
a9ee80b9 | 277 | ut_error; |
adf0fb13 AM |
278 | ret = 0; /* Eliminate compiler warning */ |
279 | @@ -5445,7 +5493,22 @@ | |
a9ee80b9 ER |
280 | srv_set_io_thread_op_info(segment, "simulated aio handle"); |
281 | ||
282 | ret = os_aio_simulated_handle(segment, &fil_node, | |
283 | - &message, &type); | |
284 | + &message, &type, &space_id); | |
285 | + } | |
286 | + | |
287 | + /* if the table space was already deleted, fil_node might not exist already. */ | |
288 | + if (message | |
289 | + && space_id < SRV_LOG_SPACE_FIRST_ID | |
290 | + && ((buf_page_t*)message)->space_was_being_deleted) { | |
291 | + | |
292 | + /* intended not to be uncompress read page */ | |
293 | + ut_a(buf_page_get_io_fix(message) == BUF_IO_WRITE | |
294 | + || !buf_page_get_zip_size(message) | |
295 | + || buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE); | |
296 | + | |
297 | + srv_set_io_thread_op_info(segment, "complete io for buf page"); | |
adf0fb13 | 298 | + buf_page_io_complete(message); |
a9ee80b9 ER |
299 | + return; |
300 | } | |
301 | ||
302 | ut_a(ret); | |
b4e1fa2c AM |
303 | diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc |
304 | --- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:13.035513990 +0900 | |
305 | +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:53.084513775 +0900 | |
adf0fb13 | 306 | @@ -12007,6 +12007,12 @@ |
a9ee80b9 ER |
307 | "except for the deletion.", |
308 | NULL, NULL, 0, &corrupt_table_action_typelib); | |
309 | ||
310 | +static MYSQL_SYSVAR_ULONG(lazy_drop_table, srv_lazy_drop_table, | |
311 | + PLUGIN_VAR_RQCMDARG, | |
312 | + "At deleting tablespace, only miminum needed processes at the time are done. " | |
313 | + "e.g. for http://bugs.mysql.com/51325", | |
314 | + NULL, NULL, 0, 0, 1, 0); | |
315 | + | |
316 | static struct st_mysql_sys_var* innobase_system_variables[]= { | |
317 | MYSQL_SYSVAR(page_size), | |
318 | MYSQL_SYSVAR(log_block_size), | |
adf0fb13 | 319 | @@ -12097,6 +12103,7 @@ |
a9ee80b9 | 320 | MYSQL_SYSVAR(purge_batch_size), |
11822e22 | 321 | MYSQL_SYSVAR(rollback_segments), |
a9ee80b9 ER |
322 | MYSQL_SYSVAR(corrupt_table_action), |
323 | + MYSQL_SYSVAR(lazy_drop_table), | |
324 | NULL | |
325 | }; | |
326 | ||
adf0fb13 | 327 | @@ -12106,7 +12113,7 @@ |
b4e1fa2c AM |
328 | &innobase_storage_engine, |
329 | innobase_hton_name, | |
adf0fb13 | 330 | plugin_author, |
b4e1fa2c AM |
331 | - "Supports transactions, row-level locking, and foreign keys", |
332 | + "Percona-XtraDB, Supports transactions, row-level locking, and foreign keys", | |
333 | PLUGIN_LICENSE_GPL, | |
334 | innobase_init, /* Plugin Init */ | |
335 | NULL, /* Plugin Deinit */ | |
a9ee80b9 ER |
336 | diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h |
337 | --- a/storage/innobase/include/buf0buf.h 2011-02-23 19:00:48.252696774 +0900 | |
338 | +++ b/storage/innobase/include/buf0buf.h 2011-02-23 19:01:19.182655902 +0900 | |
adf0fb13 | 339 | @@ -1438,6 +1438,7 @@ |
a9ee80b9 ER |
340 | 0 if the block was never accessed |
341 | in the buffer pool */ | |
342 | /* @} */ | |
343 | + ibool space_was_being_deleted; | |
344 | ibool is_corrupt; | |
df1b5770 | 345 | # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG |
a9ee80b9 ER |
346 | ibool file_page_was_freed; |
347 | diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic | |
348 | --- a/storage/innobase/include/buf0buf.ic 2011-02-23 19:00:48.130659154 +0900 | |
349 | +++ b/storage/innobase/include/buf0buf.ic 2011-02-23 19:01:19.185655906 +0900 | |
11822e22 | 350 | @@ -408,6 +408,7 @@ |
a9ee80b9 ER |
351 | buf_block_set_state(block, BUF_BLOCK_FILE_PAGE); |
352 | block->page.space = space; | |
353 | block->page.offset = page_no; | |
354 | + block->page.space_was_being_deleted = FALSE; | |
355 | } | |
356 | ||
357 | /*********************************************************************//** | |
358 | diff -ruN a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h | |
359 | --- a/storage/innobase/include/buf0lru.h 2011-02-23 19:00:47.977658923 +0900 | |
360 | +++ b/storage/innobase/include/buf0lru.h 2011-02-23 19:01:19.188625768 +0900 | |
361 | @@ -85,6 +85,13 @@ | |
362 | buf_LRU_invalidate_tablespace( | |
363 | /*==========================*/ | |
364 | ulint id); /*!< in: space id */ | |
365 | +/******************************************************************//** | |
366 | +*/ | |
367 | +UNIV_INTERN | |
368 | +void | |
369 | +buf_LRU_mark_space_was_deleted( | |
370 | +/*===========================*/ | |
371 | + ulint id); /*!< in: space id */ | |
372 | /********************************************************************//** | |
373 | Insert a compressed block into buf_pool->zip_clean in the LRU order. */ | |
374 | UNIV_INTERN | |
375 | diff -ruN a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h | |
376 | --- a/storage/innobase/include/os0file.h 2011-02-23 19:00:48.260696646 +0900 | |
377 | +++ b/storage/innobase/include/os0file.h 2011-02-23 19:01:19.190656054 +0900 | |
378 | @@ -280,9 +280,9 @@ | |
379 | pfs_os_file_close_func(file, __FILE__, __LINE__) | |
380 | ||
381 | # define os_aio(type, mode, name, file, buf, offset, offset_high, \ | |
382 | - n, message1, message2, trx) \ | |
383 | + n, message1, message2, space_id, trx) \ | |
384 | pfs_os_aio_func(type, mode, name, file, buf, offset, \ | |
385 | - offset_high, n, message1, message2, trx, \ | |
386 | + offset_high, n, message1, message2, space_id, trx,\ | |
387 | __FILE__, __LINE__) | |
388 | ||
389 | # define os_file_read(file, buf, offset, offset_high, n) \ | |
390 | @@ -326,9 +326,9 @@ | |
391 | # define os_file_close(file) os_file_close_func(file) | |
392 | ||
393 | # define os_aio(type, mode, name, file, buf, offset, offset_high, \ | |
394 | - n, message1, message2, trx) \ | |
395 | + n, message1, message2, space_id, trx) \ | |
396 | os_aio_func(type, mode, name, file, buf, offset, offset_high, n,\ | |
397 | - message1, message2, trx) | |
398 | + message1, message2, space_id, trx) | |
399 | ||
400 | # define os_file_read(file, buf, offset, offset_high, n) \ | |
401 | os_file_read_func(file, buf, offset, offset_high, n, NULL) | |
402 | @@ -757,6 +757,7 @@ | |
403 | (can be used to identify a completed | |
404 | aio operation); ignored if mode is | |
405 | OS_AIO_SYNC */ | |
406 | + ulint space_id, | |
407 | trx_t* trx, | |
408 | const char* src_file,/*!< in: file name where func invoked */ | |
409 | ulint src_line);/*!< in: line where the func invoked */ | |
413cadc7 | 410 | @@ -1065,6 +1066,7 @@ |
a9ee80b9 ER |
411 | (can be used to identify a completed |
412 | aio operation); ignored if mode is | |
413 | OS_AIO_SYNC */ | |
414 | + ulint space_id, | |
415 | trx_t* trx); | |
416 | /************************************************************************//** | |
417 | Wakes up all async i/o threads so that they know to exit themselves in | |
413cadc7 | 418 | @@ -1125,7 +1127,8 @@ |
a9ee80b9 ER |
419 | parameters are valid and can be used to |
420 | restart the operation, for example */ | |
421 | void** message2, | |
422 | - ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */ | |
423 | + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ | |
424 | + ulint* space_id); | |
425 | #endif | |
426 | ||
427 | /**********************************************************************//** | |
413cadc7 | 428 | @@ -1147,7 +1150,8 @@ |
a9ee80b9 ER |
429 | parameters are valid and can be used to |
430 | restart the operation, for example */ | |
431 | void** message2, | |
432 | - ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */ | |
433 | + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ | |
434 | + ulint* space_id); | |
435 | /**********************************************************************//** | |
436 | Validates the consistency of the aio system. | |
437 | @return TRUE if ok */ | |
413cadc7 | 438 | @@ -1226,7 +1230,8 @@ |
a9ee80b9 ER |
439 | aio operation failed, these output |
440 | parameters are valid and can be used to | |
441 | restart the operation. */ | |
442 | - ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */ | |
443 | + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ | |
444 | + ulint* space_id); | |
445 | #endif /* LINUX_NATIVE_AIO */ | |
446 | ||
447 | #ifndef UNIV_NONINL | |
448 | diff -ruN a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic | |
449 | --- a/storage/innobase/include/os0file.ic 2011-02-23 19:00:47.915696756 +0900 | |
450 | +++ b/storage/innobase/include/os0file.ic 2011-02-23 19:01:19.191625891 +0900 | |
451 | @@ -229,6 +229,7 @@ | |
452 | (can be used to identify a completed | |
453 | aio operation); ignored if mode is | |
454 | OS_AIO_SYNC */ | |
455 | + ulint space_id, | |
456 | trx_t* trx, | |
457 | const char* src_file,/*!< in: file name where func invoked */ | |
458 | ulint src_line)/*!< in: line where the func invoked */ | |
459 | @@ -245,7 +246,7 @@ | |
460 | src_file, src_line); | |
461 | ||
462 | result = os_aio_func(type, mode, name, file, buf, offset, offset_high, | |
463 | - n, message1, message2, trx); | |
464 | + n, message1, message2, space_id, trx); | |
465 | ||
466 | register_pfs_file_io_end(locker, n); | |
467 | ||
468 | diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h | |
469 | --- a/storage/innobase/include/srv0srv.h 2011-02-23 19:00:48.212625715 +0900 | |
470 | +++ b/storage/innobase/include/srv0srv.h 2011-02-23 19:01:19.193655990 +0900 | |
adf0fb13 | 471 | @@ -244,6 +244,8 @@ |
11822e22 | 472 | extern ulint srv_pass_corrupt_table; |
a9ee80b9 | 473 | |
a9ee80b9 ER |
474 | extern ulint srv_dict_size_limit; |
475 | + | |
476 | +extern ulint srv_lazy_drop_table; | |
477 | /*-------------------------------------------*/ | |
478 | ||
479 | extern ulint srv_n_rows_inserted; | |
480 | diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h | |
481 | --- a/storage/innobase/include/sync0sync.h 2011-02-23 19:00:47.875625940 +0900 | |
482 | +++ b/storage/innobase/include/sync0sync.h 2011-02-23 19:01:19.195703856 +0900 | |
adf0fb13 | 483 | @@ -691,6 +691,7 @@ |
a9ee80b9 ER |
484 | #define SYNC_BUF_POOL 150 /* Buffer pool mutex */ |
485 | #define SYNC_BUF_FLUSH_LIST 145 /* Buffer flush list mutex */ | |
486 | #define SYNC_DOUBLEWRITE 140 | |
487 | +#define SYNC_OUTER_ANY_LATCH 136 | |
488 | #define SYNC_ANY_LATCH 135 | |
489 | #define SYNC_THR_LOCAL 133 | |
490 | #define SYNC_MEM_HASH 131 | |
b4e1fa2c AM |
491 | diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i |
492 | --- a/storage/innobase/include/univ.i 2010-12-04 15:57:13.050485224 +0900 | |
493 | +++ b/storage/innobase/include/univ.i 2010-12-04 15:57:53.091592933 +0900 | |
d8778560 | 494 | @@ -53,6 +53,11 @@ |
b4e1fa2c | 495 | #define INNODB_VERSION_MINOR 1 |
adf0fb13 | 496 | #define INNODB_VERSION_BUGFIX 7 |
b4e1fa2c AM |
497 | |
498 | +#ifndef PERCONA_INNODB_VERSION | |
adf0fb13 | 499 | +#define PERCONA_INNODB_VERSION 20.1 |
b4e1fa2c AM |
500 | +#endif |
501 | + | |
502 | + | |
503 | /* The following is the InnoDB version as shown in | |
504 | SELECT plugin_version FROM information_schema.plugins; | |
505 | calculated in make_version_string() in sql/sql_show.cc like this: | |
d8778560 | 506 | @@ -65,7 +70,8 @@ |
b4e1fa2c | 507 | #define INNODB_VERSION_STR \ |
d8778560 AM |
508 | IB_TO_STR(INNODB_VERSION_MAJOR) "." \ |
509 | IB_TO_STR(INNODB_VERSION_MINOR) "." \ | |
510 | - IB_TO_STR(INNODB_VERSION_BUGFIX) | |
511 | + IB_TO_STR(INNODB_VERSION_BUGFIX) "-" \ | |
512 | + IB_TO_STR(PERCONA_INNODB_VERSION) | |
513 | ||
514 | #define REFMAN "http://dev.mysql.com/doc/refman/" \ | |
515 | IB_TO_STR(MYSQL_MAJOR_VERSION) "." \ | |
a9ee80b9 ER |
516 | diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c |
517 | --- a/storage/innobase/os/os0file.c 2011-02-23 19:00:47.928696481 +0900 | |
518 | +++ b/storage/innobase/os/os0file.c 2011-02-23 19:01:19.200696353 +0900 | |
519 | @@ -180,6 +180,7 @@ | |
520 | made and only the slot message | |
521 | needs to be passed to the caller | |
522 | of os_aio_simulated_handle */ | |
523 | + ulint space_id; | |
524 | fil_node_t* message1; /*!< message which is given by the */ | |
525 | void* message2; /*!< the requester of an aio operation | |
526 | and which can be used to identify | |
413cadc7 | 527 | @@ -3685,7 +3686,8 @@ |
a9ee80b9 ER |
528 | offset */ |
529 | ulint offset_high, /*!< in: most significant 32 bits of | |
530 | offset */ | |
531 | - ulint len) /*!< in: length of the block to read or write */ | |
532 | + ulint len, /*!< in: length of the block to read or write */ | |
533 | + ulint space_id) | |
534 | { | |
535 | os_aio_slot_t* slot = NULL; | |
536 | #ifdef WIN_ASYNC_IO | |
413cadc7 | 537 | @@ -3774,6 +3776,7 @@ |
a9ee80b9 ER |
538 | slot->offset = offset; |
539 | slot->offset_high = offset_high; | |
540 | slot->io_already_done = FALSE; | |
541 | + slot->space_id = space_id; | |
542 | ||
543 | #ifdef WIN_ASYNC_IO | |
544 | control = &(slot->control); | |
413cadc7 | 545 | @@ -4061,6 +4064,7 @@ |
a9ee80b9 ER |
546 | (can be used to identify a completed |
547 | aio operation); ignored if mode is | |
548 | OS_AIO_SYNC */ | |
549 | + ulint space_id, | |
550 | trx_t* trx) | |
551 | { | |
552 | os_aio_array_t* array; | |
413cadc7 | 553 | @@ -4149,7 +4153,7 @@ |
a9ee80b9 ER |
554 | trx->io_read += n; |
555 | } | |
556 | slot = os_aio_array_reserve_slot(type, array, message1, message2, file, | |
557 | - name, buf, offset, offset_high, n); | |
558 | + name, buf, offset, offset_high, n, space_id); | |
559 | if (type == OS_FILE_READ) { | |
560 | if (srv_use_native_aio) { | |
561 | os_n_file_reads++; | |
413cadc7 | 562 | @@ -4268,7 +4272,8 @@ |
a9ee80b9 ER |
563 | parameters are valid and can be used to |
564 | restart the operation, for example */ | |
565 | void** message2, | |
566 | - ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */ | |
567 | + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ | |
568 | + ulint* space_id) | |
569 | { | |
570 | ulint orig_seg = segment; | |
571 | os_aio_array_t* array; | |
413cadc7 | 572 | @@ -4347,6 +4352,7 @@ |
a9ee80b9 ER |
573 | *message2 = slot->message2; |
574 | ||
575 | *type = slot->type; | |
576 | + *space_id = slot->space_id; | |
577 | ||
578 | if (ret && len == slot->len) { | |
579 | ret_val = TRUE; | |
413cadc7 | 580 | @@ -4575,7 +4581,8 @@ |
a9ee80b9 ER |
581 | aio operation failed, these output |
582 | parameters are valid and can be used to | |
583 | restart the operation. */ | |
584 | - ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */ | |
585 | + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ | |
586 | + ulint* space_id) | |
587 | { | |
588 | ulint segment; | |
589 | os_aio_array_t* array; | |
413cadc7 | 590 | @@ -4648,6 +4655,7 @@ |
a9ee80b9 ER |
591 | *message2 = slot->message2; |
592 | ||
593 | *type = slot->type; | |
594 | + *space_id = slot->space_id; | |
595 | ||
596 | if ((slot->ret == 0) && (slot->n_bytes == (long)slot->len)) { | |
597 | ret = TRUE; | |
413cadc7 | 598 | @@ -4701,7 +4709,8 @@ |
a9ee80b9 ER |
599 | parameters are valid and can be used to |
600 | restart the operation, for example */ | |
601 | void** message2, | |
602 | - ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */ | |
603 | + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */ | |
604 | + ulint* space_id) | |
605 | { | |
606 | os_aio_array_t* array; | |
607 | ulint segment; | |
413cadc7 | 608 | @@ -4997,6 +5006,7 @@ |
a9ee80b9 ER |
609 | *message2 = slot->message2; |
610 | ||
611 | *type = slot->type; | |
612 | + *space_id = slot->space_id; | |
613 | ||
614 | os_mutex_exit(array->mutex); | |
615 | ||
b4e1fa2c AM |
616 | diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c |
617 | --- a/storage/innobase/row/row0mysql.c 2010-12-04 15:37:50.598481116 +0900 | |
618 | +++ b/storage/innobase/row/row0mysql.c 2010-12-04 15:57:53.092563335 +0900 | |
d8778560 AM |
619 | @@ -51,6 +51,7 @@ |
620 | #include "btr0sea.h" | |
621 | #include "fil0fil.h" | |
622 | #include "ibuf0ibuf.h" | |
623 | +#include "ha_prototypes.h" | |
624 | ||
625 | /** Provide optional 4.x backwards compatibility for 5.0 and above */ | |
626 | UNIV_INTERN ibool row_rollback_on_timeout = FALSE; | |
adf0fb13 | 627 | @@ -1191,6 +1192,13 @@ |
b4e1fa2c AM |
628 | |
629 | thr = que_fork_get_first_thr(prebuilt->ins_graph); | |
630 | ||
631 | + if (!prebuilt->mysql_has_locked && !(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) { | |
632 | + fprintf(stderr, "InnoDB: Error: row_insert_for_mysql is called without ha_innobase::external_lock()\n"); | |
633 | + if (trx->mysql_thd != NULL) { | |
634 | + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600); | |
635 | + } | |
636 | + } | |
637 | + | |
638 | if (prebuilt->sql_stat_start) { | |
639 | node->state = INS_NODE_SET_IX_LOCK; | |
640 | prebuilt->sql_stat_start = FALSE; | |
641 | diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c | |
642 | --- a/storage/innobase/row/row0sel.c 2010-12-04 15:52:23.494514495 +0900 | |
643 | +++ b/storage/innobase/row/row0sel.c 2010-12-04 16:01:38.320883699 +0900 | |
644 | @@ -3366,6 +3366,7 @@ | |
645 | ulint offsets_[REC_OFFS_NORMAL_SIZE]; | |
646 | ulint* offsets = offsets_; | |
647 | ibool table_lock_waited = FALSE; | |
648 | + ibool problematic_use = FALSE; | |
649 | ||
650 | rec_offs_init(offsets_); | |
651 | ||
adf0fb13 | 652 | @@ -3737,6 +3738,17 @@ |
b4e1fa2c AM |
653 | |
654 | /* Do some start-of-statement preparations */ | |
655 | ||
656 | + if (!prebuilt->mysql_has_locked) { | |
657 | + if (!(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) { | |
658 | + fprintf(stderr, "InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock()\n"); | |
659 | + if (trx->mysql_thd != NULL) { | |
660 | + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600); | |
661 | + } | |
662 | + } | |
663 | + problematic_use = TRUE; | |
664 | + } | |
665 | +retry_check: | |
666 | + | |
667 | if (!prebuilt->sql_stat_start) { | |
668 | /* No need to set an intention lock or assign a read view */ | |
669 | ||
adf0fb13 | 670 | @@ -3747,6 +3759,18 @@ |
b4e1fa2c AM |
671 | " perform a consistent read\n" |
672 | "InnoDB: but the read view is not assigned!\n", | |
673 | stderr); | |
674 | + if (problematic_use) { | |
675 | + fprintf(stderr, "InnoDB: It may be caused by calling " | |
676 | + "without ha_innobase::external_lock()\n" | |
677 | + "InnoDB: For the first-aid, avoiding the crash. " | |
678 | + "But it should be fixed ASAP.\n"); | |
679 | + if (prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT) | |
680 | + && trx->mysql_thd != NULL) { | |
681 | + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600); | |
682 | + } | |
683 | + prebuilt->sql_stat_start = TRUE; | |
684 | + goto retry_check; | |
685 | + } | |
686 | trx_print(stderr, trx, 600); | |
687 | fputc('\n', stderr); | |
688 | ut_error; | |
a9ee80b9 ER |
689 | diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c |
690 | --- a/storage/innobase/srv/srv0srv.c 2011-02-23 19:00:48.283695497 +0900 | |
691 | +++ b/storage/innobase/srv/srv0srv.c 2011-02-23 19:01:19.204696643 +0900 | |
adf0fb13 | 692 | @@ -441,6 +441,8 @@ |
11822e22 | 693 | UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */ |
a9ee80b9 | 694 | |
a9ee80b9 ER |
695 | UNIV_INTERN ulint srv_dict_size_limit = 0; |
696 | + | |
697 | +UNIV_INTERN ulint srv_lazy_drop_table = 0; | |
698 | /*-------------------------------------------*/ | |
699 | UNIV_INTERN ulong srv_n_spin_wait_rounds = 30; | |
700 | UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500; | |
b4e1fa2c AM |
701 | diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c |
702 | --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:57:13.073495392 +0900 | |
703 | +++ b/storage/innobase/srv/srv0start.c 2010-12-04 16:02:50.704884053 +0900 | |
adf0fb13 | 704 | @@ -2161,7 +2161,7 @@ |
b4e1fa2c AM |
705 | if (srv_print_verbose_log) { |
706 | ut_print_timestamp(stderr); | |
707 | fprintf(stderr, | |
d8778560 | 708 | - " InnoDB: %s started; " |
b4e1fa2c AM |
709 | + " Percona XtraDB (http://www.percona.com) %s started; " |
710 | "log sequence number %llu\n", | |
711 | INNODB_VERSION_STR, srv_start_lsn); | |
712 | } | |
a9ee80b9 ER |
713 | diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c |
714 | --- a/storage/innobase/sync/sync0sync.c 2011-02-25 14:18:55.817202060 +0900 | |
715 | +++ b/storage/innobase/sync/sync0sync.c 2011-02-25 14:19:44.596202017 +0900 | |
adf0fb13 | 716 | @@ -1220,6 +1220,7 @@ |
a9ee80b9 ER |
717 | case SYNC_LOG_FLUSH_ORDER: |
718 | case SYNC_THR_LOCAL: | |
719 | case SYNC_ANY_LATCH: | |
720 | + case SYNC_OUTER_ANY_LATCH: | |
721 | case SYNC_FILE_FORMAT_TAG: | |
722 | case SYNC_DOUBLEWRITE: | |
723 | case SYNC_SEARCH_SYS: | |
b4e1fa2c AM |
724 | diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c |
725 | --- a/storage/innobase/trx/trx0purge.c 2010-11-03 07:01:13.000000000 +0900 | |
726 | +++ b/storage/innobase/trx/trx0purge.c 2010-12-04 15:57:53.106551154 +0900 | |
11822e22 | 727 | @@ -1149,8 +1149,7 @@ |
b4e1fa2c AM |
728 | /* If we cannot advance the 'purge view' because of an old |
729 | 'consistent read view', then the DML statements cannot be delayed. | |
730 | Also, srv_max_purge_lag <= 0 means 'infinity'. */ | |
731 | - if (srv_max_purge_lag > 0 | |
732 | - && !UT_LIST_GET_LAST(trx_sys->view_list)) { | |
733 | + if (srv_max_purge_lag > 0) { | |
734 | float ratio = (float) trx_sys->rseg_history_len | |
735 | / srv_max_purge_lag; | |
736 | if (ratio > ULINT_MAX / 10000) { |