1
0
mirror of https://github.com/MariaDB/server.git synced 2025-07-30 16:24:05 +03:00

Generate warning in ha_delete_table() if files is missing in handler

mysql-test/r/myisam.result:
  Test of DROP TABLE when .MYI or .MYD is missing
mysql-test/r/ndb_autodiscover.result:
  Update test results
mysql-test/r/rpl_EE_error.result:
  Change test to conform with new handling of drop table when handler file is missing
mysql-test/t/myisam.test:
  Test of DROP TABLE when .MYI or .MYD is missing
mysql-test/t/rpl_EE_error.test:
  Change test to conform with new handling of drop table when handler file is missing
sql/handler.cc:
  Generate a warning in ha_delete_table() if we get an error from 'delete_table()'
sql/handler.h:
  More parameters to ha_delete_table() so that we can generate better error messages
sql/sql_table.cc:
  Generate warning in ha_delete_table()
This commit is contained in:
unknown
2005-02-21 20:41:48 +02:00
parent ac1852b403
commit 8cb6031dd7
8 changed files with 108 additions and 26 deletions

View File

@ -109,11 +109,12 @@ bool mysql_rm_table(THD *thd,TABLE_LIST *tables, my_bool if_exists,
delete (drop) tables.
SYNOPSIS
mysql_rm_table_part2_with_lock()
thd Thread handle
tables List of tables to delete
if_exists If 1, don't give error if one table doesn't exists
dont_log_query Don't write query to log files
mysql_rm_table_part2_with_lock()
thd Thread handle
tables List of tables to delete
if_exists If 1, don't give error if one table doesn't exists
dont_log_query Don't write query to log files. This will also not
generate warnings if the handler files doesn't exists
NOTES
Works like documented in mysql_rm_table(), but don't check
@ -157,7 +158,8 @@ int mysql_rm_table_part2_with_lock(THD *thd,
In this case we give an warning of level 'NOTE'
drop_temporary Only drop temporary tables
drop_view Allow to delete VIEW .frm
dont_log_query Don't log the query
dont_log_query Don't write query to log files. This will also not
generate warnings if the handler files doesn't exists
TODO:
When logging to the binary log, we should log
@ -234,16 +236,10 @@ int mysql_rm_table_part2(THD *thd, TABLE_LIST *tables, bool if_exists,
char *end;
db_type table_type= get_table_type(path);
*(end=fn_ext(path))=0; // Remove extension for delete
error=ha_delete_table(table_type, path);
error= ha_delete_table(thd, table_type, path, table->table_name,
!dont_log_query);
if ((error == ENOENT || error == HA_ERR_NO_SUCH_TABLE) && if_exists)
{
/* Warn that the table did not exist in engine */
if (error == HA_ERR_NO_SUCH_TABLE)
push_warning_printf(thd, MYSQL_ERROR::WARN_LEVEL_NOTE,
ER_BAD_TABLE_ERROR, ER(ER_BAD_TABLE_ERROR),
table->table_name);
error= 0;
}
if (error == HA_ERR_ROW_IS_REFERENCED)
{
/* the table is referenced by a foreign key constraint */
@ -306,7 +302,7 @@ int quick_rm_table(enum db_type base,const char *db,
error=1; /* purecov: inspected */
my_snprintf(path, sizeof(path), "%s/%s/%s", mysql_data_home, db, table_name);
unpack_filename(path,path);
return ha_delete_table(base,path) || error;
return ha_delete_table(current_thd, base, path, table_name, 0) || error;
}
/*