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

Commit 299b2ea

Browse files
add debug logging
1 parent 9de8d6f commit 299b2ea

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

compact.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ func (c *LeveledCompactor) Plan(dir string) ([]string, error) {
157157
for _, dir := range dirs {
158158
meta, err := readMetaFile(dir)
159159
if err != nil {
160-
// No need to return an error as this will be deleted when reloading the db.
160+
level.Debug(c.logger).Log("msg", "couldn't read a block meta file at planning", "err", err)
161+
// We continue with the rest of the blocks.
162+
// This one will be deleted when reloading the db.
161163
continue
162164
}
163165
dms = append(dms, dirMeta{dir, meta})

db.go

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -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
}

repair.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@ func repairBadIndexVersion(logger log.Logger, dir string) error {
3030
continue
3131
}
3232
d = path.Join(dir, d)
33-
// Skip dirs with missing meta. These will be deleted when reloading the db.
3433
if _, err := os.Stat(filepath.Join(d, metaFilename)); os.IsNotExist(err) {
34+
level.Debug(logger).Log("msg", "couldn't read a block meta file at index repair", "err", err)
35+
// We continue with the rest of the blocks.
36+
// This one will be deleted when reloading the db.
3537
continue
3638
}
3739

0 commit comments

Comments
 (0)