You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by GitBox <gi...@apache.org> on 2020/09/16 02:59:23 UTC

[GitHub] [kafka] ableegoldman commented on a change in pull request #9083: KAFKA-9450: Follow-up; Forbid process after closed

ableegoldman commented on a change in pull request #9083:
URL: https://github.com/apache/kafka/pull/9083#discussion_r489129386



##########
File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/AbstractTask.java
##########
@@ -37,6 +37,7 @@
 
     /**
      * If the checkpoint has not been loaded from the file yet (null), then we should not overwrite the checkpoint;
+     * If the checkpoint has been loaded form the file and has never been re-written (empty map), then we should re-write the checkpoint;

Review comment:
       ```suggestion
        * If the checkpoint has been loaded from the file and has never been re-written (empty map), then we should re-write the checkpoint;
   ```

##########
File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/ProcessorContextImpl.java
##########
@@ -217,7 +217,7 @@ public StateStore getStateStore(final String name) {
                     forward((ProcessorNode<K, V, ?, ?>) child, key, value);
                 }
             } else {
-                final ProcessorNode<K, V, ?, ?> child = currentNode().getChild(sendTo);
+                final ProcessorNode child = currentNode().getChild(sendTo);

Review comment:
       Rebasing error?

##########
File path: streams/src/test/java/org/apache/kafka/streams/processor/internals/StreamTaskTest.java
##########
@@ -1310,9 +1310,11 @@ public void shouldNotCheckpointOffsetsAgainOnCommitIfSnapshotNotChangedMuch() {
         EasyMock.expect(recordCollector.offsets()).andReturn(Collections.singletonMap(changelogPartition, offset)).anyTimes();
         stateManager.checkpoint();
         EasyMock.expectLastCall().once();
+        EasyMock.expect(stateManager.changelogPartitions()).andReturn(Collections.singleton(changelogPartition));

Review comment:
       Why does this need to change?

##########
File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/ProcessorNode.java
##########
@@ -149,10 +155,20 @@ public void close() {
         } catch (final Exception e) {

Review comment:
       Should we `throwIfClosed()` at the beginning of `close()` too?

##########
File path: streams/src/main/java/org/apache/kafka/streams/processor/internals/ProcessorNode.java
##########
@@ -118,6 +120,10 @@ public void init(final InternalProcessorContext context) {
         } catch (final Exception e) {
             throw new StreamsException(String.format("failed to initialize processor %s", name), e);
         }
+
+        // revived tasks could re-initialize the topology,
+        // in which case we should reset the flag
+        closed = false;

Review comment:
       Should we assert that it's in `closed` when `init` is called?




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org