summaryrefslogtreecommitdiff
path: root/sql/ha_innodb.cc
diff options
context:
space:
mode:
authorunknown <guilhem@mysql.com>2004-06-10 16:41:24 +0200
committerunknown <guilhem@mysql.com>2004-06-10 16:41:24 +0200
commit78492226529495f2dcac22e0dcd2a32c2956bb9a (patch)
treed6be22cfef257179e9dd0d0a40fc3ee77622003e /sql/ha_innodb.cc
parent0e6b9457fe40808e096df13e1388360caed5d9bf (diff)
downloadmariadb-git-78492226529495f2dcac22e0dcd2a32c2956bb9a.tar.gz
WL#1689 "Map OPTIMIZE TABLE to ALTER TABLE for InnoDB"
exactly it's mapped to "ALTER TABLE t; ANALYZE TABLE t;" sql/ha_innodb.cc: ::optimize() now returns "try ALTER and then analyze" instead of only analyze. sql/handler.h: new code to say "try alter and analyze". sql/mysql_priv.h: as we may now use mysql_alter_table() internally to ::optimize we must prevent it from talking to the client. New function mysql_recreate_table() which is the same as ALTER TABLE t; sql/sql_parse.cc: the big block removed here is moved into mysql_recreate_table(). sql/sql_table.cc: In mysql_admin_table(): if the handler returns HA_ADMIN_TRY_ALTER, we close the table, recreate it, then open it and analyze it. This is currently used only for OPTIMIZE TABLE of an InnoDB table.
Diffstat (limited to 'sql/ha_innodb.cc')
-rw-r--r--sql/ha_innodb.cc7
1 files changed, 3 insertions, 4 deletions
diff --git a/sql/ha_innodb.cc b/sql/ha_innodb.cc
index 619c05711c4..19ff0aee8cb 100644
--- a/sql/ha_innodb.cc
+++ b/sql/ha_innodb.cc
@@ -4336,9 +4336,8 @@ ha_innobase::analyze(
}
/**************************************************************************
-This is currently mapped to ::analyze. A better option would be to map this
-to "ALTER TABLE tablename TYPE=InnoDB", which seems to rebuild the table in
-MySQL. */
+This is mapped to "ALTER TABLE tablename TYPE=InnoDB", which rebuilds
+the table in MySQL. */
int
ha_innobase::optimize(
@@ -4346,7 +4345,7 @@ ha_innobase::optimize(
THD* thd, /* in: connection thread handle */
HA_CHECK_OPT* check_opt) /* in: currently ignored */
{
- return(ha_innobase::analyze(thd, check_opt));
+ return(HA_ADMIN_TRY_ALTER);
}
/***********************************************************************