Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-6138 Simplify StreamsBuilder#addGlobalStore #4430

Merged
merged 3 commits into from
Jan 31, 2018
Merged

KAFKA-6138 Simplify StreamsBuilder#addGlobalStore #4430

merged 3 commits into from
Jan 31, 2018

Conversation

panuwat-sc
Copy link
Contributor

@panuwat-sc panuwat-sc commented Jan 17, 2018

deprecated StreamsBuilder#addGlobalStore and InternalStreamsBuilder#addGlobalStore
add new StreamsBuilder#addGlobalStore and InternalStreamsBuilder#addGlobalStore without sourceName and processorName as parameter
generate sourceName and processorName by using InternalStreamsBuilder#newProcessorName

More detailed description of your change,
if necessary. The PR title and PR message become
the squashed commit message, so use a separate
comment to ping reviewers.

Summary of testing strategy (including rationale)
for the feature or bug fix. Unit and/or integration
tests are expected for any behaviour change and
system tests should be considered for larger changes.

Committer Checklist (excluded from commit message)

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

deprecated StreamsBuilder#addGlobalStore and InternalStreamsBuilder#addGlobalStore
add new StreamsBuilder#addGlobalStore and InternalStreamsBuilder#addGlobalStore without sourceName and processorName as parameter
generate sourceName and processorName by using InternalStreamsBuilder#newProcessorName
Copy link
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. Some initial comments.

String globalTopicName = "testGlobalTopic";
String globalStoreName = "testAddGlobalStore";
final StreamsBuilder builder = new StreamsBuilder();
KeyValueStoreBuilder t = new KeyValueStoreBuilder();
Copy link
Member

Choose a reason for hiding this comment

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

This line fails in the build and needs a fix.

@@ -476,6 +476,7 @@ public synchronized StreamsBuilder addStateStore(final StoreBuilder builder) {
* @throws TopologyException if the processor of state is already registered
*/
@SuppressWarnings("unchecked")
@Deprecated
Copy link
Member

Choose a reason for hiding this comment

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

We should extend the JavaDoc, with @deprecated annotation to, and point to the new method that should be used.

@@ -492,6 +493,39 @@ public synchronized StreamsBuilder addGlobalStore(final StoreBuilder storeBuilde
stateUpdateSupplier);
return this;
}
/**
Copy link
Member

Choose a reason for hiding this comment

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

Nit: missing empty line

@@ -174,7 +174,7 @@ public String newStoreName(final String prefix) {
public synchronized void addStateStore(final StoreBuilder builder) {
internalTopologyBuilder.addStateStore(builder);
}

@Deprecated
Copy link
Member

Choose a reason for hiding this comment

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

This is an internal class -- no need to mark as deprecated.

final String topic,
final ConsumedInternal consumed,
final ProcessorSupplier stateUpdateSupplier) {
// explicitly disable logging for global stores
Copy link
Member

Choose a reason for hiding this comment

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

we should not copy the code from the old addGlobalStore() but rather call the old addGlobalStore() passing the generated names.

extend the JavaDoc with @deprecated pointing to new method
add missing empty line
call old addGlobalStore instead of copy code
@mjsax
Copy link
Member

mjsax commented Jan 27, 2018

Retest this please.

Copy link
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.

Just two nits. Otherwise LGTM.

Call for second review @bbejeck @dguy @guozhangwang

@@ -194,4 +194,19 @@ public synchronized void addGlobalStore(final StoreBuilder<KeyValueStore> storeB
processorName,
stateUpdateSupplier);
}
public synchronized void addGlobalStore(final StoreBuilder<KeyValueStore> storeBuilder,
Copy link
Member

Choose a reason for hiding this comment

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

Nit: add empty line

@@ -204,4 +204,6 @@ public static InternalTopologyBuilder internalTopologyBuilder(final StreamsBuild
public static Collection<Set<String>> getCopartitionedGroups(final StreamsBuilder builder) {
return builder.internalTopologyBuilder.copartitionGroups();
}


Copy link
Member

Choose a reason for hiding this comment

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

nit: revert

@mjsax mjsax added the streams label Jan 30, 2018
@mjsax
Copy link
Member

mjsax commented Jan 30, 2018

@dguy @bbejeck @guozhangwang Can we get a second review? If not merged today, it won't be included in 1.1. @panuwat-sc You will need to address all comments today so we can get it into 1.1 release.

Copy link
Contributor

@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 PR, LGTM

@mjsax
Copy link
Member

mjsax commented Jan 30, 2018

Retest this please.

@dguy
Copy link
Contributor

dguy commented Jan 31, 2018

retest this please

add a missing empty line in InternalStreamsBuilder.java
fix revert from last commit(remove two empty line) in StreamsBuilderTest.java
@mjsax mjsax merged commit b822206 into apache:trunk Jan 31, 2018
@mjsax
Copy link
Member

mjsax commented Jan 31, 2018

Merged to trunk -- will be part of 1.1 release.

Thanks for the KIP and patch @panuwat-sc !

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.

4 participants