From 3014733b2098e6cdb26a57e9cd4afddef4f77786 Mon Sep 17 00:00:00 2001 From: Jeff Wendling Date: Tue, 22 Jan 2019 10:31:35 -0700 Subject: [PATCH] chore: fix staticcheck issues --- storage/retention.go | 7 ++++-- storage/series_iterator.go | 46 -------------------------------------- tsdb/tsm1/engine.go | 4 ---- tsdb/tsm1/engine_test.go | 27 ---------------------- 4 files changed, 5 insertions(+), 79 deletions(-) delete mode 100644 storage/series_iterator.go diff --git a/storage/retention.go b/storage/retention.go index 3951b4d7e3..72b908981c 100644 --- a/storage/retention.go +++ b/storage/retention.go @@ -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)) } } diff --git a/storage/series_iterator.go b/storage/series_iterator.go deleted file mode 100644 index 48f28dfc41..0000000000 --- a/storage/series_iterator.go +++ /dev/null @@ -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 } diff --git a/tsdb/tsm1/engine.go b/tsdb/tsm1/engine.go index de37de6b55..fbe751397b 100644 --- a/tsdb/tsm1/engine.go +++ b/tsdb/tsm1/engine.go @@ -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 ) diff --git a/tsdb/tsm1/engine_test.go b/tsdb/tsm1/engine_test.go index b8f86d6d0d..26e94b5e8e 100644 --- a/tsdb/tsm1/engine_test.go +++ b/tsdb/tsm1/engine_test.go @@ -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 -}