From 7b66df16a1ca00084ee6336aaf50d32f914e625c Mon Sep 17 00:00:00 2001 From: "bin.x.su@oracle.com" <> Date: Tue, 25 Jun 2013 09:42:54 +0800 Subject: Bug 16876388 - PLEASE BACKPORT BUG#16208542 TO 5.5 Straight forward backport. Approved by Jimmy, rb#2656 --- storage/innobase/include/dict0dict.h | 29 ++++++++++++------------- storage/innobase/include/dict0dict.ic | 40 +++++++---------------------------- storage/innobase/include/dict0load.h | 14 ++++++------ storage/innobase/include/dict0types.h | 2 ++ 4 files changed, 31 insertions(+), 54 deletions(-) (limited to 'storage/innobase/include') diff --git a/storage/innobase/include/dict0dict.h b/storage/innobase/include/dict0dict.h index 7b55a59ea19..deabbfcbe92 100644 --- a/storage/innobase/include/dict0dict.h +++ b/storage/innobase/include/dict0dict.h @@ -328,9 +328,11 @@ UNIV_INTERN ulint dict_foreign_add_to_cache( /*======================*/ - dict_foreign_t* foreign, /*!< in, own: foreign key constraint */ - ibool check_charsets);/*!< in: TRUE=check charset - compatibility */ + dict_foreign_t* foreign, /*!< in, own: foreign key + constraint */ + ibool check_charsets, /*!< in: TRUE=check charset + compatibility */ + dict_err_ignore_t ignore_err); /*!< in: error to be ignored */ /*********************************************************************//** Check if the index is referenced by a foreign key, if TRUE return the matching instance NULL otherwise. @@ -426,10 +428,14 @@ UNIV_INTERN dict_table_t* dict_table_get( /*===========*/ - const char* table_name, /*!< in: table name */ - ibool inc_mysql_count); + const char* table_name, + /*!< in: table name */ + ibool inc_mysql_count, /*!< in: whether to increment the open handle count on the table */ + dict_err_ignore_t ignore_err); + /*!< in: errors to ignore when loading + the table */ /**********************************************************************//** Returns a index object, based on table and index id, and memoryfixes it. @return index, NULL if does not exist */ @@ -454,22 +460,13 @@ function. @return table, NULL if not found */ UNIV_INLINE dict_table_t* -dict_table_get_low_ignore_err( -/*===========================*/ +dict_table_get_low( +/*===============*/ const char* table_name, /*!< in: table name */ dict_err_ignore_t ignore_err); /*!< in: error to be ignored when loading a table definition */ /**********************************************************************//** -Gets a table; loads it to the dictionary cache if necessary. A low-level -function. -@return table, NULL if not found */ -UNIV_INLINE -dict_table_t* -dict_table_get_low( -/*===============*/ - const char* table_name); /*!< in: table name */ -/**********************************************************************//** Returns a table object based on table id. @return table, NULL if does not exist */ UNIV_INLINE diff --git a/storage/innobase/include/dict0dict.ic b/storage/innobase/include/dict0dict.ic index faa28959c59..9b0c9e5c001 100644 --- a/storage/innobase/include/dict0dict.ic +++ b/storage/innobase/include/dict0dict.ic @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2012, Oracle and/or its affiliates. All Rights Reserved. +Copyright (c) 1996, 2013, 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 @@ -815,34 +815,6 @@ dict_table_check_if_in_cache_low( return(table); } -/**********************************************************************//** -load a table into dictionary cache, ignore any error specified during load; -@return table, NULL if not found */ -UNIV_INLINE -dict_table_t* -dict_table_get_low_ignore_err( -/*==========================*/ - const char* table_name, /*!< in: table name */ - dict_err_ignore_t - ignore_err) /*!< in: error to be ignored when - loading a table definition */ -{ - dict_table_t* table; - - ut_ad(table_name); - ut_ad(mutex_own(&(dict_sys->mutex))); - - table = dict_table_check_if_in_cache_low(table_name); - - if (table == NULL) { - table = dict_load_table(table_name, TRUE, ignore_err); - } - - ut_ad(!table || table->cached); - - return(table); -} - /**********************************************************************//** Gets a table; loads it to the dictionary cache if necessary. A low-level function. @@ -851,7 +823,10 @@ UNIV_INLINE dict_table_t* dict_table_get_low( /*===============*/ - const char* table_name) /*!< in: table name */ + const char* table_name, /*!< in: table name */ + dict_err_ignore_t + ignore_err) /*!< in: error to be ignored when + loading a table definition */ { dict_table_t* table; @@ -860,7 +835,8 @@ dict_table_get_low( table = dict_table_check_if_in_cache_low(table_name); - if (table && table->corrupted) { + if (table && table->corrupted + && !(ignore_err & DICT_ERR_IGNORE_CORRUPT)) { fprintf(stderr, "InnoDB: table"); ut_print_name(stderr, NULL, TRUE, table->name); if (srv_load_corrupted) { @@ -873,7 +849,7 @@ dict_table_get_low( } if (table == NULL) { - table = dict_load_table(table_name, TRUE, DICT_ERR_IGNORE_NONE); + table = dict_load_table(table_name, TRUE, ignore_err); } ut_ad(!table || table->cached); diff --git a/storage/innobase/include/dict0load.h b/storage/innobase/include/dict0load.h index 654576d07d1..bdc6a2b995c 100644 --- a/storage/innobase/include/dict0load.h +++ b/storage/innobase/include/dict0load.h @@ -1,6 +1,6 @@ /***************************************************************************** -Copyright (c) 1996, 2009, Innobase Oy. All Rights Reserved. +Copyright (c) 1996, 2013, Innobase Oy. 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 @@ -207,11 +207,13 @@ UNIV_INTERN ulint dict_load_foreigns( /*===============*/ - const char* table_name, /*!< in: table name */ - ibool check_recursive,/*!< in: Whether to check recursive - load of tables chained by FK */ - ibool check_charsets);/*!< in: TRUE=check charsets - compatibility */ + const char* table_name, /*!< in: table name */ + ibool check_recursive,/*!< in: Whether to check + recursive load of tables + chained by FK */ + ibool check_charsets, /*!< in: TRUE=check charsets + compatibility */ + dict_err_ignore_t ignore_err); /*!< in: error to be ignored */ /********************************************************************//** Prints to the standard output information on all tables found in the data dictionary system table. */ diff --git a/storage/innobase/include/dict0types.h b/storage/innobase/include/dict0types.h index d9f1f564036..330e6a25114 100644 --- a/storage/innobase/include/dict0types.h +++ b/storage/innobase/include/dict0types.h @@ -53,6 +53,8 @@ enum dict_err_ignore { DICT_ERR_IGNORE_INDEX_ROOT = 1, /*!< ignore error if index root page is FIL_NULL or incorrect value */ DICT_ERR_IGNORE_CORRUPT = 2, /*!< skip corrupted indexes */ + DICT_ERR_IGNORE_FK_NOKEY = 4, /*!< ignore error if any foreign + key is missing */ DICT_ERR_IGNORE_ALL = 0xFFFF /*!< ignore all errors */ }; -- cgit v1.2.1