diff options
author | unknown <ingo@mysql.com> | 2004-10-14 20:02:56 +0200 |
---|---|---|
committer | unknown <ingo@mysql.com> | 2004-10-14 20:02:56 +0200 |
commit | fc27da0879c477eba748d1412978afa4032b54ab (patch) | |
tree | 8190b930b058c56a2fd410218c7fb1df01150777 /sql/ha_myisam.cc | |
parent | cd430fbfb6eae25c7abfb18758c8907fa44cbd35 (diff) | |
download | mariadb-git-fc27da0879c477eba748d1412978afa4032b54ab.tar.gz |
BUG#5625 - MyISAM Index corruption on ALTER TABLE x ENABLE KEYS due to full tmpdir.
Added a try to a normal repair() if repair_by_sort() failed.
This was not done with ENABLE KEYS and OPTIMIZE TABLE.
Fixed error code handling in mysql_alter_table().
sql/ha_myisam.cc:
BUG#5625 - MyISAM Index corruption on ALTER TABLE x ENABLE KEYS due to full tmpdir.
Added a try to a normal repair() if repair_by_sort() failed.
This was not done with ENABLE KEYS and OPTIMIZE TABLE.
sql/sql_table.cc:
BUG#5625 - MyISAM Index corruption on ALTER TABLE x ENABLE KEYS due to full tmpdir.
Added a translation from 'bool' return value to '< 0' error indication,
which is used within mysql_execute_command() and must as such be
handed over by mysql_alter_table(). A returncode >= 0 is interpreted
as 'I have already called send_ok()'.
Diffstat (limited to 'sql/ha_myisam.cc')
-rw-r--r-- | sql/ha_myisam.cc | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/sql/ha_myisam.cc b/sql/ha_myisam.cc index 2b7b8f436b1..71623238bd9 100644 --- a/sql/ha_myisam.cc +++ b/sql/ha_myisam.cc @@ -525,6 +525,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt) { + int error; if (!file) return HA_ADMIN_INTERNAL_ERROR; MI_CHECK param; @@ -534,7 +535,14 @@ int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt) param.testflag = (check_opt->flags | T_SILENT | T_FORCE_CREATE | T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX); param.sort_buffer_length= check_opt->sort_buffer_size; - return repair(thd,param,1); + if ((error= repair(thd,param,1)) && param.retry_repair) + { + sql_print_warning("Warning: Optimize table got errno %d, retrying", + my_errno); + param.testflag&= ~T_REP_BY_SORT; + error= repair(thd,param,1); + } + return error; } @@ -744,7 +752,13 @@ bool ha_myisam::activate_all_index(THD *thd) param.myf_rw&= ~MY_WAIT_IF_FULL; param.sort_buffer_length= thd->variables.myisam_sort_buff_size; param.tmpdir=mysql_tmpdir; - error=repair(thd,param,0) != HA_ADMIN_OK; + if ((error= (repair(thd,param,0) != HA_ADMIN_OK)) && param.retry_repair) + { + sql_print_warning("Warning: Enabling keys got errno %d, retrying", + my_errno); + param.testflag&= ~(T_REP_BY_SORT | T_QUICK); + error= (repair(thd,param,0) != HA_ADMIN_OK); + } info(HA_STATUS_CONST); thd->proc_info=save_proc_info; } |