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

fix #1717: all points must have at least one field #1718

Merged
merged 2 commits into from
Feb 24, 2015
Merged

Conversation

dgnorton
Copy link
Contributor

No description provided.

// Make sure every point has at least one field.
for _, p := range points {
if len(p.Fields) == 0 {
return 0, fmt.Errorf("point %s has no fields", p.Name)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just return ErrFieldsRequired. In any event, cpu is a Measurement.

Copy link
Contributor

Choose a reason for hiding this comment

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

To be clear, ErrFieldsRequired already exists in the source.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, why not do this at line 1403? We are already walking the points there. Let's not walk at the top, then walk again.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At line 1403, the Measurements and ShardGroups have been created...they would have to be deleted. Or, we'd have to move creation of measurements and shard groups inside the loop and created them one at a time. Maybe that would give better performance?...not sure.

Copy link
Contributor

Choose a reason for hiding this comment

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

OK, I see what you mean. Ironically createMeasurementsIfNotExists also loops through the points and I wrote that.

Now that I see it, this function does a lot of stuff with a batch -- create shards, create series etc. It now seems to me you're on the right path, and that some basic validation of the batch is quite important before anything else happens. It kills me that we loop through the batch so many times. Oh well, we can profile it and see how it is, if it comes to it.

@pauldix
Copy link
Member

pauldix commented Feb 24, 2015

Update the changelog and address @otoolep's comment. Other than that LGTM.

@otoolep
Copy link
Contributor

otoolep commented Feb 24, 2015

Change makes sense, but it seems to me that the code should use the existing point-walking loop.

@otoolep
Copy link
Contributor

otoolep commented Feb 24, 2015

+1 on this change now, it's pretty important that the batch is sane before anything else happens.

@otoolep
Copy link
Contributor

otoolep commented Feb 24, 2015

+1, as long as the error code is fixed up, of course.

dgnorton added a commit that referenced this pull request Feb 24, 2015
fix #1717: all points must have at least one field
@dgnorton dgnorton merged commit ffcdf8e into master Feb 24, 2015
@dgnorton dgnorton deleted the fix-1717 branch February 24, 2015 21:27
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.

None yet

3 participants