fix context.forward() using a stack of nodes#21
Merged
Conversation
There was a problem hiding this comment.
MockProcessorContext have the same logic for a bunch of the functions as ProcessorContextImpl, so share we just make it implement the interface while extending ProcessorContextImpl and just override other functions?
Author
There was a problem hiding this comment.
Yeah, I am thinking of extracting common methods out for sharing. But I oppose to extend ProcessContextImpl because ProcessContextImpl has more dependencies.
|
One minor comment, otherwise LGTM. |
ymatsuda
added a commit
that referenced
this pull request
Aug 28, 2015
fix context.forward() using a stack of nodes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Guozhang Wang (@guozhangwang)
flatMap, flatMapValue and join were broken due to the way context.forward() sets the current node. Any processor that calls forward() multiple times in a single process() call doesn't work since after calling childNode.process() the current node is set to childNode and forget the original caller node. After forward(), the "current node" is one of the children, thus subsequent forward() propagates KV to wrong nodes. My solution is use a stack to remember the call hierarchy and set to the correct node after childNode.process(). This is done in ProcessorContextImpl (and MockProcessorContext for testing)
joinPrior is removed. We can revisit it if necessary.
join is now implemented using three processors. Originally I though two are enough. But I realized I need the third one since the processor cannot freely control the recipient of forward().