ableegoldman commented on code in PR #18772:
URL: https://github.com/apache/kafka/pull/18772#discussion_r1938203145


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/AbstractMergedSortedCacheStoreIterator.java:
##########
@@ -23,16 +23,31 @@
 import java.util.NoSuchElementException;
 
 /**
- * Merges two iterators. Assumes each of them is sorted by key
+ * AbstractMergedSortedCacheStoreIterator is an abstract class for merging two 
sorted iterators, one from a cache and
+ * the other from a store. It ensures the merged results maintain sorted order 
while resolving conflicts between cache
+ * and store entries.
  *
- * @param <K>
- * @param <V>
+ * <p>This iterator is primarily used in Kafka Streams' state store layer, 
where state is backed by an in-memory cache
+ * and persistent store. It handles common scenarios like skipping tombstones 
(deleted entries) and preferring cache
+ * entries over store entries when conflicts arise.</p>

Review Comment:
   ```suggestion
    * <p>This iterator is used for state stores in Kafka Streams, which have an 
(optional) caching layer that needs to be "merged" 
    *  with the underlying state. It handles common scenarios like skipping 
records with cached tombstones (deleted entries)
    * and preferring cache entries over store entries when conflicts arise.</p>
   ```



##########
streams/src/main/java/org/apache/kafka/streams/state/internals/AbstractMergedSortedCacheStoreIterator.java:
##########
@@ -23,16 +23,31 @@
 import java.util.NoSuchElementException;
 
 /**
- * Merges two iterators. Assumes each of them is sorted by key
+ * AbstractMergedSortedCacheStoreIterator is an abstract class for merging two 
sorted iterators, one from a cache and
+ * the other from a store. It ensures the merged results maintain sorted order 
while resolving conflicts between cache
+ * and store entries.
  *
- * @param <K>
- * @param <V>
+ * <p>This iterator is primarily used in Kafka Streams' state store layer, 
where state is backed by an in-memory cache
+ * and persistent store. It handles common scenarios like skipping tombstones 
(deleted entries) and preferring cache
+ * entries over store entries when conflicts arise.</p>

Review Comment:
   nit: more "exclusively" than "primarily", right? (Assuming this doesn't get 
used anywhere else)
   
   also stores are not necessarily persistent, you can have an in-memory store 
under the in-memory cache (which isn't pointless because the caching layer has 
additional functionality like buffering writes)



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