diff options
author | unknown <monty@donna.mysql.com> | 2000-10-17 16:19:24 +0300 |
---|---|---|
committer | unknown <monty@donna.mysql.com> | 2000-10-17 16:19:24 +0300 |
commit | 2ad8320b97ec7e4068a02e91169f4851e9d3f10f (patch) | |
tree | 27d0e6155df4adf8bc2ba4032977ecad637026a2 /myisam/myisamchk.c | |
parent | 08bb74b631c5b405b0a6cad155f6abc06a5fbf51 (diff) | |
download | mariadb-git-2ad8320b97ec7e4068a02e91169f4851e9d3f10f.tar.gz |
Fixes for automatic recover of MyISAM tables
Docs/manual.texi:
Update of automatic recover of MyISAM tables
myisam/mi_check.c:
Let the repair function rename files; This made the rest of the recover code simpler.
myisam/mi_page.c:
More debug information
myisam/myisamchk.c:
Addapt to new mi_check code; Fixed bug when a recover on RAID tables where aborted.
mysys/my_winthread.c:
Portability fix
sql/ha_myisam.cc:
Fix for automatic recover
sql/sql_table.cc:
Close all instances of table before running recover / optimize
Diffstat (limited to 'myisam/myisamchk.c')
-rw-r--r-- | myisam/myisamchk.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/myisam/myisamchk.c b/myisam/myisamchk.c index 26e1699a07c..7d9ba9b7c28 100644 --- a/myisam/myisamchk.c +++ b/myisam/myisamchk.c @@ -481,6 +481,7 @@ static int myisamchk(MI_CHECK *param, my_string filename) File datafile; char fixed_name[FN_REFLEN]; char llbuff[22],llbuff2[22]; + my_bool state_updated=0; MYISAM_SHARE *share; DBUG_ENTER("myisamchk"); @@ -665,12 +666,20 @@ static int myisamchk(MI_CHECK *param, my_string filename) (share->state.key_map || (rep_quick && !param->keys_in_use && !recreate)) && mi_test_if_sort_rep(info, info->state->records, 1)) + { error=mi_repair_by_sort(&check_param,info,fixed_name,rep_quick); + state_updated=1; + } else if (param->testflag & (T_REP | T_REP_BY_SORT)) error=mi_repair(&check_param, info,fixed_name,rep_quick); } if (!error && param->testflag & T_SORT_RECORDS) { + /* + The data file is nowadays reopened in the repair code so we should + soon remove the following reopen-code + */ +#ifndef TO_BE_REMOVED if (param->out_flag & O_NEW_DATA) { /* Change temp file to org file */ VOID(my_close(info->dfile,MYF(MY_WME))); /* Close new file */ @@ -682,6 +691,7 @@ static int myisamchk(MI_CHECK *param, my_string filename) param->out_flag&= ~O_NEW_DATA; /* We are using new datafile */ param->read_cache.file=info->dfile; } +#endif if (! error) { uint key; @@ -737,7 +747,11 @@ static int myisamchk(MI_CHECK *param, my_string filename) { error|=chk_key(param, info); if (!error && (param->testflag & (T_STATISTICS | T_AUTO_INC))) - error=update_state_info(param, info, UPDATE_STAT); + error=update_state_info(param, info, + ((param->testflag & T_STATISTICS) ? + UPDATE_STAT : 0) | + ((param->testflag & T_AUTO_INC) ? + UPDATE_AUTO_INC : 0)); } if ((!rep_quick && !error) || !(param->testflag & (T_FAST | T_FORCE_CREATE))) @@ -788,7 +802,8 @@ static int myisamchk(MI_CHECK *param, my_string filename) error|=update_state_info(param, info, UPDATE_OPEN_COUNT | (((param->testflag & (T_REP | T_REP_BY_SORT)) ? - UPDATE_TIME | UPDATE_STAT : 0) | + UPDATE_TIME : 0) | + (state_updated ? UPDATE_STAT : 0) | ((param->testflag & T_SORT_RECORDS) ? UPDATE_SORT : 0))); VOID(lock_file(param, share->kfile,0L,F_UNLCK,"indexfile",filename)); @@ -1244,7 +1259,7 @@ err: { VOID(end_io_cache(&info->rec_cache)); (void) my_close(new_file,MYF(MY_WME)); - (void) my_raid_delete(param->temp_filename, share->base.raid_chunksize, + (void) my_raid_delete(param->temp_filename, share->base.raid_chunks, MYF(MY_WME)); } if (temp_buff) |