]> git.pld-linux.org Git - packages/mysql.git/blob - innodb_fix_misc.patch
- not all chunks needed to patch
[packages/mysql.git] / innodb_fix_misc.patch
1 # name       : innodb_fix_misc.patch
2 # introduced : 11 or before
3 # maintainer : Yasufumi
4 #
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 #
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
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
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
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
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);
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
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
94 @@ -1568,6 +1599,10 @@
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 */
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 @@
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. */
117 @@ -1894,15 +1896,17 @@
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         /*---------------------------------------------------*/
142 @@ -1915,12 +1919,7 @@
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 */
156 @@ -1928,7 +1927,7 @@
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);
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
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);
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);
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),
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),
378    NULL
379  };
380  
381 @@ -12018,7 +12025,7 @@
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 */
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 */
396         /* @} */
397 +       ibool           space_was_being_deleted;
398         ibool           is_corrupt;
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
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  /*********************************************************************//**
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
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
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
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
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
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  
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
525 @@ -247,6 +247,8 @@
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;
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
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
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
548 @@ -53,6 +53,11 @@
549  #define INNODB_VERSION_MINOR   1
550  #define INNODB_VERSION_BUGFIX  5
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:
560 @@ -65,7 +70,8 @@
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)
567  
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
573 @@ -408,7 +408,7 @@
574         ptr += 2;
575  
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;
580  
581                 return(NULL);
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
585 @@ -180,6 +180,7 @@
586                                         made and only the slot message
587                                         needs to be passed to the caller
588                                         of os_aio_simulated_handle */
589 +       ulint           space_id;
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 @@
594                                 offset */
595         ulint           offset_high, /*!< in: most significant 32 bits of
596                                 offset */
597 -       ulint           len)    /*!< in: length of the block to read or write */
598 +       ulint           len,    /*!< in: length of the block to read or write */
599 +       ulint           space_id)
600  {
601         os_aio_slot_t*  slot = NULL;
602  #ifdef WIN_ASYNC_IO
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;
608  
609  #ifdef WIN_ASYNC_IO
610         control = &(slot->control);
611 @@ -4051,6 +4054,7 @@
612                                 (can be used to identify a completed
613                                 aio operation); ignored if mode is
614                                 OS_AIO_SYNC */
615 +       ulint           space_id,
616         trx_t*          trx)
617  {
618         os_aio_array_t* array;
619 @@ -4137,7 +4141,7 @@
620                 trx->io_read += n;
621         }
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) {
627                         os_n_file_reads++;
628 @@ -4256,7 +4260,8 @@
629                                 parameters are valid and can be used to
630                                 restart the operation, for example */
631         void**  message2,
632 -       ulint*  type)           /*!< out: OS_FILE_WRITE or ..._READ */
633 +       ulint*  type,           /*!< out: OS_FILE_WRITE or ..._READ */
634 +       ulint*  space_id)
635  {
636         ulint           orig_seg        = segment;
637         os_aio_array_t* array;
638 @@ -4329,6 +4334,7 @@
639         *message2 = slot->message2;
640  
641         *type = slot->type;
642 +       *space_id = slot->space_id;
643  
644         if (ret && len == slot->len) {
645                 ret_val = TRUE;
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 */
652 +       ulint*  space_id)
653  {
654         ulint           segment;
655         os_aio_array_t* array;
656 @@ -4627,6 +4634,7 @@
657         *message2 = slot->message2;
658  
659         *type = slot->type;
660 +       *space_id = slot->space_id;
661  
662         if ((slot->ret == 0) && (slot->n_bytes == (long)slot->len)) {
663                 ret = TRUE;
664 @@ -4680,7 +4688,8 @@
665                                 parameters are valid and can be used to
666                                 restart the operation, for example */
667         void**  message2,
668 -       ulint*  type)           /*!< out: OS_FILE_WRITE or ..._READ */
669 +       ulint*  type,           /*!< out: OS_FILE_WRITE or ..._READ */
670 +       ulint*  space_id)
671  {
672         os_aio_array_t* array;
673         ulint           segment;
674 @@ -4958,6 +4967,7 @@
675         *message2 = slot->message2;
676  
677         *type = slot->type;
678 +       *space_id = slot->space_id;
679  
680         os_mutex_exit(array->mutex);
681  
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
685 @@ -51,6 +51,7 @@
686  #include "btr0sea.h"
687  #include "fil0fil.h"
688  #include "ibuf0ibuf.h"
689 +#include "ha_prototypes.h"
690  
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 @@
694  
695         thr = que_fork_get_first_thr(prebuilt->ins_graph);
696  
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);
701 +               }
702 +       }
703 +
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;
715  
716         rec_offs_init(offsets_);
717  
718 @@ -3732,6 +3733,17 @@
719  
720         /* Do some start-of-statement preparations */
721  
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);
727 +                       }
728 +               }
729 +               problematic_use = TRUE;
730 +       }
731 +retry_check:
732 +       
733         if (!prebuilt->sql_stat_start) {
734                 /* No need to set an intention lock or assign a read view */
735  
736 @@ -3742,6 +3754,18 @@
737                               " perform a consistent read\n"
738                               "InnoDB: but the read view is not assigned!\n",
739                               stderr);
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);
748 +                               }
749 +                               prebuilt->sql_stat_start = TRUE;
750 +                               goto retry_check;
751 +                       }
752                         trx_print(stderr, trx, 600);
753                         fputc('\n', stderr);
754                         ut_error;
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
758 @@ -442,6 +442,8 @@
759  
760  UNIV_INTERN ulint      srv_extra_rsegments = 127; /* extra rseg for users */
761  UNIV_INTERN ulint      srv_dict_size_limit = 0;
762 +
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);
773                 fprintf(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);
778         }
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:
784         case SYNC_THR_LOCAL:
785         case SYNC_ANY_LATCH:
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
801                         / srv_max_purge_lag;
802                 if (ratio > ULINT_MAX / 10000) {
This page took 0.171477 seconds and 3 git commands to generate.