@@ -286,7 +286,7 @@ func loadMergeFiles(dirPath string) error {
286
286
_ = os .RemoveAll (mergeDirPath )
287
287
}()
288
288
289
- copyFile := func (suffix string , fileId uint32 ) {
289
+ copyFile := func (suffix string , fileId uint32 , force bool ) {
290
290
srcFile := wal .SegmentFileName (mergeDirPath , suffix , fileId )
291
291
stat , err := os .Stat (srcFile )
292
292
if os .IsNotExist (err ) {
@@ -295,7 +295,7 @@ func loadMergeFiles(dirPath string) error {
295
295
if err != nil {
296
296
panic (fmt .Sprintf ("loadMergeFiles: failed to get src file stat %v" , err ))
297
297
}
298
- if stat .Size () == 0 {
298
+ if ! force && stat .Size () == 0 {
299
299
return
300
300
}
301
301
destFile := wal .SegmentFileName (dirPath , suffix , fileId )
@@ -322,14 +322,14 @@ func loadMergeFiles(dirPath string) error {
322
322
return err
323
323
}
324
324
// move the merge data file to the original data directory
325
- copyFile (dataFileNameSuffix , fileId )
325
+ copyFile (dataFileNameSuffix , fileId , false )
326
326
}
327
327
328
328
// copy MERGEFINISHED and HINT files to the original data directory
329
329
// there is only one merge finished file, so the file id is always 1,
330
330
// the same as the hint file.
331
- copyFile (mergeFinNameSuffix , 1 )
332
- copyFile (hintFileNameSuffix , 1 )
331
+ copyFile (mergeFinNameSuffix , 1 , true )
332
+ copyFile (hintFileNameSuffix , 1 , true )
333
333
334
334
return nil
335
335
}
0 commit comments