Muralidhar Basani created KAFKA-20603:
-----------------------------------------

             Summary: Replace MemoryLRUCache restoring flag with restore 
lifecycle hooks
                 Key: KAFKA-20603
                 URL: https://issues.apache.org/jira/browse/KAFKA-20603
             Project: Kafka
          Issue Type: Improvement
          Components: streams
            Reporter: Muralidhar Basani
            Assignee: Muralidhar Basani


MemoryLRUCache 
(https://github.com/apache/kafka/blob/edcada2a4848b9456f7a025581c777f92f7683b4/streams/src/main/java/org/apache/kafka/streams/state/internals/MemoryLRUCache.java#L53)
 carries a stateful boolean restoring field that is flipped on/off inside 
RecordBatchingStateRestoreCallback


Fix the TODO comment :
{code:java}
private boolean restoring = false; // TODO: this is a sub-optimal solution to 
avoid logging during restoration.
// in the future we should augment the StateRestoreCallback with onComplete etc 
to better resolve this.{code}

Add lifecycle hooks to the internal RecordBatchingStateRestoreCallback and let 
ProcessorStateManager and GlobalStateManagerImpl invoke them around each 
restore batch.

 
{code:java}
private boolean restoring;
@Override public void onRestoreStart() { restoring = true; }
@Override public void onRestoreEnd()   { restoring = false; }
{code}
 

And replace the restore flag in MemoryLRUCache with a callback.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to