Browse Source
Bug#49907: ALTER TABLE ... TRUNCATE PARTITION does not wait for
Bug#49907: ALTER TABLE ... TRUNCATE PARTITION does not wait for
locks on the table Fixing the partitioning specifics after TRUNCATE TABLE in bug-42643 was fixed. Reorganize of code to decrease the size of the giant switch in mysql_execute_command, and to prepare for future parser reengineering. Moved code into Sql_statement objects. Updated patch according to davi's review comments.pull/73/head
32 changed files with 2106 additions and 1183 deletions
-
3libmysqld/CMakeLists.txt
-
7libmysqld/Makefile.am
-
18mysql-test/r/not_partition.result
-
2mysql-test/r/partition_disabled.result
-
8mysql-test/r/partition_truncate.result
-
2mysql-test/suite/parts/inc/partition_mgm.inc
-
34mysql-test/suite/parts/r/partition_debug_sync_innodb.result
-
10mysql-test/suite/parts/r/partition_mgm_lc0_archive.result
-
10mysql-test/suite/parts/r/partition_mgm_lc1_archive.result
-
10mysql-test/suite/parts/r/partition_mgm_lc2_archive.result
-
41mysql-test/suite/parts/t/partition_debug_sync_innodb.test
-
1mysql-test/t/not_partition.test
-
7mysql-test/t/partition_truncate.test
-
6sql/CMakeLists.txt
-
9sql/Makefile.am
-
67sql/datadict.cc
-
2sql/datadict.h
-
106sql/sql_alter_table.cc
-
66sql/sql_alter_table.h
-
1sql/sql_lex.cc
-
18sql/sql_lex.h
-
176sql/sql_parse.cc
-
1sql/sql_parse.h
-
139sql/sql_partition_admin.cc
-
236sql/sql_partition_admin.h
-
953sql/sql_table.cc
-
30sql/sql_table.h
-
1004sql/sql_table_maintenance.cc
-
132sql/sql_table_maintenance.h
-
50sql/sql_truncate.cc
-
26sql/sql_truncate.h
-
114sql/sql_yacc.yy
@ -0,0 +1,106 @@ |
|||
/* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
|||
|
|||
#include "sql_parse.h" // check_access,
|
|||
// check_merge_table_access
|
|||
#include "sql_table.h" // mysql_alter_table,
|
|||
// mysql_exchange_partition
|
|||
#include "sql_alter_table.h"
|
|||
|
|||
bool Alter_table_statement::execute(THD *thd) |
|||
{ |
|||
LEX *lex= thd->lex; |
|||
/* first SELECT_LEX (have special meaning for many of non-SELECTcommands) */ |
|||
SELECT_LEX *select_lex= &lex->select_lex; |
|||
/* first table of first SELECT_LEX */ |
|||
TABLE_LIST *first_table= (TABLE_LIST*) select_lex->table_list.first; |
|||
/*
|
|||
Code in mysql_alter_table() may modify its HA_CREATE_INFO argument, |
|||
so we have to use a copy of this structure to make execution |
|||
prepared statement- safe. A shallow copy is enough as no memory |
|||
referenced from this structure will be modified. |
|||
@todo move these into constructor... |
|||
*/ |
|||
HA_CREATE_INFO create_info(lex->create_info); |
|||
Alter_info alter_info(lex->alter_info, thd->mem_root); |
|||
ulong priv=0; |
|||
ulong priv_needed= ALTER_ACL; |
|||
bool result; |
|||
|
|||
DBUG_ENTER("Alter_table_statement::execute"); |
|||
|
|||
if (thd->is_fatal_error) /* out of memory creating a copy of alter_info */ |
|||
DBUG_RETURN(TRUE); |
|||
/*
|
|||
We also require DROP priv for ALTER TABLE ... DROP PARTITION, as well |
|||
as for RENAME TO, as being done by SQLCOM_RENAME_TABLE |
|||
*/ |
|||
if (alter_info.flags & (ALTER_DROP_PARTITION | ALTER_RENAME)) |
|||
priv_needed|= DROP_ACL; |
|||
|
|||
/* Must be set in the parser */ |
|||
DBUG_ASSERT(select_lex->db); |
|||
DBUG_ASSERT(!(alter_info.flags & ALTER_ADMIN_PARTITION)); |
|||
if (check_access(thd, priv_needed, first_table->db, |
|||
&first_table->grant.privilege, |
|||
&first_table->grant.m_internal, |
|||
0, 0) || |
|||
check_access(thd, INSERT_ACL | CREATE_ACL, select_lex->db, |
|||
&priv, |
|||
NULL, /* Don't use first_tab->grant with sel_lex->db */ |
|||
0, 0) || |
|||
check_merge_table_access(thd, first_table->db, |
|||
create_info.merge_list.first)) |
|||
DBUG_RETURN(TRUE); /* purecov: inspected */ |
|||
|
|||
if (check_grant(thd, priv_needed, first_table, FALSE, UINT_MAX, FALSE)) |
|||
DBUG_RETURN(TRUE); /* purecov: inspected */ |
|||
|
|||
if (lex->name.str && !test_all_bits(priv, INSERT_ACL | CREATE_ACL)) |
|||
{ |
|||
// Rename of table
|
|||
TABLE_LIST tmp_table; |
|||
bzero((char*) &tmp_table,sizeof(tmp_table)); |
|||
tmp_table.table_name= lex->name.str; |
|||
tmp_table.db= select_lex->db; |
|||
tmp_table.grant.privilege= priv; |
|||
if (check_grant(thd, INSERT_ACL | CREATE_ACL, &tmp_table, FALSE, |
|||
UINT_MAX, FALSE)) |
|||
DBUG_RETURN(TRUE); /* purecov: inspected */ |
|||
} |
|||
|
|||
/* Don't yet allow changing of symlinks with ALTER TABLE */ |
|||
if (create_info.data_file_name) |
|||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, |
|||
WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED), |
|||
"DATA DIRECTORY"); |
|||
if (create_info.index_file_name) |
|||
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_WARN, |
|||
WARN_OPTION_IGNORED, ER(WARN_OPTION_IGNORED), |
|||
"INDEX DIRECTORY"); |
|||
create_info.data_file_name= create_info.index_file_name= NULL; |
|||
|
|||
thd->enable_slow_log= opt_log_slow_admin_statements; |
|||
|
|||
result= mysql_alter_table(thd, select_lex->db, lex->name.str, |
|||
&create_info, |
|||
first_table, |
|||
&alter_info, |
|||
select_lex->order_list.elements, |
|||
select_lex->order_list.first, |
|||
lex->ignore); |
|||
|
|||
DBUG_RETURN(result); |
|||
} |
|||
@ -0,0 +1,66 @@ |
|||
/* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
|||
|
|||
#ifndef SQL_ALTER_TABLE_H |
|||
#define SQL_ALTER_TABLE_H |
|||
|
|||
/** |
|||
Alter_table_common represents the common properties of the ALTER TABLE |
|||
statements. |
|||
@todo move Alter_info and other ALTER generic structures from Lex here. |
|||
*/ |
|||
class Alter_table_common : public Sql_statement |
|||
{ |
|||
protected: |
|||
/** |
|||
Constructor. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Alter_table_common(LEX *lex) |
|||
: Sql_statement(lex) |
|||
{} |
|||
|
|||
virtual ~Alter_table_common() |
|||
{} |
|||
|
|||
}; |
|||
|
|||
/** |
|||
Alter_table_statement represents the generic ALTER TABLE statement. |
|||
@todo move Alter_info and other ALTER specific structures from Lex here. |
|||
*/ |
|||
class Alter_table_statement : public Alter_table_common |
|||
{ |
|||
public: |
|||
/** |
|||
Constructor, used to represent a ALTER TABLE statement. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Alter_table_statement(LEX *lex) |
|||
: Alter_table_common(lex) |
|||
{} |
|||
|
|||
~Alter_table_statement() |
|||
{} |
|||
|
|||
/** |
|||
Execute a ALTER TABLE statement at runtime. |
|||
@param thd the current thread. |
|||
@return false on success. |
|||
*/ |
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
#endif |
|||
@ -0,0 +1,139 @@ |
|||
/* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved.
|
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
|||
|
|||
#include "sql_parse.h" // check_one_table_access
|
|||
#include "sql_table.h" // mysql_alter_table, etc.
|
|||
#include "sql_lex.h" // Sql_statement
|
|||
#include "sql_truncate.h" // mysql_truncate_table,
|
|||
// Truncate_statement
|
|||
#include "sql_table_maintenance.h" // Analyze/Check/.._table_statement
|
|||
#include "sql_partition_admin.h" // Alter_table_*_partition
|
|||
|
|||
#ifndef WITH_PARTITION_STORAGE_ENGINE
|
|||
|
|||
bool Partition_statement_unsupported::execute(THD *) |
|||
{ |
|||
DBUG_ENTER("Partition_statement_unsupported::execute"); |
|||
/* error, partitioning support not compiled in... */ |
|||
my_error(ER_FEATURE_DISABLED, MYF(0), "partitioning", |
|||
"--with-plugin-partition"); |
|||
DBUG_RETURN(TRUE); |
|||
} |
|||
|
|||
#else
|
|||
|
|||
bool Alter_table_analyze_partition_statement::execute(THD *thd) |
|||
{ |
|||
bool res; |
|||
DBUG_ENTER("Alter_table_analyze_partition_statement::execute"); |
|||
|
|||
/*
|
|||
Flag that it is an ALTER command which administrates partitions, used |
|||
by ha_partition |
|||
*/ |
|||
m_lex->alter_info.flags|= ALTER_ADMIN_PARTITION; |
|||
|
|||
res= Analyze_table_statement::execute(thd); |
|||
|
|||
DBUG_RETURN(res); |
|||
} |
|||
|
|||
|
|||
bool Alter_table_check_partition_statement::execute(THD *thd) |
|||
{ |
|||
bool res; |
|||
DBUG_ENTER("Alter_table_check_partition_statement::execute"); |
|||
|
|||
/*
|
|||
Flag that it is an ALTER command which administrates partitions, used |
|||
by ha_partition |
|||
*/ |
|||
m_lex->alter_info.flags|= ALTER_ADMIN_PARTITION; |
|||
|
|||
res= Check_table_statement::execute(thd); |
|||
|
|||
DBUG_RETURN(res); |
|||
} |
|||
|
|||
|
|||
bool Alter_table_optimize_partition_statement::execute(THD *thd) |
|||
{ |
|||
bool res; |
|||
DBUG_ENTER("Alter_table_optimize_partition_statement::execute"); |
|||
|
|||
/*
|
|||
Flag that it is an ALTER command which administrates partitions, used |
|||
by ha_partition |
|||
*/ |
|||
m_lex->alter_info.flags|= ALTER_ADMIN_PARTITION; |
|||
|
|||
res= Optimize_table_statement::execute(thd); |
|||
|
|||
DBUG_RETURN(res); |
|||
} |
|||
|
|||
|
|||
bool Alter_table_repair_partition_statement::execute(THD *thd) |
|||
{ |
|||
bool res; |
|||
DBUG_ENTER("Alter_table_repair_partition_statement::execute"); |
|||
|
|||
/*
|
|||
Flag that it is an ALTER command which administrates partitions, used |
|||
by ha_partition |
|||
*/ |
|||
m_lex->alter_info.flags|= ALTER_ADMIN_PARTITION; |
|||
|
|||
res= Repair_table_statement::execute(thd); |
|||
|
|||
DBUG_RETURN(res); |
|||
} |
|||
|
|||
|
|||
bool Alter_table_truncate_partition_statement::execute(THD *thd) |
|||
{ |
|||
TABLE_LIST *first_table= thd->lex->select_lex.table_list.first; |
|||
bool res; |
|||
enum_sql_command original_sql_command; |
|||
DBUG_ENTER("Alter_table_truncate_partition_statement::execute"); |
|||
|
|||
/*
|
|||
Execute TRUNCATE PARTITION just like TRUNCATE TABLE. |
|||
Some storage engines (InnoDB, partition) checks thd_sql_command, |
|||
so we set it to SQLCOM_TRUNCATE during the execution. |
|||
*/ |
|||
original_sql_command= m_lex->sql_command; |
|||
m_lex->sql_command= SQLCOM_TRUNCATE; |
|||
|
|||
/*
|
|||
Flag that it is an ALTER command which administrates partitions, used |
|||
by ha_partition. |
|||
*/ |
|||
m_lex->alter_info.flags|= ALTER_ADMIN_PARTITION; |
|||
|
|||
/*
|
|||
Fix the lock types (not the same as ordinary ALTER TABLE). |
|||
*/ |
|||
first_table->lock_type= TL_WRITE; |
|||
first_table->mdl_request.set_type(MDL_SHARED_NO_READ_WRITE); |
|||
|
|||
/* execute as a TRUNCATE TABLE */ |
|||
res= Truncate_statement::execute(thd); |
|||
|
|||
m_lex->sql_command= original_sql_command; |
|||
DBUG_RETURN(res); |
|||
} |
|||
|
|||
#endif /* WITH_PARTITION_STORAGE_ENGINE */
|
|||
@ -0,0 +1,236 @@ |
|||
/* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
|||
|
|||
#ifndef SQL_PARTITION_ADMIN_H |
|||
#define SQL_PARTITION_ADMIN_H |
|||
|
|||
#ifndef WITH_PARTITION_STORAGE_ENGINE |
|||
|
|||
/** |
|||
Stub class that returns a error if the partition storage engine is |
|||
not supported. |
|||
*/ |
|||
class Partition_statement_unsupported : public Sql_statement |
|||
{ |
|||
public: |
|||
Partition_statement_unsupported(LEX *lex) |
|||
: Sql_statement(lex) |
|||
{} |
|||
|
|||
~Partition_statement_unsupported() |
|||
{} |
|||
|
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
|
|||
class Alter_table_analyze_partition_statement : |
|||
public Partition_statement_unsupported |
|||
{ |
|||
public: |
|||
Alter_table_analyze_partition_statement(LEX *lex) |
|||
: Partition_statement_unsupported(lex) |
|||
{} |
|||
|
|||
~Alter_table_analyze_partition_statement() |
|||
{} |
|||
}; |
|||
|
|||
|
|||
class Alter_table_check_partition_statement : |
|||
public Partition_statement_unsupported |
|||
{ |
|||
public: |
|||
Alter_table_check_partition_statement(LEX *lex) |
|||
: Partition_statement_unsupported(lex) |
|||
{} |
|||
|
|||
~Alter_table_check_partition_statement() |
|||
{} |
|||
}; |
|||
|
|||
|
|||
class Alter_table_optimize_partition_statement : |
|||
public Partition_statement_unsupported |
|||
{ |
|||
public: |
|||
Alter_table_optimize_partition_statement(LEX *lex) |
|||
: Partition_statement_unsupported(lex) |
|||
{} |
|||
|
|||
~Alter_table_optimize_partition_statement() |
|||
{} |
|||
}; |
|||
|
|||
|
|||
class Alter_table_repair_partition_statement : |
|||
public Partition_statement_unsupported |
|||
{ |
|||
public: |
|||
Alter_table_repair_partition_statement(LEX *lex) |
|||
: Partition_statement_unsupported(lex) |
|||
{} |
|||
|
|||
~Alter_table_repair_partition_statement() |
|||
{} |
|||
}; |
|||
|
|||
|
|||
class Alter_table_truncate_partition_statement : |
|||
public Partition_statement_unsupported |
|||
{ |
|||
public: |
|||
Alter_table_truncate_partition_statement(LEX *lex) |
|||
: Partition_statement_unsupported(lex) |
|||
{} |
|||
|
|||
~Alter_table_truncate_partition_statement() |
|||
{} |
|||
}; |
|||
|
|||
|
|||
#else |
|||
|
|||
/** |
|||
Class that represents the ALTER TABLE t1 ANALYZE PARTITION p statement. |
|||
*/ |
|||
class Alter_table_analyze_partition_statement : public Analyze_table_statement |
|||
{ |
|||
public: |
|||
/** |
|||
Constructor, used to represent a ALTER TABLE ANALYZE PARTITION statement. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Alter_table_analyze_partition_statement(LEX *lex) |
|||
: Analyze_table_statement(lex) |
|||
{} |
|||
|
|||
~Alter_table_analyze_partition_statement() |
|||
{} |
|||
|
|||
/** |
|||
Execute a ALTER TABLE ANALYZE PARTITION statement at runtime. |
|||
@param thd the current thread. |
|||
@return false on success. |
|||
*/ |
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
|
|||
/** |
|||
Class that represents the ALTER TABLE t1 CHECK PARTITION p statement. |
|||
*/ |
|||
class Alter_table_check_partition_statement : public Check_table_statement |
|||
{ |
|||
public: |
|||
/** |
|||
Constructor, used to represent a ALTER TABLE CHECK PARTITION statement. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Alter_table_check_partition_statement(LEX *lex) |
|||
: Check_table_statement(lex) |
|||
{} |
|||
|
|||
~Alter_table_check_partition_statement() |
|||
{} |
|||
|
|||
/** |
|||
Execute a ALTER TABLE CHECK PARTITION statement at runtime. |
|||
@param thd the current thread. |
|||
@return false on success. |
|||
*/ |
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
|
|||
/** |
|||
Class that represents the ALTER TABLE t1 OPTIMIZE PARTITION p statement. |
|||
*/ |
|||
class Alter_table_optimize_partition_statement : public Optimize_table_statement |
|||
{ |
|||
public: |
|||
/** |
|||
Constructor, used to represent a ALTER TABLE OPTIMIZE PARTITION statement. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Alter_table_optimize_partition_statement(LEX *lex) |
|||
: Optimize_table_statement(lex) |
|||
{} |
|||
|
|||
~Alter_table_optimize_partition_statement() |
|||
{} |
|||
|
|||
/** |
|||
Execute a ALTER TABLE OPTIMIZE PARTITION statement at runtime. |
|||
@param thd the current thread. |
|||
@return false on success. |
|||
*/ |
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
|
|||
/** |
|||
Class that represents the ALTER TABLE t1 REPAIR PARTITION p statement. |
|||
*/ |
|||
class Alter_table_repair_partition_statement : public Repair_table_statement |
|||
{ |
|||
public: |
|||
/** |
|||
Constructor, used to represent a ALTER TABLE REPAIR PARTITION statement. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Alter_table_repair_partition_statement(LEX *lex) |
|||
: Repair_table_statement(lex) |
|||
{} |
|||
|
|||
~Alter_table_repair_partition_statement() |
|||
{} |
|||
|
|||
/** |
|||
Execute a ALTER TABLE REPAIR PARTITION statement at runtime. |
|||
@param thd the current thread. |
|||
@return false on success. |
|||
*/ |
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
|
|||
/** |
|||
Class that represents the ALTER TABLE t1 TRUNCATE PARTITION p statement. |
|||
*/ |
|||
class Alter_table_truncate_partition_statement : public Truncate_statement |
|||
{ |
|||
public: |
|||
/** |
|||
Constructor, used to represent a ALTER TABLE TRUNCATE PARTITION statement. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Alter_table_truncate_partition_statement(LEX *lex) |
|||
: Truncate_statement(lex) |
|||
{} |
|||
|
|||
~Alter_table_truncate_partition_statement() |
|||
{} |
|||
|
|||
/** |
|||
Execute a ALTER TABLE TRUNCATE PARTITION statement at runtime. |
|||
@param thd the current thread. |
|||
@return false on success. |
|||
*/ |
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
#endif /* WITH_PARTITION_STORAGE_ENGINE */ |
|||
#endif /* SQL_PARTITION_ADMIN_H */ |
|||
953
sql/sql_table.cc
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
1004
sql/sql_table_maintenance.cc
File diff suppressed because it is too large
View File
File diff suppressed because it is too large
View File
@ -0,0 +1,132 @@ |
|||
/* Copyright (c) 2010 Oracle and/or its affiliates. All rights reserved. |
|||
|
|||
This program is free software; you can redistribute it and/or modify |
|||
it under the terms of the GNU General Public License as published by |
|||
the Free Software Foundation; version 2 of the License. |
|||
|
|||
This program is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with this program; if not, write to the Free Software |
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ |
|||
|
|||
#ifndef SQL_TABLE_MAINTENANCE_H |
|||
#define SQL_TABLE_MAINTENANCE_H |
|||
|
|||
|
|||
bool mysql_assign_to_keycache(THD* thd, TABLE_LIST* table_list, |
|||
LEX_STRING *key_cache_name); |
|||
bool mysql_preload_keys(THD* thd, TABLE_LIST* table_list); |
|||
int reassign_keycache_tables(THD* thd, KEY_CACHE *src_cache, |
|||
KEY_CACHE *dst_cache); |
|||
|
|||
/** |
|||
Analyze_statement represents the ANALYZE TABLE statement. |
|||
*/ |
|||
class Analyze_table_statement : public Sql_statement |
|||
{ |
|||
public: |
|||
/** |
|||
Constructor, used to represent a ANALYZE TABLE statement. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Analyze_table_statement(LEX *lex) |
|||
: Sql_statement(lex) |
|||
{} |
|||
|
|||
~Analyze_table_statement() |
|||
{} |
|||
|
|||
/** |
|||
Execute a ANALYZE TABLE statement at runtime. |
|||
@param thd the current thread. |
|||
@return false on success. |
|||
*/ |
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
|
|||
|
|||
/** |
|||
Check_table_statement represents the CHECK TABLE statement. |
|||
*/ |
|||
class Check_table_statement : public Sql_statement |
|||
{ |
|||
public: |
|||
/** |
|||
Constructor, used to represent a CHECK TABLE statement. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Check_table_statement(LEX *lex) |
|||
: Sql_statement(lex) |
|||
{} |
|||
|
|||
~Check_table_statement() |
|||
{} |
|||
|
|||
/** |
|||
Execute a CHECK TABLE statement at runtime. |
|||
@param thd the current thread. |
|||
@return false on success. |
|||
*/ |
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
|
|||
|
|||
/** |
|||
Optimize_table_statement represents the OPTIMIZE TABLE statement. |
|||
*/ |
|||
class Optimize_table_statement : public Sql_statement |
|||
{ |
|||
public: |
|||
/** |
|||
Constructor, used to represent a OPTIMIZE TABLE statement. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Optimize_table_statement(LEX *lex) |
|||
: Sql_statement(lex) |
|||
{} |
|||
|
|||
~Optimize_table_statement() |
|||
{} |
|||
|
|||
/** |
|||
Execute a OPTIMIZE TABLE statement at runtime. |
|||
@param thd the current thread. |
|||
@return false on success. |
|||
*/ |
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
|
|||
|
|||
/** |
|||
Repair_table_statement represents the REPAIR TABLE statement. |
|||
*/ |
|||
class Repair_table_statement : public Sql_statement |
|||
{ |
|||
public: |
|||
/** |
|||
Constructor, used to represent a REPAIR TABLE statement. |
|||
@param lex the LEX structure for this statement. |
|||
*/ |
|||
Repair_table_statement(LEX *lex) |
|||
: Sql_statement(lex) |
|||
{} |
|||
|
|||
~Repair_table_statement() |
|||
{} |
|||
|
|||
/** |
|||
Execute a REPAIR TABLE statement at runtime. |
|||
@param thd the current thread. |
|||
@return false on success. |
|||
*/ |
|||
bool execute(THD *thd); |
|||
}; |
|||
|
|||
#endif |
|||
Write
Preview
Loading…
Cancel
Save
Reference in new issue