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

Simplify test if we can use table in query cache

- Added TABLE_SHARE->not_usable_by_query_cache
- Moved TABLE->no_replicate to TABLE_SHARE->no_replicate as it's same for
  all TABLE instances
- Renamed TABLE_SHARE->cached_row_logging_check to can_do_row_logging
This commit is contained in:
Michael Widenius
2017-06-18 09:58:13 +03:00
committed by Sergei Golubchik
parent 1ed605e490
commit 8bfda2f0af
8 changed files with 53 additions and 62 deletions

View File

@ -4050,41 +4050,35 @@ Query_cache::process_and_count_tables(THD *thd, TABLE_LIST *tables_used,
tables_used->view_name.str,
tables_used->view_db.str));
*tables_type|= HA_CACHE_TBL_NONTRANSACT;
continue;
}
else
if (tables_used->derived)
{
if (tables_used->derived)
{
DBUG_PRINT("qcache", ("table: %s", tables_used->alias));
table_count--;
DBUG_PRINT("qcache", ("derived table skipped"));
continue;
}
DBUG_PRINT("qcache", ("table: %s db: %s type: %u",
tables_used->table->s->table_name.str,
tables_used->table->s->db.str,
tables_used->table->s->db_type()->db_type));
*tables_type|= tables_used->table->file->table_cache_type();
DBUG_PRINT("qcache", ("table: %s", tables_used->alias));
table_count--;
DBUG_PRINT("qcache", ("derived table skipped"));
continue;
}
/*
table_alias_charset used here because it depends of
lower_case_table_names variable
*/
table_count+= tables_used->table->file->
count_query_cache_dependant_tables(tables_type);
DBUG_PRINT("qcache", ("table: %s db: %s type: %u",
tables_used->table->s->table_name.str,
tables_used->table->s->db.str,
tables_used->table->s->db_type()->db_type));
*tables_type|= tables_used->table->file->table_cache_type();
if (tables_used->table->s->tmp_table != NO_TMP_TABLE ||
(*tables_type & HA_CACHE_TBL_NOCACHE) ||
(tables_used->db_length == 5 &&
my_strnncoll(table_alias_charset,
(uchar*)tables_used->table->s->table_cache_key.str, 6,
(uchar*)"mysql",6) == 0))
{
DBUG_PRINT("qcache",
("select not cacheable: temporary, system or "
"other non-cacheable table(s)"));
DBUG_RETURN(0);
}
/*
table_alias_charset used here because it depends of
lower_case_table_names variable
*/
table_count+= tables_used->table->file->
count_query_cache_dependant_tables(tables_type);
if (tables_used->table->s->not_usable_by_query_cache)
{
DBUG_PRINT("qcache",
("select not cacheable: temporary, system or "
"other non-cacheable table(s)"));
DBUG_RETURN(0);
}
}
DBUG_RETURN(table_count);