[jira] [Commented] (IGNITE-4244) Redis INCR/DECR to operate on AtomicLong.
[ https://issues.apache.org/jira/browse/IGNITE-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15768119#comment-15768119 ] Denis Magda commented on IGNITE-4244: - [~roman_s], were the changes merged into the master branch? If so, please close the ticket then. > 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 > > > Making INCR/DECR behave as expected by Redis. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (IGNITE-4244) Redis INCR/DECR to operate on AtomicLong.
[ https://issues.apache.org/jira/browse/IGNITE-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15701196#comment-15701196 ] Vladimir Ozerov commented on IGNITE-4244: - Yes, why not? > 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)
[jira] [Commented] (IGNITE-4244) Redis INCR/DECR to operate on AtomicLong.
[ https://issues.apache.org/jira/browse/IGNITE-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15700815#comment-15700815 ] Roman Shtykh commented on IGNITE-4244: -- [~anovikov] Thank you, I overlooked INCRBY/DECRBY. Fixed now. > 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)
[jira] [Commented] (IGNITE-4244) Redis INCR/DECR to operate on AtomicLong.
[ 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)
[jira] [Commented] (IGNITE-4244) Redis INCR/DECR to operate on AtomicLong.
[ https://issues.apache.org/jira/browse/IGNITE-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15697123#comment-15697123 ] Roman Shtykh commented on IGNITE-4244: -- [~anovikov] Andrey, an error message starting with ERR. This is covered by the unit test in RedisProtocolSelfTest#testIncrDecr lines 299-307. > 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 >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)
[jira] [Commented] (IGNITE-4244) Redis INCR/DECR to operate on AtomicLong.
[ https://issues.apache.org/jira/browse/IGNITE-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15695592#comment-15695592 ] Andrey Novikov commented on IGNITE-4244: Hi [~roman_s], In incr/decr command we can receive Long overflow, which behavior is expected from Redis? {code} jedis.set("outOfRange", "" + Long.MAX_VALUE); Long res = jedis.incr("outOfRange"); assertFalse(res == Long.MIN_VALUE); {code} > 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 >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)
[jira] [Commented] (IGNITE-4244) Redis INCR/DECR to operate on AtomicLong.
[ https://issues.apache.org/jira/browse/IGNITE-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15692129#comment-15692129 ] Roman Shtykh commented on IGNITE-4244: -- Hi [~anovikov], Thank you for the tips! I have implemented as you advised. The only difference is for INCR/DECR -- I used {{get}} and them {{remove}} the key, because {{remove}} returns a boolean value. Also I used REST requests. It works this way, but I think we can improve it when we have a new REST implementation the next year. > 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 >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)
[jira] [Commented] (IGNITE-4244) Redis INCR/DECR to operate on AtomicLong.
[ https://issues.apache.org/jira/browse/IGNITE-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15689707#comment-15689707 ] Andrey Novikov commented on IGNITE-4244: Hi [~roman_s], I reviewed your pull request and I think this behavior leads to problems with set initial value or reset counter. Simple example http://redis.io/commands/incr#examples from documentation will not work. To fix this we need use Ignite API in commmands INCR/DECR and GET, SET I suggest using the following sequence in INCR/DECR: * Remove from cache by key. * If removed value not null try to parse and use as initial value on fail use 0. * Get IgniteAtomicLong with initial value and create flag true. https://apacheignite.readme.io/docs/atomic-types * exetute INCR/DECR logic under IgniteAtomicLong. SET: * If value with this key not exist in cache try to remove IgniteAtomicLong * exetute SET logic. GET: * If value not exists in cache by key then try to get IgniteAtomicLong by key and return it's value. > 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 >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)
[jira] [Commented] (IGNITE-4244) Redis INCR/DECR to operate on AtomicLong.
[ https://issues.apache.org/jira/browse/IGNITE-4244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15676464#comment-15676464 ] ASF GitHub Bot commented on IGNITE-4244: GitHub user shroman opened a pull request: https://github.com/apache/ignite/pull/1247 IGNITE-4244: INCR/DECR to operate on AtomicLong. You can merge this pull request into a Git repository by running: $ git pull https://github.com/shroman/ignite ignite-4244 Alternatively you can review and apply these changes as the patch at: https://github.com/apache/ignite/pull/1247.patch To close this pull request, make a commit to your master/trunk branch with (at least) the following in the commit message: This closes #1247 commit 518857097e2de888c5c56e8b1ef543cf3548c041 Author: shtykh_roman Date: 2016-11-18T10:17:11Z IGNITE-4244: INCR/DECR to operate on AtomicLong. > 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 >Reporter: Roman Shtykh >Assignee: Roman Shtykh > > "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)