diff options
author | unknown <monty@mashka.mysql.fi> | 2003-04-27 22:12:08 +0300 |
---|---|---|
committer | unknown <monty@mashka.mysql.fi> | 2003-04-27 22:12:08 +0300 |
commit | f22be777341f53b4deb58851828c0733ab5380bf (patch) | |
tree | 9cf8ed6360561508fc24e4f8cc90f56282626854 /sql/sql_table.cc | |
parent | 3e90ec6a582ec6a39209c00329ed93a7cc639ded (diff) | |
download | mariadb-git-f22be777341f53b4deb58851828c0733ab5380bf.tar.gz |
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)
VC++Files/libmysql/libmysql.dsp:
Added new source files
myisam/mi_key.c:
Fixed problem when comparing a key for a multi-byte-character set.
myisam/mi_range.c:
Fixed problem when comparing a key for a multi-byte-character set.
myisam/mi_rkey.c:
Fixed problem when comparing a key for a multi-byte-character set.
myisam/mi_search.c:
Fixed problem when comparing a key for a multi-byte-character set.
myisam/mi_test2.c:
Fixed printf statements
myisam/myisamdef.h:
Fixed problem when comparing a key for a multi-byte-character set.
myisam/sort.c:
Fixed printf statements
mysql-test/r/ctype_latin1_de.result:
New test results
mysql-test/r/join.result:
New test results
mysql-test/r/repair.result:
New test results
mysql-test/r/rpl_alter.result:
New test results
mysql-test/t/ctype_latin1_de-master.opt:
--new is needed to get 0x... strings to work properly
mysql-test/t/ctype_latin1_de.test:
New test for latin1_de
mysql-test/t/repair.test:
Test of USE_FRM and HEAP tables
sql/field.cc:
Fixed problem when comparing a key for a multi-byte-character set.
sql/item.cc:
Use 0x.... as strings if 'new' mode
sql/item.h:
Use 0x.... as strings if 'new' mode
sql/mysqld.cc:
Don't report -max on windows when InnoDB is enabled.
sql/sql_analyse.cc:
Removed unused variable
sql/sql_insert.cc:
Removed debug message
sql/sql_repl.cc:
Reset current_linfo; This could cause a hang when doing PURGE LOGS.
sql/sql_select.cc:
Fix for row numbers in EXPLAIN
sql/sql_table.cc:
Fix that USE_FRM works for all table types (without strange errors)
sql/sql_yacc.yy:
Removed compiler warnings.
Diffstat (limited to 'sql/sql_table.cc')
-rw-r--r-- | sql/sql_table.cc | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/sql/sql_table.cc b/sql/sql_table.cc index 0fbb5807c57..1b1b5112e0b 100644 --- a/sql/sql_table.cc +++ b/sql/sql_table.cc @@ -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)) { |