DonalEvans commented on a change in pull request #6701:
URL: https://github.com/apache/geode/pull/6701#discussion_r674390885
##########
File path:
geode-apis-compatible-with-redis/src/main/java/org/apache/geode/redis/internal/data/RedisHash.java
##########
@@ -237,15 +238,21 @@ public int hstrlen(byte[] field) {
return new ArrayList<>(hash.keySet());
}
- public ImmutablePair<Integer, List<byte[]>> hscan(Pattern matchPattern,
- int count,
- int cursor) {
-
- ArrayList<byte[]> resultList = new ArrayList<>(count + 2);
+ public ImmutablePair<Integer, List<byte[]>> hscan(Pattern matchPattern, int
count, int cursor) {
+ // No need to allocate more space than it's possible to use given the size
of the hash. We need
+ // to add 1 to hash.size() to ensure that if count > hash.size(), we
return a cursor of 0
+ long maximumCapacity = 2L * Math.min(count, hlen() + 1);
+ if (maximumCapacity > Integer.MAX_VALUE) {
Review comment:
The integration tests are designed to simulate the behaviour of a client
connecting to a Redis cluster, and to be agnostic about whether that cluster is
a Geode Radish cluster or a native Redis cluster, so it's not really possible
to get under the hood and mock out the returns of methods in our classes to
force certain behaviours, unfortunately.
--
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]