Skip to content
This repository was archived by the owner on Aug 13, 2019. It is now read-only.

Commit 66a4898

Browse files
don't bail for missing meta.js files
1 parent bc49a66 commit 66a4898

File tree

2 files changed

+14
-8
lines changed

2 files changed

+14
-8
lines changed

compact.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,8 @@ func (c *LeveledCompactor) Plan(dir string) ([]string, error) {
157157
for _, dir := range dirs {
158158
meta, err := readMetaFile(dir)
159159
if err != nil {
160-
return nil, err
160+
level.Error(c.logger).Log("msg", "reading meta file", "dir", dir, "err", err.Error())
161+
continue
161162
}
162163
dms = append(dms, dirMeta{dir, meta})
163164
}
@@ -313,13 +314,15 @@ func (c *LeveledCompactor) Compact(dest string, dirs ...string) (uid ulid.ULID,
313314
for _, d := range dirs {
314315
b, err := OpenBlock(d, c.chunkPool)
315316
if err != nil {
316-
return uid, err
317+
level.Error(c.logger).Log("msg", "couldn't open a block", "dir", d, "err", err.Error())
318+
continue
317319
}
318320
defer b.Close()
319321

320322
meta, err := readMetaFile(d)
321323
if err != nil {
322-
return uid, err
324+
level.Error(c.logger).Log("msg", "reading meta file", "dir", d, "err", err.Error())
325+
continue
323326
}
324327

325328
metas = append(metas, meta)

db.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func (db *DB) retentionCutoff() (b bool, err error) {
319319
last := blocks[len(db.blocks)-1]
320320

321321
mint := last.Meta().MaxTime - int64(db.opts.RetentionDuration)
322-
dirs, err := retentionCutoffDirs(db.dir, mint)
322+
dirs, err := retentionCutoffDirs(db.logger, db.dir, mint)
323323
if err != nil {
324324
return false, err
325325
}
@@ -433,7 +433,7 @@ func (db *DB) compact() (changes bool, err error) {
433433

434434
// retentionCutoffDirs returns all directories of blocks in dir that are strictly
435435
// before mint.
436-
func retentionCutoffDirs(dir string, mint int64) ([]string, error) {
436+
func retentionCutoffDirs(l log.Logger, dir string, mint int64) ([]string, error) {
437437
df, err := fileutil.OpenDir(dir)
438438
if err != nil {
439439
return nil, errors.Wrapf(err, "open directory")
@@ -450,7 +450,8 @@ func retentionCutoffDirs(dir string, mint int64) ([]string, error) {
450450
for _, dir := range dirs {
451451
meta, err := readMetaFile(dir)
452452
if err != nil {
453-
return nil, errors.Wrapf(err, "read block meta %s", dir)
453+
level.Error(l).Log("msg", "reading meta file", "dir", dir, "err", err.Error())
454+
continue
454455
}
455456
// The first block we encounter marks that we crossed the boundary
456457
// of deletable blocks.
@@ -504,7 +505,8 @@ func (db *DB) reload(deleteable ...string) (err error) {
504505
for _, dir := range dirs {
505506
meta, err := readMetaFile(dir)
506507
if err != nil {
507-
return errors.Wrapf(err, "read meta information %s", dir)
508+
level.Error(db.logger).Log("msg", "reading meta file", "dir", dir, "err", err.Error())
509+
continue
508510
}
509511
// If the block is pending for deletion, don't add it to the new block set.
510512
if stringsContain(deleteable, dir) {
@@ -515,7 +517,8 @@ func (db *DB) reload(deleteable ...string) (err error) {
515517
if !ok {
516518
b, err = OpenBlock(dir, db.chunkPool)
517519
if err != nil {
518-
return errors.Wrapf(err, "open block %s", dir)
520+
level.Error(db.logger).Log("msg", "couldn't open a block", "dir", dir, "err", err.Error())
521+
continue
519522
}
520523
}
521524

0 commit comments

Comments
 (0)