Commit cef9a026 authored by marko's avatar marko

Remove the special treatment of tables

rsql_IDENTIFIER_recover_innodb_tmp_table, which is redundant and
was broken with the introduction of the "safe" file name encoding of
identifiers.  (Bug #21313)
parent 59ec36ce
...@@ -54,27 +54,6 @@ static const char S_innodb_tablespace_monitor[] = "innodb_tablespace_monitor"; ...@@ -54,27 +54,6 @@ static const char S_innodb_tablespace_monitor[] = "innodb_tablespace_monitor";
static const char S_innodb_table_monitor[] = "innodb_table_monitor"; static const char S_innodb_table_monitor[] = "innodb_table_monitor";
static const char S_innodb_mem_validate[] = "innodb_mem_validate"; static const char S_innodb_mem_validate[] = "innodb_mem_validate";
/* Name suffix for recovered orphaned temporary tables */
static const char S_recover_innodb_tmp_table[] = "_recover_innodb_tmp_table";
/***********************************************************************
Determine if the given name ends in the suffix reserved for recovered
orphaned temporary tables. */
static
ibool
row_mysql_is_recovered_tmp_table(
/*=============================*/
/* out: TRUE if table name ends in
the reserved suffix */
const char* name)
{
ulint namelen = strlen(name) + 1;
return(namelen >= sizeof S_recover_innodb_tmp_table
&& !memcmp(name + namelen -
sizeof S_recover_innodb_tmp_table,
S_recover_innodb_tmp_table,
sizeof S_recover_innodb_tmp_table));
}
/*********************************************************************** /***********************************************************************
Determine if the given name is a name reserved for MySQL system tables. */ Determine if the given name is a name reserved for MySQL system tables. */
static static
...@@ -1659,48 +1638,6 @@ row_get_mysql_key_number_for_index( ...@@ -1659,48 +1638,6 @@ row_get_mysql_key_number_for_index(
return(i); return(i);
} }
/*************************************************************************
Recovers an orphaned tmp table inside InnoDB by renaming it. In the table
name #sql becomes rsql, and "_recover_innodb_tmp_table" is catenated to
the end of name. table->name should be of the form
"dbname/rsql..._recover_innodb_tmp_table". This renames a table whose
name is "#sql..." */
static
int
row_mysql_recover_tmp_table(
/*========================*/
/* out: error code or DB_SUCCESS */
dict_table_t* table, /* in: table definition */
trx_t* trx) /* in: transaction handle */
{
const char* ptr = strstr(table->name, "/rsql");
if (!ptr) {
/* table name does not begin with "/rsql" */
dict_mem_table_free(table);
trx_commit_for_mysql(trx);
return(DB_ERROR);
}
else {
int status;
int namelen = (int) strlen(table->name);
char* old_name = mem_strdupl(table->name, namelen);
/* replace "rsql" with "#sql" */
old_name[ptr - table->name + 1] = '#';
/* remove "_recover_innodb_tmp_table" suffix */
ut_ad(namelen > (int) sizeof S_recover_innodb_tmp_table);
ut_ad(!strcmp(old_name + namelen + 1 -
sizeof S_recover_innodb_tmp_table,
S_recover_innodb_tmp_table));
old_name[namelen + 1 - sizeof S_recover_innodb_tmp_table] = 0;
status = row_rename_table_for_mysql(old_name,
table->name, trx);
mem_free(old_name);
return(status);
}
}
/************************************************************************* /*************************************************************************
Locks the data dictionary in shared mode from modifications, for performing Locks the data dictionary in shared mode from modifications, for performing
foreign key check, rollback, or other operation invisible to MySQL. */ foreign key check, rollback, or other operation invisible to MySQL. */
...@@ -1845,18 +1782,6 @@ row_create_table_for_mysql( ...@@ -1845,18 +1782,6 @@ row_create_table_for_mysql(
trx_start_if_not_started(trx); trx_start_if_not_started(trx);
if (row_mysql_is_recovered_tmp_table(table->name)) {
/* MySQL prevents accessing of tables whose name begins
with #sql, that is temporary tables. If mysqld crashes in
the middle of an ALTER TABLE, we may get an orphaned
#sql-table in the tablespace. We have here a special
mechanism to recover such tables by renaming them to
rsql... */
return(row_mysql_recover_tmp_table(table, trx));
}
/* The table name is prefixed with the database name and a '/'. /* The table name is prefixed with the database name and a '/'.
Certain table names starting with 'innodb_' have their special Certain table names starting with 'innodb_' have their special
meaning regardless of the database name. Thus, we need to meaning regardless of the database name. Thus, we need to
...@@ -2063,11 +1988,6 @@ row_create_index_for_mysql( ...@@ -2063,11 +1988,6 @@ row_create_index_for_mysql(
} }
} }
if (row_mysql_is_recovered_tmp_table(index->table_name)) {
return(DB_SUCCESS);
}
heap = mem_heap_create(512); heap = mem_heap_create(512);
trx->dict_operation = TRUE; trx->dict_operation = TRUE;
...@@ -2142,11 +2062,6 @@ row_table_add_foreign_constraints( ...@@ -2142,11 +2062,6 @@ row_table_add_foreign_constraints(
trx_start_if_not_started(trx); trx_start_if_not_started(trx);
if (row_mysql_is_recovered_tmp_table(name)) {
return(DB_SUCCESS);
}
trx->dict_operation = TRUE; trx->dict_operation = TRUE;
err = dict_create_foreign_constraints(trx, sql_string, name, err = dict_create_foreign_constraints(trx, sql_string, name,
...@@ -3495,7 +3410,6 @@ row_rename_table_for_mysql( ...@@ -3495,7 +3410,6 @@ row_rename_table_for_mysql(
mem_heap_t* heap = NULL; mem_heap_t* heap = NULL;
const char** constraints_to_drop = NULL; const char** constraints_to_drop = NULL;
ulint n_constraints_to_drop = 0; ulint n_constraints_to_drop = 0;
ibool recovering_temp_table = FALSE;
ibool old_is_tmp, new_is_tmp; ibool old_is_tmp, new_is_tmp;
pars_info_t* info = NULL; pars_info_t* info = NULL;
...@@ -3533,15 +3447,10 @@ row_rename_table_for_mysql( ...@@ -3533,15 +3447,10 @@ row_rename_table_for_mysql(
old_is_tmp = row_is_mysql_tmp_table_name(old_name); old_is_tmp = row_is_mysql_tmp_table_name(old_name);
new_is_tmp = row_is_mysql_tmp_table_name(new_name); new_is_tmp = row_is_mysql_tmp_table_name(new_name);
if (row_mysql_is_recovered_tmp_table(new_name)) {
recovering_temp_table = TRUE;
} else {
/* Serialize data dictionary operations with dictionary mutex: /* Serialize data dictionary operations with dictionary mutex:
no deadlocks can occur then in these operations */ no deadlocks can occur then in these operations */
row_mysql_lock_data_dictionary(trx); row_mysql_lock_data_dictionary(trx);
}
table = dict_table_get_low(old_name); table = dict_table_get_low(old_name);
...@@ -3798,10 +3707,6 @@ end: ...@@ -3798,10 +3707,6 @@ end:
funct_exit: funct_exit:
trx_commit_for_mysql(trx); trx_commit_for_mysql(trx);
if (!recovering_temp_table) {
row_mysql_unlock_data_dictionary(trx);
}
if (UNIV_LIKELY_NULL(heap)) { if (UNIV_LIKELY_NULL(heap)) {
mem_heap_free(heap); mem_heap_free(heap);
} }
......
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