bbejeck commented on code in PR #23037:
URL: https://github.com/apache/kafka/pull/23037#discussion_r3753549982


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/PlainToHeadersWindowStoreAdapter.java:
##########
@@ -68,6 +68,23 @@ public PlainToHeadersWindowStoreAdapter(final 
WindowStore<Bytes, byte[]> store)
         this.store = store;
     }
 
+    /**
+     * Report the retention of the store being adapted. This adapter holds its 
delegate in a private
+     * field rather than as a {@link WrappedStateStore}, so {@code 
extractRetentionPeriod}'s unwrap
+     * walk terminates here; without this it resolves -1 and the KAFKA-13499 
windowed-restore
+     * optimisation is silently skipped for every store behind the adapter.
+     */
+    @Override
+    public long retentionPeriod() {
+        StateStore current = store;

Review Comment:
   We repeat this code in 5 locations.  All 4 new adapters, plus 
`ProcessorStateManager` line 147 - I'm wondering if we should add a static 
method on the `WithRetentionPeriod` interface that accepts a `StateStore` 
parameter and executes the unwrapping and returns the retention in one spot.  



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

Reply via email to