guozhangwang commented on a change in pull request #9138:
URL: https://github.com/apache/kafka/pull/9138#discussion_r480473830



##########
File path: 
streams/src/main/java/org/apache/kafka/streams/state/internals/SegmentIterator.java
##########
@@ -67,14 +70,22 @@ public Bytes peekNextKey() {
     public boolean hasNext() {
         boolean hasNext = false;
         while ((currentIterator == null || !(hasNext = 
hasNextConditionHasNext()) || !currentSegment.isOpen())
-                && segments.hasNext()) {
+            && segments.hasNext()) {
             close();
             currentSegment = segments.next();
             try {
                 if (from == null || to == null) {
-                    currentIterator = currentSegment.all();
+                    if (forward) {
+                        currentIterator = currentSegment.all();
+                    } else {
+                        currentIterator = currentSegment.reverseAll();

Review comment:
       This is not directly related to this PR, but it makes me wondering: why 
do we keep a separate `range / all` in extended `Segment` interface? Should we 
just remove that? Now we've added the reverse ones but only in the parent 
interface, it makes me feeling the original ones on `Segment` is not necessary.




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

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


Reply via email to