(ctx context.Context, id common.ID)
| 34 | ) |
| 35 | |
| 36 | func (b *backendBlock) checkBloom(ctx context.Context, id common.ID) (found bool, err error) { |
| 37 | derivedCtx, span := tracer.Start(ctx, "parquet.backendBlock.checkBloom", |
| 38 | trace.WithAttributes( |
| 39 | attribute.String("blockID", b.meta.BlockID.String()), |
| 40 | attribute.String("tenantID", b.meta.TenantID), |
| 41 | )) |
| 42 | defer span.End() |
| 43 | |
| 44 | shardKey := common.ShardKeyForTraceID(id, int(b.meta.BloomShardCount)) |
| 45 | nameBloom := common.BloomName(shardKey) |
| 46 | span.SetAttributes(attribute.String("bloom", nameBloom)) |
| 47 | |
| 48 | bloomBytes, err := b.r.Read(derivedCtx, nameBloom, (uuid.UUID)(b.meta.BlockID), b.meta.TenantID, &backend.CacheInfo{ |
| 49 | Meta: b.meta, |
| 50 | Role: cache.RoleBloom, |
| 51 | }) |
| 52 | if err != nil { |
| 53 | return false, fmt.Errorf("error retrieving bloom %s (%s, %s): %w", nameBloom, b.meta.TenantID, b.meta.BlockID, err) |
| 54 | } |
| 55 | |
| 56 | filter := &bloom.BloomFilter{} |
| 57 | _, err = filter.ReadFrom(bytes.NewReader(bloomBytes)) |
| 58 | if err != nil { |
| 59 | return false, fmt.Errorf("error parsing bloom (%s, %s): %w", b.meta.TenantID, b.meta.BlockID, err) |
| 60 | } |
| 61 | |
| 62 | return filter.Test(id), nil |
| 63 | } |
| 64 | |
| 65 | func (b *backendBlock) checkIndex(ctx context.Context, id common.ID) (bool, int, error) { |
| 66 | if os.Getenv(EnvVarIndexName) != EnvVarIndexEnabledValue { |
no test coverage detected