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

Copy batch points slice before modification #1389

Merged
merged 1 commit into from
May 19, 2017
Merged

Conversation

nathanielc
Copy link
Contributor

@nathanielc nathanielc commented May 19, 2017

Fixes #1379
The idea of this change is to shallow copy the batch points slice so that nodes which modify the batch points slice do not collide.

The existing code already takes care to copy the maps before modification, but that didn't matter since the underlying slice was shared. This change copies the slice to prevent those issues.

This is horrible :), I really dislike how this came together and we need a better way to manage copying/modifying data. My hope is that the migration to message passing #1319 will open up a way to manage this better. There is simply too much onus on each implementation of a node to keep everything straight and not introduce new bugs.

  • Rebased/mergable
  • Tests pass
  • CHANGELOG.md updated

@nathanielc nathanielc merged commit d2e0ee5 into master May 19, 2017
nathanielc added a commit that referenced this pull request May 19, 2017
Copy batch points slice before modification
@nathanielc nathanielc deleted the nc-issue#1379 branch May 19, 2017 15:46
@phemmer
Copy link

phemmer commented May 19, 2017

Looks like alert.go needs to be adjusted too. It's modifying b.Points without a copy: https://github.com/influxdata/kapacitor/blob/master/alert.go#L671-L691

@nathanielc
Copy link
Contributor Author

@phemmer Thanks see #1391

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.

3 participants