showuon commented on a change in pull request #11292:
URL: https://github.com/apache/kafka/pull/11292#discussion_r700910107



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/state/internals/InMemoryWindowStore.java
##########
@@ -499,10 +499,14 @@ public void close() {
             final Map.Entry<Long, ConcurrentNavigableMap<Bytes, byte[]>> 
currentSegment = segmentIterator.next();
             currentTime = currentSegment.getKey();
 
-            if (allKeys) {
-                return currentSegment.getValue().entrySet().iterator();
+            final ConcurrentNavigableMap<Bytes, byte[]> subMap = allKeys ?
+                currentSegment.getValue() :
+                currentSegment.getValue().subMap(keyFrom, true, keyTo, true);
+
+            if (forward) {
+                return subMap.entrySet().iterator();
             } else {
-                return currentSegment.getValue().subMap(keyFrom, true, keyTo, 
true).entrySet().iterator();
+                return subMap.descendingMap().entrySet().iterator();

Review comment:
       Before this change, when setting records iterator, we only consider the 
`allKey` case, not the `forward/backward` cases. Fix it.




-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to