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


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/CachingWindowStore.java:
##########
@@ -170,242 +174,200 @@ public synchronized void put(final Bytes key,
     }
 
     @Override
-    public byte[] fetch(final Bytes key,
-                        final long timestamp) {
+    public byte[] fetch(final Bytes key, final long timestamp) {
+        return fetchPointInternal(key, timestamp, wrapped());
+    }
+
+    private byte[] fetchPointInternal(final Bytes key,
+                                      final long timestamp,
+                                      final ReadOnlyWindowStore<Bytes, byte[]> 
source) {
         validateStoreOpen();
         final Bytes bytesKey = WindowKeySchema.toStoreKeyBinary(key, 
timestamp, 0);
         final Bytes cacheKey = cacheFunction.cacheKey(bytesKey);
         if (internalContext.cache() == null) {
-            return wrapped().fetch(key, timestamp);
+            return source.fetch(key, timestamp);
         }
         final LRUCacheEntry entry = internalContext.cache().get(cacheName, 
cacheKey);
         if (entry == null) {
-            return wrapped().fetch(key, timestamp);
+            return source.fetch(key, timestamp);
         } else {
             return entry.value();
         }
     }
 
+
     @Override
-    public synchronized WindowStoreIterator<byte[]> fetch(final Bytes key,

Review Comment:
   I'm thinking we need to move the `synchronized` modifer back to the external 
fetch call as it stands now the `validateStoreOpen` and the `fetch` for the 
underlying iterator are not thread safe - the  `wrapped().fetch` call will be 
evaluated before entering the method body - hence not synchronized.
   
   



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