[
https://issues.apache.org/jira/browse/GEODE-8864?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17291697#comment-17291697
]
ASF GitHub Bot commented on GEODE-8864:
---------------------------------------
sabbey37 commented on a change in pull request #5954:
URL: https://github.com/apache/geode/pull/5954#discussion_r583222940
##########
File path:
geode-redis/src/main/java/org/apache/geode/redis/internal/data/RedisHash.java
##########
@@ -203,49 +279,122 @@ public int hstrlen(ByteArrayWrapper field) {
return new ArrayList<>(hash.keySet());
}
- public Pair<BigInteger, List<Object>> hscan(Pattern matchPattern, int count,
BigInteger cursor) {
- List<Object> returnList = new ArrayList<Object>();
- int size = hash.size();
- BigInteger beforeCursor = new BigInteger("0");
- int numElements = 0;
- int i = -1;
- for (Map.Entry<ByteArrayWrapper, ByteArrayWrapper> entry :
hash.entrySet()) {
- ByteArrayWrapper key = entry.getKey();
- ByteArrayWrapper value = entry.getValue();
- i++;
- if (beforeCursor.compareTo(cursor) < 0) {
- beforeCursor = beforeCursor.add(new BigInteger("1"));
+ public ImmutablePair<BigInteger, List<Object>> hscan(UUID clientID, Pattern
matchPattern,
+ int count,
+ BigInteger cursorParameter) {
+
+ int startCursor = cursorParameter.intValue();
Review comment:
I'm kinda torn about this... I think it makes sense for the cursor value
to be an `int` since the maximum list size in Java is also an `int`... and
`2,147,483,647` entries is quite a lot... but in Redis the cursor value max
capacity is the same as an unsigned long (18446744073709551615).
So does it make more sense for us to differ from Redis and error if the
cursor exceeds the max int capacity or continue to error if the cursor exceeds
the max long capacity, but convert it to an `int` behind the scenes? I guess
since the Hash size in java cant exceed `Integer.MAX_VALUE` we'll never have
the issue of having to return a cursor that's larger than an int...
I guess it is slightly concerning that the docs for `intValue()` state:
`Note that this conversion can lose information about the overall magnitude of
the BigInteger value as well as return a result with the opposite sign.` So I'm
wondering if it would ever cause any problems? There is also the
`intValueExact()` method which throws an `ArithmeticException` if the value is
out of range... but in that case we probably should've just tried converting
the cursor to an `int` from the start?
----------------------------------------------------------------
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:
[email protected]
> finish implementation of Redis HScan Command
> --------------------------------------------
>
> Key: GEODE-8864
> URL: https://issues.apache.org/jira/browse/GEODE-8864
> Project: Geode
> Issue Type: New Feature
> Components: redis
> Reporter: John Hutchison
> Priority: Major
> Labels: pull-request-available
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)