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

eval & others nodes add fields to wrong point when in batch #1379

Closed
phemmer opened this issue May 16, 2017 · 2 comments
Closed

eval & others nodes add fields to wrong point when in batch #1379

phemmer opened this issue May 16, 2017 · 2 comments
Assignees
Labels

Comments

@phemmer
Copy link

phemmer commented May 16, 2017

Input data:

test v=1i 0s
test v=2i 1s

Script:

var data = stream|from().measurement('test')
	|window().period(1s).every(0s)
data
	|eval(lambda: "v" + 1).keep().as('v_plus_one')
	|log()
data
	|eval(lambda: "v" + 2).keep().as('v_plus_two')
	|log()

Output:

[test.tick:log4] 2017/05/16 10:52:22 I!  {"name":"test","tmax":"1970-01-01T00:00:00Z","points":[{"time":"1970-01-01T00:00:00Z","fields":{"v":1,"v_plus_two":3},"tags":{}}]}
[test.tick:log4] 2017/05/16 10:52:22 I!  {"name":"test","tmax":"1970-01-01T00:00:01Z","points":[{"time":"1970-01-01T00:00:01Z","fields":{"v":2,"v_plus_one":3,"v_plus_two":4},"tags":{}}]}
[test.tick:log6] 2017/05/16 10:52:22 I!  {"name":"test","tmax":"1970-01-01T00:00:00Z","points":[{"time":"1970-01-01T00:00:00Z","fields":{"v":1,"v_plus_two":3},"tags":{}}]}
[test.tick:log6] 2017/05/16 10:52:22 I!  {"name":"test","tmax":"1970-01-01T00:00:01Z","points":[{"time":"1970-01-01T00:00:01Z","fields":{"v":2,"v_plus_one":3,"v_plus_two":4},"tags":{}}]}

Notice that some of the points have both v_plus_one and v_plus_two, and that none of the points have just v_plus_one.
You may need to run this a few times as it is a race condition

I noticed this while fixing the map race reported in #1369. The design pattern in the stateDuration, eval, default node, and others results in a race as multiple nodes all end up iterating over the same Batch object, and thus add data to the wrong point.

@desa
Copy link
Contributor

desa commented May 17, 2017

@phemmer Good find. Any thoughts on what the expected behavior should be?

@desa desa added the bug label May 17, 2017
@phemmer
Copy link
Author

phemmer commented May 17, 2017

[test.tick:log4] 2017/05/16 10:52:22 I!  {"name":"test","tmax":"1970-01-01T00:00:00Z","points":[{"time":"1970-01-01T00:00:00Z","fields":{"v":1,"v_plus_one":2},"tags":{}}]}
[test.tick:log6] 2017/05/16 10:52:22 I!  {"name":"test","tmax":"1970-01-01T00:00:00Z","points":[{"time":"1970-01-01T00:00:00Z","fields":{"v":1,"v_plus_two":3},"tags":{}}]}
[test.tick:log4] 2017/05/16 10:52:22 I!  {"name":"test","tmax":"1970-01-01T00:00:01Z","points":[{"time":"1970-01-01T00:00:01Z","fields":{"v":2,"v_plus_one":3},"tags":{}}]}
[test.tick:log6] 2017/05/16 10:52:22 I!  {"name":"test","tmax":"1970-01-01T00:00:01Z","points":[{"time":"1970-01-01T00:00:01Z","fields":{"v":2,"v_plus_two":4},"tags":{}}]}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants