[
https://issues.apache.org/jira/browse/IGNITE-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15700762#comment-15700762
]
Andrey Novikov commented on IGNITE-4244:
----------------------------------------
[~roman_s]
I reviewed your fix and find that we still may receive overflow of long for
command INCRBY/DECRBY.
I suggest to use one of this techniques for detecting long overflow:
https://www.securecoding.cert.org/confluence/display/java/NUM00-J.+Detect+or+prevent+integer+overflow
For example:
{code}
static final long safeAdd(long left, long right) {
if (right > 0 ? left > Long.MAX_VALUE - right
: left < Long.MIN_VALUE - right) {
throw new ArithmeticException("Long overflow");
}
return left + right;
}
{code}
After this fix, I think you can merge changes to master.
> Redis INCR/DECR to operate on AtomicLong.
> -----------------------------------------
>
> Key: IGNITE-4244
> URL: https://issues.apache.org/jira/browse/IGNITE-4244
> Project: Ignite
> Issue Type: Sub-task
> Affects Versions: 1.8
> Reporter: Roman Shtykh
> Assignee: Roman Shtykh
> Labels: redis
> Fix For: 1.8
>
>
> "The INCR command parses the string value as an integer, increments it by
> one, and finally sets the obtained value as the new value. "
> http://redis.io/topics/data-types-intro
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)