mjsax commented on a change in pull request #11455:
URL: https://github.com/apache/kafka/pull/11455#discussion_r791323385
##########
File path:
streams/src/test/java/org/apache/kafka/streams/integration/GlobalKTableIntegrationTest.java
##########
@@ -176,7 +177,9 @@ public void shouldKStreamGlobalKTableLeftJoin() throws
Exception {
TestUtils.waitForCondition(
() -> {
globalState.clear();
- replicatedStore.all().forEachRemaining(pair ->
globalState.put(pair.key, pair.value));
+ try (final KeyValueIterator<Long, String> it =
replicatedStore.all()) {
Review comment:
side cleanup to close the iterator (same below)
##########
File path: streams/src/main/java/org/apache/kafka/streams/KafkaStreams.java
##########
@@ -668,8 +669,10 @@ public synchronized void onChange(final Thread thread,
if (newState == GlobalStreamThread.State.RUNNING) {
maybeSetRunning();
} else if (newState == GlobalStreamThread.State.DEAD) {
- log.error("Global thread has died. The streams
application or client will now close to ERROR.");
- closeToError();
+ if (state != State.PENDING_SHUTDOWN) {
Review comment:
New solution: if the instance is not in `PENDING_SHUTDOW` we know that
an error happened and we log an ERROR and `closeToError`.
On a clean close, the instance with go to `PENDING_SHUTDOWN` first, before
shutting down the global thread, and we won't log an error and just proceed.
##########
File path: streams/src/test/java/org/apache/kafka/streams/KafkaStreamsTest.java
##########
@@ -459,12 +462,15 @@ public void
shouldCleanupResourcesOnCloseWithoutPreviousStart() throws Exception
final StreamsBuilder builder = getBuilderWithSource();
builder.globalTable("anyTopic");
- try (final KafkaStreams streams = new KafkaStreams(builder.build(),
props, supplier, time)) {
+ try (final LogCaptureAppender appender =
LogCaptureAppender.createAndRegister(KafkaStreams.class);
+ final KafkaStreams streams = new KafkaStreams(builder.build(),
props, supplier, time)) {
streams.close();
waitForCondition(
() -> streams.state() == KafkaStreams.State.NOT_RUNNING,
"Streams never stopped.");
+
+ assertThat(appender.getMessages(),
not(hasItem(containsString("ERROR"))));
Review comment:
Verify that a clean close does not log an error
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]