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/06/03 15:06:18 UTC
[GitHub] [geode] jdeppe-pivotal opened a new pull request #5206: GEODE-8219: Apply RedisResponse to all redis string commands
jdeppe-pivotal opened a new pull request #5206:
URL: https://github.com/apache/geode/pull/5206
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] jdeppe-pivotal commented on a change in pull request #5206: GEODE-8219: Apply RedisResponse to all redis string commands
Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal commented on a change in pull request #5206:
URL: https://github.com/apache/geode/pull/5206#discussion_r435310328
##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java
##########
@@ -81,31 +79,30 @@ public void executeCommand(Command command, ExecutionHandlerContext context) {
}
stringCommands.set(key, new ByteArrayWrapper(bytes), null);
command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
Review comment:
Doh! Thanks.
----------------------------------------------------------------
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 #5206: GEODE-8219: Apply RedisResponse to all redis string commands
Posted by GitBox <gi...@apache.org>.
dschneider-pivotal commented on a change in pull request #5206:
URL: https://github.com/apache/geode/pull/5206#discussion_r435011635
##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java
##########
@@ -34,12 +35,13 @@
"The offset is out of range, must be greater than or equal to 0 and at most 4294967295 (512MB)";
@Override
- public void executeCommand(Command command, ExecutionHandlerContext context) {
+ public RedisResponse executeCommandWithResponse(Command command,
+ ExecutionHandlerContext context) {
List<byte[]> commandElems = command.getProcessedCommand();
if (commandElems.size() < 4) {
command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ArityDef.SETBIT));
- return;
+ return RedisResponse.error(ArityDef.SETBIT);
Review comment:
remove this setResponse calls
##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/BitPosExecutor.java
##########
@@ -47,27 +48,17 @@ public void executeCommand(Command command, ExecutionHandlerContext context) {
byte[] bitAr = commandElems.get(2);
bit = Coder.bytesToInt(bitAr);
} catch (NumberFormatException e) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_NOT_INT));
- return;
+ return RedisResponse.error(ERROR_NOT_INT);
}
if (bit != 0 && bit != 1) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ERROR_BIT));
- return;
+ return RedisResponse.error(ERROR_BIT);
}
if (string == null || string.length() == 0) {
- command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), -bit)); // Redis
- // returns
- // 0 when
- // key
- // does
- // not
- // exists
- // for
- // this
- // command
- return;
+ // Redis returns 0 when key does not exists for this command
+ command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), -bit));
Review comment:
Should this setResponse be removed?
##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetBitExecutor.java
##########
@@ -81,31 +79,30 @@ public void executeCommand(Command command, ExecutionHandlerContext context) {
}
stringCommands.set(key, new ByteArrayWrapper(bytes), null);
command.setResponse(Coder.getIntegerResponse(context.getByteBufAllocator(), 0));
Review comment:
I think this setReponse call should have been deleted
##########
File path: geode-redis/src/main/java/org/apache/geode/redis/internal/executor/string/SetExecutor.java
##########
@@ -42,23 +44,24 @@ public void executeCommand(Command command, ExecutionHandlerContext context) {
try {
setOptions = parseCommandElems(commandElems);
} catch (IllegalArgumentException ex) {
- command.setResponse(Coder.getErrorResponse(context.getByteBufAllocator(), ex.getMessage()));
- return;
+ return RedisResponse.error(ex.getMessage());
}
- doSet(command, context, keyToSet, valueToSet, redisStringCommands, setOptions);
+ return doSet(command, context, keyToSet, valueToSet, redisStringCommands, setOptions);
}
- private void doSet(Command command, ExecutionHandlerContext context, ByteArrayWrapper key,
+ private RedisResponse doSet(Command command, ExecutionHandlerContext context,
+ ByteArrayWrapper key,
ByteArrayWrapper value, RedisStringCommands redisStringCommands, SetOptions setOptions) {
boolean result = redisStringCommands.set(key, value, setOptions);
if (result) {
command.setResponse(Coder.getSimpleStringResponse(context.getByteBufAllocator(), SUCCESS));
- } else {
- command.setResponse(Coder.getNilResponse(context.getByteBufAllocator()));
+ return RedisResponse.string(SUCCESS);
Review comment:
remove this setResponse call
----------------------------------------------------------------
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 merged pull request #5206: GEODE-8219: Apply RedisResponse to all redis string commands
Posted by GitBox <gi...@apache.org>.
jdeppe-pivotal merged pull request #5206:
URL: https://github.com/apache/geode/pull/5206
----------------------------------------------------------------
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