Skip to content

[STORM-3589] Prevent inconsistent results from consecutive hasNext and next calls in LazyNodeSortingIterator#3216

Merged
Ethanlm merged 1 commit intoapache:masterfrom
RuiLi8080:STORM-3589
Feb 27, 2020
Merged

[STORM-3589] Prevent inconsistent results from consecutive hasNext and next calls in LazyNodeSortingIterator#3216
Ethanlm merged 1 commit intoapache:masterfrom
RuiLi8080:STORM-3589

Conversation

@RuiLi8080
Copy link
Contributor

Prevent the problem that consecutive hasNext() calls will lose elements in nodeIterator without using it.

Prevent the problem that consecutive next() calls will skip to post iterator since nextValueFromNode is null even if nodeIterator still have available elements.

@Ethanlm
Copy link
Contributor

Ethanlm commented Feb 26, 2020

Good catch. But I think there is a bug in this code:

first assume pre and post are both empty to simplify discussion.

if every node is in the skip list, the first call of hasNext will return false (which is correct), the second call of hasNext will return true since nextValueFromNode is no longer null

@RuiLi8080
Copy link
Contributor Author

@Ethanlm Wow sorry for overlook this. Thanks for pointing out. Fixed and force pushed.

Copy link
Contributor

@Ethanlm Ethanlm left a comment

Choose a reason for hiding this comment

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

+1 Thanks for the quick fix

@Ethanlm Ethanlm merged commit a595c67 into apache:master Feb 27, 2020
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.

2 participants