Skip to content

KAFKA-7420: Global store surrounded by read only implementation#5865

Merged
mjsax merged 9 commits intoapache:trunkfrom
nizhikov:KAFKA-7420
Dec 5, 2018
Merged

KAFKA-7420: Global store surrounded by read only implementation#5865
mjsax merged 9 commits intoapache:trunkfrom
nizhikov:KAFKA-7420

Conversation

@nizhikov
Copy link
Copy Markdown
Contributor

@nizhikov nizhikov commented Nov 1, 2018

Global store surrounded by read-only KeyValueStore implementation.
All methods that try to write into Store will throw UnsupportedOperationException

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Nov 1, 2018

Hello, @mjsax! Can you take a look at my changes?

@mjsax mjsax added the streams label Nov 1, 2018
@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Nov 1, 2018

Failure unrelated.
Retest this, please

1 similar comment
@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Nov 3, 2018

Failure unrelated.
Retest this, please

Copy link
Copy Markdown
Member

@mjsax mjsax left a comment

Choose a reason for hiding this comment

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

Thanks for the PR @nizhikov! We should add a new ProcessorContextImplTest -- would be even better, if we test all existing methods, too, to close this testing gap.

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Nov 4, 2018

Failure unrelated.
Retest this, please

@mjsax
Copy link
Copy Markdown
Member

mjsax commented Nov 4, 2018

@nizhikov We stabilized a couple of test recently. Can you rebase this PR? This should help to get green builds.

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Nov 4, 2018

@mjsax

We should add a new ProcessorContextImplTest

Please, tell me, what should be tested by this?

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Nov 5, 2018

Failure unrelated.
Retest this, please

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Nov 8, 2018

@mjsax

We should add a new ProcessorContextImplTest

Can you help me with this? What should be tested?

@mjsax
Copy link
Copy Markdown
Member

mjsax commented Nov 8, 2018

We should test, that if a globalstore is returned from the context, calling any of the protected methods throws an exception.

@nizhikov
Copy link
Copy Markdown
Contributor Author

@mjsax Test added. Please, review.

@nizhikov
Copy link
Copy Markdown
Contributor Author

Tests passed

@nizhikov
Copy link
Copy Markdown
Contributor Author

@mjsax Can you take a look at my changes?

@mjsax
Copy link
Copy Markdown
Member

mjsax commented Nov 20, 2018

Call for second review. Anyof @guozhangwang @bbejeck @vvcephei

Copy link
Copy Markdown
Member

@bbejeck bbejeck left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution @nizhikov!

Overall looks good, but I think we should get test coverage on the non-exception throwing methods from the KeyValueStore wrapper of the global store.

@nizhikov
Copy link
Copy Markdown
Contributor Author

@bbejeck Thank you for the review.

I've added tests for non-exception methods of KeyValueStore.
Please, take a look.

@mjsax
Copy link
Copy Markdown
Member

mjsax commented Nov 21, 2018

Build failed with a checkstyle error

Copy link
Copy Markdown
Member

@bbejeck bbejeck left a comment

Choose a reason for hiding this comment

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

@nizhikov thanks for the updated tests, LGTM pending the checkstyle fix

@nizhikov
Copy link
Copy Markdown
Contributor Author

@mjsax
@bbejeck

Thanks for the review.

Build failed with a checkstyle error
LGTM pending the checkstyle fix

🤦‍♂️ Sorry about that. Fixed

@nizhikov
Copy link
Copy Markdown
Contributor Author

Tests passed. Can we merge this PR?

Copy link
Copy Markdown
Member

@mjsax mjsax left a comment

Choose a reason for hiding this comment

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

I was just about to merge this PR, but I suddenly have doubts about the correctness. For global stores, we do not dictate that it must be a KeyValueStore (only for GlobalKTables) if I am not wrong.

Thus, if somebody uses a custom store, the cast into a KeyValueStore in L79 would fail and we would crash.

For library provided stores, it's only possible to use a KeyValueStore though (WindowStore and SessionStores are not supported for the provided default implementations). However, users could also use custom implementation of WindowStore or SessionStore -- the problem is not with the interfaces, but with the implementation of the or built-in window/session store.

