Skip to content
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

Merged
merged 8 commits into from
May 19, 2020

Conversation

prettyClouds
Copy link
Contributor

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.

@jdeppe-pivotal jdeppe-pivotal added the redis Issues related to the geode-for-redis module label May 18, 2020
@jdeppe-pivotal jdeppe-pivotal added this to In progress in Redis Module via automation May 18, 2020
@@ -37,7 +37,7 @@ public void executeCommand(Command command, ExecutionHandlerContext context) {
try {
ByteArrayWrapper skey = e.getKey();
RedisDataType type = e.getValue().getType();
Copy link
Contributor

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

@prettyClouds prettyClouds marked this pull request as ready for review May 18, 2020 21:40
@prettyClouds prettyClouds changed the title Key commands::DELETE Use Function/Delta model for key commands: DELETE, EXISTS May 19, 2020
@prettyClouds prettyClouds changed the title Use Function/Delta model for key commands: DELETE, EXISTS Use Function-Delta model for key commands: DELETE, EXISTS May 19, 2020
@prettyClouds prettyClouds changed the title Use Function-Delta model for key commands: DELETE, EXISTS Key Commands, DELETE and EXISTS, implement Function-Delta paradigm May 19, 2020
@prettyClouds prettyClouds changed the title Key Commands, DELETE and EXISTS, implement Function-Delta paradigm DELETE and EXISTS, implement Function-Delta paradigm May 19, 2020
@prettyClouds prettyClouds changed the title DELETE and EXISTS, implement Function-Delta paradigm DELETE and EXISTS implement Function-Delta May 19, 2020
@prettyClouds prettyClouds changed the title DELETE and EXISTS implement Function-Delta GEODE-8147: DELETE and EXISTS implement Function-Delta May 19, 2020
@@ -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) {
Copy link
Contributor

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))
Copy link
Contributor

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

Copy link
Contributor Author

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);
Copy link
Contributor

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

Copy link
Contributor Author

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.

Redis Module automation moved this from In progress to Reviewer approved May 19, 2020
@dschneider-pivotal dschneider-pivotal merged commit 7e222df into apache:develop May 19, 2020
Redis Module automation moved this from Reviewer approved to Done May 19, 2020
agingade pushed a commit to agingade/geode that referenced this pull request Jun 3, 2020
…che#5128)

Co-authored-by: Sarah <mboxwala@pivotal.io>
Co-authored-by: Sarah <sabbey@pivotal.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
redis Issues related to the geode-for-redis module
Projects
Redis Module
  
Done
4 participants