ableegoldman commented on code in PR #14735:
URL: https://github.com/apache/kafka/pull/14735#discussion_r1396625434
##########
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:
I think that makes sense -- it's certainly worth a shot! You can always try
it out and see if it works 😄
On that note, there is an existing integration tests that cover task
recycling which you might find useful. You can just add a standby listener to
that instead of creating new integration tests from scratch. Check out
`RestoreIntegrationTest#shouldRecycleStateFromStandbyTaskPromotedToActiveTaskAndNotRestore`
##########
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:
I think that makes sense -- it's certainly worth a shot! You can always try
it out and see if it works 😄
On that note, there is an existing integration tests that cover task
recycling which you might find useful. You can just add a standby listener to
that instead of creating new integration tests from scratch. Check out
`RestoreIntegrationTest#shouldRecycleStateFromStandbyTaskPromotedToActiveTaskAndNotRestore`
--
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]