diff options
author | Michael Widenius <monty@askmonty.org> | 2010-11-07 14:25:29 +0200 |
---|---|---|
committer | Michael Widenius <monty@askmonty.org> | 2010-11-07 14:25:29 +0200 |
commit | 9d68ccdeb8692b05d9cc0479d8d3757edbc49368 (patch) | |
tree | 0a17bea389e830f45d0e2bc2ed5e682a20ea2daf /storage/maria | |
parent | a1bd9532352aed69f03b632658b4ba20512b9cd1 (diff) | |
download | mariadb-git-9d68ccdeb8692b05d9cc0479d8d3757edbc49368.tar.gz |
Added option BACKUP_ALL to mysqld --myisam-recover to also get a backup of the index file before it's repaired.
Removed wrong call to translog_buffer_unlock() that caused 'unlocking not locked mutex' failure in Aria log handler.
extra/replace.c:
Updated call to my_redel()
include/maria.h:
Updated prototype for maria_change_to_newfile
include/my_sys.h:
Updated prototypes
Added my_create_backup_name
include/myisam.h:
Updated prototypes
include/myisamchk.h:
Added 'backup_time' to st_handler_check_param to be able to generate same name for backuped data and index file
mysys/my_redel.c:
Added time_t option to my_redel() to be able to generate same backup extensions for many files
sql/handler.cc:
Added start_time to st_ha_check_opt
sql/handler.h:
Added start_time to HA_CHECK_OPT
sql/mysqld.cc:
Added option BACKUP_ALL to --myisam-recover
storage/maria/ha_maria.cc:
Remember start time for repair
storage/maria/ma_check.c:
Use remembered start time for backup file names
Removed some dead code
storage/maria/ma_loghandler.c:
Removed wrong call to translog_buffer_unlock() that caused 'unlocking not locked mutex' failure in log handler.
storage/maria/maria_chk.c:
Removed dead code (O_NEW_INDEX was never set)
Report if table was 'crashed on repair'
storage/maria/maria_pack.c:
Updated parameters to my_redel()
storage/myisam/ha_myisam.cc:
Added recover option BACKUP_ALL to get a backup of the index file before it's repaired.
Print information to log if we make a backup of data as part of repair.
storage/myisam/ha_myisam.h:
Added HA_RECOVER_FULL_BACKUP
storage/myisam/mi_check.c:
Use remembered start time for backup file names
Added mi_make_backup_of_index()
storage/myisam/myisamchk.c:
Removed dead code (O_NEW_INDEX was never set)
Report if table was 'crashed on repair'
storage/myisam/myisampack.c:
Updated call to my_redel()
Diffstat (limited to 'storage/maria')
-rw-r--r-- | storage/maria/ha_maria.cc | 1 | ||||
-rw-r--r-- | storage/maria/ma_check.c | 19 | ||||
-rw-r--r-- | storage/maria/ma_loghandler.c | 3 | ||||
-rw-r--r-- | storage/maria/maria_chk.c | 9 | ||||
-rw-r--r-- | storage/maria/maria_pack.c | 2 |
5 files changed, 13 insertions, 21 deletions
diff --git a/storage/maria/ha_maria.cc b/storage/maria/ha_maria.cc index 2b26de17875..6852e84fc65 100644 --- a/storage/maria/ha_maria.cc +++ b/storage/maria/ha_maria.cc @@ -1316,6 +1316,7 @@ int ha_maria::repair(THD * thd, HA_CHECK_OPT *check_opt) T_SILENT | T_FORCE_CREATE | T_CALC_CHECKSUM | (check_opt->flags & T_EXTEND ? T_REP : T_REP_BY_SORT)); param.sort_buffer_length= THDVAR(thd, sort_buffer_size); + param.backup_time= check_opt->start_time; start_records= file->state->records; while ((error= repair(thd, ¶m, 0)) && param.retry_repair) { diff --git a/storage/maria/ma_check.c b/storage/maria/ma_check.c index f0702d95554..fcf01385e97 100644 --- a/storage/maria/ma_check.c +++ b/storage/maria/ma_check.c @@ -2743,7 +2743,7 @@ int maria_repair(HA_CHECK *param, register MARIA_HA *info, new_file= -1; change_data_file_descriptor(info, -1); if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT, - DATA_TMP_EXT, + DATA_TMP_EXT, param->backup_time, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0)) | sync_dir) || @@ -3059,7 +3059,7 @@ int maria_sort_index(HA_CHECK *param, register MARIA_HA *info, char *name) pthread_mutex_unlock(&share->intern_lock); VOID(my_close(new_file,MYF(MY_WME))); if (maria_change_to_newfile(share->index_file_name.str, MARIA_NAME_IEXT, - INDEX_TMP_EXT, sync_dir) || + INDEX_TMP_EXT, 0, sync_dir) || _ma_open_keyfile(share)) goto err2; info->lock_type= F_UNLCK; /* Force maria_readinfo to lock */ @@ -3492,20 +3492,15 @@ int maria_zerofill(HA_CHECK *param, MARIA_HA *info, const char *name) */ int maria_change_to_newfile(const char * filename, const char * old_ext, - const char * new_ext, myf MyFlags) + const char * new_ext, time_t backup_time, + myf MyFlags) { char old_filename[FN_REFLEN],new_filename[FN_REFLEN]; -#ifdef USE_RAID - if (raid_chunks) - return my_raid_redel(fn_format(old_filename,filename,"",old_ext,2+4), - fn_format(new_filename,filename,"",new_ext,2+4), - raid_chunks, - MYF(MY_WME | MY_LINK_WARNING | MyFlags)); -#endif /* Get real path to filename */ (void) fn_format(old_filename,filename,"",old_ext,2+4+32); return my_redel(old_filename, fn_format(new_filename,old_filename,"",new_ext,2+4), + backup_time, MYF(MY_WME | MY_LINK_WARNING | MyFlags)); } /* maria_change_to_newfile */ @@ -3875,7 +3870,7 @@ int maria_repair_by_sort(HA_CHECK *param, register MARIA_HA *info, } change_data_file_descriptor(info, -1); if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT, - DATA_TMP_EXT, + DATA_TMP_EXT, param->backup_time, (param->testflag & T_BACKUP_DATA ? MYF(MY_REDEL_MAKE_BACKUP): MYF(0)) | sync_dir) || @@ -4500,7 +4495,7 @@ err: my_close(new_file,MYF(0)); info->dfile.file= new_file= -1; if (maria_change_to_newfile(share->data_file_name.str, MARIA_NAME_DEXT, - DATA_TMP_EXT, + DATA_TMP_EXT, param->backup_time, MYF((param->testflag & T_BACKUP_DATA ? MY_REDEL_MAKE_BACKUP : 0) | sync_dir)) || diff --git a/storage/maria/ma_loghandler.c b/storage/maria/ma_loghandler.c index be86740d822..1cc4140081a 100644 --- a/storage/maria/ma_loghandler.c +++ b/storage/maria/ma_loghandler.c @@ -2500,10 +2500,7 @@ my_bool translog_prev_buffer_flush_wait(struct st_translog_buffer *buffer) pthread_cond_wait(&buffer->prev_sent_to_disk_cond, &buffer->mutex); if (buffer->file != file || buffer->offset != offset || buffer->ver != ver) - { - translog_buffer_unlock(buffer); DBUG_RETURN(1); /* some the thread flushed the buffer already */ - } } while(buffer->prev_buffer_offset != buffer->prev_sent_to_disk); } DBUG_RETURN(0); diff --git a/storage/maria/maria_chk.c b/storage/maria/maria_chk.c index 9efdcb24abf..d065070693f 100644 --- a/storage/maria/maria_chk.c +++ b/storage/maria/maria_chk.c @@ -1211,7 +1211,7 @@ static int maria_chk(HA_CHECK *param, char *filename) { /* Change temp file to org file */ VOID(my_close(info->dfile.file, MYF(MY_WME))); /* Close new file */ error|=maria_change_to_newfile(filename,MARIA_NAME_DEXT,DATA_TMP_EXT, - MYF(0)); + 0, MYF(0)); if (_ma_open_datafile(info,info->s, NullS, -1)) error=1; param->out_flag&= ~O_NEW_DATA; /* We are using new datafile */ @@ -1349,11 +1349,9 @@ end2: { if (param->out_flag & O_NEW_DATA) error|=maria_change_to_newfile(filename,MARIA_NAME_DEXT,DATA_TMP_EXT, + param->backup_time, ((param->testflag & T_BACKUP_DATA) ? MYF(MY_REDEL_MAKE_BACKUP) : MYF(0))); - if (param->out_flag & O_NEW_INDEX) - error|=maria_change_to_newfile(filename,MARIA_NAME_IEXT,INDEX_TMP_EXT, - MYF(0)); } if (opt_transaction_logging && share->base.born_transactional && !error && @@ -1457,7 +1455,8 @@ static void descript(HA_CHECK *param, register MARIA_HA *info, char *name) printf("UUID: %s\n", buff); pos=buff; if (share->state.changed & STATE_CRASHED) - strmov(buff,"crashed"); + strmov(buff, share->state.changed & STATE_CRASHED_ON_REPAIR ? + "crashed on repair" : "crashed"); else { if (share->state.open_count) diff --git a/storage/maria/maria_pack.c b/storage/maria/maria_pack.c index 167d0af3078..3e0ea3d571c 100644 --- a/storage/maria/maria_pack.c +++ b/storage/maria/maria_pack.c @@ -736,7 +736,7 @@ static int compress(PACK_MRG_INFO *mrg,char *result_table) VOID(my_delete(new_name,MYF(MY_WME))); } else - error=my_redel(org_name,new_name,MYF(MY_WME | MY_COPYTIME)); + error=my_redel(org_name, new_name, 0, MYF(MY_WME | MY_COPYTIME)); } if (! error) error=save_state(isam_file,mrg,new_length,glob_crc); |