]> git.pld-linux.org Git - packages/mysql.git/blame - innodb_fix_misc.patch
- fixed todo list
[packages/mysql.git] / innodb_fix_misc.patch
CommitLineData
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!
13#
14# comment: http://lists.mysql.com/commits/112400 is applied also for innodb_plugin
15# to pass innodb_bug53756.test by innodb_plugin
a9ee80b9
ER
16diff -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
19@@ -4043,6 +4043,7 @@
20 bpage->state = BUF_BLOCK_ZIP_PAGE;
21 bpage->space = space;
22 bpage->offset = offset;
23+ bpage->space_was_being_deleted = FALSE;
24
25
26 #ifdef UNIV_DEBUG
27diff -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
30@@ -439,7 +439,7 @@
31
32 if (UNIV_LIKELY(bpage->in_LRU_list && buf_page_in_file(bpage))) {
33
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);
38 }
39@@ -481,6 +481,13 @@
40 && buf_page_get_io_fix(bpage) == BUF_IO_NONE) {
41 ut_ad(bpage->in_flush_list);
42
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);
47+ return(FALSE);
48+ }
49+
50 if (flush_type != BUF_FLUSH_LRU) {
51
52 return(TRUE);
53diff -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
56@@ -554,6 +554,37 @@
57 }
58 }
59
60+/******************************************************************//**
61+*/
62+UNIV_INTERN
63+void
64+buf_LRU_mark_space_was_deleted(
65+/*===========================*/
66+ ulint id) /*!< in: space id */
67+{
68+ ulint i;
69+
70+ for (i = 0; i < srv_buf_pool_instances; i++) {
71+ buf_pool_t* buf_pool;
72+ buf_page_t* bpage;
73+
74+ buf_pool = buf_pool_from_array(i);
75+
76+ mutex_enter(&buf_pool->LRU_list_mutex);
77+
78+ bpage = UT_LIST_GET_FIRST(buf_pool->LRU);
79+
80+ while (bpage != NULL) {
81+ if (buf_page_get_space(bpage) == id) {
82+ bpage->space_was_being_deleted = TRUE;
83+ }
84+ bpage = UT_LIST_GET_NEXT(LRU, bpage);
85+ }
86+
87+ mutex_exit(&buf_pool->LRU_list_mutex);
88+ }
89+}
90+
91 /********************************************************************//**
92 Insert a compressed block into buf_pool->zip_clean in the LRU order. */
93 UNIV_INTERN
df1b5770 94@@ -1538,6 +1569,10 @@
a9ee80b9
ER
95 return(BUF_LRU_NOT_FREED);
96 }
97
98+ if (bpage->space_was_being_deleted && bpage->oldest_modification != 0) {
99+ buf_flush_remove(bpage);
100+ }
101+
102 #ifdef UNIV_IBUF_COUNT_DEBUG
103 ut_a(ibuf_count_get(bpage->space, bpage->offset) == 0);
104 #endif /* UNIV_IBUF_COUNT_DEBUG */
b4e1fa2c
AM
105diff -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
d8778560 108@@ -1868,6 +1868,8 @@
b4e1fa2c
AM
109
110 ut_ad(mutex_own(&(dict_sys->mutex)));
111
112+ table = NULL;
113+
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. */
d8778560 117@@ -1894,15 +1896,17 @@
b4e1fa2c
AM
118 BTR_SEARCH_LEAF, &pcur, &mtr);
119 rec = btr_pcur_get_rec(&pcur);
120
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)) {
124 /* Not found */
125+ goto func_exit;
126+ }
127
128- btr_pcur_close(&pcur);
129- mtr_commit(&mtr);
130- mem_heap_free(heap);
131-
132- return(NULL);
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)) {
136+ goto func_exit;
137+ }
138+ rec = btr_pcur_get_rec(&pcur);
139 }
140
141 /*---------------------------------------------------*/
d8778560 142@@ -1915,12 +1919,7 @@
b4e1fa2c
AM
143
144 /* Check if the table id in record is the one searched for */
145 if (table_id != mach_read_from_8(field)) {
146-
147- btr_pcur_close(&pcur);
148- mtr_commit(&mtr);
149- mem_heap_free(heap);
150-
151- return(NULL);
152+ goto func_exit;
153 }
154
155 /* Now we get the table name from the record */
d8778560 156@@ -1928,7 +1927,7 @@
b4e1fa2c
AM
157 /* Load the table definition to memory */
158 table = dict_load_table(mem_heap_strdupl(heap, (char*) field, len),
159 TRUE);
160-
161+func_exit:
162 btr_pcur_close(&pcur);
163 mtr_commit(&mtr);
164 mem_heap_free(heap);
a9ee80b9
ER
165diff -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
168@@ -252,6 +252,7 @@
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
176@@ -861,7 +862,7 @@
177 ut_ad(node && system);
178 ut_ad(mutex_own(&(system->mutex)));
179 ut_a(node->open);
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);
184
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);
191
192 if (node->open) {
193 /* We fool the assertion in fil_node_close_file() to think
194@@ -1595,6 +1596,8 @@
195
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);
200
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. */
206
207+ if (srv_lazy_drop_table) {
208+ buf_LRU_mark_space_was_deleted(id);
209+ } else {
210 buf_LRU_invalidate_tablespace(id);
211+ }
212 #endif
213 /* printf("Deleting tablespace %s id %lu\n", space->name, id); */
214
215@@ -4400,6 +4407,10 @@
216 ulint page_size;
217 ibool success = TRUE;
218
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);
224
225 space = fil_space_get_by_id(space_id);
226@@ -4411,6 +4422,7 @@
227 *actual_size = space->size;
228
229 mutex_exit(&fil_system->mutex);
230+ mutex_exit(&fil_system->file_extend_mutex);
231
232 return(TRUE);
233 }
234@@ -4443,6 +4455,8 @@
235 offset_low = ((start_page_no - file_start_page_no)
236 % (4096 * ((1024 * 1024) / page_size)))
237 * page_size;
238+
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,
246 page_size * n_pages,
247- NULL, NULL, NULL);
248+ NULL, NULL, space_id, NULL);
249 #endif
250+ mutex_enter(&fil_system->mutex);
251+
252 if (success) {
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);
260
261 fil_flush(space_id);
262
263@@ -4863,6 +4880,22 @@
264 srv_data_written+= len;
265 }
266
267+ /* if the table space was already deleted, space might not exist already. */
268+ if (message
269+ && space_id < SRV_LOG_SPACE_FIRST_ID
270+ && ((buf_page_t*)message)->space_was_being_deleted) {
271+
272+ if (mode == OS_AIO_NORMAL) {
273+ buf_page_io_complete(message, trx);
274+ return(DB_SUCCESS); /*fake*/
275+ }
276+ if (type == OS_FILE_READ) {
277+ return(DB_TABLESPACE_DELETED);
278+ } else {
279+ return(DB_SUCCESS); /*fake*/
280+ }
281+ }
282+
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 */
285
286@@ -4992,10 +5025,24 @@
287 #else
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);
292 #endif
293 } /**/
294
295+ /* if the table space was already deleted, space might not exist already. */
296+ if (message
297+ && space_id < SRV_LOG_SPACE_FIRST_ID
298+ && ((buf_page_t*)message)->space_was_being_deleted) {
299+
300+ if (mode == OS_AIO_SYNC) {
301+ if (type == OS_FILE_READ) {
302+ return(DB_TABLESPACE_DELETED);
303+ } else {
304+ return(DB_SUCCESS); /*fake*/
305+ }
306+ }
307+ }
308+
309 ut_a(ret);
310
311 if (mode == OS_AIO_SYNC) {
312@@ -5095,6 +5142,7 @@
313 fil_node_t* fil_node;
314 void* message;
315 ulint type;
316+ ulint space_id = 0;
317
318 ut_ad(fil_validate_skip());
319
320@@ -5102,10 +5150,10 @@
321 srv_set_io_thread_op_info(segment, "native aio handle");
322 #ifdef WIN_ASYNC_IO
323 ret = os_aio_windows_handle(segment, 0, &fil_node,
324- &message, &type);
325+ &message, &type, &space_id);
326 #elif defined(LINUX_NATIVE_AIO)
327 ret = os_aio_linux_handle(segment, &fil_node,
328- &message, &type);
329+ &message, &type, &space_id);
330 #else
331 ret = 0; /* Eliminate compiler warning */
332 ut_error;
333@@ -5114,7 +5162,22 @@
334 srv_set_io_thread_op_info(segment, "simulated aio handle");
335
336 ret = os_aio_simulated_handle(segment, &fil_node,
337- &message, &type);
338+ &message, &type, &space_id);
339+ }
340+
341+ /* if the table space was already deleted, fil_node might not exist already. */
342+ if (message
343+ && space_id < SRV_LOG_SPACE_FIRST_ID
344+ && ((buf_page_t*)message)->space_was_being_deleted) {
345+
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);
350+
351+ srv_set_io_thread_op_info(segment, "complete io for buf page");
352+ buf_page_io_complete(message, NULL);
353+ return;
354 }
355
356 ut_a(ret);
b4e1fa2c
AM
357diff -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
df1b5770 360@@ -11980,6 +11980,12 @@
a9ee80b9
ER
361 "except for the deletion.",
362 NULL, NULL, 0, &corrupt_table_action_typelib);
363
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);
369+
370 static struct st_mysql_sys_var* innobase_system_variables[]= {
371 MYSQL_SYSVAR(page_size),
372 MYSQL_SYSVAR(log_block_size),
df1b5770 373@@ -12070,6 +12076,7 @@
a9ee80b9
ER
374 MYSQL_SYSVAR(purge_threads),
375 MYSQL_SYSVAR(purge_batch_size),
376 MYSQL_SYSVAR(corrupt_table_action),
377+ MYSQL_SYSVAR(lazy_drop_table),
378 NULL
379 };
380
df1b5770 381@@ -12079,7 +12086,7 @@
b4e1fa2c
AM
382 &innobase_storage_engine,
383 innobase_hton_name,
384 "Innobase Oy",
385- "Supports transactions, row-level locking, and foreign keys",
386+ "Percona-XtraDB, Supports transactions, row-level locking, and foreign keys",
387 PLUGIN_LICENSE_GPL,
388 innobase_init, /* Plugin Init */
389 NULL, /* Plugin Deinit */
a9ee80b9
ER
390diff -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 */
396 /* @} */
397+ ibool space_was_being_deleted;
398 ibool is_corrupt;
df1b5770 399 # if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG
a9ee80b9
ER
400 ibool file_page_was_freed;
401diff -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
404@@ -406,6 +406,7 @@
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;
409 }
410
411 /*********************************************************************//**
412diff -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
415@@ -85,6 +85,13 @@
416 buf_LRU_invalidate_tablespace(
417 /*==========================*/
418 ulint id); /*!< in: space id */
419+/******************************************************************//**
420+*/
421+UNIV_INTERN
422+void
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. */
428 UNIV_INTERN
429diff -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
432@@ -280,9 +280,9 @@
433 pfs_os_file_close_func(file, __FILE__, __LINE__)
434
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,\
441 __FILE__, __LINE__)
442
443 # define os_file_read(file, buf, offset, offset_high, n) \
444@@ -326,9 +326,9 @@
445 # define os_file_close(file) os_file_close_func(file)
446
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)
453
454 # define os_file_read(file, buf, offset, offset_high, n) \
455 os_file_read_func(file, buf, offset, offset_high, n, NULL)
456@@ -757,6 +757,7 @@
457 (can be used to identify a completed
458 aio operation); ignored if mode is
459 OS_AIO_SYNC */
460+ ulint space_id,
461 trx_t* trx,
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
467 OS_AIO_SYNC */
468+ ulint space_id,
469 trx_t* trx);
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 */
475 void** message2,
476- ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */
477+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
478+ ulint* space_id);
479 #endif
480
481 /**********************************************************************//**
482@@ -1145,7 +1148,8 @@
483 parameters are valid and can be used to
484 restart the operation, for example */
485 void** message2,
486- ulint* type); /*!< out: OS_FILE_WRITE or ..._READ */
487+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
488+ ulint* space_id);
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 */
498+ ulint* space_id);
499 #endif /* LINUX_NATIVE_AIO */
500
501 #ifndef UNIV_NONINL
502diff -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
505@@ -229,6 +229,7 @@
506 (can be used to identify a completed
507 aio operation); ignored if mode is
508 OS_AIO_SYNC */
509+ ulint space_id,
510 trx_t* trx,
511 const char* src_file,/*!< in: file name where func invoked */
512 ulint src_line)/*!< in: line where the func invoked */
513@@ -245,7 +246,7 @@
514 src_file, src_line);
515
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);
519
520 register_pfs_file_io_end(locker, n);
521
522diff -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
df1b5770 525@@ -248,6 +248,8 @@
a9ee80b9
ER
526
527 extern ulint srv_extra_rsegments;
528 extern ulint srv_dict_size_limit;
529+
530+extern ulint srv_lazy_drop_table;
531 /*-------------------------------------------*/
532
533 extern ulint srv_n_rows_inserted;
534diff -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
537@@ -683,6 +683,7 @@
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
b4e1fa2c
AM
545diff -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
d8778560 548@@ -53,6 +53,11 @@
b4e1fa2c 549 #define INNODB_VERSION_MINOR 1
d8778560 550 #define INNODB_VERSION_BUGFIX 5
b4e1fa2c
AM
551
552+#ifndef PERCONA_INNODB_VERSION
553+#define PERCONA_INNODB_VERSION 12.1
554+#endif
555+
556+
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:
d8778560 560@@ -65,7 +70,8 @@
b4e1fa2c 561 #define INNODB_VERSION_STR \
d8778560
AM
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)
567
568 #define REFMAN "http://dev.mysql.com/doc/refman/" \
569 IB_TO_STR(MYSQL_MAJOR_VERSION) "." \
a9ee80b9
ER
570diff -ruN a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c
571--- a/storage/innobase/os/os0file.c 2011-02-23 19:00:47.928696481 +0900
572+++ b/storage/innobase/os/os0file.c 2011-02-23 19:01:19.200696353 +0900
573@@ -180,6 +180,7 @@
574 made and only the slot message
575 needs to be passed to the caller
576 of os_aio_simulated_handle */
577+ ulint space_id;
578 fil_node_t* message1; /*!< message which is given by the */
579 void* message2; /*!< the requester of an aio operation
580 and which can be used to identify
581@@ -3675,7 +3676,8 @@
582 offset */
583 ulint offset_high, /*!< in: most significant 32 bits of
584 offset */
585- ulint len) /*!< in: length of the block to read or write */
586+ ulint len, /*!< in: length of the block to read or write */
587+ ulint space_id)
588 {
589 os_aio_slot_t* slot = NULL;
590 #ifdef WIN_ASYNC_IO
591@@ -3764,6 +3766,7 @@
592 slot->offset = offset;
593 slot->offset_high = offset_high;
594 slot->io_already_done = FALSE;
595+ slot->space_id = space_id;
596
597 #ifdef WIN_ASYNC_IO
598 control = &(slot->control);
599@@ -4051,6 +4054,7 @@
600 (can be used to identify a completed
601 aio operation); ignored if mode is
602 OS_AIO_SYNC */
603+ ulint space_id,
604 trx_t* trx)
605 {
606 os_aio_array_t* array;
607@@ -4137,7 +4141,7 @@
608 trx->io_read += n;
609 }
610 slot = os_aio_array_reserve_slot(type, array, message1, message2, file,
611- name, buf, offset, offset_high, n);
612+ name, buf, offset, offset_high, n, space_id);
613 if (type == OS_FILE_READ) {
614 if (srv_use_native_aio) {
615 os_n_file_reads++;
616@@ -4256,7 +4260,8 @@
617 parameters are valid and can be used to
618 restart the operation, for example */
619 void** message2,
620- ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */
621+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
622+ ulint* space_id)
623 {
624 ulint orig_seg = segment;
625 os_aio_array_t* array;
626@@ -4329,6 +4334,7 @@
627 *message2 = slot->message2;
628
629 *type = slot->type;
630+ *space_id = slot->space_id;
631
632 if (ret && len == slot->len) {
633 ret_val = TRUE;
634@@ -4569,7 +4575,8 @@
635 aio operation failed, these output
636 parameters are valid and can be used to
637 restart the operation. */
638- ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */
639+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
640+ ulint* space_id)
641 {
642 ulint segment;
643 os_aio_array_t* array;
644@@ -4627,6 +4634,7 @@
645 *message2 = slot->message2;
646
647 *type = slot->type;
648+ *space_id = slot->space_id;
649
650 if ((slot->ret == 0) && (slot->n_bytes == (long)slot->len)) {
651 ret = TRUE;
652@@ -4680,7 +4688,8 @@
653 parameters are valid and can be used to
654 restart the operation, for example */
655 void** message2,
656- ulint* type) /*!< out: OS_FILE_WRITE or ..._READ */
657+ ulint* type, /*!< out: OS_FILE_WRITE or ..._READ */
658+ ulint* space_id)
659 {
660 os_aio_array_t* array;
661 ulint segment;
662@@ -4958,6 +4967,7 @@
663 *message2 = slot->message2;
664
665 *type = slot->type;
666+ *space_id = slot->space_id;
667
668 os_mutex_exit(array->mutex);
669
b4e1fa2c
AM
670diff -ruN a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c
671--- a/storage/innobase/row/row0mysql.c 2010-12-04 15:37:50.598481116 +0900
672+++ b/storage/innobase/row/row0mysql.c 2010-12-04 15:57:53.092563335 +0900
d8778560
AM
673@@ -51,6 +51,7 @@
674 #include "btr0sea.h"
675 #include "fil0fil.h"
676 #include "ibuf0ibuf.h"
677+#include "ha_prototypes.h"
678
679 /** Provide optional 4.x backwards compatibility for 5.0 and above */
680 UNIV_INTERN ibool row_rollback_on_timeout = FALSE;
681@@ -1194,6 +1195,13 @@
b4e1fa2c
AM
682
683 thr = que_fork_get_first_thr(prebuilt->ins_graph);
684
685+ if (!prebuilt->mysql_has_locked && !(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) {
686+ fprintf(stderr, "InnoDB: Error: row_insert_for_mysql is called without ha_innobase::external_lock()\n");
687+ if (trx->mysql_thd != NULL) {
688+ innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
689+ }
690+ }
691+
692 if (prebuilt->sql_stat_start) {
693 node->state = INS_NODE_SET_IX_LOCK;
694 prebuilt->sql_stat_start = FALSE;
695diff -ruN a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c
696--- a/storage/innobase/row/row0sel.c 2010-12-04 15:52:23.494514495 +0900
697+++ b/storage/innobase/row/row0sel.c 2010-12-04 16:01:38.320883699 +0900
698@@ -3366,6 +3366,7 @@
699 ulint offsets_[REC_OFFS_NORMAL_SIZE];
700 ulint* offsets = offsets_;
701 ibool table_lock_waited = FALSE;
702+ ibool problematic_use = FALSE;
703
704 rec_offs_init(offsets_);
705
706@@ -3732,6 +3733,17 @@
707
708 /* Do some start-of-statement preparations */
709
710+ if (!prebuilt->mysql_has_locked) {
711+ if (!(prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT))) {
712+ fprintf(stderr, "InnoDB: Error: row_search_for_mysql() is called without ha_innobase::external_lock()\n");
713+ if (trx->mysql_thd != NULL) {
714+ innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
715+ }
716+ }
717+ problematic_use = TRUE;
718+ }
719+retry_check:
720+
721 if (!prebuilt->sql_stat_start) {
722 /* No need to set an intention lock or assign a read view */
723
724@@ -3742,6 +3754,18 @@
725 " perform a consistent read\n"
726 "InnoDB: but the read view is not assigned!\n",
727 stderr);
728+ if (problematic_use) {
729+ fprintf(stderr, "InnoDB: It may be caused by calling "
730+ "without ha_innobase::external_lock()\n"
731+ "InnoDB: For the first-aid, avoiding the crash. "
732+ "But it should be fixed ASAP.\n");
733+ if (prebuilt->table->flags & (DICT_TF2_TEMPORARY << DICT_TF2_SHIFT)
734+ && trx->mysql_thd != NULL) {
735+ innobase_mysql_print_thd(stderr, trx->mysql_thd, 600);
736+ }
737+ prebuilt->sql_stat_start = TRUE;
738+ goto retry_check;
739+ }
740 trx_print(stderr, trx, 600);
741 fputc('\n', stderr);
742 ut_error;
a9ee80b9
ER
743diff -ruN a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c
744--- a/storage/innobase/srv/srv0srv.c 2011-02-23 19:00:48.283695497 +0900
745+++ b/storage/innobase/srv/srv0srv.c 2011-02-23 19:01:19.204696643 +0900
df1b5770 746@@ -446,6 +446,8 @@
a9ee80b9
ER
747
748 UNIV_INTERN ulint srv_extra_rsegments = 127; /* extra rseg for users */
749 UNIV_INTERN ulint srv_dict_size_limit = 0;
750+
751+UNIV_INTERN ulint srv_lazy_drop_table = 0;
752 /*-------------------------------------------*/
753 UNIV_INTERN ulong srv_n_spin_wait_rounds = 30;
754 UNIV_INTERN ulong srv_n_free_tickets_to_enter = 500;
b4e1fa2c
AM
755diff -ruN a/storage/innobase/srv/srv0start.c b/storage/innobase/srv/srv0start.c
756--- a/storage/innobase/srv/srv0start.c 2010-12-04 15:57:13.073495392 +0900
757+++ b/storage/innobase/srv/srv0start.c 2010-12-04 16:02:50.704884053 +0900
df1b5770 758@@ -2156,7 +2156,7 @@
b4e1fa2c
AM
759 if (srv_print_verbose_log) {
760 ut_print_timestamp(stderr);
761 fprintf(stderr,
d8778560 762- " InnoDB: %s started; "
b4e1fa2c
AM
763+ " Percona XtraDB (http://www.percona.com) %s started; "
764 "log sequence number %llu\n",
765 INNODB_VERSION_STR, srv_start_lsn);
766 }
a9ee80b9
ER
767diff -ruN a/storage/innobase/sync/sync0sync.c b/storage/innobase/sync/sync0sync.c
768--- a/storage/innobase/sync/sync0sync.c 2011-02-25 14:18:55.817202060 +0900
769+++ b/storage/innobase/sync/sync0sync.c 2011-02-25 14:19:44.596202017 +0900
df1b5770 770@@ -1174,6 +1174,7 @@
a9ee80b9
ER
771 case SYNC_LOG_FLUSH_ORDER:
772 case SYNC_THR_LOCAL:
773 case SYNC_ANY_LATCH:
774+ case SYNC_OUTER_ANY_LATCH:
775 case SYNC_FILE_FORMAT_TAG:
776 case SYNC_DOUBLEWRITE:
777 case SYNC_SEARCH_SYS:
b4e1fa2c
AM
778diff -ruN a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c
779--- a/storage/innobase/trx/trx0purge.c 2010-11-03 07:01:13.000000000 +0900
780+++ b/storage/innobase/trx/trx0purge.c 2010-12-04 15:57:53.106551154 +0900
781@@ -1131,8 +1131,7 @@
782 /* If we cannot advance the 'purge view' because of an old
783 'consistent read view', then the DML statements cannot be delayed.
784 Also, srv_max_purge_lag <= 0 means 'infinity'. */
785- if (srv_max_purge_lag > 0
786- && !UT_LIST_GET_LAST(trx_sys->view_list)) {
787+ if (srv_max_purge_lag > 0) {
788 float ratio = (float) trx_sys->rseg_history_len
789 / srv_max_purge_lag;
790 if (ratio > ULINT_MAX / 10000) {
This page took 0.167896 seconds and 4 git commands to generate.