vcrfxia commented on code in PR #13431:
URL: https://github.com/apache/kafka/pull/13431#discussion_r1151098634


##########
streams/src/main/java/org/apache/kafka/streams/state/internals/LogicalKeyValueSegment.java:
##########
@@ -176,7 +184,7 @@ public synchronized KeyValueIterator<Bytes, byte[]> 
range(final Bytes from, fina
         // with empty bytes from the returned iterator. this filtering is 
accomplished by
         // passing the prefix filter into 
StrippedPrefixKeyValueIteratorAdapter().
         final Bytes toBound = to == null
-            ? Bytes.increment(prefixKeyFormatter.getPrefix())
+            ? incrementWithoutOverflow(prefixKeyFormatter.getPrefix())

Review Comment:
   For a logical segment, a range query with `toBound == null` means that all 
data in the segment (after the specified `fromBound`) should be returned. But 
data from other segments should NOT be returned, which is why we need to 
specify the incremented prefix as the upper bound for the range scan in the 
physical store. Except in the edge case where incrementing the prefix would 
cause overflow, in which case using `null` for the upper bound is correct. 
Thus, `incrementWithoutOverflow()` is correct here.



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