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-5958: Global stores access state restore listener #3973

Conversation

bbejeck
Copy link
Contributor

@bbejeck bbejeck commented Sep 27, 2017

No description provided.

@bbejeck
Copy link
Contributor Author

bbejeck commented Sep 27, 2017

ping @mjsax @dguy @guozhangwang

@bbejeck bbejeck changed the title Kafka-5958: Global stores access state restore listener KAFKA-5958: Global stores access state restore listener Sep 27, 2017
Copy link
Contributor

@dguy dguy left a comment

Choose a reason for hiding this comment

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

Thanks @bbejeck

@@ -294,7 +298,7 @@ public void run() {

private StateConsumer initialize() {
try {
final GlobalStateManager stateMgr = new GlobalStateManagerImpl(topology, consumer, stateDirectory);
final GlobalStateManager stateMgr = new GlobalStateManagerImpl(topology, consumer, stateDirectory, stateRestoreListener);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: should probably put the params on separate lines as it has exceeded the 120 char limit

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack

@@ -179,6 +179,7 @@ public void testStateGlobalThreadClose() throws Exception {
builder.globalTable("anyTopic");
props.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, numThreads);
final KafkaStreams streams = new KafkaStreams(builder.build(), props);
streams.setGlobalStateRestoreListener(new MockStateRestoreListener());
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need this? The test doesn't actually use or test it so it seems irrelevant

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Nope, good catch

@@ -452,7 +475,7 @@ public void shouldThrowLockExceptionIfIOExceptionCaughtWhenTryingToLockStateDir(
public boolean lockGlobalState(final int retry) throws IOException {
throw new IOException("KABOOM!");
}
});
}, null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this be null? It seems that GlobalStateMangerImpl never expects it to be null.

@@ -96,7 +98,7 @@ public void shouldThrowStreamsExceptionOnStartupIfExceptionOccurred() {
new StateDirectory("appId", TestUtils.tempDirectory().getPath(), time),
new Metrics(),
new MockTime(),
"clientId");
"clientId", null);
Copy link
Contributor

Choose a reason for hiding this comment

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

new line for param and I think it should probably not be null

@@ -220,7 +221,7 @@ public ProcessorTopologyTestDriver(final StreamsConfig config,
globalPartitionsByTopic.put(topicName, partition);
offsetsByTopicPartition.put(partition, new AtomicLong());
}
final GlobalStateManagerImpl stateManager = new GlobalStateManagerImpl(globalTopology, globalConsumer, stateDirectory);
final GlobalStateManagerImpl stateManager = new GlobalStateManagerImpl(globalTopology, globalConsumer, stateDirectory, stateRestoreListener);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: params on sep line as char limit exceeded?

@bbejeck
Copy link
Contributor Author

bbejeck commented Sep 27, 2017

@dguy thanks for review, updated for comments

@@ -179,6 +179,7 @@ public void testStateGlobalThreadClose() throws Exception {
builder.globalTable("anyTopic");
props.put(StreamsConfig.NUM_STREAM_THREADS_CONFIG, numThreads);
final KafkaStreams streams = new KafkaStreams(builder.build(), props);
streams.setGlobalStateRestoreListener(null);
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we just not set it all?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ack

@bbejeck
Copy link
Contributor Author

bbejeck commented Sep 27, 2017

updated this

Copy link
Contributor

@dguy dguy left a comment

Choose a reason for hiding this comment

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

Thanks @bbejeck, LGTM

@dguy
Copy link
Contributor

dguy commented Sep 28, 2017

merged to trunk

@asfgit asfgit closed this in e1543a5 Sep 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants