MCPcopy
hub / github.com/grafana/tempo / openForIteration

Method openForIteration

tempodb/encoding/vparquet4/block_iterator.go:19–39  ·  view source on GitHub ↗

openForIteration opens and returns the parquet file. Note that this is currently only used for compaction and is tuned for this kind of workload. In particular it uses the tempo_io.BufferedReaderAt which is slower but uses less memory and incurs fewer backend calls.

(ctx context.Context)

Source from the content-addressed store, hash-verified

17// openForIteration opens and returns the parquet file. Note that this is currently only used for compaction and is tuned for this kind of workload.
18// In particular it uses the tempo_io.BufferedReaderAt which is slower but uses less memory and incurs fewer backend calls.
19func (b *backendBlock) openForIteration(ctx context.Context) (*parquet.File, *parquet.Reader, error) { //nolint:all //deprecated
20 rr := NewBackendReaderAt(ctx, b.r, DataFileName, b.meta)
21
22 // 128 MB memory buffering
23 br := tempo_io.NewBufferedReaderAt(rr, int64(b.meta.Size_), 2*1024*1024, 64)
24
25 o := []parquet.FileOption{
26 parquet.SkipBloomFilters(true),
27 parquet.SkipPageIndex(true),
28 parquet.FileSchema(parquetSchema),
29 parquet.FileReadMode(parquet.ReadModeAsync),
30 }
31
32 pf, err := parquet.OpenFile(br, int64(b.meta.Size_), o...)
33 if err != nil {
34 return nil, nil, err
35 }
36
37 r := parquet.NewReader(pf, parquet.SchemaOf(&Trace{}))
38 return pf, r, nil
39}
40
41func (b *backendBlock) rawIter(ctx context.Context, pool *rowPool) (*rawIterator, error) {
42 pf, r, err := b.openForIteration(ctx)

Callers 1

rawIterMethod · 0.95

Calls 1

NewBackendReaderAtFunction · 0.70

Tested by

no test coverage detected