MINOR: clarify usage of stateful processor node - #5740
Conversation
vvcephei
left a comment
There was a problem hiding this comment.
@guozhangwang @mjsax @bbejeck ,
In light of the recent confusion about this class, I was thinking this change might help avoid it in the future.
There was a problem hiding this comment.
Having a separate method for getStatefulProcessorNode was unnecessary, so I've just inlined it to call the constructor directly instead. Perhaps that method did extra work in the past.
There was a problem hiding this comment.
This is the core change. Instead of having one constructor and a contract that callers should specify either names or a store builder and set the other to null is confusing. Instead, we'll have two constructors, one for names and the other for the store builder.
There was a problem hiding this comment.
This is an internal class, and the constructor is quite simple. Having a builder for it seems like extra code for no real gain. Plus, it makes it more difficult for callers to tell what arguments are expected.
There was a problem hiding this comment.
The compiler can't tell which constructor to call, so we cast null to pick one. It doesn't matter which, since this argument is never evaluated.
|
Failure unrelated. (spotbugs couldn't write to some local socket?) Retest this, please. |
There was a problem hiding this comment.
I agree having two separate constructors clears usage of StatefulProcessorNode up.
Maybe we could add some Javadoc comments that the constructor taking the StateStore parameter is for stateful operations that create a state store.
And the constructor taking storeNames is for stateful DSL methods process, transform and the other transform variants where the state store is already created (with a StreamsBuilder.addStateStore call) , and we pass in the names so the Processor can access the stores.
|
Waiting for jenkins to pass. |
|
Major hiccough in the core integration tests. Retest this, please. |
|
@vvcephei could you rebase please? |
|
@guozhangwang, It is rebased. |
|
Cherry-picked to 2.1 as well. |
|
Thank you! |
In recent PRs, we have been confused about the proper usage of StatefulProcessorNode (apache#5731 , apache#5737 ) This change disambiguates it. Reviewers: Matthias J. Sax <matthias@confluent.io>, Bill Bejeck <bill@confluent.io>, Guozhang Wang <guozhang@confluent.io>
In recent PRs, we have been confused about the proper usage of
StatefulProcessorNode (#5731 , #5737 )
This change disambiguates it.
Committer Checklist (excluded from commit message)