@@ -450,15 +450,16 @@ func retentionCutoffDirs(l log.Logger, dir string, mint int64) ([]string, error)
450450 for _ , dir := range dirs {
451451 meta , err := readMetaFile (dir )
452452 if err != nil {
453- delDirs = append (delDirs , dir )
453+ level .Debug (l ).Log ("msg" , "couldn't read a block meta file at retention" , "err" , err )
454+ // We continue with the rest of the blocks.
455+ // This one will be deleted when reloading the db.
454456 continue
455457 }
456458 // The first block we encounter marks that we crossed the boundary
457459 // of deletable blocks.
458460 if meta .MaxTime >= mint {
459461 break
460462 }
461-
462463 delDirs = append (delDirs , dir )
463464 }
464465
@@ -505,14 +506,11 @@ func (db *DB) reload(deleteable ...string) (err error) {
505506 for _ , dir := range dirs {
506507 meta , err := readMetaFile (dir )
507508 if err != nil {
508- if os .IsNotExist (err ) {
509- deleteable = append (deleteable , dir )
510- level .Error (db .logger ).Log ("msg" , "dir set for deletion due to error in the meta file" , "dir" , dir , "err" , err .Error ())
511- continue
512- }
513- return errors .Wrapf (err , "read meta information %s" , dir )
509+ deleteable = append (deleteable , dir )
510+ level .Error (db .logger ).Log ("msg" , "block set for deletion due to error in the meta file" , "dir" , dir , "err" , err .Error ())
511+ continue
514512 }
515-
513+ // If the block is pending for deletion, don't add it to the new block set.
516514 if stringsContain (deleteable , dir ) {
517515 continue
518516 }
0 commit comments