diff options
Diffstat (limited to 'storage')
-rw-r--r-- | storage/innobase/btr/btr0btr.c | 31 | ||||
-rw-r--r-- | storage/innobase/btr/btr0cur.c | 13 | ||||
-rw-r--r-- | storage/innobase/buf/buf0buf.c | 6 | ||||
-rw-r--r-- | storage/innobase/handler/ha_innodb.cc | 120 | ||||
-rw-r--r-- | storage/innobase/ibuf/ibuf0ibuf.c | 62 | ||||
-rw-r--r-- | storage/innobase/include/btr0btr.h | 22 | ||||
-rw-r--r-- | storage/innobase/include/mtr0log.ic | 3 | ||||
-rw-r--r-- | storage/innobase/include/trx0rseg.ic | 9 | ||||
-rw-r--r-- | storage/innobase/include/trx0sys.h | 6 | ||||
-rw-r--r-- | storage/innobase/lock/lock0lock.c | 7 | ||||
-rw-r--r-- | storage/innobase/os/os0file.c | 99 | ||||
-rw-r--r-- | storage/innobase/page/page0page.c | 5 | ||||
-rw-r--r-- | storage/innobase/row/row0ins.c | 4 | ||||
-rw-r--r-- | storage/innobase/row/row0mysql.c | 14 | ||||
-rw-r--r-- | storage/innobase/row/row0sel.c | 3 | ||||
-rw-r--r-- | storage/innobase/row/row0umod.c | 3 | ||||
-rw-r--r-- | storage/innobase/row/row0upd.c | 3 | ||||
-rw-r--r-- | storage/innobase/srv/srv0srv.c | 3 | ||||
-rw-r--r-- | storage/innobase/trx/trx0purge.c | 3 | ||||
-rw-r--r-- | storage/innobase/trx/trx0rec.c | 5 | ||||
-rw-r--r-- | storage/innobase/trx/trx0sys.c | 5 | ||||
-rw-r--r-- | storage/sphinx/ha_sphinx.cc | 2 |
22 files changed, 375 insertions, 53 deletions
diff --git a/storage/innobase/btr/btr0btr.c b/storage/innobase/btr/btr0btr.c index b476167af29..88371208230 100644 --- a/storage/innobase/btr/btr0btr.c +++ b/storage/innobase/btr/btr0btr.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -42,6 +42,27 @@ Created 6/2/1994 Heikki Tuuri #include "ibuf0ibuf.h" #include "trx0trx.h" +/**************************************************************//** +Report that an index page is corrupted. */ +UNIV_INTERN +void +btr_corruption_report( +/*==================*/ + const buf_block_t* block, /*!< in: corrupted block */ + const dict_index_t* index) /*!< in: index tree */ +{ + fprintf(stderr, "InnoDB: flag mismatch in space %u page %u" + " index %s of table %s\n", + (unsigned) buf_block_get_space(block), + (unsigned) buf_block_get_page_no(block), + index->name, index->table_name); + buf_page_print(buf_block_get_frame(block), 0); + if (block->page.zip.data) { + buf_page_print(block->page.zip.data, + buf_block_get_zip_size(block)); + } +} + #ifdef UNIV_BLOB_DEBUG # include "srv0srv.h" # include "ut0rbt.h" @@ -692,8 +713,7 @@ btr_root_block_get( block = btr_block_get(space, zip_size, root_page_no, RW_X_LATCH, index, mtr); - ut_a((ibool)!!page_is_comp(buf_block_get_frame(block)) - == dict_table_is_comp(index->table)); + btr_assert_not_corrupted(block, index); #ifdef UNIV_BTR_DEBUG if (!dict_index_is_ibuf(index)) { const page_t* root = buf_block_get_frame(block); @@ -1532,7 +1552,7 @@ btr_page_reorganize_low( ibool success = FALSE; ut_ad(mtr_memo_contains(mtr, block, MTR_MEMO_PAGE_X_FIX)); - ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table)); + btr_assert_not_corrupted(block, index); #ifdef UNIV_ZIP_DEBUG ut_a(!page_zip || page_zip_validate(page_zip, page)); #endif /* UNIV_ZIP_DEBUG */ @@ -3164,7 +3184,8 @@ btr_compress( block = btr_cur_get_block(cursor); page = btr_cur_get_page(cursor); index = btr_cur_get_index(cursor); - ut_a((ibool) !!page_is_comp(page) == dict_table_is_comp(index->table)); + + btr_assert_not_corrupted(block, index); ut_ad(mtr_memo_contains(mtr, dict_index_get_lock(index), MTR_MEMO_X_LOCK)); diff --git a/storage/innobase/btr/btr0cur.c b/storage/innobase/btr/btr0cur.c index 03346337d3f..1551aee5426 100644 --- a/storage/innobase/btr/btr0cur.c +++ b/storage/innobase/btr/btr0cur.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -408,7 +408,12 @@ btr_cur_search_to_nth_level( ut_ad(dict_index_check_search_tuple(index, tuple)); ut_ad(!dict_index_is_ibuf(index) || ibuf_inside(mtr)); ut_ad(dtuple_check_typed(tuple)); + ut_ad(index->page != FIL_NULL); + UNIV_MEM_INVALID(&cursor->up_match, sizeof cursor->up_match); + UNIV_MEM_INVALID(&cursor->up_bytes, sizeof cursor->up_bytes); + UNIV_MEM_INVALID(&cursor->low_match, sizeof cursor->low_match); + UNIV_MEM_INVALID(&cursor->low_bytes, sizeof cursor->low_bytes); #ifdef UNIV_DEBUG cursor->up_match = ULINT_UNDEFINED; cursor->low_match = ULINT_UNDEFINED; @@ -757,11 +762,11 @@ retry_page_get: if (level != 0) { /* x-latch the page */ - page = btr_page_get( + buf_block_t* child_block = btr_block_get( space, zip_size, page_no, RW_X_LATCH, index, mtr); - ut_a((ibool)!!page_is_comp(page) - == dict_table_is_comp(index->table)); + page = buf_block_get_frame(child_block); + btr_assert_not_corrupted(child_block, index); } else { cursor->low_match = low_match; cursor->low_bytes = low_bytes; diff --git a/storage/innobase/buf/buf0buf.c b/storage/innobase/buf/buf0buf.c index 890d0282286..0721929abd3 100644 --- a/storage/innobase/buf/buf0buf.c +++ b/storage/innobase/buf/buf0buf.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -615,6 +615,8 @@ buf_page_print( ulint old_checksum; ulint size = zip_size; + ut_ad(0); + if (!size) { size = UNIV_PAGE_SIZE; } @@ -2830,7 +2832,7 @@ buf_page_get_known_nowait( ut_a(buf_block_get_state(block) == BUF_BLOCK_FILE_PAGE); #endif /* UNIV_DEBUG || UNIV_BUF_DEBUG */ #if defined UNIV_DEBUG_FILE_ACCESSES || defined UNIV_DEBUG - ut_a(block->page.file_page_was_freed == FALSE); + ut_a(mode == BUF_KEEP_OLD || !block->page.file_page_was_freed); #endif #ifdef UNIV_IBUF_COUNT_DEBUG diff --git a/storage/innobase/handler/ha_innodb.cc b/storage/innobase/handler/ha_innodb.cc index 306263d0154..2dfbb4a0734 100644 --- a/storage/innobase/handler/ha_innodb.cc +++ b/storage/innobase/handler/ha_innodb.cc @@ -3319,18 +3319,29 @@ ha_innobase::primary_key_is_clustered() return(true); } +/** Always normalize table name to lower case on Windows */ +#ifdef __WIN__ +#define normalize_table_name(norm_name, name) \ + normalize_table_name_low(norm_name, name, TRUE) +#else +#define normalize_table_name(norm_name, name) \ + normalize_table_name_low(norm_name, name, FALSE) +#endif /* __WIN__ */ + /*****************************************************************//** Normalizes a table name string. A normalized name consists of the database name catenated to '/' and table name. An example: test/mytable. On Windows normalization puts both the database name and the -table name always to lower case. */ +table name always to lower case if "set_lower_case" is set to TRUE. */ static void -normalize_table_name( -/*=================*/ +normalize_table_name_low( +/*=====================*/ char* norm_name, /*!< out: normalized name as a null-terminated string */ - const char* name) /*!< in: table name string */ + const char* name, /*!< in: table name string */ + ibool set_lower_case) /*!< in: TRUE if we want to set + name to lower case */ { char* name_ptr; char* db_ptr; @@ -3360,9 +3371,9 @@ normalize_table_name( norm_name[name_ptr - db_ptr - 1] = '/'; -#ifdef __WIN__ - innobase_casedn_str(norm_name); -#endif + if (set_lower_case) { + innobase_casedn_str(norm_name); + } } /********************************************************************//** @@ -3766,6 +3777,8 @@ ha_innobase::open( THD* thd; ulint retries = 0; char* is_part = NULL; + ibool par_case_name_set = FALSE; + char par_case_name[MAX_FULL_NAME_LEN + 1]; DBUG_ENTER("ha_innobase::open"); @@ -3799,16 +3812,87 @@ ha_innobase::open( workaround for http://bugs.mysql.com/bug.php?id=33349. Look at support issue https://support.mysql.com/view.php?id=21080 for more details. */ +#ifdef __WIN__ + is_part = strstr(norm_name, "#p#"); +#else is_part = strstr(norm_name, "#P#"); +#endif /* __WIN__ */ + retry: /* Get pointer to a table object in InnoDB dictionary cache */ ib_table = dict_table_get(norm_name, TRUE); - + if (NULL == ib_table) { if (is_part && retries < 10) { - ++retries; - os_thread_sleep(100000); - goto retry; + /* MySQL partition engine hard codes the file name + separator as "#P#". The text case is fixed even if + lower_case_table_names is set to 1 or 2. This is true + for sub-partition names as well. InnoDB always + normalises file names to lower case on Windows, this + can potentially cause problems when copying/moving + tables between platforms. + + 1) If boot against an installation from Windows + platform, then its partition table name could + be all be in lower case in system tables. So we + will need to check lower case name when load table. + + 2) If we boot an installation from other case + sensitive platform in Windows, we might need to + check the existence of table name without lowering + case them in the system table. */ + if (innobase_get_lower_case_table_names() == 1) { + + if (!par_case_name_set) { +#ifndef __WIN__ + /* Check for the table using lower + case name, including the partition + separator "P" */ + memcpy(par_case_name, norm_name, + strlen(norm_name)); + par_case_name[strlen(norm_name)] = 0; + innobase_casedn_str(par_case_name); +#else + /* On Windows platfrom, check + whether there exists table name in + system table whose name is + not being normalized to lower case */ + normalize_table_name_low( + par_case_name, name, FALSE); +#endif + par_case_name_set = TRUE; + } + + ib_table = dict_table_get( + par_case_name, FALSE); + } + if (!ib_table) { + ++retries; + os_thread_sleep(100000); + goto retry; + } else { +#ifndef __WIN__ + sql_print_warning("Partition table %s opened " + "after converting to lower " + "case. The table may have " + "been moved from a case " + "in-sensitive file system. " + "Please recreate table in " + "the current file system\n", + norm_name); +#else + sql_print_warning("Partition table %s opened " + "after skipping the step to " + "lower case the table name. " + "The table may have been " + "moved from a case sensitive " + "file system. Please " + "recreate table in the " + "current file system\n", + norm_name); +#endif + goto table_opened; + } } if (is_part) { @@ -3838,6 +3922,8 @@ retry: DBUG_RETURN(HA_ERR_NO_SUCH_TABLE); } +table_opened: + if (ib_table->ibd_file_missing && !thd_tablespace_op(thd)) { sql_print_error("MySQL is trying to open a table handle but " "the .ibd file for\ntable %s does not exist.\n" @@ -11485,6 +11571,13 @@ static MYSQL_SYSVAR_ULONG(read_ahead_threshold, srv_read_ahead_threshold, "trigger a readahead.", NULL, NULL, 56, 0, 64, 0); +#ifdef UNIV_DEBUG +static MYSQL_SYSVAR_UINT(trx_rseg_n_slots_debug, trx_rseg_n_slots_debug, + PLUGIN_VAR_RQCMDARG, + "Debug flags for InnoDB to limit TRX_RSEG_N_SLOTS for trx_rsegf_undo_find_free()", + NULL, NULL, 0, 0, 1024, 0); +#endif /* UNIV_DEBUG */ + static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(additional_mem_pool_size), MYSQL_SYSVAR(autoextend_increment), @@ -11554,10 +11647,14 @@ static struct st_mysql_sys_var* innobase_system_variables[]= { MYSQL_SYSVAR(purge_threads), MYSQL_SYSVAR(purge_batch_size), MYSQL_SYSVAR(rollback_segments), +#ifdef UNIV_DEBUG + MYSQL_SYSVAR(trx_rseg_n_slots_debug), +#endif /* UNIV_DEBUG */ NULL }; mysql_declare_plugin(innobase) +i_s_innodb_trx, // this need to be before SE plugin, otherwise --innodb-trx-rseg-n-slots-debug shadows --innodb-trx option { MYSQL_STORAGE_ENGINE_PLUGIN, &innobase_storage_engine, @@ -11573,7 +11670,6 @@ mysql_declare_plugin(innobase) NULL, /* reserved */ 0, /* flags */ }, -i_s_innodb_trx, i_s_innodb_locks, i_s_innodb_lock_waits, i_s_innodb_cmp, diff --git a/storage/innobase/ibuf/ibuf0ibuf.c b/storage/innobase/ibuf/ibuf0ibuf.c index 47ec1365cb8..96af9038be2 100644 --- a/storage/innobase/ibuf/ibuf0ibuf.c +++ b/storage/innobase/ibuf/ibuf0ibuf.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -2546,7 +2546,15 @@ ibuf_get_merge_page_nos_func( } else { rec_page_no = ibuf_rec_get_page_no(mtr, rec); rec_space_id = ibuf_rec_get_space(mtr, rec); - ut_ad(rec_page_no > IBUF_TREE_ROOT_PAGE_NO); + /* In the system tablespace, the smallest + possible secondary index leaf page number is + bigger than IBUF_TREE_ROOT_PAGE_NO (4). In + other tablespaces, the clustered index tree is + created at page 3, which makes page 4 the + smallest possible secondary index leaf page + (and that only after DROP INDEX). */ + ut_ad(rec_page_no + > IBUF_TREE_ROOT_PAGE_NO - (rec_space_id != 0)); } #ifdef UNIV_IBUF_DEBUG @@ -3872,6 +3880,7 @@ ibuf_insert_to_index_page_low( fputs("InnoDB: Submit a detailed bug report" " to http://bugs.mysql.com\n", stderr); + ut_ad(0); } /************************************************************************ @@ -4065,6 +4074,11 @@ ibuf_set_del_mark( TRUE, mtr); } } else { + const page_t* page + = page_cur_get_page(&page_cur); + const buf_block_t* block + = page_cur_get_block(&page_cur); + ut_print_timestamp(stderr); fputs(" InnoDB: unable to find a record to delete-mark\n", stderr); @@ -4073,10 +4087,14 @@ ibuf_set_del_mark( fputs("\n" "InnoDB: record ", stderr); rec_print(stderr, page_cur_get_rec(&page_cur), index); - putc('\n', stderr); - fputs("\n" - "InnoDB: Submit a detailed bug report" - " to http://bugs.mysql.com\n", stderr); + fprintf(stderr, "\nspace %u offset %u" + " (%u records, index id %llu)\n" + "InnoDB: Submit a detailed bug report" + " to http://bugs.mysql.com\n", + (unsigned) buf_block_get_space(block), + (unsigned) buf_block_get_page_no(block), + (unsigned) page_get_n_recs(page), + (ulonglong) btr_page_get_index_id(page)); ut_ad(0); } } @@ -4120,12 +4138,31 @@ ibuf_delete( offsets = rec_get_offsets( rec, index, offsets, ULINT_UNDEFINED, &heap); - /* Refuse to delete the last record. */ - ut_a(page_get_n_recs(page) > 1); - - /* The record should have been marked for deletion. */ - ut_ad(REC_INFO_DELETED_FLAG - & rec_get_info_bits(rec, page_is_comp(page))); + if (page_get_n_recs(page) <= 1 + || !(REC_INFO_DELETED_FLAG + & rec_get_info_bits(rec, page_is_comp(page)))) { + /* Refuse to purge the last record or a + record that has not been marked for deletion. */ + ut_print_timestamp(stderr); + fputs(" InnoDB: unable to purge a record\n", + stderr); + fputs("InnoDB: tuple ", stderr); + dtuple_print(stderr, entry); + fputs("\n" + "InnoDB: record ", stderr); + rec_print_new(stderr, rec, offsets); + fprintf(stderr, "\nspace %u offset %u" + " (%u records, index id %llu)\n" + "InnoDB: Submit a detailed bug report" + " to http://bugs.mysql.com\n", + (unsigned) buf_block_get_space(block), + (unsigned) buf_block_get_page_no(block), + (unsigned) page_get_n_recs(page), + (ulonglong) btr_page_get_index_id(page)); + + ut_ad(0); + return; + } lock_update_delete(block, rec); @@ -4211,6 +4248,7 @@ ibuf_restore_pos( fprintf(stderr, "InnoDB: ibuf tree ok\n"); fflush(stderr); + ut_ad(0); } return(FALSE); diff --git a/storage/innobase/include/btr0btr.h b/storage/innobase/include/btr0btr.h index 71e772388a0..93b59fdfafb 100644 --- a/storage/innobase/include/btr0btr.h +++ b/storage/innobase/include/btr0btr.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -92,6 +92,26 @@ insert/delete buffer when the record is not in the buffer pool. */ buffer when the record is not in the buffer pool. */ #define BTR_DELETE 8192 +/**************************************************************//** +Report that an index page is corrupted. */ +UNIV_INTERN +void +btr_corruption_report( +/*==================*/ + const buf_block_t* block, /*!< in: corrupted block */ + const dict_index_t* index) /*!< in: index tree */ + UNIV_COLD __attribute__((nonnull)); + +/** Assert that a B-tree page is not corrupted. +@param block buffer block containing a B-tree page +@param index the B-tree index */ +#define btr_assert_not_corrupted(block, index) \ + if ((ibool) !!page_is_comp(buf_block_get_frame(block)) \ + != dict_table_is_comp((index)->table)) { \ + btr_corruption_report(block, index); \ + ut_error; \ + } + #ifdef UNIV_BLOB_DEBUG # include "ut0rbt.h" /** An index->blobs entry for keeping track of off-page column references */ diff --git a/storage/innobase/include/mtr0log.ic b/storage/innobase/include/mtr0log.ic index c670a0a8c82..6f871170099 100644 --- a/storage/innobase/include/mtr0log.ic +++ b/storage/innobase/include/mtr0log.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -216,6 +216,7 @@ mlog_write_initial_log_record_fast( "Please post a bug report to " "bugs.mysql.com.\n", type, offset, space); + ut_ad(0); } } diff --git a/storage/innobase/include/trx0rseg.ic b/storage/innobase/include/trx0rseg.ic index daffa92fc7d..5e8d2b41120 100644 --- a/storage/innobase/include/trx0rseg.ic +++ b/storage/innobase/include/trx0rseg.ic @@ -25,6 +25,7 @@ Created 3/26/1996 Heikki Tuuri #include "srv0srv.h" #include "mtr0log.h" +#include "trx0sys.h" /******************************************************************//** Gets a rollback segment header. @@ -131,7 +132,13 @@ trx_rsegf_undo_find_free( ulint i; ulint page_no; - for (i = 0; i < TRX_RSEG_N_SLOTS; i++) { + for (i = 0; +#ifndef UNIV_DEBUG + i < TRX_RSEG_N_SLOTS; +#else + i < (trx_rseg_n_slots_debug ? trx_rseg_n_slots_debug : TRX_RSEG_N_SLOTS); +#endif + i++) { page_no = trx_rsegf_get_nth_undo(rsegf, i, mtr); diff --git a/storage/innobase/include/trx0sys.h b/storage/innobase/include/trx0sys.h index 9cec1933e9d..3913792d594 100644 --- a/storage/innobase/include/trx0sys.h +++ b/storage/innobase/include/trx0sys.h @@ -223,6 +223,12 @@ trx_id_t trx_sys_get_new_trx_id(void); /*========================*/ #endif /* !UNIV_HOTBACKUP */ + +#ifdef UNIV_DEBUG +/* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */ +extern uint trx_rseg_n_slots_debug; +#endif + /*****************************************************************//** Writes a trx id to an index page. In case that the id size changes in some future version, this function should be used instead of diff --git a/storage/innobase/lock/lock0lock.c b/storage/innobase/lock/lock0lock.c index 714107304f7..263516ab5fd 100644 --- a/storage/innobase/lock/lock0lock.c +++ b/storage/innobase/lock/lock0lock.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -38,6 +38,7 @@ Created 5/7/1996 Heikki Tuuri #include "trx0purge.h" #include "dict0mem.h" #include "trx0sys.h" +#include "btr0btr.h" /* Restricts the length of search we will do in the waits-for graph of transactions */ @@ -1690,7 +1691,7 @@ lock_rec_create( page_no = buf_block_get_page_no(block); page = block->frame; - ut_ad(!!page_is_comp(page) == dict_table_is_comp(index->table)); + btr_assert_not_corrupted(block, index); /* If rec is the supremum record, then we reset the gap and LOCK_REC_NOT_GAP bits, as all locks on the supremum are @@ -1795,6 +1796,7 @@ lock_rec_enqueue_waiting( "InnoDB: Submit a detailed bug report" " to http://bugs.mysql.com\n", stderr); + ut_ad(0); } /* Enqueue the lock request that will wait to be granted */ @@ -3795,6 +3797,7 @@ lock_table_enqueue_waiting( "InnoDB: Submit a detailed bug report" " to http://bugs.mysql.com\n", stderr); + ut_ad(0); } /* Enqueue the lock request that will wait to be granted */ diff --git a/storage/innobase/os/os0file.c b/storage/innobase/os/os0file.c index bd48d0e4b6e..502cb44a0fa 100644 --- a/storage/innobase/os/os0file.c +++ b/storage/innobase/os/os0file.c @@ -3211,7 +3211,91 @@ retry: fprintf(stderr, "InnoDB: You can disable Linux Native AIO by" - " setting innodb_native_aio = off in my.cnf\n"); + " setting innodb_use_native_aio = 0 in my.cnf\n"); + return(FALSE); +} + +/******************************************************************//** +Checks if the system supports native linux aio. On some kernel +versions where native aio is supported it won't work on tmpfs. In such +cases we can't use native aio as it is not possible to mix simulated +and native aio. +@return: TRUE if supported, FALSE otherwise. */ +static +ibool +os_aio_native_aio_supported(void) +/*=============================*/ +{ + int fd; + byte* buf; + byte* ptr; + struct io_event io_event; + io_context_t io_ctx; + struct iocb iocb; + struct iocb* p_iocb; + int err; + + if (!os_aio_linux_create_io_ctx(1, &io_ctx)) { + /* The platform does not support native aio. */ + return(FALSE); + } + + /* Now check if tmpdir supports native aio ops. */ + fd = innobase_mysql_tmpfile(); + + if (fd < 0) { + ut_print_timestamp(stderr); + fprintf(stderr, " InnoDB: Error: unable to create " + "temp file to check native AIO support.\n"); + + return(FALSE); + } + + memset(&io_event, 0x0, sizeof(io_event)); + + buf = (byte*) ut_malloc(UNIV_PAGE_SIZE * 2); + ptr = (byte*) ut_align(buf, UNIV_PAGE_SIZE); + + /* Suppress valgrind warning. */ + memset(buf, 0x00, UNIV_PAGE_SIZE * 2); + + memset(&iocb, 0x0, sizeof(iocb)); + p_iocb = &iocb; + io_prep_pwrite(p_iocb, fd, ptr, UNIV_PAGE_SIZE, 0); + + err = io_submit(io_ctx, 1, &p_iocb); + if (err >= 1) { + /* Now collect the submitted IO request. */ + err = io_getevents(io_ctx, 1, 1, &io_event, NULL); + } + + ut_free(buf); + close(fd); + + switch (err) { + case 1: + return(TRUE); + + case -EINVAL: + case -ENOSYS: + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Error: Linux Native AIO is not" + " supported on tmpdir.\n" + "InnoDB: You can either move tmpdir to a" + " file system that supports native AIO\n" + "InnoDB: or you can set" + " innodb_use_native_aio to FALSE to avoid" + " this message.\n"); + + /* fall through. */ + default: + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Error: Linux Native AIO check" + " on tmpdir returned error[%d]\n", -err); + } + return(FALSE); } #endif /* LINUX_NATIVE_AIO */ @@ -3378,6 +3462,19 @@ os_aio_init( os_io_init_simple(); +#if defined(LINUX_NATIVE_AIO) + /* Check if native aio is supported on this system and tmpfs */ + if (srv_use_native_aio + && !os_aio_native_aio_supported()) { + + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Warning: Linux Native AIO" + " disabled.\n"); + srv_use_native_aio = FALSE; + } +#endif /* LINUX_NATIVE_AIO */ + for (i = 0; i < n_segments; i++) { srv_set_io_thread_op_info(i, "not started yet"); } diff --git a/storage/innobase/page/page0page.c b/storage/innobase/page/page0page.c index 4858929082a..e250bb359fe 100644 --- a/storage/innobase/page/page0page.c +++ b/storage/innobase/page/page0page.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1994, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1994, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -549,8 +549,7 @@ page_copy_rec_list_end_no_locks( page_cur_move_to_next(&cur1); } - ut_a((ibool)!!page_is_comp(new_page) - == dict_table_is_comp(index->table)); + btr_assert_not_corrupted(new_block, index); ut_a(page_is_comp(new_page) == page_rec_is_comp(rec)); ut_a(mach_read_from_2(new_page + UNIV_PAGE_SIZE - 10) == (ulint) (page_is_comp(new_page) ? PAGE_NEW_INFIMUM : PAGE_OLD_INFIMUM)); diff --git a/storage/innobase/row/row0ins.c b/storage/innobase/row/row0ins.c index 6e311ce2e80..67846ab6f69 100644 --- a/storage/innobase/row/row0ins.c +++ b/storage/innobase/row/row0ins.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -950,7 +950,7 @@ row_ins_foreign_check_on_constraint( fputs("\n" "InnoDB: Submit a detailed bug report to" " http://bugs.mysql.com\n", stderr); - + ut_ad(0); err = DB_SUCCESS; goto nonstandard_exit_func; diff --git a/storage/innobase/row/row0mysql.c b/storage/innobase/row/row0mysql.c index 996a49f76e8..3f81604a1a2 100644 --- a/storage/innobase/row/row0mysql.c +++ b/storage/innobase/row/row0mysql.c @@ -1991,6 +1991,20 @@ err_exit: } break; + case DB_TOO_MANY_CONCURRENT_TRXS: + /* We already have .ibd file here. it should be deleted. */ + + if (table->space && !fil_delete_tablespace(table->space)) { + ut_print_timestamp(stderr); + fprintf(stderr, + " InnoDB: Error: not able to" + " delete tablespace %lu of table ", + (ulong) table->space); + ut_print_name(stderr, trx, TRUE, table->name); + fputs("!\n", stderr); + } + /* fall through */ + case DB_DUPLICATE_KEY: default: /* We may also get err == DB_ERROR if the .ibd file for the diff --git a/storage/innobase/row/row0sel.c b/storage/innobase/row/row0sel.c index 20d45c1884d..0d1d3aad1c6 100644 --- a/storage/innobase/row/row0sel.c +++ b/storage/innobase/row/row0sel.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, Google Inc. Portions of this file contain modifications contributed and copyrighted by @@ -2963,6 +2963,7 @@ row_sel_get_clust_rec_for_mysql( fputs("\n" "InnoDB: Submit a detailed bug report" " to http://bugs.mysql.com\n", stderr); + ut_ad(0); } clust_rec = NULL; diff --git a/storage/innobase/row/row0umod.c b/storage/innobase/row/row0umod.c index b86ce9eeabd..9597c476125 100644 --- a/storage/innobase/row/row0umod.c +++ b/storage/innobase/row/row0umod.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1997, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1997, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -509,6 +509,7 @@ row_undo_mod_del_unmark_sec_and_undo_update( fputs("\n" "InnoDB: Submit a detailed bug report" " to http://bugs.mysql.com\n", stderr); + ut_ad(0); break; case ROW_FOUND: btr_cur = btr_pcur_get_btr_cur(&pcur); diff --git a/storage/innobase/row/row0upd.c b/storage/innobase/row/row0upd.c index 0c6036fe218..c57b829a1ca 100644 --- a/storage/innobase/row/row0upd.c +++ b/storage/innobase/row/row0upd.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2010, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1617,6 +1617,7 @@ row_upd_sec_index_entry( fputs("\n" "InnoDB: Submit a detailed bug report" " to http://bugs.mysql.com\n", stderr); + ut_ad(0); break; case ROW_FOUND: /* Delete mark the old index record; it can already be diff --git a/storage/innobase/srv/srv0srv.c b/storage/innobase/srv/srv0srv.c index c7427abdddd..bda086f4778 100644 --- a/storage/innobase/srv/srv0srv.c +++ b/storage/innobase/srv/srv0srv.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1995, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved. Copyright (c) 2008, 2009 Google Inc. Copyright (c) 2009, Percona Inc. @@ -2415,6 +2415,7 @@ loop: "InnoDB: Please submit a bug report" " to http://bugs.mysql.com\n", old_lsn, new_lsn); + ut_ad(0); } old_lsn = new_lsn; diff --git a/storage/innobase/trx/trx0purge.c b/storage/innobase/trx/trx0purge.c index 02ec9f1c072..2370d3deab0 100644 --- a/storage/innobase/trx/trx0purge.c +++ b/storage/innobase/trx/trx0purge.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2011, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -730,6 +730,7 @@ trx_purge_rseg_get_next_history_log( "InnoDB: report, and submit it" " to http://bugs.mysql.com\n", (ulong) trx_sys->rseg_history_len); + ut_ad(0); } mutex_exit(&kernel_mutex); diff --git a/storage/innobase/trx/trx0rec.c b/storage/innobase/trx/trx0rec.c index 0bf41780fcc..786c7be36a4 100644 --- a/storage/innobase/trx/trx0rec.c +++ b/storage/innobase/trx/trx0rec.c @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2011, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software @@ -1003,6 +1003,7 @@ trx_undo_update_rec_get_update( fprintf(stderr, "\n" "InnoDB: n_fields = %lu, i = %lu, ptr %p\n", (ulong) n_fields, (ulong) i, ptr); + ut_ad(0); *upd = NULL; return(NULL); } @@ -1513,6 +1514,7 @@ trx_undo_prev_version_build( "InnoDB: record version ", stderr); rec_print_new(stderr, rec, offsets); putc('\n', stderr); + ut_ad(0); return(DB_ERROR); } @@ -1618,6 +1620,7 @@ trx_undo_prev_version_build( (ullint) old_roll_ptr, (ullint) roll_ptr); trx_purge_sys_print(); + ut_ad(0); return(DB_ERROR); } diff --git a/storage/innobase/trx/trx0sys.c b/storage/innobase/trx/trx0sys.c index da9075816f7..c0283448d10 100644 --- a/storage/innobase/trx/trx0sys.c +++ b/storage/innobase/trx/trx0sys.c @@ -134,6 +134,11 @@ UNIV_INTERN mysql_pfs_key_t trx_doublewrite_mutex_key; UNIV_INTERN mysql_pfs_key_t file_format_max_mutex_key; #endif /* UNIV_PFS_MUTEX */ +#ifdef UNIV_DEBUG +/* Flag to control TRX_RSEG_N_SLOTS behavior debugging. */ +uint trx_rseg_n_slots_debug = 0; +#endif + #ifndef UNIV_HOTBACKUP /** This is used to track the maximum file format id known to InnoDB. It's updated via SET GLOBAL innodb_file_format_max = 'x' or when we open diff --git a/storage/sphinx/ha_sphinx.cc b/storage/sphinx/ha_sphinx.cc index 0121d4335be..0a33a393b7a 100644 --- a/storage/sphinx/ha_sphinx.cc +++ b/storage/sphinx/ha_sphinx.cc @@ -703,7 +703,7 @@ static int sphinx_init_func ( void * p ) #if MYSQL_VERSION_ID > 50100 handlerton * hton = (handlerton*) p; hton->state = SHOW_OPTION_YES; - hton->db_type = DB_TYPE_FIRST_DYNAMIC; + hton->db_type = DB_TYPE_AUTOASSIGN; hton->create = sphinx_create_handler; hton->close_connection = sphinx_close_connection; hton->show_status = sphinx_show_status; |