You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2020/05/27 03:48:29 UTC

[GitHub] [geode] dschneider-pivotal opened a new pull request #5165: GEODE-8182: change String commands to use one region

dschneider-pivotal opened a new pull request #5165:
URL: https://github.com/apache/geode/pull/5165


   Thank you for submitting a contribution to Apache Geode.
   
   In order to streamline the review of the contribution we ask you
   to ensure the following steps have been taken:
   
   ### For all changes:
   - [ ] Is there a JIRA ticket associated with this PR? Is it referenced in the commit message?
   
   - [ ] Has your PR been rebased against the latest commit within the target branch (typically `develop`)?
   
   - [ ] Is your initial contribution a single, squashed commit?
   
   - [ ] Does `gradlew build` run cleanly?
   
   - [ ] Have you written or updated unit tests to verify your changes?
   
   - [ ] If adding new dependencies to the code, are these dependencies licensed in a way that is compatible for inclusion under [ASF 2.0](http://www.apache.org/legal/resolved.html#category-a)?
   
   ### Note:
   Please ensure that once the PR is submitted, check Concourse for build issues and
   submit an update to your PR as soon as possible. If you need help, please send an
   email to dev@geode.apache.org.
   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] lgtm-com[bot] commented on pull request #5165: GEODE-8182: change String commands to use one region

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #5165:
URL: https://github.com/apache/geode/pull/5165#issuecomment-634494424


   This pull request **fixes 1 alert** when merging 3b4c1cd9aef9ff1a13b5172c58ae56c93934af5e into bef07b34131abddb8c0f04e0ab6a48f1daac991d - [view on LGTM.com](https://lgtm.com/projects/g/apache/geode/rev/pr-7d19dc7dd451817295f349613650ae387317eb4c)
   
   **fixed alerts:**
   
   * 1 for Useless null check


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] dschneider-pivotal merged pull request #5165: GEODE-8182: change String commands to use one region

Posted by GitBox <gi...@apache.org>.
dschneider-pivotal merged pull request #5165:
URL: https://github.com/apache/geode/pull/5165


   


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] lgtm-com[bot] commented on pull request #5165: GEODE-8182: change String commands to use one region

Posted by GitBox <gi...@apache.org>.
lgtm-com[bot] commented on pull request #5165:
URL: https://github.com/apache/geode/pull/5165#issuecomment-634402024


   This pull request **introduces 1 alert** and **fixes 1** when merging 7b7fccd68184803bc1310253485f8a4e9b3cca29 into bef07b34131abddb8c0f04e0ab6a48f1daac991d - [view on LGTM.com](https://lgtm.com/projects/g/apache/geode/rev/pr-65c8530e49d4876609488d2d1930fe11e23f278d)
   
   **new alerts:**
   
   * 1 for Boxed variable is never null
   
   **fixed alerts:**
   
   * 1 for Useless null check


----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] dschneider-pivotal commented on a change in pull request #5165: GEODE-8182: change String commands to use one region

Posted by GitBox <gi...@apache.org>.
dschneider-pivotal commented on a change in pull request #5165:
URL: https://github.com/apache/geode/pull/5165#discussion_r431238457



##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetNXExecutor.java
##########
@@ -36,27 +36,23 @@
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, RedisData> region =
-        context.getRegionProvider().getStringsRegion();
-
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETNX));
       return;
     }
 
     ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    byte[] value = commandElems.get(VALUE_INDEX);
+    ByteArrayWrapper value = new ByteArrayWrapper(commandElems.get(VALUE_INDEX));
 
-    Object oldValue =
-        region.putIfAbsent(key, (RedisData) new RedisString(new ByteArrayWrapper(value)));
+    RedisStringCommands stringCommands = getRedisStringCommands(context);
+    SetOptions setOptions = new SetOptions(NX, 0L, null, false);

Review comment:
       Thanks for pointing this out. At this time, all that is used on the SetOptions when we call RedisStringCommands.set is the first parameter (NX in this case) so I just went with defaults on all the others. Some of these apply to expiration so they will be reviewed when the string expiration work is done.




----------------------------------------------------------------
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:
users@infra.apache.org



[GitHub] [geode] jdeppe-pivotal commented on a change in pull request #5165: GEODE-8182: change String commands to use one region

Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #5165:
URL: https://github.com/apache/geode/pull/5165#discussion_r431140254



##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetNXExecutor.java
##########
@@ -36,27 +36,23 @@
   public void executeCommand(Command command, ExecutionHandlerContext context) {
     List<byte[]> commandElems = command.getProcessedCommand();
 
-    Region<ByteArrayWrapper, RedisData> region =
-        context.getRegionProvider().getStringsRegion();
-
     if (commandElems.size() < 3) {
       command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETNX));
       return;
     }
 
     ByteArrayWrapper key = command.getKey();
-    checkAndSetDataType(key, context);
-    byte[] value = commandElems.get(VALUE_INDEX);
+    ByteArrayWrapper value = new ByteArrayWrapper(commandElems.get(VALUE_INDEX));
 
-    Object oldValue =
-        region.putIfAbsent(key, (RedisData) new RedisString(new ByteArrayWrapper(value)));
+    RedisStringCommands stringCommands = getRedisStringCommands(context);
+    SetOptions setOptions = new SetOptions(NX, 0L, null, false);

Review comment:
       This should be `SetOptions(NX, 0L, ExpireUnit.NONE, false);`




----------------------------------------------------------------
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:
users@infra.apache.org