mirror of
https://github.com/MariaDB/server.git
synced 2025-07-30 16:24:05 +03:00
Fixed problem when comparing a key for a multi-byte-character set. (bug 152)
Use 0x.... as strings if 'new' mode. (bug 152) Don't report -max on windows when InnoDB is enabled. (bug 332) Reset current_linfo; This could cause a hang when doing PURGE LOGS. Fix for row numbers in EXPLAIN (bug 322) Fix that USE_FRM works for all table types (bug 97)
This commit is contained in:
@ -23,6 +23,7 @@
|
||||
#endif
|
||||
#include <hash.h>
|
||||
#include <myisam.h>
|
||||
#include <my_dir.h>
|
||||
#include <assert.h>
|
||||
|
||||
#ifdef __WIN__
|
||||
@ -1046,12 +1047,31 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table,
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
User gave us USE_FRM which means that the header in the index file is
|
||||
trashed.
|
||||
In this case we will try to fix the table the following way:
|
||||
- Rename the data file to a temporary name
|
||||
- Truncate the table
|
||||
- Replace the new data file with the old one
|
||||
- Run a normal repair using the new index file and the old data file
|
||||
*/
|
||||
|
||||
char from[FN_REFLEN],tmp[FN_REFLEN];
|
||||
char* db = thd->db ? thd->db : table->db;
|
||||
char from[FN_REFLEN],tmp[FN_REFLEN+32];
|
||||
const char **ext= table->table->file->bas_ext();
|
||||
MY_STAT stat_info;
|
||||
|
||||
/*
|
||||
Check if this is a table type that stores index and data separately,
|
||||
like ISAM or MyISAM
|
||||
*/
|
||||
if (!ext[0] || !ext[1])
|
||||
DBUG_RETURN(0); // No data file
|
||||
|
||||
strxmov(from, table->table->path, ext[1], NullS); // Name of data file
|
||||
if (!my_stat(from, &stat_info, MYF(0)))
|
||||
DBUG_RETURN(0); // Can't use USE_FRM flag
|
||||
|
||||
sprintf(from, "%s/%s/%s", mysql_real_data_home, db, table->real_name);
|
||||
fn_format(from, from, "", MI_NAME_DEXT, 4);
|
||||
sprintf(tmp,"%s-%lx_%lx", from, current_pid, thd->thread_id);
|
||||
|
||||
pthread_mutex_lock(&LOCK_open);
|
||||
@ -1067,7 +1087,7 @@ static int prepare_for_repair(THD* thd, TABLE_LIST* table,
|
||||
unlock_table_name(thd, table);
|
||||
pthread_mutex_unlock(&LOCK_open);
|
||||
DBUG_RETURN(send_check_errmsg(thd, table, "repair",
|
||||
"Failed renaming .MYD file"));
|
||||
"Failed renaming data file"));
|
||||
}
|
||||
if (mysql_truncate(thd, table, 1))
|
||||
{
|
||||
|
Reference in New Issue
Block a user