@@ -1517,7 +1517,7 @@ static int mi_drop_all_indexes(MI_CHECK *param, MI_INFO *info, my_bool force)
15171517 /* Save new datafile-name in temp_filename */
15181518
15191519int mi_repair (MI_CHECK * param , MI_INFO * info ,
1520- char * name , int rep_quick )
1520+ char * name , int rep_quick , my_bool no_copy_stat )
15211521{
15221522 int error ,got_error ;
15231523 ha_rows start_records ,new_header_length ;
@@ -1731,6 +1731,11 @@ int mi_repair(MI_CHECK *param, MI_INFO *info,
17311731 /* Replace the actual file with the temporary file */
17321732 if (new_file >= 0 )
17331733 {
1734+ myf flags = 0 ;
1735+ if (param -> testflag & T_BACKUP_DATA )
1736+ flags |= MY_REDEL_MAKE_BACKUP ;
1737+ if (no_copy_stat )
1738+ flags |= MY_REDEL_NO_COPY_STAT ;
17341739 mysql_file_close (new_file , MYF (0 ));
17351740 info -> dfile = new_file = -1 ;
17361741 /*
@@ -1749,8 +1754,7 @@ int mi_repair(MI_CHECK *param, MI_INFO *info,
17491754 info -> s -> file_map = NULL ;
17501755 }
17511756 if (change_to_newfile (share -> data_file_name , MI_NAME_DEXT , DATA_TMP_EXT ,
1752- (param -> testflag & T_BACKUP_DATA ?
1753- MYF (MY_REDEL_MAKE_BACKUP ): MYF (0 ))) ||
1757+ flags ) ||
17541758 mi_open_datafile (info ,share ,name ,-1 ))
17551759 got_error = 1 ;
17561760
@@ -1937,7 +1941,8 @@ int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file)
19371941
19381942 /* Sort index for more efficent reads */
19391943
1940- int mi_sort_index (MI_CHECK * param , MI_INFO * info , char * name )
1944+ int mi_sort_index (MI_CHECK * param , MI_INFO * info , char * name ,
1945+ my_bool no_copy_stat )
19411946{
19421947 uint key ;
19431948 MI_KEYDEF * keyinfo ;
@@ -2015,7 +2020,7 @@ int mi_sort_index(MI_CHECK *param, MI_INFO *info, char * name)
20152020 share -> kfile = -1 ;
20162021 (void ) mysql_file_close (new_file , MYF (MY_WME ));
20172022 if (change_to_newfile (share -> index_file_name , MI_NAME_IEXT , INDEX_TMP_EXT ,
2018- MYF (0 )) ||
2023+ no_copy_stat ? MYF ( MY_REDEL_NO_COPY_STAT ) : MYF (0 )) ||
20192024 mi_open_keyfile (share ))
20202025 goto err2 ;
20212026 info -> lock_type = F_UNLCK ; /* Force mi_readinfo to lock */
@@ -2219,14 +2224,16 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
22192224 info MyISAM handler to repair
22202225 name Name of table (for warnings)
22212226 rep_quick set to <> 0 if we should not change data file
2227+ no_copy_stat Don't copy file stats from old to new file,
2228+ assume that new file was created with correct stats
22222229
22232230 RESULT
22242231 0 ok
22252232 <>0 Error
22262233*/
22272234
22282235int mi_repair_by_sort (MI_CHECK * param , MI_INFO * info ,
2229- const char * name , int rep_quick )
2236+ const char * name , int rep_quick , my_bool no_copy_stat )
22302237{
22312238 int got_error ;
22322239 uint i ;
@@ -2549,11 +2556,15 @@ int mi_repair_by_sort(MI_CHECK *param, MI_INFO *info,
25492556 /* Replace the actual file with the temporary file */
25502557 if (new_file >= 0 )
25512558 {
2559+ myf flags = 0 ;
2560+ if (param -> testflag & T_BACKUP_DATA )
2561+ flags |= MY_REDEL_MAKE_BACKUP ;
2562+ if (no_copy_stat )
2563+ flags |= MY_REDEL_NO_COPY_STAT ;
25522564 mysql_file_close (new_file , MYF (0 ));
25532565 info -> dfile = new_file = -1 ;
25542566 if (change_to_newfile (share -> data_file_name ,MI_NAME_DEXT , DATA_TMP_EXT ,
2555- (param -> testflag & T_BACKUP_DATA ?
2556- MYF (MY_REDEL_MAKE_BACKUP ): MYF (0 ))) ||
2567+ flags ) ||
25572568 mi_open_datafile (info ,share ,name ,-1 ))
25582569 got_error = 1 ;
25592570 }
@@ -2601,6 +2612,8 @@ int mi_repair_by_sort(MI_CHECK *param, MI_INFO *info,
26012612 info MyISAM handler to repair
26022613 name Name of table (for warnings)
26032614 rep_quick set to <> 0 if we should not change data file
2615+ no_copy_stat Don't copy file stats from old to new file,
2616+ assume that new file was created with correct stats
26042617
26052618 DESCRIPTION
26062619 Same as mi_repair_by_sort but do it multithreaded
@@ -2635,7 +2648,7 @@ int mi_repair_by_sort(MI_CHECK *param, MI_INFO *info,
26352648*/
26362649
26372650int mi_repair_parallel (MI_CHECK * param , MI_INFO * info ,
2638- const char * name , int rep_quick )
2651+ const char * name , int rep_quick , my_bool no_copy_stat )
26392652{
26402653 int got_error ;
26412654 uint i ,key , total_key_length , istep ;
@@ -3070,11 +3083,15 @@ int mi_repair_parallel(MI_CHECK *param, MI_INFO *info,
30703083 /* Replace the actual file with the temporary file */
30713084 if (new_file >= 0 )
30723085 {
3086+ myf flags = 0 ;
3087+ if (param -> testflag & T_BACKUP_DATA )
3088+ flags |= MY_REDEL_MAKE_BACKUP ;
3089+ if (no_copy_stat )
3090+ flags |= MY_REDEL_NO_COPY_STAT ;
30733091 mysql_file_close (new_file , MYF (0 ));
30743092 info -> dfile = new_file = -1 ;
30753093 if (change_to_newfile (share -> data_file_name , MI_NAME_DEXT , DATA_TMP_EXT ,
3076- (param -> testflag & T_BACKUP_DATA ?
3077- MYF (MY_REDEL_MAKE_BACKUP ): MYF (0 ))) ||
3094+ flags ) ||
30783095 mi_open_datafile (info ,share ,name ,-1 ))
30793096 got_error = 1 ;
30803097 }
0 commit comments