Thus, I think, we need to check the type of the global store, and wrap it accordingly if it implements one of the three store interfaces. The store type might also so unknown, and for this case we need to return the store as-is.

Does this make sense?

It would be great to add test for all those cases.

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Nov 22, 2018

Thus, I think, we need to check the type of the global store, and wrap it accordingly if it implements one of the three store interfaces.

We should wrap in read only decorator instances that implements 3 following interfaces:

  1. KeyValueStore
  2. WindowStore
  3. SessionStore

@mjsax , am I understand you correctly?

I will provide this fix and tests shortly.

@mjsax
Copy link
Copy Markdown
Member

mjsax commented Nov 23, 2018

Yes. Check the type, for KeyValueStore do what the current PR does, and for Window/Session-Store apply the same pattern.

@nizhikov
Copy link
Copy Markdown
Contributor Author

@mjsax I've implement your proposal. Please, review.

@nizhikov
Copy link
Copy Markdown
Contributor Author

Tests are green.

Copy link
Copy Markdown
Member

@mjsax mjsax left a comment

Choose a reason for hiding this comment

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

Thanks fo the update! Couple of nits.

Call for review @guozhangwang

@nizhikov
Copy link
Copy Markdown
Contributor Author

Thanks for the update! Couple of nits.

Nits fixed.

@nizhikov
Copy link
Copy Markdown
Contributor Author

Tests are green.

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Nov 28, 2018

Hello, @guozhangwang

Please, review and my merge my PR.

I have 2 approval from mjsax and bbejeck

@nizhikov
Copy link
Copy Markdown
Contributor Author

@mjsax Do I need to improve this PR? Can you approve it?

@nizhikov
Copy link
Copy Markdown
Contributor Author

Hello @mjsax
I got 2 OKs from you and bbejeck
Do I need one more review from guozhangwang?

No rush, I just want to know, how it's work in Kafka community

Can you merge this PR by yourself? :)

@mjsax
Copy link
Copy Markdown
Member

mjsax commented Nov 30, 2018

@nizhikov Committers can merge PRs.

I would like to get a confirmation from @bbejeck because we did some mayor changes after he approved. (Or a second review from @guozhangwang @vvcephei).

We want two +1 before merging.

Copy link
Copy Markdown
Member

@bbejeck bbejeck left a comment

Choose a reason for hiding this comment

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

I took another pass over the updates LGTM

@nizhikov
Copy link
Copy Markdown
Contributor Author

@bbejeck Thank you.

@mjsax There are two +1. Let's merge it?! :)

@mjsax
Copy link
Copy Markdown
Member

mjsax commented Nov 30, 2018

SGTM. There was a merge into trunk enabling spotBugs -- can you rebase this PR one more time to make sure the build is green (just as a guard to not break trunk if we merge). Thanks.

@nizhikov
Copy link
Copy Markdown
Contributor Author

can you rebase this PR one more time to make sure the build is green (just as a guard to not break trunk if we merge). Thanks.

Done

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Dec 1, 2018

@mjsax

just as a guard to not break trunk if we merge

Tests are green.

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Dec 3, 2018

Hello, @mjsax
Is there anything that should be improved prior merge?

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Dec 5, 2018

Hello, @mjsax

Do you have a change do look at the tests results?
Can we merge PR?

Should I ask Bill Bejeck or Guozhang Wang to review and merge this patch?

@mjsax mjsax merged commit ec501f3 into apache:trunk Dec 5, 2018
@mjsax
Copy link
Copy Markdown
Member

mjsax commented Dec 5, 2018

Thanks for the PR @nizhikov! Merged to trunk.

Please be a little patient. We try to get back to PRs as soon as we can, but it might take couple of days. :)

@nizhikov
Copy link
Copy Markdown
Contributor Author

nizhikov commented Dec 5, 2018

Thank you, @mjsax

Sorry for pinging you too many times.
WIll try to avoid it in the next contributions.

pengxiaolong pushed a commit to pengxiaolong/kafka that referenced this pull request Jun 14, 2019
…he#5865)

Reviewers: Matthias J. Sax <matthias@confluent.io>, Kamal Chandraprakash (@kamalcph), Bill Bejeck <bill@confluent.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants