Skip to content

fix context.forward() using a stack of nodes#21

Merged
ymatsuda merged 1 commit into
confluentinc:streamingfrom
ymatsuda:streaming
Aug 28, 2015
Merged

fix context.forward() using a stack of nodes#21
ymatsuda merged 1 commit into
confluentinc:streamingfrom
ymatsuda:streaming

Conversation

@ymatsuda

Copy link
Copy Markdown

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().

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yeah, I am thinking of extracting common methods out for sharing. But I oppose to extend ProcessContextImpl because ProcessContextImpl has more dependencies.

@guozhangwang

Copy link
Copy Markdown

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
@ymatsuda ymatsuda merged commit 06536c9 into confluentinc:streaming Aug 28, 2015
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