diff options
author | Monty <monty@mariadb.org> | 2015-07-17 16:27:41 +0300 |
---|---|---|
committer | Monty <monty@mariadb.org> | 2015-08-18 11:18:57 +0300 |
commit | 92fd65832727162a003647b4c48344dc9567ce84 (patch) | |
tree | ee92ae361346ef043aa08c04442298643242de0f /storage/myisam | |
parent | 35a019837e0290af45962484b4ddc1d6a92ac654 (diff) | |
download | mariadb-git-92fd65832727162a003647b4c48344dc9567ce84.tar.gz |
MDEV-8475 stale .TMM file causes MyiSAM and Aria engine to stop serving the table
Issue was two fold (both in MyISAM and Aria)
- optimize and repair failed if there was an old .TMM file around. As optimized and repair are protected against multiple execution, I decided to change so that we just truncate the file if it exists.
- I had missed to check for error condition if creation of the temporary index file failed. This caused the strange behaviour that it looked as if optimized would have worked once.
Diffstat (limited to 'storage/myisam')
-rw-r--r-- | storage/myisam/ha_myisam.cc | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/storage/myisam/ha_myisam.cc b/storage/myisam/ha_myisam.cc index 6b02db1e0ba..3029909e79f 100644 --- a/storage/myisam/ha_myisam.cc +++ b/storage/myisam/ha_myisam.cc @@ -1012,6 +1012,7 @@ int ha_myisam::repair(THD* thd, HA_CHECK_OPT *check_opt) param.testflag= ((check_opt->flags & ~(T_EXTEND)) | T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM | (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT)); + param.tmpfile_createflag= O_RDWR | O_TRUNC; param.sort_buffer_length= THDVAR(thd, sort_buffer_size); param.backup_time= check_opt->start_time; start_records=file->state->records; @@ -1062,6 +1063,7 @@ int ha_myisam::optimize(THD* thd, HA_CHECK_OPT *check_opt) param.op_name= "optimize"; param.testflag= (check_opt->flags | T_SILENT | T_FORCE_CREATE | T_REP_BY_SORT | T_STATISTICS | T_SORT_INDEX); + param.tmpfile_createflag= O_RDWR | O_TRUNC; param.sort_buffer_length= THDVAR(thd, sort_buffer_size); if ((error= repair(thd,param,1)) && param.retry_repair) { @@ -1181,7 +1183,7 @@ int ha_myisam::repair(THD *thd, HA_CHECK ¶m, bool do_optimize) thd_proc_info(thd, "Sorting index"); error=mi_sort_index(¶m,file,fixed_name); } - if (!statistics_done && (local_testflag & T_STATISTICS)) + if (!error && !statistics_done && (local_testflag & T_STATISTICS)) { if (share->state.changed & STATE_NOT_ANALYZED) { |