1 # name : innodb_fix_misc.patch
2 # introduced : 11 or before
3 # maintainer : Yasufumi
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.
11 # Any small change to this file in the main branch
12 # should be done or reviewed by the maintainer!
14 # comment: http://lists.mysql.com/commits/112400 is applied also for innodb_plugin
15 # to pass innodb_bug53756.test by innodb_plugin
16 diff -ruN a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c
17 --- a/storage/innobase/buf/buf0buf.c 2011-02-23 19:00:48.178696354 +0900
18 +++ b/storage/innobase/buf/buf0buf.c 2011-02-23 19:01:19.138826278 +0900
20 bpage->state = BUF_BLOCK_ZIP_PAGE;
22 bpage->offset = offset;
23 + bpage->space_was_being_deleted = FALSE;
27 diff -ruN a/storage/innobase/buf/buf0flu.c b/storage/innobase/buf/buf0flu.c
28 --- a/storage/innobase/buf/buf0flu.c 2011-02-23 19:00:48.182659256 +0900
29 +++ b/storage/innobase/buf/buf0flu.c 2011-02-23 19:01:19.138826278 +0900
32 if (UNIV_LIKELY(bpage->in_LRU_list && buf_page_in_file(bpage))) {
34 - return(bpage->oldest_modification == 0
35 + return((bpage->oldest_modification == 0 || bpage->space_was_being_deleted)
36 && buf_page_get_io_fix(bpage) == BUF_IO_NONE
37 && bpage->buf_fix_count == 0);
40 && buf_page_get_io_fix(bpage) == BUF_IO_NONE) {
41 ut_ad(bpage->in_flush_list);
43 + if (bpage->space_was_being_deleted) {
44 + /* should be removed from flush_list here */
45 + /* because buf_flush_try_neighbors() cannot flush without fil_space_get_size(space) */
46 + buf_flush_remove(bpage);
50 if (flush_type != BUF_FLUSH_LRU) {
53 diff -ruN a/storage/innobase/buf/buf0lru.c b/storage/innobase/buf/buf0lru.c
54 --- a/storage/innobase/buf/buf0lru.c 2011-02-23 19:00:47.939695791 +0900
55 +++ b/storage/innobase/buf/buf0lru.c 2011-02-23 19:01:19.142741970 +0900
60 +/******************************************************************//**
64 +buf_LRU_mark_space_was_deleted(
65 +/*===========================*/
66 + ulint id) /*!< in: space id */
70 + for (i = 0; i < srv_buf_pool_instances; i++) {
71 + buf_pool_t* buf_pool;
74 + buf_pool = buf_pool_from_array(i);
76 + mutex_enter(&buf_pool->LRU_list_mutex);
78 + bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
80 + while (bpage != NULL) {
81 + if (buf_page_get_space(bpage) == id) {
82 + bpage->space_was_being_deleted = TRUE;
84 + bpage = UT_LIST_GET_NEXT(LRU, bpage);
87 + mutex_exit(&buf_pool->LRU_list_mutex);
91 /********************************************************************//**
92 Insert a compressed block into buf_pool->zip_clean in the LRU order. */
94 @@ -1568,6 +1599,10 @@
95 return(BUF_LRU_NOT_FREED);
98 + if (bpage->space_was_being_deleted && bpage->oldest_modification != 0) {
99 + buf_flush_remove(bpage);
102 #ifdef UNIV_IBUF_COUNT_DEBUG
103 ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0);
104 #endif /* UNIV_IBUF_COUNT_DEBUG */
105 diff -ruN a/storage/innobase/dict/dict0load.c b/storage/innobase/dict/dict0load.c
106 --- a/storage/innobase/dict/dict0load.c 2010-12-04 15:37:50.559480289 +0900
107 +++ b/storage/innobase/dict/dict0load.c 2010-12-04 15:57:53.078513745 +0900
108 @@ -1868,6 +1868,8 @@
110 ut_ad(mutex_own(&(dict_sys->mutex)));
114 /* NOTE that the operation of this function is protected by
115 the dictionary mutex, and therefore no deadlocks can occur
116 with other dictionary operations. */
117 @@ -1894,15 +1896,17 @@
118 BTR_SEARCH_LEAF, &pcur, &mtr);
119 rec = btr_pcur_get_rec(&pcur);
121 - if (!btr_pcur_is_on_user_rec(&pcur)
122 - || rec_get_deleted_flag(rec, 0)) {
123 + if (!btr_pcur_is_on_user_rec(&pcur)) {
128 - btr_pcur_close(&pcur);
130 - mem_heap_free(heap);
133 + /* Find the first record that is not delete marked */
134 + while (rec_get_deleted_flag(rec, 0)) {
135 + if (!btr_pcur_move_to_next_user_rec(&pcur, &mtr)) {
138 + rec = btr_pcur_get_rec(&pcur);
141 /*---------------------------------------------------*/
142 @@ -1915,12 +1919,7 @@
144 /* Check if the table id in record is the one searched for */
145 if (table_id != mach_read_from_8(field)) {
147 - btr_pcur_close(&pcur);
149 - mem_heap_free(heap);
155 /* Now we get the table name from the record */
156 @@ -1928,7 +1927,7 @@
157 /* Load the table definition to memory */
158 table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len),
162 btr_pcur_close(&pcur);
165 diff -ruN a/storage/innobase/fil/fil0fil.c b/storage/innobase/fil/fil0fil.c
166 --- a/storage/innobase/fil/fil0fil.c 2011-02-23 19:00:48.223696428 +0900
167 +++ b/storage/innobase/fil/fil0fil.c 2011-02-23 19:01:19.147655510 +0900
169 struct fil_system_struct {
170 #ifndef UNIV_HOTBACKUP
171 mutex_t mutex; /*!< The mutex protecting the cache */
172 + mutex_t file_extend_mutex;
173 #endif /* !UNIV_HOTBACKUP */
174 hash_table_t* spaces; /*!< The hash table of spaces in the
175 system; they are hashed on the space
177 ut_ad(node && system);
178 ut_ad(mutex_own(&(system->mutex)));
180 - ut_a(node->n_pending == 0);
181 + ut_a(node->n_pending == 0 || srv_lazy_drop_table);
182 ut_a(node->n_pending_flushes == 0);
183 ut_a(node->modification_counter == node->flush_counter);
185 @@ -1073,7 +1074,7 @@
186 ut_ad(node && system && space);
187 ut_ad(mutex_own(&(system->mutex)));
188 ut_a(node->magic_n == FIL_NODE_MAGIC_N);
189 - ut_a(node->n_pending == 0);
190 + ut_a(node->n_pending == 0 || srv_lazy_drop_table);
193 /* We fool the assertion in fil_node_close_file() to think
194 @@ -1595,6 +1596,8 @@
196 mutex_create(fil_system_mutex_key,
197 &fil_system->mutex, SYNC_ANY_LATCH);
198 + mutex_create(fil_system_mutex_key,
199 + &fil_system->file_extend_mutex, SYNC_OUTER_ANY_LATCH);
201 fil_system->spaces = hash_create(hash_size);
202 fil_system->name_hash = hash_create(hash_size);
203 @@ -2341,7 +2344,11 @@
204 completely and permanently. The flag is_being_deleted also prevents
205 fil_flush() from being applied to this tablespace. */
207 + if (srv_lazy_drop_table) {
208 + buf_LRU_mark_space_was_deleted(id);
210 buf_LRU_invalidate_tablespace(id);
213 /* printf("Deleting tablespace %s id %lu\n", space->name, id); */
215 @@ -4400,6 +4407,10 @@
217 ibool success = TRUE;
219 + /* file_extend_mutex is for http://bugs.mysql.com/56433 */
220 + /* to protect from the other fil_extend_space_to_desired_size() */
221 + /* during temprary releasing &fil_system->mutex */
222 + mutex_enter(&fil_system->file_extend_mutex);
223 fil_mutex_enter_and_prepare_for_io(space_id);
225 space = fil_space_get_by_id(space_id);
226 @@ -4411,6 +4422,7 @@
227 *actual_size = space->size;
229 mutex_exit(&fil_system->mutex);
230 + mutex_exit(&fil_system->file_extend_mutex);
234 @@ -4443,6 +4455,8 @@
235 offset_low = ((start_page_no - file_start_page_no)
236 % (4096 * ((1024 * 1024) / page_size)))
239 + mutex_exit(&fil_system->mutex);
240 #ifdef UNIV_HOTBACKUP
241 success = os_file_write(node->name, node->handle, buf,
242 offset_low, offset_high,
243 @@ -4452,8 +4466,10 @@
244 node->name, node->handle, buf,
245 offset_low, offset_high,
248 + NULL, NULL, space_id, NULL);
250 + mutex_enter(&fil_system->mutex);
253 node->size += n_pages;
254 space->size += n_pages;
255 @@ -4499,6 +4515,7 @@
256 printf("Extended %s to %lu, actual size %lu pages\n", space->name,
257 size_after_extend, *actual_size); */
258 mutex_exit(&fil_system->mutex);
259 + mutex_exit(&fil_system->file_extend_mutex);
263 @@ -4863,6 +4880,22 @@
264 srv_data_written+= len;
267 + /* if the table space was already deleted, space might not exist already. */
269 + && space_id < SRV_LOG_SPACE_FIRST_ID
270 + && ((buf_page_t*)message)->space_was_being_deleted) {
272 + if (mode == OS_AIO_NORMAL) {
273 + buf_page_io_complete(message, trx);
274 + return(DB_SUCCESS); /*fake*/
276 + if (type == OS_FILE_READ) {
277 + return(DB_TABLESPACE_DELETED);
279 + return(DB_SUCCESS); /*fake*/
283 /* Reserve the fil_system mutex and make sure that we can open at
284 least one file while holding it, if the file is not already open */
286 @@ -4992,10 +5025,24 @@
288 /* Queue the aio request */
289 ret = os_aio(type, mode | wake_later, node->name, node->handle, buf,
290 - offset_low, offset_high, len, node, message, trx);
291 + offset_low, offset_high, len, node, message, space_id, trx);
295 + /* if the table space was already deleted, space might not exist already. */
297 + && space_id < SRV_LOG_SPACE_FIRST_ID
298 + && ((buf_page_t*)message)->space_was_being_deleted) {
300 + if (mode == OS_AIO_SYNC) {
301 + if (type == OS_FILE_READ) {
302 + return(DB_TABLESPACE_DELETED);
304 + return(DB_SUCCESS); /*fake*/
311 if (mode == OS_AIO_SYNC) {
312 @@ -5095,6 +5142,7 @@
313 fil_node_t* fil_node;
316 + ulint space_id = 0;
318 ut_ad(fil_validate_skip());
320 @@ -5102,10 +5150,10 @@
321 srv_set_io_thread_op_info(segment, "native aio handle");
323 ret = os_aio_windows_handle(segment, 0, &fil_node,
325 + &message, &type, &space_id);
326 #elif defined(LINUX_NATIVE_AIO)
327 ret = os_aio_linux_handle(segment, &fil_node,
329 + &message, &type, &space_id);
331 ret = 0; /* Eliminate compiler warning */
333 @@ -5114,7 +5162,22 @@
334 srv_set_io_thread_op_info(segment, "simulated aio handle");
336 ret = os_aio_simulated_handle(segment, &fil_node,
338 + &message, &type, &space_id);
341 + /* if the table space was already deleted, fil_node might not exist already. */
343 + && space_id < SRV_LOG_SPACE_FIRST_ID
344 + && ((buf_page_t*)message)->space_was_being_deleted) {
346 + /* intended not to be uncompress read page */
347 + ut_a(buf_page_get_io_fix(message) == BUF_IO_WRITE
348 + || !buf_page_get_zip_size(message)
349 + || buf_page_get_state(message) != BUF_BLOCK_FILE_PAGE);
351 + srv_set_io_thread_op_info(segment, "complete io for buf page");
352 + buf_page_io_complete(message, NULL);
357 diff -ruN a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc
358 --- a/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:13.035513990 +0900
359 +++ b/storage/innobase/handler/ha_innodb.cc 2010-12-04 15:57:53.084513775 +0900
360 @@ -11919,6 +11919,12 @@
361 "except for the deletion.",
362 NULL, NULL, 0, &corrupt_table_action_typelib);
364 +static MYSQL_SYSVAR_ULONG(lazy_drop_table, srv_lazy_drop_table,
365 + PLUGIN_VAR_RQCMDARG,
366 + "At deleting tablespace, only miminum needed processes at the time are done. "
367 + "e.g. for http://bugs.mysql.com/51325",
368 + NULL, NULL, 0, 0, 1, 0);
370 static struct st_mysql_sys_var* innobase_system_variables[]= {
371 MYSQL_SYSVAR(page_size),
372 MYSQL_SYSVAR(log_block_size),
373 @@ -12009,6 +12015,7 @@
374 MYSQL_SYSVAR(purge_threads),
375 MYSQL_SYSVAR(purge_batch_size),
376 MYSQL_SYSVAR(corrupt_table_action),
377 + MYSQL_SYSVAR(lazy_drop_table),
381 @@ -12018,7 +12025,7 @@
382 &innobase_storage_engine,
385 - "Supports transactions, row-level locking, and foreign keys",
386 + "Percona-XtraDB, Supports transactions, row-level locking, and foreign keys",
388 innobase_init, /* Plugin Init */
389 NULL, /* Plugin Deinit */
390 diff -ruN a/storage/innobase/include/buf0buf.h b/storage/innobase/include/buf0buf.h
391 --- a/storage/innobase/include/buf0buf.h 2011-02-23 19:00:48.252696774 +0900
392 +++ b/storage/innobase/include/buf0buf.h 2011-02-23 19:01:19.182655902 +0900
393 @@ -1437,6 +1437,7 @@
394 0 if the block was never accessed
395 in the buffer pool */
397 + ibool space_was_being_deleted;
399 # ifdef UNIV_DEBUG_FILE_ACCESSES
400 ibool file_page_was_freed;
401 diff -ruN a/storage/innobase/include/buf0buf.ic b/storage/innobase/include/buf0buf.ic
402 --- a/storage/innobase/include/buf0buf.ic 2011-02-23 19:00:48.130659154 +0900
403 +++ b/storage/innobase/include/buf0buf.ic 2011-02-23 19:01:19.185655906 +0900
405 buf_block_set_state(block, BUF_BLOCK_FILE_PAGE);
406 block->page.space = space;
407 block->page.offset = page_no;
408 + block->page.space_was_being_deleted = FALSE;
411 /*********************************************************************//**
412 diff -ruN a/storage/innobase/include/buf0lru.h b/storage/innobase/include/buf0lru.h
413 --- a/storage/innobase/include/buf0lru.h 2011-02-23 19:00:47.977658923 +0900
414 +++ b/storage/innobase/include/buf0lru.h 2011-02-23 19:01:19.188625768 +0900
416 buf_LRU_invalidate_tablespace(
417 /*==========================*/
418 ulint id); /*!< in: space id */
419 +/******************************************************************//**
423 +buf_LRU_mark_space_was_deleted(
424 +/*===========================*/
425 + ulint id); /*!< in: space id */
426 /********************************************************************//**
427 Insert a compressed block into buf_pool->zip_clean in the LRU order. */
429 diff -ruN a/storage/innobase/include/os0file.h b/storage/innobase/include/os0file.h
430 --- a/storage/innobase/include/os0file.h 2011-02-23 19:00:48.260696646 +0900
431 +++ b/storage/innobase/include/os0file.h 2011-02-23 19:01:19.190656054 +0900
433 pfs_os_file_close_func(file, __FILE__, __LINE__)
435 # define os_aio(type, mode, name, file, buf, offset, offset_high, \
436 - n, message1, message2, trx) \
437 + n, message1, message2, space_id, trx) \
438 pfs_os_aio_func(type, mode, name, file, buf, offset, \
439 - offset_high, n, message1, message2, trx, \
440 + offset_high, n, message1, message2, space_id, trx,\
443 # define os_file_read(file, buf, offset, offset_high, n) \
445 # define os_file_close(file) os_file_close_func(file)
447 # define os_aio(type, mode, name, file, buf, offset, offset_high, \
448 - n, message1, message2, trx) \
449 + n, message1, message2, space_id, trx) \
450 os_aio_func(type, mode, name, file, buf, offset, offset_high, n,\
451 - message1, message2, trx)
452 + message1, message2, space_id, trx)
454 # define os_file_read(file, buf, offset, offset_high, n) \
455 os_file_read_func(file, buf, offset, offset_high, n, NULL)
457 (can be used to identify a completed
458 aio operation); ignored if mode is
462 const char* src_file,/*!< in: file name where func invoked */
463 ulint src_line);/*!< in: line where the func invoked */
464 @@ -1063,6 +1064,7 @@
465 (can be used to identify a completed
466 aio operation); ignored if mode is
470 /************************************************************************//**
471 Wakes up all async i/o threads so that they know to exit themselves in
472 @@ -1123,7 +1125,8 @@
473 parameters are valid and can be used to
474 restart the operation, for example */
476 - ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */
477 + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
481 /**********************************************************************//**
482 @@ -1145,7 +1148,8 @@
483 parameters are valid and can be used to
484 restart the operation, for example */
486 - ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */
487 + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
489 /**********************************************************************//**
490 Validates the consistency of the aio system.
491 @return TRUE if ok */
492 @@ -1224,7 +1228,8 @@
493 aio operation failed, these output
494 parameters are valid and can be used to
495 restart the operation. */
496 - ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */
497 + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
499 #endif /* LINUX_NATIVE_AIO */
502 diff -ruN a/storage/innobase/include/os0file.ic b/storage/innobase/include/os0file.ic
503 --- a/storage/innobase/include/os0file.ic 2011-02-23 19:00:47.915696756 +0900
504 +++ b/storage/innobase/include/os0file.ic 2011-02-23 19:01:19.191625891 +0900
506 (can be used to identify a completed
507 aio operation); ignored if mode is
511 const char* src_file,/*!< in: file name where func invoked */
512 ulint src_line)/*!< in: line where the func invoked */
516 result = os_aio_func(type, mode, name, file, buf, offset, offset_high,
517 - n, message1, message2, trx);
518 + n, message1, message2, space_id, trx);
520 register_pfs_file_io_end(locker, n);
522 diff -ruN a/storage/innobase/include/srv0srv.h b/storage/innobase/include/srv0srv.h
523 --- a/storage/innobase/include/srv0srv.h 2011-02-23 19:00:48.212625715 +0900
524 +++ b/storage/innobase/include/srv0srv.h 2011-02-23 19:01:19.193655990 +0900
527 extern ulint srv_extra_rsegments;
528 extern ulint srv_dict_size_limit;
530 +extern ulint srv_lazy_drop_table;
531 /*-------------------------------------------*/
533 extern ulint srv_n_rows_inserted;
534 diff -ruN a/storage/innobase/include/sync0sync.h b/storage/innobase/include/sync0sync.h
535 --- a/storage/innobase/include/sync0sync.h 2011-02-23 19:00:47.875625940 +0900
536 +++ b/storage/innobase/include/sync0sync.h 2011-02-23 19:01:19.195703856 +0900
538 #define SYNC_BUF_POOL 150 /* Buffer pool mutex */
539 #define SYNC_BUF_FLUSH_LIST 145 /* Buffer flush list mutex */
540 #define SYNC_DOUBLEWRITE 140
541 +#define SYNC_OUTER_ANY_LATCH 136
542 #define SYNC_ANY_LATCH 135
543 #define SYNC_THR_LOCAL 133
544 #define SYNC_MEM_HASH 131
545 diff -ruN a/storage/innobase/include/univ.i b/storage/innobase/include/univ.i
546 --- a/storage/innobase/include/univ.i 2010-12-04 15:57:13.050485224 +0900
547 +++ b/storage/innobase/include/univ.i 2010-12-04 15:57:53.091592933 +0900
549 #define INNODB_VERSION_MINOR 1
550 #define INNODB_VERSION_BUGFIX 5
552 +#ifndef PERCONA_INNODB_VERSION
553 +#define PERCONA_INNODB_VERSION 12.1
557 /* The following is the InnoDB version as shown in
558 SELECT plugin_version FROM information_schema.plugins;
559 calculated in make_version_string() in sql/sql_show.cc like this:
561 #define INNODB_VERSION_STR \
562 IB_TO_STR(INNODB_VERSION_MAJOR) "." \
563 IB_TO_STR(INNODB_VERSION_MINOR) "." \
564 - IB_TO_STR(INNODB_VERSION_BUGFIX)
565 + IB_TO_STR(INNODB_VERSION_BUGFIX) "-" \
566 + IB_TO_STR(PERCONA_INNODB_VERSION)
568 #define REFMAN "http://dev.mysql.com/doc/refman/" \
569 IB_TO_STR(MYSQL_MAJOR_VERSION) "." \
570 diff -ruN a/storage/innobase/mtr/mtr0log.c b/storage/innobase/mtr/mtr0log.c
571 --- a/storage/innobase/mtr/mtr0log.c 2010-12-04 02:58:26.000000000 +0900
572 +++ b/storage/innobase/mtr/mtr0log.c 2011-02-03 15:17:14.000000000 +0900
576 if (UNIV_UNLIKELY(offset >= UNIV_PAGE_SIZE)
577 - || UNIV_UNLIKELY(len + offset) > UNIV_PAGE_SIZE) {
578 + || UNIV_UNLIKELY(len + offset > UNIV_PAGE_SIZE)) {
579 recv_sys->found_corrupt_log = TRUE;
582 diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
583 --- a/storage/innobase/os/os0file.c 2011-02-23 19:00:47.928696481 +0900
584 +++ b/storage/innobase/os/os0file.c 2011-02-23 19:01:19.200696353 +0900
586 made and only the slot message
587 needs to be passed to the caller
588 of os_aio_simulated_handle */
590 fil_node_t* message1; /*!< message which is given by the */
591 void* message2; /*!< the requester of an aio operation
592 and which can be used to identify
593 @@ -3675,7 +3676,8 @@
595 ulint offset_high, /*!< in: most significant 32 bits of
597 - ulint len) /*!< in: length of the block to read or write */
598 + ulint len, /*!< in: length of the block to read or write */
601 os_aio_slot_t* slot = NULL;
603 @@ -3764,6 +3766,7 @@
604 slot->offset = offset;
605 slot->offset_high = offset_high;
606 slot->io_already_done = FALSE;
607 + slot->space_id = space_id;
610 control = &(slot->control);
611 @@ -4051,6 +4054,7 @@
612 (can be used to identify a completed
613 aio operation); ignored if mode is
618 os_aio_array_t* array;
619 @@ -4137,7 +4141,7 @@
622 slot = os_aio_array_reserve_slot(type, array, message1, message2, file,
623 - name, buf, offset, offset_high, n);
624 + name, buf, offset, offset_high, n, space_id);
625 if (type == OS_FILE_READ) {
626 if (srv_use_native_aio) {
628 @@ -4256,7 +4260,8 @@
629 parameters are valid and can be used to
630 restart the operation, for example */
632 - ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */
633 + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
636 ulint orig_seg = segment;
637 os_aio_array_t* array;
638 @@ -4329,6 +4334,7 @@
639 *message2 = slot->message2;
642 + *space_id = slot->space_id;
644 if (ret && len == slot->len) {
646 @@ -4569,7 +4575,8 @@
647 aio operation failed, these output
648 parameters are valid and can be used to
649 restart the operation. */
650 - ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */
651 + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
655 os_aio_array_t* array;
656 @@ -4627,6 +4634,7 @@
657 *message2 = slot->message2;
660 + *space_id = slot->space_id;
662 if ((slot->ret == 0) && (slot->n_bytes == (long)slot->len)) {
664 @@ -4680,7 +4688,8 @@
665 parameters are valid and can be used to
666 restart the operation, for example */
668 - ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */
669 + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
672 os_aio_array_t* array;
674 @@ -4958,6 +4967,7 @@
675 *message2 = slot->message2;
678 + *space_id = slot->space_id;
680 os_mutex_exit(array->mutex);
682 diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
683 --- a/storage/innobase/row/row0mysql.c 2010-12-04 15:37:50.598481116 +0900
684 +++ b/storage/innobase/row/row0mysql.c 2010-12-04 15:57:53.092563335 +0900
688 #include "ibuf0ibuf.h"
689 +#include "ha_prototypes.h"
691 /** Provide optional 4.x backwards compatibility for 5.0 and above */
692 UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
693 @@ -1194,6 +1195,13 @@
695 thr = que_fork_get_first_thr(prebuilt->ins_graph);
697 + if (!prebuilt->mysql_has_locked && !(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) {
698 + fprintf(stderr, "InnoDB: Error: row_insert_for_mysql is called without ha_innobase::external_lock()\n");
699 + if (trx->mysql_thd != NULL) {
700 + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
704 if (prebuilt->sql_stat_start) {
705 node->state = INS_NODE_SET_IX_LOCK;
706 prebuilt->sql_stat_start = FALSE;
707 diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
708 --- a/storage/innobase/row/row0sel.c 2010-12-04 15:52:23.494514495 +0900
709 +++ b/storage/innobase/row/row0sel.c 2010-12-04 16:01:38.320883699 +0900
710 @@ -3366,6 +3366,7 @@
711 ulint offsets_[REC_OFFS_NORMAL_SIZE];
712 ulint* offsets = offsets_;
713 ibool table_lock_waited = FALSE;
714 + ibool problematic_use = FALSE;
716 rec_offs_init(offsets_);
718 @@ -3732,6 +3733,17 @@
720 /* Do some start-of-statement preparations */
722 + if (!prebuilt->mysql_has_locked) {
723 + if (!(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) {
724 + fprintf(stderr, "InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock()\n");
725 + if (trx->mysql_thd != NULL) {
726 + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
729 + problematic_use = TRUE;
733 if (!prebuilt->sql_stat_start) {
734 /* No need to set an intention lock or assign a read view */
736 @@ -3742,6 +3754,18 @@
737 " perform a consistent read\n"
738 "InnoDB: but the read view is not assigned!\n",
740 + if (problematic_use) {
741 + fprintf(stderr, "InnoDB: It may be caused by calling "
742 + "without ha_innobase::external_lock()\n"
743 + "InnoDB: For the first-aid, avoiding the crash. "
744 + "But it should be fixed ASAP.\n");
745 + if (prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT)
746 + && trx->mysql_thd != NULL) {
747 + innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
749 + prebuilt->sql_stat_start = TRUE;
752 trx_print(stderr, trx, 600);
755 diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
756 --- a/storage/innobase/srv/srv0srv.c 2011-02-23 19:00:48.283695497 +0900
757 +++ b/storage/innobase/srv/srv0srv.c 2011-02-23 19:01:19.204696643 +0900
760 UNIV_INTERN ulint srv_extra_rsegments = 127; /* extra rseg for users */
761 UNIV_INTERN ulint srv_dict_size_limit = 0;
763 +UNIV_INTERN ulint srv_lazy_drop_table = 0;
764 /*-------------------------------------------*/
765 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
766 UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
767 diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
768 --- a/storage/innobase/srv/srv0start.c 2010-12-04 15:57:13.073495392 +0900
769 +++ b/storage/innobase/srv/srv0start.c 2010-12-04 16:02:50.704884053 +0900
770 @@ -2153,7 +2153,7 @@
771 if (srv_print_verbose_log) {
772 ut_print_timestamp(stderr);
774 - " InnoDB: %s started; "
775 + " Percona XtraDB (http://www.percona.com) %s started; "
776 "log sequence number %llu\n",
777 INNODB_VERSION_STR, srv_start_lsn);
779 diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
780 --- a/storage/innobase/sync/sync0sync.c 2011-02-25 14:18:55.817202060 +0900
781 +++ b/storage/innobase/sync/sync0sync.c 2011-02-25 14:19:44.596202017 +0900
782 @@ -1181,6 +1181,7 @@
783 case SYNC_LOG_FLUSH_ORDER:
786 + case SYNC_OUTER_ANY_LATCH:
787 case SYNC_FILE_FORMAT_TAG:
788 case SYNC_DOUBLEWRITE:
789 case SYNC_SEARCH_SYS:
790 diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
791 --- a/storage/innobase/trx/trx0purge.c 2010-11-03 07:01:13.000000000 +0900
792 +++ b/storage/innobase/trx/trx0purge.c 2010-12-04 15:57:53.106551154 +0900
793 @@ -1131,8 +1131,7 @@
794 /* If we cannot advance the 'purge view' because of an old
795 'consistent read view', then the DML statements cannot be delayed.
796 Also, srv_max_purge_lag <= 0 means 'infinity'. */
797 - if (srv_max_purge_lag > 0
798 - && !UT_LIST_GET_LAST(trx_sys->view_list)) {
799 + if (srv_max_purge_lag > 0) {
800 float ratio = (float) trx_sys->rseg_history_len
802 if (ratio > ULINT_MAX / 10000) {