diff --git a/CHANGELOG.md b/CHANGELOG.md index 655005269f..9d9de90723 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ We use *breaking* word for marking changes that are not backward compatible (rel ## Unreleased +### Fixed + +-[1505](https://github.com/thanos-io/thanos/pull/1505) Thanos store now removes invalid local cache blocks. + ## v0.7.0 - 2019.09.02 Accepted into CNCF: diff --git a/pkg/store/bucket.go b/pkg/store/bucket.go index 1834086aab..b6dd8b43ab 100644 --- a/pkg/store/bucket.go +++ b/pkg/store/bucket.go @@ -1188,8 +1188,8 @@ func (b *bucketBlock) indexCacheFilename() string { } func loadMeta(ctx context.Context, logger log.Logger, bucket objstore.BucketReader, dir string, id ulid.ULID) (error, *metadata.Meta) { - // If we haven't seen the block before download the meta.json file. - if _, err := os.Stat(dir); os.IsNotExist(err) { + // If we haven't seen the block before or it is missing the meta.json, download it. + if _, err := os.Stat(path.Join(dir, block.MetaFilename)); os.IsNotExist(err) { if err := os.MkdirAll(dir, 0777); err != nil { return errors.Wrap(err, "create dir"), nil }