1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

BUG#12427262 : 60961: SHOW TABLES VERY SLOW WHEN NOT IN SYSTEM DISK CACHE

Details:
- Merge : 5.1 -> 5.5
- Addded a new test case which was not added in 5.1 because PS was
  not there in 5.1.
This commit is contained in:
Mayank Prasad
2012-04-19 15:59:46 +05:30
3 changed files with 138 additions and 31 deletions

View File

@ -3192,39 +3192,44 @@ end:
static int fill_schema_table_names(THD *thd, TABLE *table,
LEX_STRING *db_name, LEX_STRING *table_name,
bool with_i_schema)
bool with_i_schema,
bool need_table_type)
{
if (with_i_schema)
/* Avoid opening FRM files if table type is not needed. */
if (need_table_type)
{
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"),
system_charset_info);
}
else
{
enum legacy_db_type not_used;
char path[FN_REFLEN + 1];
(void) build_table_filename(path, sizeof(path) - 1, db_name->str,
table_name->str, reg_ext, 0);
switch (dd_frm_type(thd, path, &not_used)) {
case FRMTYPE_ERROR:
table->field[3]->store(STRING_WITH_LEN("ERROR"),
system_charset_info);
break;
case FRMTYPE_TABLE:
table->field[3]->store(STRING_WITH_LEN("BASE TABLE"),
system_charset_info);
break;
case FRMTYPE_VIEW:
table->field[3]->store(STRING_WITH_LEN("VIEW"),
system_charset_info);
break;
default:
DBUG_ASSERT(0);
}
if (thd->is_error() && thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
if (with_i_schema)
{
thd->clear_error();
return 0;
table->field[3]->store(STRING_WITH_LEN("SYSTEM VIEW"),
system_charset_info);
}
else
{
enum legacy_db_type not_used;
char path[FN_REFLEN + 1];
(void) build_table_filename(path, sizeof(path) - 1, db_name->str,
table_name->str, reg_ext, 0);
switch (dd_frm_type(thd, path, &not_used)) {
case FRMTYPE_ERROR:
table->field[3]->store(STRING_WITH_LEN("ERROR"),
system_charset_info);
break;
case FRMTYPE_TABLE:
table->field[3]->store(STRING_WITH_LEN("BASE TABLE"),
system_charset_info);
break;
case FRMTYPE_VIEW:
table->field[3]->store(STRING_WITH_LEN("VIEW"),
system_charset_info);
break;
default:
DBUG_ASSERT(0);
}
if (thd->is_error() && thd->stmt_da->sql_errno() == ER_NO_SUCH_TABLE)
{
thd->clear_error();
return 0;
}
}
}
if (schema_table_store_record(thd, table))
@ -3763,7 +3768,8 @@ int get_all_tables(THD *thd, TABLE_LIST *tables, COND *cond)
if (schema_table_idx == SCH_TABLE_NAMES)
{
if (fill_schema_table_names(thd, tables->table, db_name,
table_name, with_i_schema))
table_name, with_i_schema,
lex->verbose))
continue;
}
else