-
Notifications
You must be signed in to change notification settings - Fork 683
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GEODE-8147: DELETE and EXISTS implement Function-Delta #5128
Conversation
geode-redis/src/main/java/org/apache/geode/redis/internal/executor/DelExecutor.java
Outdated
Show resolved
Hide resolved
geode-redis/src/main/java/org/apache/geode/redis/internal/executor/DelExecutor.java
Outdated
Show resolved
Hide resolved
@@ -37,7 +37,7 @@ public void executeCommand(Command command, ExecutionHandlerContext context) { | |||
try { | |||
ByteArrayWrapper skey = e.getKey(); | |||
RedisDataType type = e.getValue().getType(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no longer need to get type type
geode-redis/src/main/java/org/apache/geode/redis/internal/executor/RedisDataInRegion.java
Outdated
Show resolved
Hide resolved
@@ -218,21 +216,16 @@ public boolean removeKey(ByteArrayWrapper key, RedisDataType type, boolean cance | |||
if (!typeStoresDataInKeyRegistrar(type)) { | |||
keyRegistrar.unregister(key); | |||
} | |||
RedisKeyCommands redisKeyCommands = new RedisKeyCommandsFunctionExecutor(dataRegion); | |||
try { | |||
if (type == RedisDataType.REDIS_STRING) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider converting this if/elseif chain to a switch statement
|
||
long existsCount = commandElems | ||
.subList(1, commandElems.size()) | ||
.stream() | ||
.filter(key -> context.getKeyRegistrar().isRegistered(key)) | ||
.filter(key -> redisKeyCommands.exists(key)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes me happy that we didn't pass the key to the RedisKeyCommandsFunctionExecutor constructor
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lol...that would have been very passive aggressive
|
||
@Override | ||
public boolean del(ByteArrayWrapper key) { | ||
return (boolean) CommandFunction.execute(RedisCommandType.DEL, key, new Object[] {}, region); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something I find slightly confusing on CommandFunction is that is has a static method named execute. When looking at a Function I tend to look for its "instance" method named execute. Something we could consider is having all our *FunctionExecutor classes, subclass a common class that has the code from the static CommandFunction execute. I think that could also simplify how much we need to pass to this method (we would no longer need to pass the region since we could access it from the instance). Let me know what you think. No need to do this on this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, the static execute method looks a little weird to me as well.
I like the idea of having a simple interface other than the FunctionService to expose the function call, but the name execute
is definitely confusing.
Some kind of code sharing in the *FunctionExecutor classes is a good idea.
…che#5128) Co-authored-by: Sarah <mboxwala@pivotal.io> Co-authored-by: Sarah <sabbey@pivotal.io>
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?
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.