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 infinite loop in the histogram reduce logic. #7022

Closed
wants to merge 2 commits into from

Conversation

jpountz
Copy link
Contributor

@jpountz jpountz commented Jul 24, 2014

The histogram reduce method can run into an infinite loop if the
Rounding.nextRoundingValue value is buggy, which happened to be the case for
DayTimeZoneRoundingFloor.

DayTimeZoneRoundingFloor is fixed, and the histogram reduce method has been
changed to fail instead of running into an infinite loop in case of a buffy
nextRoundingValue impl.

Close #6965

The histogram reduce method can run into an infinite loop if the
Rounding.nextRoundingValue value is buggy, which happened to be the case for
DayTimeZoneRoundingFloor.

DayTimeZoneRoundingFloor is fixed, and the histogram reduce method has been
changed to fail instead of running into an infinite loop in case of a buffy
nextRoundingValue impl.

Close elastic#6965
@jpountz jpountz added the review label Jul 24, 2014
@@ -162,7 +162,7 @@ public long valueForKey(long time) {

@Override
public long nextRoundingValue(long value) {
return unit.field().roundCeiling(value + 1);
return unit.field().getDurationField().add(value, 1);
Copy link
Contributor

Choose a reason for hiding this comment

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

does it make sense to assign this unit.field().getDurationField() to a field?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, will do

@s1monw
Copy link
Contributor

s1monw commented Jul 29, 2014

I think this LGTM - left a minor comment

@s1monw s1monw removed the review label Jul 29, 2014
@jpountz
Copy link
Contributor Author

jpountz commented Jul 29, 2014

@s1monw I pushed a commit that should address your comment.

@jpountz jpountz added review and removed review labels Jul 29, 2014
@jpountz jpountz closed this Aug 1, 2014
@jpountz jpountz deleted the fix/histogram_infinite_loop branch August 1, 2014 07:09
@clintongormley clintongormley changed the title Aggregations: Fix infinite loop in the histogram reduce logic. Fix infinite loop in the histogram reduce logic. Jun 7, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[date_histogram aggregation] OutOfMemoryError when using "time_zone" attribute
3 participants