Commit 5f4e0e87 authored by Michael Widenius's avatar Michael Widenius

Don't update table and index statics for temporary tables

Fixed type and testing of last_update type for innodb_table_stats

mysql-test/r/connect.result:
  Removed tables which are not created anymore
sql/item_sum.h:
  Fixed typo
sql/sql_base.cc:
  Don't update table and index statics for temporary tables
sql/sys_vars.cc:
  Merge
storage/innobase/dict/dict0stats.cc:
  Fixed type last_update to TIMESTAMP.
parent 1f08a518
......@@ -15,15 +15,11 @@ host
index_stats
innodb_index_stats
innodb_table_stats
ndb_binlog_index
plugin
proc
procs_priv
proxies_priv
servers
slave_master_info
slave_relay_log_info
slave_worker_info
slow_log
table_stats
tables_priv
......@@ -57,15 +53,11 @@ host
index_stats
innodb_index_stats
innodb_table_stats
ndb_binlog_index
plugin
proc
procs_priv
proxies_priv
servers
slave_master_info
slave_relay_log_info
slave_worker_info
slow_log
table_stats
tables_priv
......@@ -107,15 +99,11 @@ host
index_stats
innodb_index_stats
innodb_table_stats
ndb_binlog_index
plugin
proc
procs_priv
proxies_priv
servers
slave_master_info
slave_relay_log_info
slave_worker_info
slow_log
table_stats
tables_priv
......
......@@ -1073,7 +1073,7 @@ public:
enum Sumfunctype sum_func () const {return MIN_FUNC;}
bool add();
const char *func_name() const { return "MY_MIN("; }
const char *func_name() const { return "min("; }
Item *copy_or_same(THD* thd);
};
......@@ -1086,7 +1086,7 @@ public:
enum Sumfunctype sum_func () const {return MAX_FUNC;}
bool add();
const char *func_name() const { return "MY_MAX("; }
const char *func_name() const { return "max("; }
Item *copy_or_same(THD* thd);
};
......
......@@ -2360,18 +2360,6 @@ void close_temporary(TABLE *table, bool free_share, bool delete_table)
DBUG_PRINT("tmptable", ("closing table: '%s'.'%s'",
table->s->db.str, table->s->table_name.str));
/*
in_use is not set for replication temporary tables during shutdown.
table->file->get_table() could not be set for ALTER table
when we do not open it in engine.
*/
if (table->file->get_table() && table->in_use)
{
table->file->update_global_table_stats();
table->file->update_global_index_stats();
}
free_io_cache(table);
closefrm(table, 0);
if (delete_table)
......
......@@ -320,6 +320,16 @@ static Sys_var_long Sys_pfs_digest_size(
DEFAULT(-1),
BLOCK_SIZE(1));
static Sys_var_long Sys_pfs_connect_attrs_size(
"performance_schema_session_connect_attrs_size",
"Size of session attribute string buffer per thread."
" Use 0 to disable, -1 for automated sizing.",
PARSED_EARLY READ_ONLY
GLOBAL_VAR(pfs_param.m_session_connect_attrs_sizing),
CMD_LINE(REQUIRED_ARG), VALID_RANGE(-1, 1024 * 1024),
DEFAULT(-1),
BLOCK_SIZE(1));
#endif /* WITH_PERFSCHEMA_STORAGE_ENGINE */
static Sys_var_ulong Sys_auto_increment_increment(
......
......@@ -5926,9 +5926,17 @@ dict_table_schema_check(
return(DB_ERROR);
}
/* check mtype for exact match */
if (req_schema->columns[i].mtype != table->cols[j].mtype) {
/*
check mtype for exact match.
This check is relaxed to allow use to use TIMESTAMP
(ie INT) for last_update instead of DATA_BINARY.
We have to test for both values as the innodb_table_stats
table may come from MySQL and have the old type.
*/
if (req_schema->columns[i].mtype != table->cols[j].mtype &&
!(req_schema->columns[i].mtype == DATA_INT &&
table->cols[j].mtype == DATA_FIXBINARY))
{
ut_snprintf(errstr, errstr_sz,
"Column %s in table %s is %s "
"but should be %s (type mismatch).",
......
......@@ -175,8 +175,8 @@ dict_stats_persistent_storage_check(
{"table_name", DATA_VARMYSQL,
DATA_NOT_NULL, 192},
{"last_update", DATA_FIXBINARY,
DATA_NOT_NULL, 4},
{"last_update", DATA_INT,
DATA_NOT_NULL | DATA_UNSIGNED, 4},
{"n_rows", DATA_INT,
DATA_NOT_NULL | DATA_UNSIGNED, 8},
......@@ -206,8 +206,8 @@ dict_stats_persistent_storage_check(
{"index_name", DATA_VARMYSQL,
DATA_NOT_NULL, 192},
{"last_update", DATA_FIXBINARY,
DATA_NOT_NULL, 4},
{"last_update", DATA_INT,
DATA_NOT_NULL | DATA_UNSIGNED, 4},
{"stat_name", DATA_VARMYSQL,
DATA_NOT_NULL, 64*3},
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment