chore: fix staticcheck issues
parent
a424bf3e4c
commit
3014733b20
|
@ -14,7 +14,6 @@ import (
|
|||
|
||||
const (
|
||||
bucketAPITimeout = 10 * time.Second
|
||||
engineAPITimeout = time.Minute
|
||||
)
|
||||
|
||||
// A Deleter implementation is capable of deleting data from a storage engine.
|
||||
|
@ -95,7 +94,7 @@ func (s *retentionEnforcer) run() {
|
|||
// Any series data that (1) belongs to a bucket in the provided list and
|
||||
// (2) falls outside the bucket's indicated retention period will be deleted.
|
||||
func (s *retentionEnforcer) expireData(buckets []*platform.Bucket, now time.Time) error {
|
||||
_, logEnd := logger.NewOperation(s.logger, "Data deletion", "data_deletion")
|
||||
logger, logEnd := logger.NewOperation(s.logger, "Data deletion", "data_deletion")
|
||||
defer logEnd()
|
||||
|
||||
for _, b := range buckets {
|
||||
|
@ -107,6 +106,10 @@ func (s *retentionEnforcer) expireData(buckets []*platform.Bucket, now time.Time
|
|||
err := s.Engine.DeleteBucketRange(b.OrganizationID, b.ID, math.MinInt64, max)
|
||||
if err != nil {
|
||||
// TODO(jeff): metrics?
|
||||
logger.Info("unable to delete bucket range",
|
||||
zap.String("bucket id", b.ID.String()),
|
||||
zap.String("org id", b.OrganizationID.String()),
|
||||
zap.Error(err))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,46 +0,0 @@
|
|||
package storage
|
||||
|
||||
import (
|
||||
"github.com/influxdata/influxdb/models"
|
||||
"github.com/influxdata/influxdb/tsdb"
|
||||
"github.com/influxdata/influxql"
|
||||
)
|
||||
|
||||
// fixedSeriesIterator is a tsdb.SeriesIterator over a given set of keys.
|
||||
type fixedSeriesIterator struct{ keys [][]byte }
|
||||
|
||||
// newFixedSeriesIterator returns a tsdb.SeriesIterator over the given set of keys.
|
||||
func newFixedSeriesIterator(keys [][]byte) *fixedSeriesIterator {
|
||||
return &fixedSeriesIterator{
|
||||
keys: keys,
|
||||
}
|
||||
}
|
||||
|
||||
// Close is required for the tsdb.SeriesIterator interface.
|
||||
func (i *fixedSeriesIterator) Close() error { return nil }
|
||||
|
||||
// Next advances the iterator and returns the current element.
|
||||
func (i *fixedSeriesIterator) Next() (tsdb.SeriesElem, error) {
|
||||
if len(i.keys) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
key := i.keys[0]
|
||||
i.keys = i.keys[1:]
|
||||
|
||||
name, tags := models.ParseKeyBytes(key)
|
||||
return &fixedSeriesIteratorElem{
|
||||
name: name,
|
||||
tags: tags,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// fixedSeriesIteratorElem imlements tsdb.SeriesElem but only the name and tags.
|
||||
type fixedSeriesIteratorElem struct {
|
||||
name []byte
|
||||
tags models.Tags
|
||||
}
|
||||
|
||||
func (i *fixedSeriesIteratorElem) Name() []byte { return i.name }
|
||||
func (i *fixedSeriesIteratorElem) Tags() models.Tags { return i.tags }
|
||||
func (i *fixedSeriesIteratorElem) Deleted() bool { return false }
|
||||
func (i *fixedSeriesIteratorElem) Expr() influxql.Expr { return nil }
|
|
@ -37,7 +37,6 @@ import (
|
|||
var (
|
||||
// Static objects to prevent small allocs.
|
||||
keyFieldSeparatorBytes = []byte(keyFieldSeparator)
|
||||
emptyBytes = []byte{}
|
||||
)
|
||||
|
||||
var (
|
||||
|
@ -63,9 +62,6 @@ const (
|
|||
// that identifies a specific field in series
|
||||
keyFieldSeparator = "#!~#"
|
||||
|
||||
// deleteFlushThreshold is the size in bytes of a batch of series keys to delete.
|
||||
deleteFlushThreshold = 50 * 1024 * 1024
|
||||
|
||||
// MaxPointsPerBlock is the maximum number of points in an encoded block in a TSM file
|
||||
MaxPointsPerBlock = 1000
|
||||
)
|
||||
|
|
|
@ -518,30 +518,3 @@ func (m *mockPlanner) Release(groups []tsm1.CompactionGroup) {}
|
|||
func (m *mockPlanner) FullyCompacted() bool { return false }
|
||||
func (m *mockPlanner) ForceFull() {}
|
||||
func (m *mockPlanner) SetFileStore(fs *tsm1.FileStore) {}
|
||||
|
||||
type seriesIterator struct {
|
||||
keys [][]byte
|
||||
}
|
||||
|
||||
type series struct {
|
||||
name []byte
|
||||
tags models.Tags
|
||||
deleted bool
|
||||
}
|
||||
|
||||
func (s series) Name() []byte { return s.name }
|
||||
func (s series) Tags() models.Tags { return s.tags }
|
||||
func (s series) Deleted() bool { return s.deleted }
|
||||
func (s series) Expr() influxql.Expr { return nil }
|
||||
|
||||
func (itr *seriesIterator) Close() error { return nil }
|
||||
|
||||
func (itr *seriesIterator) Next() (tsdb.SeriesElem, error) {
|
||||
if len(itr.keys) == 0 {
|
||||
return nil, nil
|
||||
}
|
||||
name, tags := models.ParseKeyBytes(itr.keys[0])
|
||||
s := series{name: name, tags: tags}
|
||||
itr.keys = itr.keys[1:]
|
||||
return s, nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue