Moves TSDB to the stores package. (#5852)

Signed-off-by: Cyril Tovena <cyril.tovena@gmail.com>
pull/5838/head
Cyril Tovena 3 years ago committed by GitHub
parent 3e17245743
commit 8c1095a554
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 0
      pkg/storage/stores/tsdb/bounds.go
  2. 0
      pkg/storage/stores/tsdb/bounds_test.go
  3. 2
      pkg/storage/stores/tsdb/compact.go
  4. 5
      pkg/storage/stores/tsdb/compact_test.go
  5. 2
      pkg/storage/stores/tsdb/index.go
  6. 0
      pkg/storage/stores/tsdb/index/builder.go
  7. 0
      pkg/storage/stores/tsdb/index/chunk.go
  8. 0
      pkg/storage/stores/tsdb/index/chunk_test.go
  9. 0
      pkg/storage/stores/tsdb/index/fingerprint.go
  10. 0
      pkg/storage/stores/tsdb/index/fingerprint_test.go
  11. 0
      pkg/storage/stores/tsdb/index/index.go
  12. 0
      pkg/storage/stores/tsdb/index/index_test.go
  13. 0
      pkg/storage/stores/tsdb/index/pool.go
  14. 0
      pkg/storage/stores/tsdb/index/postings.go
  15. 0
      pkg/storage/stores/tsdb/index/postings_test.go
  16. 0
      pkg/storage/stores/tsdb/index/postingsstats.go
  17. 0
      pkg/storage/stores/tsdb/index/postingsstats_test.go
  18. 0
      pkg/storage/stores/tsdb/index/shard.go
  19. 0
      pkg/storage/stores/tsdb/index/shard_test.go
  20. 0
      pkg/storage/stores/tsdb/index/test_utils.go
  21. 9
      pkg/storage/stores/tsdb/multi_file_index.go
  22. 4
      pkg/storage/stores/tsdb/multi_file_index_test.go
  23. 2
      pkg/storage/stores/tsdb/pool.go
  24. 2
      pkg/storage/stores/tsdb/querier.go
  25. 2
      pkg/storage/stores/tsdb/querier_test.go
  26. 4
      pkg/storage/stores/tsdb/single_file_index.go
  27. 3
      pkg/storage/stores/tsdb/single_file_index_test.go
  28. 0
      pkg/storage/stores/tsdb/testdata/20kseries.json
  29. 0
      pkg/storage/stores/tsdb/testutil/block_mock.go
  30. 0
      pkg/storage/stores/tsdb/testutil/objstore.go
  31. 2
      pkg/storage/stores/tsdb/util_test.go
  32. 2
      tools/tsdb/tsdb-map/main.go
  33. 4
      tools/tsdb/tsdb-map/main_test.go

@ -6,7 +6,7 @@ import (
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/model/labels"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
type Compactor struct {

@ -8,7 +8,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/require"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
func TestCompactor(t *testing.T) {
@ -382,9 +382,6 @@ func TestCompactor(t *testing.T) {
require.Nil(t, err)
require.Equal(t, tc.exp, res)
})
}
}

@ -6,7 +6,7 @@ import (
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/model/labels"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
type Series struct {

@ -9,7 +9,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"golang.org/x/sync/errgroup"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
type MultiIndex struct {
@ -97,7 +97,6 @@ func (i *MultiIndex) GetChunkRefs(ctx context.Context, userID string, from, thro
groups, err := i.forIndices(ctx, from, through, func(ctx context.Context, idx *TSDBIndex) (interface{}, error) {
return idx.GetChunkRefs(ctx, userID, from, through, nil, shard, matchers...)
})
if err != nil {
return nil, err
}
@ -121,7 +120,6 @@ func (i *MultiIndex) GetChunkRefs(ctx context.Context, userID string, from, thro
}
return res, nil
}
func (i *MultiIndex) Series(ctx context.Context, userID string, from, through model.Time, res []Series, shard *index.ShardAnnotation, matchers ...*labels.Matcher) ([]Series, error) {
@ -133,7 +131,6 @@ func (i *MultiIndex) Series(ctx context.Context, userID string, from, through mo
groups, err := i.forIndices(ctx, from, through, func(ctx context.Context, idx *TSDBIndex) (interface{}, error) {
return idx.Series(ctx, userID, from, through, nil, shard, matchers...)
})
if err != nil {
return nil, err
}
@ -160,7 +157,6 @@ func (i *MultiIndex) LabelNames(ctx context.Context, userID string, from, throug
groups, err := i.forIndices(ctx, from, through, func(ctx context.Context, idx *TSDBIndex) (interface{}, error) {
return idx.LabelNames(ctx, userID, from, through, matchers...)
})
if err != nil {
return nil, err
}
@ -190,14 +186,12 @@ func (i *MultiIndex) LabelNames(ctx context.Context, userID string, from, throug
}
return results, nil
}
func (i *MultiIndex) LabelValues(ctx context.Context, userID string, from, through model.Time, name string, matchers ...*labels.Matcher) ([]string, error) {
groups, err := i.forIndices(ctx, from, through, func(ctx context.Context, idx *TSDBIndex) (interface{}, error) {
return idx.LabelValues(ctx, userID, from, through, name, matchers...)
})
if err != nil {
return nil, err
}
@ -227,5 +221,4 @@ func (i *MultiIndex) LabelValues(ctx context.Context, userID string, from, throu
}
return results, nil
}

@ -8,7 +8,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/require"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
func TestMultiIndex(t *testing.T) {
@ -145,7 +145,6 @@ func TestMultiIndex(t *testing.T) {
expected := []string{"bozz", "buzz"}
require.Equal(t, expected, xs)
})
t.Run("LabelValuesWithMatchers", func(t *testing.T) {
@ -154,6 +153,5 @@ func TestMultiIndex(t *testing.T) {
expected := []string{"bozz"}
require.Equal(t, expected, xs)
})
}

@ -3,7 +3,7 @@ package tsdb
import (
"sync"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
var (

@ -22,7 +22,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/storage"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
// Bitmap used by func isRegexMetaCharacter to check whether a character needs to be escaped.

@ -8,7 +8,7 @@ import (
"github.com/stretchr/testify/require"
"github.com/grafana/loki/pkg/logql/syntax"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
func mustParseLabels(s string) labels.Labels {

@ -6,7 +6,7 @@ import (
"github.com/prometheus/common/model"
"github.com/prometheus/prometheus/model/labels"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
func LoadTSDBIdentifier(dir string, id index.Identifier) (*TSDBIndex, error) {
@ -20,7 +20,6 @@ func LoadTSDB(name string) (*TSDBIndex, error) {
}
return NewTSDBIndex(reader), nil
}
// nolint
@ -119,7 +118,6 @@ func (i *TSDBIndex) Series(_ context.Context, _ string, from, through model.Time
func(ls labels.Labels, fp model.Fingerprint, chks []index.ChunkMeta) {
// TODO(owen-d): use logarithmic approach
for _, chk := range chks {
if Overlap(queryBounds, chk) {
// this series has at least one chunk in the desired range
res = append(res, Series{

@ -8,7 +8,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/require"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
func TestSingleIdx(t *testing.T) {
@ -110,7 +110,6 @@ func TestSingleIdx(t *testing.T) {
End: 10,
Checksum: 3,
}}, shardedRefs)
})
t.Run("Series", func(t *testing.T) {

@ -7,7 +7,7 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/require"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
type LoadableSeries struct {

@ -13,7 +13,7 @@ import (
"github.com/grafana/loki/pkg/storage/config"
"github.com/grafana/loki/pkg/storage/stores/shipper/compactor/retention"
shipper_util "github.com/grafana/loki/pkg/storage/stores/shipper/util"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
var (

@ -11,8 +11,8 @@ import (
"github.com/prometheus/prometheus/model/labels"
"github.com/stretchr/testify/require"
"github.com/grafana/loki/pkg/storage/tsdb"
"github.com/grafana/loki/pkg/storage/tsdb/index"
"github.com/grafana/loki/pkg/storage/stores/tsdb"
"github.com/grafana/loki/pkg/storage/stores/tsdb/index"
)
func TestExtractChecksum(t *testing.T) {

Loading…
Cancel
Save