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!
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
17 bpage->state = BUF_BLOCK_ZIP_PAGE;
19 bpage->offset = offset;
20 + bpage->space_was_being_deleted = FALSE;
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
29 if (UNIV_LIKELY(bpage->in_LRU_list && buf_page_in_file(bpage))) {
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);
37 && buf_page_get_io_fix(bpage) == BUF_IO_NONE) {
38 ut_ad(bpage->in_flush_list);
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);
47 if (flush_type != BUF_FLUSH_LRU) {
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
57 +/******************************************************************//**
61 +buf_LRU_mark_space_was_deleted(
62 +/*===========================*/
63 + ulint id) /*!< in: space id */
67 + for (i = 0; i < srv_buf_pool_instances; i++) {
68 + buf_pool_t* buf_pool;
71 + buf_pool = buf_pool_from_array(i);
73 + mutex_enter(&buf_pool->LRU_list_mutex);
75 + bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
77 + while (bpage != NULL) {
78 + if (buf_page_get_space(bpage) == id) {
79 + bpage->space_was_being_deleted = TRUE;
81 + bpage = UT_LIST_GET_NEXT(LRU, bpage);
84 + mutex_exit(&buf_pool->LRU_list_mutex);
88 /********************************************************************//**
89 Insert a compressed block into buf_pool->zip_clean in the LRU order. */
91 @@ -1538,6 +1569,10 @@
92 return(BUF_LRU_NOT_FREED);
95 + if (bpage->space_was_being_deleted && bpage->oldest_modification != 0) {
96 + buf_flush_remove(bpage);
99 #ifdef UNIV_IBUF_COUNT_DEBUG
100 ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0);
101 #endif /* UNIV_IBUF_COUNT_DEBUG */
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
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
114 ut_ad(node && system);
115 ut_ad(mutex_own(&(system->mutex)));
117 - ut_a(node->n_pending == 0);
118 + ut_a(node->n_pending == 0 || node->space->is_being_deleted);
119 ut_a(node->n_pending_flushes == 0);
120 ut_a(node->modification_counter == node->flush_counter);
123 ut_a(system->n_open > 0);
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);
130 /* The node is in the LRU list, remove it */
131 @@ -1073,7 +1074,7 @@
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);
136 + ut_a(node->n_pending == 0 || space->is_being_deleted);
139 /* We fool the assertion in fil_node_close_file() to think
140 @@ -1595,6 +1596,8 @@
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);
147 fil_system->spaces = hash_create(hash_size);
148 fil_system->name_hash = hash_create(hash_size);
149 @@ -2341,7 +2344,11 @@
150 completely and permanently. The flag is_being_deleted also prevents
151 fil_flush() from being applied to this tablespace. */
153 + if (srv_lazy_drop_table) {
154 + buf_LRU_mark_space_was_deleted(id);
156 buf_LRU_invalidate_tablespace(id);
159 /* printf("Deleting tablespace %s id %lu\n", space->name, id); */
161 @@ -4400,6 +4407,10 @@
163 ibool success = TRUE;
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);
171 space = fil_space_get_by_id(space_id);
172 @@ -4411,6 +4422,7 @@
173 *actual_size = space->size;
175 mutex_exit(&fil_system->mutex);
176 + mutex_exit(&fil_system->file_extend_mutex);
180 @@ -4443,6 +4455,8 @@
181 offset_low = ((start_page_no - file_start_page_no)
182 % (4096 * ((1024 * 1024) / page_size)))
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,
189 @@ -4452,8 +4466,10 @@
190 node->name, node->handle, buf,
191 offset_low, offset_high,
194 + NULL, NULL, space_id, NULL);
196 + mutex_enter(&fil_system->mutex);
199 node->size += n_pages;
200 space->size += n_pages;
201 @@ -4499,6 +4515,7 @@
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);
209 @@ -4863,6 +4880,22 @@
210 srv_data_written+= len;
213 + /* if the table space was already deleted, space might not exist already. */
215 + && space_id < SRV_LOG_SPACE_FIRST_ID
216 + && ((buf_page_t*)message)->space_was_being_deleted) {
218 + if (mode == OS_AIO_NORMAL) {
219 + buf_page_io_complete(message, trx);
220 + return(DB_SUCCESS); /*fake*/
222 + if (type == OS_FILE_READ) {
223 + return(DB_TABLESPACE_DELETED);
225 + return(DB_SUCCESS); /*fake*/
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 */
232 @@ -4992,10 +5025,24 @@
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);
241 + /* if the table space was already deleted, space might not exist already. */
243 + && space_id < SRV_LOG_SPACE_FIRST_ID
244 + && ((buf_page_t*)message)->space_was_being_deleted) {
246 + if (mode == OS_AIO_SYNC) {
247 + if (type == OS_FILE_READ) {
248 + return(DB_TABLESPACE_DELETED);
250 + return(DB_SUCCESS); /*fake*/
257 if (mode == OS_AIO_SYNC) {
258 @@ -5095,6 +5142,7 @@
259 fil_node_t* fil_node;
262 + ulint space_id = 0;
264 ut_ad(fil_validate_skip());
266 @@ -5102,10 +5150,10 @@
267 srv_set_io_thread_op_info(segment, "native aio handle");
269 ret = os_aio_windows_handle(segment, 0, &fil_node,
271 + &message, &type, &space_id);
272 #elif defined(LINUX_NATIVE_AIO)
273 ret = os_aio_linux_handle(segment, &fil_node,
275 + &message, &type, &space_id);
277 ret = 0; /* Eliminate compiler warning */
279 @@ -5114,7 +5162,22 @@
280 srv_set_io_thread_op_info(segment, "simulated aio handle");
282 ret = os_aio_simulated_handle(segment, &fil_node,
284 + &message, &type, &space_id);
287 + /* if the table space was already deleted, fil_node might not exist already. */
289 + && space_id < SRV_LOG_SPACE_FIRST_ID
290 + && ((buf_page_t*)message)->space_was_being_deleted) {
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);
297 + srv_set_io_thread_op_info(segment, "complete io for buf page");
298 + buf_page_io_complete(message, NULL);
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
306 @@ -11986,6 +11986,12 @@
307 "except for the deletion.",
308 NULL, NULL, 0, &corrupt_table_action_typelib);
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);
316 static struct st_mysql_sys_var* innobase_system_variables[]= {
317 MYSQL_SYSVAR(page_size),
318 MYSQL_SYSVAR(log_block_size),
319 @@ -12076,6 +12082,7 @@
320 MYSQL_SYSVAR(purge_batch_size),
321 MYSQL_SYSVAR(rollback_segments),
322 MYSQL_SYSVAR(corrupt_table_action),
323 + MYSQL_SYSVAR(lazy_drop_table),
327 @@ -12085,7 +12092,7 @@
328 &innobase_storage_engine,
331 - "Supports transactions, row-level locking, and foreign keys",
332 + "Percona-XtraDB, Supports transactions, row-level locking, and foreign keys",
334 innobase_init, /* Plugin Init */
335 NULL, /* Plugin Deinit */
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
339 @@ -1437,6 +1437,7 @@
340 0 if the block was never accessed
341 in the buffer pool */
343 + ibool space_was_being_deleted;
345 # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
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
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;
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
362 buf_LRU_invalidate_tablespace(
363 /*==========================*/
364 ulint id); /*!< in: space id */
365 +/******************************************************************//**
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. */
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
379 pfs_os_file_close_func(file, __FILE__, __LINE__)
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,\
389 # define os_file_read(file, buf, offset, offset_high, n) \
391 # define os_file_close(file) os_file_close_func(file)
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)
400 # define os_file_read(file, buf, offset, offset_high, n) \
401 os_file_read_func(file, buf, offset, offset_high, n, NULL)
403 (can be used to identify a completed
404 aio operation); ignored if mode is
408 const char* src_file,/*!< in: file name where func invoked */
409 ulint src_line);/*!< in: line where the func invoked */
410 @@ -1063,6 +1064,7 @@
411 (can be used to identify a completed
412 aio operation); ignored if mode is
416 /************************************************************************//**
417 Wakes up all async i/o threads so that they know to exit themselves in
418 @@ -1123,7 +1125,8 @@
419 parameters are valid and can be used to
420 restart the operation, for example */
422 - ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */
423 + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
427 /**********************************************************************//**
428 @@ -1145,7 +1148,8 @@
429 parameters are valid and can be used to
430 restart the operation, for example */
432 - ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */
433 + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
435 /**********************************************************************//**
436 Validates the consistency of the aio system.
437 @return TRUE if ok */
438 @@ -1224,7 +1228,8 @@
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 */
445 #endif /* LINUX_NATIVE_AIO */
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
452 (can be used to identify a completed
453 aio operation); ignored if mode is
457 const char* src_file,/*!< in: file name where func invoked */
458 ulint src_line)/*!< in: line where the func invoked */
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);
466 register_pfs_file_io_end(locker, n);
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
472 extern ulint srv_pass_corrupt_table;
474 extern ulint srv_dict_size_limit;
476 +extern ulint srv_lazy_drop_table;
477 /*-------------------------------------------*/
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
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
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
495 #define INNODB_VERSION_MINOR 1
496 #define INNODB_VERSION_BUGFIX 6
498 +#ifndef PERCONA_INNODB_VERSION
499 +#define PERCONA_INNODB_VERSION 12.1
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:
507 #define INNODB_VERSION_STR \
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)
514 #define REFMAN "http://dev.mysql.com/doc/refman/" \
515 IB_TO_STR(MYSQL_MAJOR_VERSION) "." \
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
520 made and only the slot message
521 needs to be passed to the caller
522 of os_aio_simulated_handle */
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
527 @@ -3675,7 +3676,8 @@
529 ulint offset_high, /*!< in: most significant 32 bits of
531 - ulint len) /*!< in: length of the block to read or write */
532 + ulint len, /*!< in: length of the block to read or write */
535 os_aio_slot_t* slot = NULL;
537 @@ -3764,6 +3766,7 @@
538 slot->offset = offset;
539 slot->offset_high = offset_high;
540 slot->io_already_done = FALSE;
541 + slot->space_id = space_id;
544 control = &(slot->control);
545 @@ -4051,6 +4054,7 @@
546 (can be used to identify a completed
547 aio operation); ignored if mode is
552 os_aio_array_t* array;
553 @@ -4137,7 +4141,7 @@
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) {
562 @@ -4256,7 +4260,8 @@
563 parameters are valid and can be used to
564 restart the operation, for example */
566 - ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */
567 + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
570 ulint orig_seg = segment;
571 os_aio_array_t* array;
572 @@ -4329,6 +4334,7 @@
573 *message2 = slot->message2;
576 + *space_id = slot->space_id;
578 if (ret && len == slot->len) {
580 @@ -4569,7 +4575,8 @@
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 */
589 os_aio_array_t* array;
590 @@ -4627,6 +4634,7 @@
591 *message2 = slot->message2;
594 + *space_id = slot->space_id;
596 if ((slot->ret == 0) && (slot->n_bytes == (long)slot->len)) {
598 @@ -4680,7 +4688,8 @@
599 parameters are valid and can be used to
600 restart the operation, for example */
602 - ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */
603 + ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
606 os_aio_array_t* array;
608 @@ -4958,6 +4967,7 @@
609 *message2 = slot->message2;
612 + *space_id = slot->space_id;
614 os_mutex_exit(array->mutex);
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
622 #include "ibuf0ibuf.h"
623 +#include "ha_prototypes.h"
625 /** Provide optional 4.x backwards compatibility for 5.0 and above */
626 UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
627 @@ -1194,6 +1195,13 @@
629 thr = que_fork_get_first_thr(prebuilt->ins_graph);
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);
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;
650 rec_offs_init(offsets_);
652 @@ -3732,6 +3733,17 @@
654 /* Do some start-of-statement preparations */
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);
663 + problematic_use = TRUE;
667 if (!prebuilt->sql_stat_start) {
668 /* No need to set an intention lock or assign a read view */
670 @@ -3742,6 +3754,18 @@
671 " perform a consistent read\n"
672 "InnoDB: but the read view is not assigned!\n",
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);
683 + prebuilt->sql_stat_start = TRUE;
686 trx_print(stderr, trx, 600);
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
693 UNIV_INTERN ulint srv_pass_corrupt_table = 0; /* 0:disable 1:enable */
695 UNIV_INTERN ulint srv_dict_size_limit = 0;
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;
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
704 @@ -2162,7 +2162,7 @@
705 if (srv_print_verbose_log) {
706 ut_print_timestamp(stderr);
708 - " InnoDB: %s started; "
709 + " Percona XtraDB (http://www.percona.com) %s started; "
710 "log sequence number %llu\n",
711 INNODB_VERSION_STR, srv_start_lsn);
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
716 @@ -1174,6 +1174,7 @@
717 case SYNC_LOG_FLUSH_ORDER:
720 + case SYNC_OUTER_ANY_LATCH:
721 case SYNC_FILE_FORMAT_TAG:
722 case SYNC_DOUBLEWRITE:
723 case SYNC_SEARCH_SYS:
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
727 @@ -1149,8 +1149,7 @@
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
736 if (ratio > ULINT_MAX / 10000) {