Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix store: handle invalid cache block dir #1505

Merged
merged 2 commits into from
Sep 15, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pkg/store/bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down