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

Ensure correct number of tags parsed when commas used #9573

Merged
merged 1 commit into from
Mar 14, 2018
Merged

Conversation

e-dard
Copy link
Contributor

@e-dard e-dard commented Mar 14, 2018

Fixes #9545.

This PR fixes a parsing bug that was causing extra tags to be
generated when the incoming point contained escaped commas.

As an optimisation, the slice of tags associated with a point was
being pre-allocated using the number of commas in the series key as a hint to
the appropriate size. The hinting did not consider literal comma values in
the key though, and so it was possible for extra (empty) tag key and
value pairs to be part of the tags structure associated with a parsed
point.

The fix here is simply to pre-allocate the capacity (which is the upper bound on the maximum number of tag pairs), and then to use the slightly slower append, rather than index into the slice directly.

I think this will still be faster than parsing the key to determine the true number of tag pairs and then pre-allocating the slice using the index approach.

This commit fixes a parsing bug that was causing extra tags to be
generated when the incoming point contained escaped commas.

As an optimisation, the slice of tags associated with a point was
being pre-allocated using the number of commas in the series key as a hint to
the appropriate size. The hinting did not consider literal comma values in
the key though, and so it was possible for extra (empty) tag key and
value pairs to be part of the tags structure associated with a parsed
point.
@e-dard e-dard added this to the 1.5.1 milestone Mar 14, 2018
@ghost ghost assigned e-dard Mar 14, 2018
@ghost ghost added the review label Mar 14, 2018
Copy link
Contributor

@stuartcarnie stuartcarnie left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@e-dard e-dard merged commit 3e7c80d into master Mar 14, 2018
@ghost ghost removed the review label Mar 14, 2018
@e-dard e-dard deleted the er-tag-parsing branch March 14, 2018 17:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

show tag keys returns empty rows
3 participants