(ctx context.Context, id common.ID)
| 63 | } |
| 64 | |
| 65 | func (b *backendBlock) checkIndex(ctx context.Context, id common.ID) (bool, int, error) { |
| 66 | if os.Getenv(EnvVarIndexName) != EnvVarIndexEnabledValue { |
| 67 | // Index lookup disabled |
| 68 | return true, -1, nil |
| 69 | } |
| 70 | |
| 71 | derivedCtx, span := tracer.Start(ctx, "parquet3.backendBlock.checkIndex", |
| 72 | trace.WithAttributes( |
| 73 | attribute.String("blockID", b.meta.BlockID.String()), |
| 74 | attribute.String("tenantID", b.meta.TenantID), |
| 75 | )) |
| 76 | defer span.End() |
| 77 | |
| 78 | indexBytes, err := b.r.Read(derivedCtx, common.NameIndex, (uuid.UUID)(b.meta.BlockID), b.meta.TenantID, &backend.CacheInfo{ |
| 79 | Meta: b.meta, |
| 80 | Role: cache.RoleTraceIDIdx, |
| 81 | }) |
| 82 | if errors.Is(err, backend.ErrDoesNotExist) { |
| 83 | return true, -1, nil |
| 84 | } |
| 85 | if err != nil { |
| 86 | return false, -1, fmt.Errorf("error retrieving index (%s, %s): %w", b.meta.TenantID, b.meta.BlockID, err) |
| 87 | } |
| 88 | |
| 89 | index, err := unmarshalIndex(indexBytes) |
| 90 | if err != nil { |
| 91 | return false, -1, fmt.Errorf("error parsing index (%s, %s): %w", b.meta.TenantID, b.meta.BlockID, err) |
| 92 | } |
| 93 | |
| 94 | rowGroup := index.Find(id) |
| 95 | if rowGroup == -1 { |
| 96 | // Ruled out by index |
| 97 | return false, -1, nil |
| 98 | } |
| 99 | |
| 100 | return true, rowGroup, nil |
| 101 | } |
| 102 | |
| 103 | func (b *backendBlock) FindTraceByID(ctx context.Context, traceID common.ID, opts common.SearchOptions) (_ *tempopb.TraceByIDResponse, err error) { |
| 104 | derivedCtx, span := tracer.Start(ctx, "parquet.backendBlock.FindTraceByID", |
no test coverage detected