@@ -1512,7 +1512,7 @@ static int mi_drop_all_indexes(MI_CHECK *param, MI_INFO *info, my_bool force)
15121512 /* Save new datafile-name in temp_filename */
15131513
15141514int mi_repair (MI_CHECK * param , register MI_INFO * info ,
1515- char * name , int rep_quick )
1515+ char * name , int rep_quick , my_bool no_copy_stat )
15161516{
15171517 int error ,got_error ;
15181518 ha_rows start_records ,new_header_length ;
@@ -1726,6 +1726,11 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
17261726 /* Replace the actual file with the temporary file */
17271727 if (new_file >= 0 )
17281728 {
1729+ myf flags = 0 ;
1730+ if (param -> testflag & T_BACKUP_DATA )
1731+ flags |= MY_REDEL_MAKE_BACKUP ;
1732+ if (no_copy_stat )
1733+ flags |= MY_REDEL_NO_COPY_STAT ;
17291734 mysql_file_close (new_file , MYF (0 ));
17301735 info -> dfile = new_file = -1 ;
17311736 /*
@@ -1744,8 +1749,7 @@ int mi_repair(MI_CHECK *param, register MI_INFO *info,
17441749 info -> s -> file_map = NULL ;
17451750 }
17461751 if (change_to_newfile (share -> data_file_name , MI_NAME_DEXT , DATA_TMP_EXT ,
1747- (param -> testflag & T_BACKUP_DATA ?
1748- MYF (MY_REDEL_MAKE_BACKUP ): MYF (0 ))) ||
1752+ flags ) ||
17491753 mi_open_datafile (info ,share ,name ,-1 ))
17501754 got_error = 1 ;
17511755
@@ -1933,7 +1937,8 @@ int flush_blocks(MI_CHECK *param, KEY_CACHE *key_cache, File file)
19331937
19341938 /* Sort index for more efficent reads */
19351939
1936- int mi_sort_index (MI_CHECK * param , register MI_INFO * info , char * name )
1940+ int mi_sort_index (MI_CHECK * param , register MI_INFO * info , char * name ,
1941+ my_bool no_copy_stat )
19371942{
19381943 reg2 uint key ;
19391944 reg1 MI_KEYDEF * keyinfo ;
@@ -2010,7 +2015,7 @@ int mi_sort_index(MI_CHECK *param, register MI_INFO *info, char * name)
20102015 share -> kfile = -1 ;
20112016 (void ) mysql_file_close (new_file , MYF (MY_WME ));
20122017 if (change_to_newfile (share -> index_file_name , MI_NAME_IEXT , INDEX_TMP_EXT ,
2013- MYF (0 )) ||
2018+ no_copy_stat ? MYF ( MY_REDEL_NO_COPY_STAT ) : MYF (0 )) ||
20142019 mi_open_keyfile (share ))
20152020 goto err2 ;
20162021 info -> lock_type = F_UNLCK ; /* Force mi_readinfo to lock */
@@ -2215,14 +2220,16 @@ int filecopy(MI_CHECK *param, File to,File from,my_off_t start,
22152220 info MyISAM handler to repair
22162221 name Name of table (for warnings)
22172222 rep_quick set to <> 0 if we should not change data file
2223+ no_copy_stat Don't copy file stats from old to new file,
2224+ assume that new file was created with correct stats
22182225
22192226 RESULT
22202227 0 ok
22212228 <>0 Error
22222229*/
22232230
22242231int mi_repair_by_sort (MI_CHECK * param , register MI_INFO * info ,
2225- const char * name , int rep_quick )
2232+ const char * name , int rep_quick , my_bool no_copy_stat )
22262233{
22272234 int got_error ;
22282235 uint i ;
@@ -2549,11 +2556,15 @@ int mi_repair_by_sort(MI_CHECK *param, register 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, register 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, register MI_INFO *info,
26352648*/
26362649
26372650int mi_repair_parallel (MI_CHECK * param , register 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 ;
@@ -3082,11 +3095,15 @@ int mi_repair_parallel(MI_CHECK *param, register MI_INFO *info,
30823095 /* Replace the actual file with the temporary file */
30833096 if (new_file >= 0 )
30843097 {
3098+ myf flags = 0 ;
3099+ if (param -> testflag & T_BACKUP_DATA )
3100+ flags |= MY_REDEL_MAKE_BACKUP ;
3101+ if (no_copy_stat )
3102+ flags |= MY_REDEL_NO_COPY_STAT ;
30853103 mysql_file_close (new_file , MYF (0 ));
30863104 info -> dfile = new_file = -1 ;
30873105 if (change_to_newfile (share -> data_file_name , MI_NAME_DEXT , DATA_TMP_EXT ,
3088- (param -> testflag & T_BACKUP_DATA ?
3089- MYF (MY_REDEL_MAKE_BACKUP ): MYF (0 ))) ||
3106+ flags ) ||
30903107 mi_open_datafile (info ,share ,name ,-1 ))
30913108 got_error = 1 ;
30923109 }
0 commit comments