Bug 16876388 - PLEASE BACKPORT BUG#16208542 TO 5.5
Straight forward backport. Approved by Jimmy, rb#2656
This commit is contained in:
parent
b31a7ebe2f
commit
7b66df16a1
@ -378,7 +378,7 @@ dict_create_sys_indexes_tuple(
|
||||
|
||||
sys_indexes = dict_sys->sys_indexes;
|
||||
|
||||
table = dict_table_get_low(index->table_name);
|
||||
table = dict_table_get_low(index->table_name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
entry = dtuple_create(heap, 7 + DATA_N_SYS_COLS);
|
||||
|
||||
@ -580,7 +580,7 @@ dict_build_index_def_step(
|
||||
|
||||
index = node->index;
|
||||
|
||||
table = dict_table_get_low(index->table_name);
|
||||
table = dict_table_get_low(index->table_name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (table == NULL) {
|
||||
return(DB_TABLE_NOT_FOUND);
|
||||
@ -1215,8 +1215,8 @@ dict_create_or_check_foreign_constraint_tables(void)
|
||||
|
||||
mutex_enter(&(dict_sys->mutex));
|
||||
|
||||
table1 = dict_table_get_low("SYS_FOREIGN");
|
||||
table2 = dict_table_get_low("SYS_FOREIGN_COLS");
|
||||
table1 = dict_table_get_low("SYS_FOREIGN", DICT_ERR_IGNORE_NONE);
|
||||
table2 = dict_table_get_low("SYS_FOREIGN_COLS", DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (table1 && table2
|
||||
&& UT_LIST_GET_LEN(table1->indexes) == 3
|
||||
@ -1546,7 +1546,7 @@ dict_create_add_foreigns_to_dictionary(
|
||||
|
||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||
|
||||
if (NULL == dict_table_get_low("SYS_FOREIGN")) {
|
||||
if (NULL == dict_table_get_low("SYS_FOREIGN", DICT_ERR_IGNORE_NONE)) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: table SYS_FOREIGN not found"
|
||||
" in internal data dictionary\n");
|
||||
|
@ -752,15 +752,18 @@ UNIV_INTERN
|
||||
dict_table_t*
|
||||
dict_table_get(
|
||||
/*===========*/
|
||||
const char* table_name, /*!< in: table name */
|
||||
ibool inc_mysql_count)/*!< in: whether to increment the open
|
||||
handle count on the table */
|
||||
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 */
|
||||
{
|
||||
dict_table_t* table;
|
||||
|
||||
mutex_enter(&(dict_sys->mutex));
|
||||
|
||||
table = dict_table_get_low(table_name);
|
||||
table = dict_table_get_low(table_name, ignore_err);
|
||||
|
||||
if (inc_mysql_count && table) {
|
||||
table->n_mysql_handles_opened++;
|
||||
@ -2752,9 +2755,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 */
|
||||
{
|
||||
dict_table_t* for_table;
|
||||
dict_table_t* ref_table;
|
||||
@ -2794,7 +2799,8 @@ dict_foreign_add_to_cache(
|
||||
for_in_cache->n_fields, for_in_cache->foreign_index,
|
||||
check_charsets, FALSE);
|
||||
|
||||
if (index == NULL) {
|
||||
if (index == NULL
|
||||
&& !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) {
|
||||
dict_foreign_error_report(
|
||||
ef, for_in_cache,
|
||||
"there is no index in referenced table"
|
||||
@ -2829,7 +2835,8 @@ dict_foreign_add_to_cache(
|
||||
& (DICT_FOREIGN_ON_DELETE_SET_NULL
|
||||
| DICT_FOREIGN_ON_UPDATE_SET_NULL));
|
||||
|
||||
if (index == NULL) {
|
||||
if (index == NULL
|
||||
&& !(ignore_err & DICT_ERR_IGNORE_FK_NOKEY)) {
|
||||
dict_foreign_error_report(
|
||||
ef, for_in_cache,
|
||||
"there is no index in the table"
|
||||
@ -3218,7 +3225,7 @@ dict_scan_table_name(
|
||||
2 = Store as given, compare in lower; case semi-sensitive */
|
||||
if (innobase_get_lower_case_table_names() == 2) {
|
||||
innobase_casedn_str(ref);
|
||||
*table = dict_table_get_low(ref);
|
||||
*table = dict_table_get_low(ref, DICT_ERR_IGNORE_NONE);
|
||||
memcpy(ref, database_name, database_name_len);
|
||||
ref[database_name_len] = '/';
|
||||
memcpy(ref + database_name_len + 1, table_name, table_name_len + 1);
|
||||
@ -3231,7 +3238,7 @@ dict_scan_table_name(
|
||||
#else
|
||||
innobase_casedn_str(ref);
|
||||
#endif /* !__WIN__ */
|
||||
*table = dict_table_get_low(ref);
|
||||
*table = dict_table_get_low(ref, DICT_ERR_IGNORE_NONE);
|
||||
}
|
||||
|
||||
*success = TRUE;
|
||||
@ -3499,7 +3506,7 @@ dict_create_foreign_constraints_low(
|
||||
|
||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||
|
||||
table = dict_table_get_low(name);
|
||||
table = dict_table_get_low(name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (table == NULL) {
|
||||
mutex_enter(&dict_foreign_err_mutex);
|
||||
@ -4642,7 +4649,7 @@ dict_table_print_by_name(
|
||||
|
||||
mutex_enter(&(dict_sys->mutex));
|
||||
|
||||
table = dict_table_get_low(name);
|
||||
table = dict_table_get_low(name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
ut_a(table);
|
||||
|
||||
|
@ -103,7 +103,7 @@ dict_get_first_table_name_in_db(
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
sys_tables = dict_table_get_low("SYS_TABLES");
|
||||
sys_tables = dict_table_get_low("SYS_TABLES", DICT_ERR_IGNORE_NONE);
|
||||
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
|
||||
ut_a(!dict_table_is_comp(sys_tables));
|
||||
|
||||
@ -269,7 +269,8 @@ dict_startscan_system(
|
||||
|
||||
ut_a(system_id < SYS_NUM_SYSTEM_TABLES);
|
||||
|
||||
system_table = dict_table_get_low(SYSTEM_TABLE_NAME[system_id]);
|
||||
system_table = dict_table_get_low(SYSTEM_TABLE_NAME[system_id],
|
||||
DICT_ERR_IGNORE_NONE);
|
||||
|
||||
clust_index = UT_LIST_GET_FIRST(system_table->indexes);
|
||||
|
||||
@ -334,7 +335,7 @@ dict_process_sys_tables_rec(
|
||||
/* If DICT_TABLE_LOAD_FROM_CACHE is set, first check
|
||||
whether there is cached dict_table_t struct first */
|
||||
if (status & DICT_TABLE_LOAD_FROM_CACHE) {
|
||||
*table = dict_table_get_low(table_name);
|
||||
*table = dict_table_get_low(table_name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (!(*table)) {
|
||||
err_msg = "Table not found in cache";
|
||||
@ -675,7 +676,7 @@ dict_check_tablespaces_and_store_max_id(
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
sys_tables = dict_table_get_low("SYS_TABLES");
|
||||
sys_tables = dict_table_get_low("SYS_TABLES", DICT_ERR_IGNORE_NONE);
|
||||
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
|
||||
ut_a(!dict_table_is_comp(sys_tables));
|
||||
|
||||
@ -958,7 +959,7 @@ dict_load_columns(
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
sys_columns = dict_table_get_low("SYS_COLUMNS");
|
||||
sys_columns = dict_table_get_low("SYS_COLUMNS", DICT_ERR_IGNORE_NONE);
|
||||
sys_index = UT_LIST_GET_FIRST(sys_columns->indexes);
|
||||
ut_a(!dict_table_is_comp(sys_columns));
|
||||
|
||||
@ -1165,7 +1166,7 @@ dict_load_fields(
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
sys_fields = dict_table_get_low("SYS_FIELDS");
|
||||
sys_fields = dict_table_get_low("SYS_FIELDS", DICT_ERR_IGNORE_NONE);
|
||||
sys_index = UT_LIST_GET_FIRST(sys_fields->indexes);
|
||||
ut_a(!dict_table_is_comp(sys_fields));
|
||||
ut_a(name_of_col_is(sys_fields, sys_index, 4, "COL_NAME"));
|
||||
@ -1392,7 +1393,7 @@ dict_load_indexes(
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
sys_indexes = dict_table_get_low("SYS_INDEXES");
|
||||
sys_indexes = dict_table_get_low("SYS_INDEXES", DICT_ERR_IGNORE_NONE);
|
||||
sys_index = UT_LIST_GET_FIRST(sys_indexes->indexes);
|
||||
ut_a(!dict_table_is_comp(sys_indexes));
|
||||
ut_a(name_of_col_is(sys_indexes, sys_index, 4, "NAME"));
|
||||
@ -1764,7 +1765,7 @@ dict_load_table(
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
sys_tables = dict_table_get_low("SYS_TABLES");
|
||||
sys_tables = dict_table_get_low("SYS_TABLES", DICT_ERR_IGNORE_NONE);
|
||||
sys_index = UT_LIST_GET_FIRST(sys_tables->indexes);
|
||||
ut_a(!dict_table_is_comp(sys_tables));
|
||||
ut_a(name_of_col_is(sys_tables, sys_index, 3, "ID"));
|
||||
@ -1893,9 +1894,16 @@ err_exit:
|
||||
all indexes were loaded. */
|
||||
if (!cached) {
|
||||
} else if (err == DB_SUCCESS) {
|
||||
err = dict_load_foreigns(table->name, TRUE, TRUE);
|
||||
err = dict_load_foreigns(table->name, TRUE, TRUE,
|
||||
ignore_err);
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
fprintf(stderr,
|
||||
"InnoDB: Load table '%s' failed, the table "
|
||||
"has missing foreign key indexes. Turn off "
|
||||
"'foreign_key_checks' and try again.",
|
||||
table->name);
|
||||
|
||||
dict_table_remove_from_cache(table);
|
||||
table = NULL;
|
||||
} else {
|
||||
@ -2093,7 +2101,8 @@ dict_load_foreign_cols(
|
||||
foreign->heap, foreign->n_fields * sizeof(void*));
|
||||
mtr_start(&mtr);
|
||||
|
||||
sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS");
|
||||
sys_foreign_cols = dict_table_get_low("SYS_FOREIGN_COLS",
|
||||
DICT_ERR_IGNORE_NONE);
|
||||
sys_index = UT_LIST_GET_FIRST(sys_foreign_cols->indexes);
|
||||
ut_a(!dict_table_is_comp(sys_foreign_cols));
|
||||
|
||||
@ -2142,15 +2151,19 @@ static
|
||||
ulint
|
||||
dict_load_foreign(
|
||||
/*==============*/
|
||||
const char* id, /*!< in: foreign constraint id, not
|
||||
const char* id,
|
||||
/*!< in: foreign constraint id, not
|
||||
necessary '\0'-terminated */
|
||||
ulint id_len, /*!< in: id length */
|
||||
ibool check_charsets,
|
||||
ulint id_len,
|
||||
/*!< in: id length */
|
||||
ibool check_charsets,
|
||||
/*!< in: TRUE=check charset compatibility */
|
||||
ibool check_recursive)
|
||||
ibool check_recursive,
|
||||
/*!< in: Whether to record the foreign table
|
||||
parent count to avoid unlimited recursive
|
||||
load of chained foreign tables */
|
||||
dict_err_ignore_t ignore_err)
|
||||
/*!< in: error to be ignored */
|
||||
{
|
||||
dict_foreign_t* foreign;
|
||||
dict_table_t* sys_foreign;
|
||||
@ -2173,7 +2186,7 @@ dict_load_foreign(
|
||||
|
||||
mtr_start(&mtr);
|
||||
|
||||
sys_foreign = dict_table_get_low("SYS_FOREIGN");
|
||||
sys_foreign = dict_table_get_low("SYS_FOREIGN", DICT_ERR_IGNORE_NONE);
|
||||
sys_index = UT_LIST_GET_FIRST(sys_foreign->indexes);
|
||||
ut_a(!dict_table_is_comp(sys_foreign));
|
||||
|
||||
@ -2287,7 +2300,9 @@ dict_load_foreign(
|
||||
have to load it so that we are able to make type comparisons
|
||||
in the next function call. */
|
||||
|
||||
for_table = dict_table_get_low(foreign->foreign_table_name_lookup);
|
||||
for_table = dict_table_get_low(
|
||||
foreign->foreign_table_name_lookup,
|
||||
DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (for_table && ref_table && check_recursive) {
|
||||
/* This is to record the longest chain of ancesters
|
||||
@ -2310,7 +2325,7 @@ dict_load_foreign(
|
||||
a new foreign key constraint but loading one from the data
|
||||
dictionary. */
|
||||
|
||||
return(dict_foreign_add_to_cache(foreign, check_charsets));
|
||||
return(dict_foreign_add_to_cache(foreign, check_charsets, ignore_err));
|
||||
}
|
||||
|
||||
/***********************************************************************//**
|
||||
@ -2324,11 +2339,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 charset
|
||||
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 charset
|
||||
compatibility */
|
||||
dict_err_ignore_t ignore_err) /*!< in: error to be ignored */
|
||||
{
|
||||
ulint tuple_buf[(DTUPLE_EST_ALLOC(1) + sizeof(ulint) - 1)
|
||||
/ sizeof(ulint)];
|
||||
@ -2345,7 +2362,7 @@ dict_load_foreigns(
|
||||
|
||||
ut_ad(mutex_own(&(dict_sys->mutex)));
|
||||
|
||||
sys_foreign = dict_table_get_low("SYS_FOREIGN");
|
||||
sys_foreign = dict_table_get_low("SYS_FOREIGN", DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (sys_foreign == NULL) {
|
||||
/* No foreign keys defined yet in this database */
|
||||
@ -2429,7 +2446,7 @@ loop:
|
||||
/* Load the foreign constraint definition to the dictionary cache */
|
||||
|
||||
err = dict_load_foreign((char*) field, len, check_charsets,
|
||||
check_recursive);
|
||||
check_recursive, ignore_err);
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
btr_pcur_close(&pcur);
|
||||
|
@ -3795,16 +3795,17 @@ UNIV_INTERN
|
||||
int
|
||||
ha_innobase::open(
|
||||
/*==============*/
|
||||
const char* name, /*!< in: table name */
|
||||
int mode, /*!< in: not used */
|
||||
uint test_if_locked) /*!< in: not used */
|
||||
const char* name, /*!< in: table name */
|
||||
int mode, /*!< in: not used */
|
||||
uint test_if_locked) /*!< in: not used */
|
||||
{
|
||||
dict_table_t* ib_table;
|
||||
char norm_name[1000];
|
||||
THD* thd;
|
||||
char* is_part = NULL;
|
||||
ibool par_case_name_set = FALSE;
|
||||
char par_case_name[MAX_FULL_NAME_LEN + 1];
|
||||
dict_table_t* ib_table;
|
||||
char norm_name[1000];
|
||||
THD* thd;
|
||||
char* is_part = NULL;
|
||||
ibool par_case_name_set = FALSE;
|
||||
char par_case_name[MAX_FULL_NAME_LEN + 1];
|
||||
dict_err_ignore_t ignore_err = DICT_ERR_IGNORE_NONE;
|
||||
|
||||
DBUG_ENTER("ha_innobase::open");
|
||||
|
||||
@ -3841,8 +3842,15 @@ ha_innobase::open(
|
||||
is_part = strstr(norm_name, "#P#");
|
||||
#endif /* __WIN__ */
|
||||
|
||||
/* Check whether FOREIGN_KEY_CHECKS is set to 0. If so, the table
|
||||
can be opened even if some FK indexes are missing. If not, the table
|
||||
can't be opened in the same situation */
|
||||
if (thd_test_options(thd, OPTION_NO_FOREIGN_KEY_CHECKS)) {
|
||||
ignore_err = DICT_ERR_IGNORE_FK_NOKEY;
|
||||
}
|
||||
|
||||
/* Get pointer to a table object in InnoDB dictionary cache */
|
||||
ib_table = dict_table_get(norm_name, TRUE);
|
||||
ib_table = dict_table_get(norm_name, TRUE, ignore_err);
|
||||
|
||||
if (NULL == ib_table) {
|
||||
if (is_part) {
|
||||
@ -3886,7 +3894,7 @@ ha_innobase::open(
|
||||
}
|
||||
|
||||
ib_table = dict_table_get(
|
||||
par_case_name, FALSE);
|
||||
par_case_name, FALSE, ignore_err);
|
||||
}
|
||||
if (ib_table) {
|
||||
#ifndef __WIN__
|
||||
@ -7301,7 +7309,8 @@ ha_innobase::create(
|
||||
|
||||
log_buffer_flush_to_disk();
|
||||
|
||||
innobase_table = dict_table_get(norm_name, FALSE);
|
||||
innobase_table = dict_table_get(norm_name, FALSE,
|
||||
DICT_ERR_IGNORE_NONE);
|
||||
|
||||
DBUG_ASSERT(innobase_table != 0);
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 2005, 2012, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 2005, 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
|
||||
@ -702,7 +702,8 @@ ha_innobase::add_index(
|
||||
DBUG_RETURN(-1);
|
||||
}
|
||||
|
||||
indexed_table = dict_table_get(prebuilt->table->name, FALSE);
|
||||
indexed_table = dict_table_get(prebuilt->table->name, FALSE,
|
||||
DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (UNIV_UNLIKELY(!indexed_table)) {
|
||||
DBUG_RETURN(HA_ERR_NO_SUCH_TABLE);
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
@ -816,12 +816,13 @@ dict_table_check_if_in_cache_low(
|
||||
}
|
||||
|
||||
/**********************************************************************//**
|
||||
load a table into dictionary cache, ignore any error specified during load;
|
||||
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_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
|
||||
@ -834,33 +835,8 @@ dict_table_get_low_ignore_err(
|
||||
|
||||
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.
|
||||
@return table, NULL if not found */
|
||||
UNIV_INLINE
|
||||
dict_table_t*
|
||||
dict_table_get_low(
|
||||
/*===============*/
|
||||
const char* table_name) /*!< in: table name */
|
||||
{
|
||||
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 && 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);
|
||||
|
@ -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. */
|
||||
|
@ -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 */
|
||||
};
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1996, 2010, 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
|
||||
@ -569,7 +569,7 @@ pars_retrieve_table_def(
|
||||
|
||||
table_name = (const char*) sym_node->name;
|
||||
|
||||
sym_node->table = dict_table_get_low(table_name);
|
||||
sym_node->table = dict_table_get_low(table_name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
ut_a(sym_node->table);
|
||||
}
|
||||
|
@ -1537,7 +1537,8 @@ row_ins_check_foreign_constraints(
|
||||
|
||||
if (foreign->referenced_table == NULL) {
|
||||
dict_table_get(foreign->referenced_table_name_lookup,
|
||||
FALSE);
|
||||
FALSE,
|
||||
DICT_ERR_IGNORE_NONE);
|
||||
}
|
||||
|
||||
if (0 == trx->dict_operation_lock_mode) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
/*****************************************************************************
|
||||
|
||||
Copyright (c) 1995, 2012, Oracle and/or its affiliates. All Rights Reserved.
|
||||
Copyright (c) 1995, 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
|
||||
@ -2553,7 +2553,7 @@ row_merge_rename_tables(
|
||||
goto err_exit;
|
||||
}
|
||||
|
||||
err = dict_load_foreigns(old_name, FALSE, TRUE);
|
||||
err = dict_load_foreigns(old_name, FALSE, TRUE, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
err_exit:
|
||||
|
@ -1985,7 +1985,7 @@ err_exit:
|
||||
ut_print_name(stderr, trx, TRUE, table->name);
|
||||
fputs(" because tablespace full\n", stderr);
|
||||
|
||||
if (dict_table_get_low(table->name)) {
|
||||
if (dict_table_get_low(table->name, DICT_ERR_IGNORE_NONE)) {
|
||||
|
||||
row_drop_table_for_mysql(table->name, trx, FALSE);
|
||||
trx_commit_for_mysql(trx);
|
||||
@ -2067,7 +2067,7 @@ row_create_index_for_mysql(
|
||||
que_run_threads()) and thus index->table_name is not available. */
|
||||
table_name = mem_strdup(index->table_name);
|
||||
|
||||
table = dict_table_get_low(table_name);
|
||||
table = dict_table_get_low(table_name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
trx_start_if_not_started(trx);
|
||||
|
||||
@ -2176,7 +2176,8 @@ row_table_add_foreign_constraints(
|
||||
name, reject_fks);
|
||||
if (err == DB_SUCCESS) {
|
||||
/* Check that also referencing constraints are ok */
|
||||
err = dict_load_foreigns(name, FALSE, TRUE);
|
||||
err = dict_load_foreigns(name, FALSE, TRUE,
|
||||
DICT_ERR_IGNORE_NONE);
|
||||
}
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
@ -2278,7 +2279,7 @@ loop:
|
||||
}
|
||||
|
||||
mutex_enter(&(dict_sys->mutex));
|
||||
table = dict_table_get_low(drop->table_name);
|
||||
table = dict_table_get_low(drop->table_name, DICT_ERR_IGNORE_NONE);
|
||||
mutex_exit(&(dict_sys->mutex));
|
||||
|
||||
if (table == NULL) {
|
||||
@ -2446,7 +2447,7 @@ row_discard_tablespace_for_mysql(
|
||||
|
||||
row_mysql_lock_data_dictionary(trx);
|
||||
|
||||
table = dict_table_get_low(name);
|
||||
table = dict_table_get_low(name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (!table) {
|
||||
err = DB_TABLE_NOT_FOUND;
|
||||
@ -2636,7 +2637,7 @@ row_import_tablespace_for_mysql(
|
||||
|
||||
row_mysql_lock_data_dictionary(trx);
|
||||
|
||||
table = dict_table_get_low(name);
|
||||
table = dict_table_get_low(name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (!table) {
|
||||
ut_print_timestamp(stderr);
|
||||
@ -3157,7 +3158,7 @@ row_drop_table_for_mysql(
|
||||
ut_ad(rw_lock_own(&dict_operation_lock, RW_LOCK_EX));
|
||||
#endif /* UNIV_SYNC_DEBUG */
|
||||
|
||||
table = dict_table_get_low_ignore_err(
|
||||
table = dict_table_get_low(
|
||||
name, DICT_ERR_IGNORE_INDEX_ROOT | DICT_ERR_IGNORE_CORRUPT);
|
||||
|
||||
if (!table) {
|
||||
@ -3677,7 +3678,7 @@ loop:
|
||||
while ((table_name = dict_get_first_table_name_in_db(name))) {
|
||||
ut_a(memcmp(table_name, name, namelen) == 0);
|
||||
|
||||
table = dict_table_get_low(table_name);
|
||||
table = dict_table_get_low(table_name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
ut_a(table);
|
||||
|
||||
@ -3866,7 +3867,7 @@ row_rename_table_for_mysql(
|
||||
old_is_tmp = row_is_mysql_tmp_table_name(old_name);
|
||||
new_is_tmp = row_is_mysql_tmp_table_name(new_name);
|
||||
|
||||
table = dict_table_get_low(old_name);
|
||||
table = dict_table_get_low(old_name, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (!table) {
|
||||
err = DB_TABLE_NOT_FOUND;
|
||||
@ -4121,7 +4122,8 @@ end:
|
||||
an ALTER, not in a RENAME. */
|
||||
|
||||
err = dict_load_foreigns(
|
||||
new_name, FALSE, !old_is_tmp || trx->check_foreigns);
|
||||
new_name, FALSE, !old_is_tmp || trx->check_foreigns,
|
||||
DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (err != DB_SUCCESS) {
|
||||
ut_print_timestamp(stderr);
|
||||
|
@ -4788,7 +4788,7 @@ row_search_check_if_query_cache_permitted(
|
||||
dict_table_t* table;
|
||||
ibool ret = FALSE;
|
||||
|
||||
table = dict_table_get(norm_name, FALSE);
|
||||
table = dict_table_get(norm_name, FALSE, DICT_ERR_IGNORE_NONE);
|
||||
|
||||
if (table == NULL) {
|
||||
|
||||
|
@ -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
|
||||
@ -241,7 +241,8 @@ row_upd_check_references_constraints(
|
||||
|
||||
if (foreign->foreign_table == NULL) {
|
||||
dict_table_get(foreign->foreign_table_name_lookup,
|
||||
FALSE);
|
||||
FALSE,
|
||||
DICT_ERR_IGNORE_NONE);
|
||||
}
|
||||
|
||||
if (foreign->foreign_table) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user