eduwercamacaro commented on code in PR #14735:
URL: https://github.com/apache/kafka/pull/14735#discussion_r1393218354


##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java:
##########
@@ -701,7 +706,15 @@ private StandbyTask convertActiveToStandby(final 
StreamTask activeTask, final Se
     }
 
     private StreamTask convertStandbyToActive(final StandbyTask standbyTask, 
final Set<TopicPartition> partitions) {
-        return activeTaskCreator.createActiveTaskFromStandby(standbyTask, 
partitions, mainConsumer);
+        final StreamTask streamTask = 
activeTaskCreator.createActiveTaskFromStandby(standbyTask, partitions, 
mainConsumer);
+        final ProcessorStateManager stateManager = standbyTask.stateManager();
+        for (final TopicPartition partition : partitions) {
+            final ProcessorStateManager.StateStoreMetadata storeMetadata = 
stateManager.storeMetadata(partition);
+            if (storeMetadata != null && storeMetadata.endOffset() != null) {
+                standbyTaskUpdateListener.onUpdateSuspended(partition, 
storeMetadata.store().name(), storeMetadata.offset(), 
storeMetadata.endOffset(), StandbyUpdateListener.SuspendReason.PROMOTED);

Review Comment:
   Thanks! I agree. I'm going to implement this in the `StoreChangelogReader` 
adding a new argument for the `#unregister ` method and cover the case for 
`MIGRATED`



##########
streams/src/main/java/org/apache/kafka/streams/processor/internals/TaskManager.java:
##########
@@ -701,7 +706,15 @@ private StandbyTask convertActiveToStandby(final 
StreamTask activeTask, final Se
     }
 
     private StreamTask convertStandbyToActive(final StandbyTask standbyTask, 
final Set<TopicPartition> partitions) {
-        return activeTaskCreator.createActiveTaskFromStandby(standbyTask, 
partitions, mainConsumer);
+        final StreamTask streamTask = 
activeTaskCreator.createActiveTaskFromStandby(standbyTask, partitions, 
mainConsumer);
+        final ProcessorStateManager stateManager = standbyTask.stateManager();
+        for (final TopicPartition partition : partitions) {
+            final ProcessorStateManager.StateStoreMetadata storeMetadata = 
stateManager.storeMetadata(partition);
+            if (storeMetadata != null && storeMetadata.endOffset() != null) {
+                standbyTaskUpdateListener.onUpdateSuspended(partition, 
storeMetadata.store().name(), storeMetadata.offset(), 
storeMetadata.endOffset(), StandbyUpdateListener.SuspendReason.PROMOTED);

Review Comment:
   Thanks! I agree. I'm going to implement this in the `StoreChangelogReader` 
adding a new argument for the `#unregister` method and cover the case for 
`MIGRATED`



-- 
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: jira-unsubscr...@kafka.apache.org

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

Reply via email to