remove unused changes variable (#391)
This was added in
55a9b5428a
and later not used after some refactoring in following PRs.
Signed-off-by: Krasi Georgiev <kgeorgie@redhat.com>
This commit is contained in:
parent
2db59a71a6
commit
d38516b1c2
24
db.go
24
db.go
|
@ -300,7 +300,7 @@ func (db *DB) run() {
|
||||||
case <-db.compactc:
|
case <-db.compactc:
|
||||||
db.metrics.compactionsTriggered.Inc()
|
db.metrics.compactionsTriggered.Inc()
|
||||||
|
|
||||||
_, err := db.compact()
|
err := db.compact()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
level.Error(db.logger).Log("msg", "compaction failed", "err", err)
|
level.Error(db.logger).Log("msg", "compaction failed", "err", err)
|
||||||
backoff = exponential(backoff, 1*time.Second, 1*time.Minute)
|
backoff = exponential(backoff, 1*time.Second, 1*time.Minute)
|
||||||
|
@ -366,12 +366,12 @@ func (a dbAppender) Commit() error {
|
||||||
// this is sufficient to reliably delete old data.
|
// this is sufficient to reliably delete old data.
|
||||||
// Old blocks are only deleted on reload based on the new block's parent information.
|
// Old blocks are only deleted on reload based on the new block's parent information.
|
||||||
// See DB.reload documentation for further information.
|
// See DB.reload documentation for further information.
|
||||||
func (db *DB) compact() (changes bool, err error) {
|
func (db *DB) compact() (err error) {
|
||||||
db.cmtx.Lock()
|
db.cmtx.Lock()
|
||||||
defer db.cmtx.Unlock()
|
defer db.cmtx.Unlock()
|
||||||
|
|
||||||
if !db.compactionsEnabled {
|
if !db.compactionsEnabled {
|
||||||
return false, nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check whether we have pending head blocks that are ready to be persisted.
|
// Check whether we have pending head blocks that are ready to be persisted.
|
||||||
|
@ -379,7 +379,7 @@ func (db *DB) compact() (changes bool, err error) {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-db.stopc:
|
case <-db.stopc:
|
||||||
return changes, nil
|
return nil
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
// The head has a compactable range if 1.5 level 0 ranges are between the oldest
|
// The head has a compactable range if 1.5 level 0 ranges are between the oldest
|
||||||
|
@ -402,14 +402,13 @@ func (db *DB) compact() (changes bool, err error) {
|
||||||
maxt: maxt - 1,
|
maxt: maxt - 1,
|
||||||
}
|
}
|
||||||
if _, err = db.compactor.Write(db.dir, head, mint, maxt, nil); err != nil {
|
if _, err = db.compactor.Write(db.dir, head, mint, maxt, nil); err != nil {
|
||||||
return changes, errors.Wrap(err, "persist head block")
|
return errors.Wrap(err, "persist head block")
|
||||||
}
|
}
|
||||||
changes = true
|
|
||||||
|
|
||||||
runtime.GC()
|
runtime.GC()
|
||||||
|
|
||||||
if err := db.reload(); err != nil {
|
if err := db.reload(); err != nil {
|
||||||
return changes, errors.Wrap(err, "reload blocks")
|
return errors.Wrap(err, "reload blocks")
|
||||||
}
|
}
|
||||||
runtime.GC()
|
runtime.GC()
|
||||||
}
|
}
|
||||||
|
@ -418,7 +417,7 @@ func (db *DB) compact() (changes bool, err error) {
|
||||||
for {
|
for {
|
||||||
plan, err := db.compactor.Plan(db.dir)
|
plan, err := db.compactor.Plan(db.dir)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return changes, errors.Wrap(err, "plan compaction")
|
return errors.Wrap(err, "plan compaction")
|
||||||
}
|
}
|
||||||
if len(plan) == 0 {
|
if len(plan) == 0 {
|
||||||
break
|
break
|
||||||
|
@ -426,23 +425,22 @@ func (db *DB) compact() (changes bool, err error) {
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-db.stopc:
|
case <-db.stopc:
|
||||||
return changes, nil
|
return nil
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := db.compactor.Compact(db.dir, plan...); err != nil {
|
if _, err := db.compactor.Compact(db.dir, plan...); err != nil {
|
||||||
return changes, errors.Wrapf(err, "compact %s", plan)
|
return errors.Wrapf(err, "compact %s", plan)
|
||||||
}
|
}
|
||||||
changes = true
|
|
||||||
runtime.GC()
|
runtime.GC()
|
||||||
|
|
||||||
if err := db.reload(); err != nil {
|
if err := db.reload(); err != nil {
|
||||||
return changes, errors.Wrap(err, "reload blocks")
|
return errors.Wrap(err, "reload blocks")
|
||||||
}
|
}
|
||||||
runtime.GC()
|
runtime.GC()
|
||||||
}
|
}
|
||||||
|
|
||||||
return changes, nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (db *DB) getBlock(id ulid.ULID) (*Block, bool) {
|
func (db *DB) getBlock(id ulid.ULID) (*Block, bool) {
|
||||||
|
|
|
@ -1131,7 +1131,7 @@ func TestChunkAtBlockBoundary(t *testing.T) {
|
||||||
err := app.Commit()
|
err := app.Commit()
|
||||||
testutil.Ok(t, err)
|
testutil.Ok(t, err)
|
||||||
|
|
||||||
_, err = db.compact()
|
err = db.compact()
|
||||||
testutil.Ok(t, err)
|
testutil.Ok(t, err)
|
||||||
|
|
||||||
for _, block := range db.blocks {
|
for _, block := range db.blocks {
|
||||||
|
@ -1183,7 +1183,7 @@ func TestQuerierWithBoundaryChunks(t *testing.T) {
|
||||||
err := app.Commit()
|
err := app.Commit()
|
||||||
testutil.Ok(t, err)
|
testutil.Ok(t, err)
|
||||||
|
|
||||||
_, err = db.compact()
|
err = db.compact()
|
||||||
testutil.Ok(t, err)
|
testutil.Ok(t, err)
|
||||||
|
|
||||||
testutil.Assert(t, len(db.blocks) >= 3, "invalid test, less than three blocks in DB")
|
testutil.Assert(t, len(db.blocks) >= 3, "invalid test, less than three blocks in DB")
|
||||||
|
|
Loading…
Reference in New Issue