@@ -236,11 +236,11 @@ func (lm *LogFileManager) loadShiftTS(ctx context.Context) error {
236236}
237237
238238func (lm * LogFileManager ) streamingMeta (ctx context.Context ) (MetaNameIter , error ) {
239- return lm .streamingMetaByTS (ctx )
239+ return lm .streamingMetaByTS (ctx , func ( _ string ) bool { return true } )
240240}
241241
242- func (lm * LogFileManager ) streamingMetaByTS (ctx context.Context ) (MetaNameIter , error ) {
243- it , err := lm .createMetaIterOver (ctx , lm .storage )
242+ func (lm * LogFileManager ) streamingMetaByTS (ctx context.Context , cond func ( path string ) bool ) (MetaNameIter , error ) {
243+ it , err := lm .createMetaIterOver (ctx , lm .storage , cond )
244244 if err != nil {
245245 return nil , err
246246 }
@@ -250,15 +250,15 @@ func (lm *LogFileManager) streamingMetaByTS(ctx context.Context) (MetaNameIter,
250250 return filtered , nil
251251}
252252
253- func (lm * LogFileManager ) createMetaIterOver (ctx context.Context , s storeapi.Storage ) (MetaNameIter , error ) {
253+ func (lm * LogFileManager ) createMetaIterOver (ctx context.Context , s storeapi.Storage , cond func ( path string ) bool ) (MetaNameIter , error ) {
254254 opt := & storeapi.WalkOption {SubDir : stream .GetStreamBackupMetaPrefix ()}
255255 names := []string {}
256256 err := s .WalkDir (ctx , opt , func (path string , size int64 ) error {
257257 if ! strings .HasSuffix (path , ".meta" ) {
258258 return nil
259259 }
260260 newPath := stream .FilterPathByTs (path , lm .shiftStartTS , lm .restoreTS )
261- if len (newPath ) > 0 {
261+ if len (newPath ) > 0 && cond ( newPath ) {
262262 names = append (names , newPath )
263263 }
264264 return nil
@@ -347,7 +347,13 @@ func (lm *LogFileManager) collectDDLFilesAndPrepareCache(
347347// LoadDDLFiles loads all DDL files needs to be restored in the restoration.
348348// This function returns all DDL files needing directly because we need sort all of them.
349349func (lm * LogFileManager ) LoadDDLFiles (ctx context.Context ) ([]Log , error ) {
350- m , err := lm .streamingMeta (ctx )
350+ m , err := lm .streamingMetaByTS (ctx , func (path string ) bool {
351+ parsedName , err := stream .TryParseTaggedBackupMetaFileNameWrapper (path )
352+ if err != nil {
353+ return true
354+ }
355+ return parsedName .HasDDLFiles ()
356+ })
351357 if err != nil {
352358 return nil , err
353359 }
0 commit comments