1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

Merge branch '5.5-galera' into 10.0-galera

This commit is contained in:
Nirbhay Choubey
2015-08-14 01:17:57 -04:00
9 changed files with 247 additions and 45 deletions

View File

@@ -51,7 +51,7 @@
#include "sql_connect.h" // decrease_user_connections,
// check_mqh,
// reset_mqh
#include "sql_rename.h" // mysql_rename_table
#include "sql_rename.h" // mysql_rename_tables
#include "sql_tablespace.h" // mysql_alter_tablespace
#include "hostname.h" // hostname_cache_refresh
#include "sql_acl.h" // *_ACL, check_grant, is_acl_user,
@@ -132,7 +132,7 @@ static void sql_kill(THD *thd, longlong id, killed_state state, killed_type type
static void sql_kill_user(THD *thd, LEX_USER *user, killed_state state);
static bool lock_tables_precheck(THD *thd, TABLE_LIST *tables);
static bool execute_show_status(THD *, TABLE_LIST *);
static bool execute_rename_table(THD *, TABLE_LIST *, TABLE_LIST *);
static bool check_rename_table(THD *, TABLE_LIST *, TABLE_LIST *);
const char *any_db="*any*"; // Special symbol for check_access
@@ -1064,6 +1064,11 @@ bool do_command(THD *thd)
command != COM_SLEEP &&
command != COM_STATISTICS &&
command != COM_TIME &&
command != COM_STMT_PREPARE &&
command != COM_STMT_SEND_LONG_DATA &&
command != COM_STMT_EXECUTE &&
command != COM_STMT_RESET &&
command != COM_STMT_CLOSE &&
command != COM_END
) {
my_message(ER_UNKNOWN_COM_ERROR,
@@ -3503,8 +3508,12 @@ end_with_restore_list:
#endif /* HAVE_REPLICATION */
case SQLCOM_RENAME_TABLE:
{
if (check_rename_table(thd, first_table, all_tables))
goto error;
WSREP_TO_ISOLATION_BEGIN(0, 0, first_table)
if (execute_rename_table(thd, first_table, all_tables))
if (mysql_rename_tables(thd, first_table, 0))
goto error;
break;
}
@@ -5805,8 +5814,8 @@ static bool execute_show_status(THD *thd, TABLE_LIST *all_tables)
}
static bool execute_rename_table(THD *thd, TABLE_LIST *first_table,
TABLE_LIST *all_tables)
static bool check_rename_table(THD *thd, TABLE_LIST *first_table,
TABLE_LIST *all_tables)
{
DBUG_ASSERT(first_table == all_tables && first_table != 0);
TABLE_LIST *table;
@@ -5820,7 +5829,7 @@ static bool execute_rename_table(THD *thd, TABLE_LIST *first_table,
&table->next_local->grant.privilege,
&table->next_local->grant.m_internal,
0, 0))
return 1;
return true;
TABLE_LIST old_list, new_list;
/*
we do not need initialize old_list and new_list because we will
@@ -5833,10 +5842,10 @@ static bool execute_rename_table(THD *thd, TABLE_LIST *first_table,
INSERT_ACL | CREATE_ACL) &&
check_grant(thd, INSERT_ACL | CREATE_ACL, &new_list, FALSE, 1,
FALSE)))
return 1;
return true;
}
return mysql_rename_tables(thd, first_table, 0);
return false;
}