Skip to content

Return an empty iterator when no chunks are present#1355

Closed
gouthamve wants to merge 1 commit intocortexproject:masterfrom
gouthamve:fix-panic
Closed

Return an empty iterator when no chunks are present#1355
gouthamve wants to merge 1 commit intocortexproject:masterfrom
gouthamve:fix-panic

Conversation

@gouthamve
Copy link
Contributor

Fixes: #1354

Signed-off-by: Goutham Veeramachaneni <gouthamve@gmail.com>
@gouthamve gouthamve requested a review from bboreham April 29, 2019 13:00
}

// emptyIterator has no samples.
type emptyIterator struct{}
Copy link
Contributor

Choose a reason for hiding this comment

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

How about using NewNopIterator() from TSDB instead of this?
AFAICS only Batch() would behave differently, and that might indicate a bug.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

NewNopIterator() returns a tsdb.Iterator as seen here: https://github.com/prometheus/tsdb/blob/719b57db44f5e5dbad7d813a5645c222c3ba7647/chunkenc/chunk.go#L55-L65

Not sure how it'll be simpler to use that than just add a few lines here.

Copy link
Contributor

Choose a reason for hiding this comment

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

because then you won't add any lines here?

I'm pretty sure it returns a chunkenc.Iterator, i.e. it fits in curr.

Copy link
Contributor

Choose a reason for hiding this comment

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

I created #1461 to make clear what I meant.

@bboreham
Copy link
Contributor

Closed in favour of #1461

@bboreham bboreham closed this Jul 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic in querier

2 participants