KAFKA-7075: Allow Topology#addGlobalStore to add a window store#5725
KAFKA-7075: Allow Topology#addGlobalStore to add a window store#5725lmontrieux wants to merge 8 commits intoapache:trunkfrom
Conversation
|
@guozhangwang since you reported the bug in Jira, would you like to have a look at this PR? |
|
retest this please |
mjsax
left a comment
There was a problem hiding this comment.
Thanks for the PR. Some comments.
There was a problem hiding this comment.
Does the cast make sense? addGlobalStore has not generic type any more and thus the type cannot be checked anyway?
There was a problem hiding this comment.
I guess you are right. The cast was useful when addGlobalStore still had a generic type, as it would refuse to compile. I should have removed it.
There was a problem hiding this comment.
Do we need MockWindowStoreBuilder and MockWindowStore ? Can't we just use Mockito ?
There was a problem hiding this comment.
We could use Mockito. I went for EasyMock as there were already MockKeyValueStoreBuilder and MockKeyValueStore, so it seemed like a nice fit, at least for someone who, like me, is only getting started with the Kafka code. I since saw discussions about using Mockito instead of EasyMock on the mailing list, and I agree that it makes sense to use Mockito.
There was a problem hiding this comment.
Actually I can't seem to find any use of mockito anywhere in this repo, so perhaps it is better to stick with easymock for this PR? What do you think?
There was a problem hiding this comment.
That's fine -- it's just about avoiding own mock classes.
bbejeck
left a comment
There was a problem hiding this comment.
@lmontrieux thanks for the contribution.
In my mind, one of the reasons the addGlobalStore method accepts a KeyValueStore is Streams doesn't need to know anything about the data since the data from the backing topic is in key-value pairs already. So loading the global store is just a matter of put(key, value).
Can discuss how the loading of a windowed GlobalStore would work? Maybe provide an integration test as well?
|
@bbejeck Note, that when adding a global store, user also provides the corresponding processor. This method is at Processor API level and it's the users responsibility to implement the Adding an integration test is always a good idea of course :) |
@mjsax hhanks for the clarification. As soon as I read your comment I realized that I knew that, but it slipped my mind at the moment. Personal confusion aside, I agree with you that an integration test is still worthwhile. |
|
Hi, @lmontrieux are you still working on this PR? |
|
Hi @bbejeck , |
|
Hi @lmontrieux no need to apologize! Just checking in and thanks again for contributing! |
|
@lmontrieux Are you still interested in working on this? |
|
Actually, looking at the latest trunk, I think the enforced types have already been resolved, but we still need this PR for adding the @lmontrieux could you rebase your PR and then only leave the test / mocks in place, and run them to see if they pass? If yes, we can go ahead and review / merge this PR still. |
|
@guozhangwang sure, I'll do that |
|
Thank you! |
|
Wow, I did something wrong. Will fix it. |
f7b368b to
d92ab5f
Compare
d92ab5f to
37a287a
Compare
…com:lmontrieux/kafka into KAFKA-7075-addGlobalStore-with-window-store
|
Some warnings are causing the build to fail, I'll have a look |
|
@lmontrieux Any updates on this PR? |
|
@mjsax now all tests are passing. I'll update the PR description to reflect that this only adds unit tests. |
|
\cc @mjsax for a second review |
|
The original ticket claims, that it's not possible to add a non-kv-store as global store? This PR adds test that proof the ticket wrong? Or was it fixed with a different PR? |
|
Seems this was fixed via #5779 Should we close the ticket as "contained by" and merge this as MINOR PR instead? |
| @Test | ||
| public void shouldAllowAddGlobalStoreWithNonKVStore() { | ||
| final StoreBuilder windowStoreBuilder = new MockWindowStoreBuilder("store", false); | ||
| builder.addGlobalStore(windowStoreBuilder.withLoggingDisabled(), |
There was a problem hiding this comment.
The signature of addGlobalStore accepts any StoreBuilder, thus I am wondering if we should switch to pass in a TestStateStoreBuilder that returns StateStore instead of a WindowedStore?
I am also thinking if we should add an test using TopologyTestDriver to verify that a TestStateStore can be used as global store?
There was a problem hiding this comment.
Makes sense, I'll update the PR accordingly
SGTM. @lmontrieux can you respond to @mjsax's comments? |
Yes, makes sense to me. |
|
@lmontrieux what's status of this PR? Once you address the latest comments we can get this merged. Thanks! |
|
@lmontrieux -- just cycling back to this PR. Are you still interesting? Seems the PR would need a rebase and there a some open comments to address. |
|
Closing this old PR due to inactivity. |
|
@mjsax, do you think this PR is still needed? If yes, and if @lmontrieux agrees, I could assume this work. |
|
@fonsdant I am not 100% sure -- guess it should not be too hard to write a small unit test for it (or first check if one might already exist)? If the unit test passed, we know it's not an issue any longer (and we could close some testing gap). If it's still a problem feel free to pick it up. This PR was close 2 years ago, and nobody is working on this. |
InternalTopologyBuilder#addGlobalStorehas no tests for stores other thanKeyValueStore. This PR adds a new unit test to show that a StoreBuilder can be used in InternalTopologyBuilder#addGlobalStore. This required creating two new mocks,MockWindowStoreandMockWindowStoreBuilder, modelled onMockKeyValueStoreandMockKeyValueStoreBuilder, respectively.Committer Checklist (excluded from commit message)