vcrfxia commented on code in PR #13431: URL: https://github.com/apache/kafka/pull/13431#discussion_r1152471732
########## 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: > You mean to here, which is the input parameter Yeah sorry, that's what I meant. > But if we overflow, and set toBound = null (as returned by incrementWithoutOverflow()) would it not imply we scan the physical store to its end, beyond the current logical segment bound? If the prefix overflows then that means that this is the last possible segment in the store, in which case scanning to the end of the physical store is the same as scanning to the end of the segment, so that's actually exactly what we want. (This only works because all prefixes are the same length -- a bunch of the other logic in this class would break too if that were not the case, though, so it's a fine assumption.) -- 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