mirror of
https://github.com/prometheus/prometheus.git
synced 2025-03-05 20:59:13 -08:00
Address feedback.
This commit is contained in:
parent
58dab3de8a
commit
ffd281ab9d
|
@ -601,12 +601,12 @@ func (c *LeveledCompactor) write(dest string, outBlocks []shardedBlock, blocks .
|
||||||
defer func(t time.Time) {
|
defer func(t time.Time) {
|
||||||
err = tsdb_errors.NewMulti(err, tsdb_errors.CloseAll(closers)).Err()
|
err = tsdb_errors.NewMulti(err, tsdb_errors.CloseAll(closers)).Err()
|
||||||
|
|
||||||
// RemoveAll returns no error when tmp doesn't exist so it is safe to always run it.
|
|
||||||
for _, ob := range outBlocks {
|
for _, ob := range outBlocks {
|
||||||
if ob.tmpDir == "" {
|
if ob.tmpDir == "" {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// RemoveAll returns no error when tmp doesn't exist so it is safe to always run it.
|
||||||
if err := os.RemoveAll(ob.tmpDir); err != nil {
|
if err := os.RemoveAll(ob.tmpDir); err != nil {
|
||||||
level.Error(c.logger).Log("msg", "removed tmp folder after failed compaction", "err", err.Error())
|
level.Error(c.logger).Log("msg", "removed tmp folder after failed compaction", "err", err.Error())
|
||||||
}
|
}
|
||||||
|
@ -661,12 +661,15 @@ func (c *LeveledCompactor) write(dest string, outBlocks []shardedBlock, blocks .
|
||||||
outBlocks[ix].indexw = indexw
|
outBlocks[ix].indexw = indexw
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We use MinTime and MaxTime from first output block, because ALL output blocks have the same min/max times set.
|
||||||
if err := c.populateBlock(blocks, outBlocks[0].meta.MinTime, outBlocks[0].meta.MaxTime, outBlocks); err != nil {
|
if err := c.populateBlock(blocks, outBlocks[0].meta.MinTime, outBlocks[0].meta.MaxTime, outBlocks); err != nil {
|
||||||
return errors.Wrap(err, "populate block")
|
return errors.Wrap(err, "populate block")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := c.ctx.Err(); err != nil {
|
select {
|
||||||
return err
|
case <-c.ctx.Done():
|
||||||
|
return c.ctx.Err()
|
||||||
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
// We are explicitly closing them here to check for error even
|
// We are explicitly closing them here to check for error even
|
||||||
|
@ -703,7 +706,7 @@ func (c *LeveledCompactor) write(dest string, outBlocks []shardedBlock, blocks .
|
||||||
}
|
}
|
||||||
defer func() {
|
defer func() {
|
||||||
if df != nil {
|
if df != nil {
|
||||||
_ = df.Close()
|
df.Close()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue