Skip to content

Commit

Permalink
pkg/auth/badgerauth: silence ErrNoRewrite in gcValueLog
Browse files Browse the repository at this point in the history
This change modifies gcValueLog so that it won't alarm typical users
that something's wrong when ErrNoRewrite is actually expected (other
codebases using BadgerDB also silence ErrNoRewrite for this purpose).

Change-Id: I742edea063439f194b061b82e8ed8c6dd492b39c
  • Loading branch information
amwolff committed Jul 5, 2022
1 parent a297560 commit 652b63d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/auth/badgerauth/db.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ func (db *DB) gcValueLog(ctx context.Context) (err error) {
case <-ctx.Done():
err = ctx.Err()
default:
err = db.db.RunValueLogGC(0.5)
// Run GC and optionally silence ErrNoRewrite errors:
if err = db.db.RunValueLogGC(.5); errs.Is(err, badger.ErrNoRewrite) {
err = nil
}
}
gcFinished(&err)
}
Expand Down

0 comments on commit 652b63d

Please sign in to comment.