summaryrefslogtreecommitdiffstats
path: root/storage/innobase/handler/i_s.cc
diff options
context:
space:
mode:
Diffstat (limited to 'storage/innobase/handler/i_s.cc')
-rw-r--r--storage/innobase/handler/i_s.cc127
1 files changed, 99 insertions, 28 deletions
diff --git a/storage/innobase/handler/i_s.cc b/storage/innobase/handler/i_s.cc
index b00308d7..711144e3 100644
--- a/storage/innobase/handler/i_s.cc
+++ b/storage/innobase/handler/i_s.cc
@@ -4539,6 +4539,15 @@ i_s_dict_fill_sys_tables(
DBUG_RETURN(0);
}
+/** Handle the error for information schema query
+@param err error value
+@param thd thread
+@return 0 if query is interrupted or error */
+static int i_s_sys_error_handling(int err, THD *thd)
+{
+ return thd_kill_level(thd) ? 0 : err;
+}
+
/** Convert one SYS_TABLES record to dict_table_t.
@param pcur persistent cursor position on SYS_TABLES record
@param mtr mini-transaction (nullptr=use the dict_sys cache)
@@ -4587,6 +4596,7 @@ i_s_sys_tables_fill_table(
{
btr_pcur_t pcur;
mtr_t mtr;
+ int err = 0;
DBUG_ENTER("i_s_sys_tables_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
@@ -4616,8 +4626,15 @@ i_s_sys_tables_fill_table(
dict_sys.unlock();
if (!err_msg) {
- i_s_dict_fill_sys_tables(thd, table_rec,
- tables->table);
+ err = i_s_dict_fill_sys_tables(
+ thd, table_rec, tables->table);
+ if (err) {
+ err = i_s_sys_error_handling(err, thd);
+ if (table_rec) {
+ dict_mem_table_free(table_rec);
+ }
+ goto func_exit;
+ }
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
@@ -4635,8 +4652,10 @@ i_s_sys_tables_fill_table(
mtr.commit();
dict_sys.unlock();
+func_exit:
+ ut_free(pcur.old_rec_buf);
- DBUG_RETURN(0);
+ DBUG_RETURN(err);
}
/*******************************************************************//**
@@ -4807,6 +4826,7 @@ i_s_sys_tables_fill_table_stats(
btr_pcur_t pcur;
const rec_t* rec;
mtr_t mtr;
+ int err = 0;
DBUG_ENTER("i_s_sys_tables_fill_table_stats");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
@@ -4832,8 +4852,12 @@ i_s_sys_tables_fill_table_stats(
&table_rec);
if (UNIV_LIKELY(!err_msg)) {
- i_s_dict_fill_sys_tablestats(thd, table_rec,
+ err = i_s_dict_fill_sys_tablestats(thd, table_rec,
tables->table);
+ if (err) {
+ err = i_s_sys_error_handling(err, thd);
+ goto func_exit;
+ }
} else {
ut_ad(!table_rec);
dict_sys.unlock();
@@ -4851,8 +4875,9 @@ i_s_sys_tables_fill_table_stats(
mtr.commit();
dict_sys.unlock();
-
- DBUG_RETURN(0);
+func_exit:
+ ut_free(pcur.old_rec_buf);
+ DBUG_RETURN(err);
}
/*******************************************************************//**
@@ -5024,6 +5049,7 @@ i_s_sys_indexes_fill_table(
const rec_t* rec;
mem_heap_t* heap;
mtr_t mtr;
+ int err = 0;
DBUG_ENTER("i_s_sys_indexes_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
@@ -5059,11 +5085,13 @@ i_s_sys_indexes_fill_table(
dict_sys.unlock();
if (!err_msg) {
- if (int err = i_s_dict_fill_sys_indexes(
- thd, table_id, space_id, &index_rec,
- tables->table)) {
- mem_heap_free(heap);
- DBUG_RETURN(err);
+ err = i_s_dict_fill_sys_indexes(
+ thd, table_id, space_id,
+ &index_rec,
+ tables->table);
+ if (err) {
+ err = i_s_sys_error_handling(err, thd);
+ goto func_exit;
}
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
@@ -5081,9 +5109,11 @@ i_s_sys_indexes_fill_table(
mtr.commit();
dict_sys.unlock();
+func_exit:
mem_heap_free(heap);
+ ut_free(pcur.old_rec_buf);
- DBUG_RETURN(0);
+ DBUG_RETURN(err);
}
/*******************************************************************//**
Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_indexes
@@ -5232,6 +5262,7 @@ i_s_sys_columns_fill_table(
const char* col_name;
mem_heap_t* heap;
mtr_t mtr;
+ int err = 0;
DBUG_ENTER("i_s_sys_columns_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
@@ -5263,9 +5294,14 @@ i_s_sys_columns_fill_table(
dict_sys.unlock();
if (!err_msg) {
- i_s_dict_fill_sys_columns(thd, table_id, col_name,
- &column_rec, nth_v_col,
- tables->table);
+ err = i_s_dict_fill_sys_columns(
+ thd, table_id, col_name,
+ &column_rec, nth_v_col,
+ tables->table);
+ if (err) {
+ err = i_s_sys_error_handling(err, thd);
+ goto func_exit;
+ }
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
@@ -5282,9 +5318,11 @@ i_s_sys_columns_fill_table(
mtr.commit();
dict_sys.unlock();
+func_exit:
mem_heap_free(heap);
+ ut_free(pcur.old_rec_buf);
- DBUG_RETURN(0);
+ DBUG_RETURN(err);
}
/*******************************************************************//**
@@ -5416,6 +5454,7 @@ i_s_sys_virtual_fill_table(
ulint pos;
ulint base_pos;
mtr_t mtr;
+ int err = 0;
DBUG_ENTER("i_s_sys_virtual_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
@@ -5444,8 +5483,13 @@ i_s_sys_virtual_fill_table(
dict_sys.unlock();
if (!err_msg) {
- i_s_dict_fill_sys_virtual(thd, table_id, pos, base_pos,
- tables->table);
+ err = i_s_dict_fill_sys_virtual(
+ thd, table_id, pos, base_pos,
+ tables->table);
+ if (err) {
+ err = i_s_sys_error_handling(err, thd);
+ goto func_exit;
+ }
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
@@ -5462,6 +5506,9 @@ i_s_sys_virtual_fill_table(
dict_sys.unlock();
DBUG_RETURN(0);
+func_exit:
+ ut_free(pcur.old_rec_buf);
+ DBUG_RETURN(err);
}
/** Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_virtual
@@ -5589,6 +5636,7 @@ i_s_sys_fields_fill_table(
mem_heap_t* heap;
index_id_t last_id;
mtr_t mtr;
+ int err = 0;
DBUG_ENTER("i_s_sys_fields_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
@@ -5624,8 +5672,13 @@ i_s_sys_fields_fill_table(
dict_sys.unlock();
if (!err_msg) {
- i_s_dict_fill_sys_fields(thd, index_id, &field_rec,
- pos, tables->table);
+ err = i_s_dict_fill_sys_fields(
+ thd, index_id, &field_rec,
+ pos, tables->table);
+ if (err) {
+ err = i_s_sys_error_handling(err, thd);
+ goto func_exit;
+ }
last_id = index_id;
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
@@ -5643,9 +5696,11 @@ i_s_sys_fields_fill_table(
mtr.commit();
dict_sys.unlock();
+func_exit:
mem_heap_free(heap);
+ ut_free(pcur.old_rec_buf);
- DBUG_RETURN(0);
+ DBUG_RETURN(err);
}
/*******************************************************************//**
Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_fields
@@ -5782,6 +5837,7 @@ i_s_sys_foreign_fill_table(
const rec_t* rec;
mem_heap_t* heap;
mtr_t mtr;
+ int err = 0;
DBUG_ENTER("i_s_sys_foreign_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
@@ -5809,8 +5865,12 @@ i_s_sys_foreign_fill_table(
dict_sys.unlock();
if (!err_msg) {
- i_s_dict_fill_sys_foreign(thd, &foreign_rec,
- tables->table);
+ err = i_s_dict_fill_sys_foreign(
+ thd, &foreign_rec, tables->table);
+ if (err) {
+ err = i_s_sys_error_handling(err, thd);
+ goto func_exit;
+ }
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
@@ -5827,9 +5887,11 @@ i_s_sys_foreign_fill_table(
mtr.commit();
dict_sys.unlock();
+func_exit:
mem_heap_free(heap);
+ ut_free(pcur.old_rec_buf);
- DBUG_RETURN(0);
+ DBUG_RETURN(err);
}
/*******************************************************************//**
@@ -5963,6 +6025,7 @@ i_s_sys_foreign_cols_fill_table(
const rec_t* rec;
mem_heap_t* heap;
mtr_t mtr;
+ int err = 0;
DBUG_ENTER("i_s_sys_foreign_cols_fill_table");
RETURN_IF_INNODB_NOT_STARTED(tables->schema_table_name.str);
@@ -5994,9 +6057,13 @@ i_s_sys_foreign_cols_fill_table(
dict_sys.unlock();
if (!err_msg) {
- i_s_dict_fill_sys_foreign_cols(
- thd, name, for_col_name, ref_col_name, pos,
- tables->table);
+ err = i_s_dict_fill_sys_foreign_cols(
+ thd, name, for_col_name,
+ ref_col_name, pos, tables->table);
+ if (err) {
+ err = i_s_sys_error_handling(err, thd);
+ goto func_exit;
+ }
} else {
push_warning_printf(thd, Sql_condition::WARN_LEVEL_WARN,
ER_CANT_FIND_SYSTEM_REC, "%s",
@@ -6013,9 +6080,11 @@ i_s_sys_foreign_cols_fill_table(
mtr.commit();
dict_sys.unlock();
+func_exit:
mem_heap_free(heap);
+ ut_free(pcur.old_rec_buf);
- DBUG_RETURN(0);
+ DBUG_RETURN(err);
}
/*******************************************************************//**
Bind the dynamic table INFORMATION_SCHEMA.innodb_sys_foreign_cols
@@ -6218,6 +6287,8 @@ static int i_s_sys_tablespaces_fill_table(THD *thd, TABLE_LIST *tables, Item*)
mysql_mutex_unlock(&fil_system.mutex);
if (err == DB_SUCCESS)
err= i_s_sys_tablespaces_fill(thd, *fil_system.temp_space, tables->table);
+ else
+ err = i_s_sys_error_handling(err, thd);
DBUG_RETURN(err);
}