Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

service/search: ignore request span if pool has no span #2745

Merged
merged 1 commit into from
May 20, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion service/search/search.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func (s *SearchOp) Run(ctx context.Context, adaptor proc.DataAdaptor, pool *lake
scanOrder = "desc"
}
var scanRange *ast.Range
if s.query.Span.Dur != 0 {
if s.query.Span.Dur != 0 && poolHasSpan(ctx, pool) {
scanRange = &ast.Range{
Kind: "Range",
Lower: &zed.Primitive{
Expand Down Expand Up @@ -132,6 +132,18 @@ func (s *SearchOp) Run(ctx context.Context, adaptor proc.DataAdaptor, pool *lake
return driver.RunWithLakeAndStats(ctx, d, seq, zctx, adaptor, statsTicker.C, s.logger, parallelism)
}

func poolHasSpan(ctx context.Context, pool *lake.Pool) bool {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can just check len(pool.Layout.Keys) == 0

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That'll break the app in a different way since it currently creates pools with no key.

snap, err := pool.Log().Head(ctx)
if err != nil {
return false
}
info, err := pool.Info(ctx, snap)
if err != nil {
return false
}
return info.Span != nil
}

// A Query is the internal representation of search query describing a source
// of tuples, a "search" applied to the tuples producing a set of matched
// tuples, and a proc to the process the tuples
Expand Down