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

Jedis Cluster functionalities improved (cluster-revised branch) #671

Merged
merged 39 commits into from Apr 21, 2015

Conversation

HeartSaVioR
Copy link
Contributor

Since there're some PRs on JedisCluster and it will be merged on 3.0.0, we can incubate cluster-revised branch for improving JedisCluster.

Currently these PRs are merged to cluster-revised branch (updated continuously)

phufool and others added 24 commits April 1, 2014 20:48
Fixed cluster scripting commands build test
-Add missing scripting methods with key
-Separate ScriptingCommands from JedisClusterScriptingCommands
 - Add missing methods with key parameter
 - Separate BinaryScriptingCommands from JedisClusterBinaryScriptingCommands
 - Add missing methods with key parameter
 - Separate BinaryScriptingCommands from JedisClusterBinaryScriptingCommands
 - Removed runBinaryScript
- fixed getSlot bug
- fixed eval method that uses bytearray keyCount
- changed methods that pass 1 for keyCount
- pass arg to runBinary
- removed BasicCommands
- Added getClusterNodes method back from accidentally removing it
- Removed test case using deprecated ping method
…is-cluster

Remove BasicCommand implementation from JedisCluster
…-revised

Conflicts:
	src/main/java/redis/clients/jedis/JedisCluster.java
@HeartSaVioR HeartSaVioR added this to the 3.0.0 milestone Jul 6, 2014
* add missing methods from BinaryJedisCluster
Conflicts:
	src/main/java/redis/clients/jedis/JedisCluster.java
* New interfaces introduced (copy existing interfaces and remove some commands)
* there're some commands that doesn't seems to compatible with Redis Cluster
  * remove commands from BinaryJedisCluster & JedisCluster
* Add some util (KeyMergeUtil), exception (related CROSSSLOT) classes
* Add runWithAnyNode() to JedisClusterCommand
  * some of commands (ex. publish/subscribe) doesn't need to run into
specific node
Conflicts:
	src/main/java/redis/clients/jedis/BinaryJedisCluster.java
	src/main/java/redis/clients/jedis/JedisCluster.java
Supports Multi Key commands to JedisCluster (revised of #673)
@HeartSaVioR
Copy link
Contributor Author

So many random tests failure occurred... We should have an issue tracing these and try to fix / discard tests.

@HeartSaVioR
Copy link
Contributor Author

@marcosnils
I've merged multi key ops PR into this PR, and upmerged.
We still don't have tests, and I wonder we can test commands for normal, pipeline, transaction, cluster, etc without much duplicated code.

@HeartSaVioR
Copy link
Contributor Author

Please note that I spent another over 1 hours to upmerge #687 and this.
I REALLY don't want to try it again.

* remove some of methods from common interface which doesn't fit RedisCluster
** move
@HeartSaVioR
Copy link
Contributor Author

@christophstrobl
I introduced new interfaces for BinaryJedisCluster and JedisCluster.
BinaryJedisCluster and JedisCluster don't have move() now. :)

@christophstrobl
Copy link

thanks @HeartSaVioR!

marcosnils added a commit that referenced this pull request Apr 21, 2015
Jedis Cluster functionalities improved (cluster-revised branch)
@marcosnils marcosnils merged commit ca59f9b into master Apr 21, 2015
@marcosnils
Copy link
Contributor

@HeartSaVioR exceptional work, I don't have preliminary observations. This PR really takes us really close to have a 3.0 version!.

@HeartSaVioR
Copy link
Contributor Author

@marcosnils Thanks for reviewing huge PR! Great work!

@benkris1
Copy link

@marcosnils @HeartSaVioR @christophstrobl you guys do a great job. great programer! Thank all of you!

christophstrobl added a commit to spring-projects/spring-data-redis that referenced this pull request Apr 24, 2015
Added ClusterConnection and started implementing required stuff for jedis as a start. Since there’s an open PR for jedis (redis/jedis#671) we should wait for that one to be fixed since it includes major stuff that’s currently missing to it still allowes to issue invalid commands like move that cannot be run in cluster mode….
@bpoweski
Copy link

bpoweski commented Sep 9, 2015

Is the intent to remove any common protocol between Jedis/JedisCluster for the 3.0 version?

@marcosnils
Copy link
Contributor

@bpoweski what do you mean exactly by "removing common protocols"?

@bpoweski
Copy link

bpoweski commented Sep 9, 2015

Apologies, I meant interfaces!

In the 2.7.3 branch JedisCluster and Jedis have the following signatures.

public class JedisCluster implements JedisCommands, BasicCommands, Closeable 

public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommands,
    AdvancedJedisCommands, ScriptingCommands, BasicCommands, ClusterCommands, SentinelCommands 

In master they now have:

public class JedisCluster extends BinaryJedisCluster implements JedisClusterCommands,
        MultiKeyJedisClusterCommands, JedisClusterScriptingCommands

public class Jedis extends BinaryJedis implements JedisCommands, MultiKeyCommands,
        AdvancedJedisCommands, ScriptingCommands, BasicCommands, ClusterCommands, SentinelCommands

While there are various caveats for using Redis cluster, the underlying API is mostly the same. Having a common interface between the two clients is useful. For example, we run our application using both a Redis Cluster and a non clustered Redis configuration. We currently use JedisCommands to abstract most of the differences between the two connections.

@HeartSaVioR
Copy link
Contributor Author

@bpoweski
There was some comments about removing caveats (some commands are not compatible with Redis Cluster) at compile time, and I think it is still important.
I also think having same interface is awesome for abstraction, but filling method body to UnsupportedOperationException is also bad kind of implementation.

tl;dr. There's pros and cons about each approach, and I just pick first one. It could be changed anytime when there's elegant way to resolve.

Also please note that Jedis 3.0 should be breaking changes, so we're free to REWRITE whole codes though I think it's hard to be occured for now.

@bpoweski
Copy link

bpoweski commented Sep 9, 2015

Have you considered rolling up shared signatures into a common interface and then using extends. For example, changing from:

public interface JedisCommands {
  String set(String key, String value);
  ..
}

public interface JedisClusterCommands {
  String set(String key, String value);
  ..
}

to:

public interface SingleKeyCommands {
  String set(String key, String value);
}

public interface JedisCommands extends SingleKeyCommands {
  ..
}

public interface JedisClusterCommands extends SingleKeyCommands, OtherSpecificNonClusterAllowedCommands {
  ..
}

An added benefit is that it would facilitate decomposing the larger JedisCommands and JedisClusterCommands interfaces into ones grouped by function. I suspect you'd reduce the line count by doing so given there is a so much overlap.

@HeartSaVioR
Copy link
Contributor Author

@bpoweski Maintaining OtherSpecificNonClusterAllowedCommands should be annoying.
I'm thinking another approach, breaks interface into data type, though it is just an idea for now.

@HeartSaVioR
Copy link
Contributor Author

@bpoweski Forgot to say "Thanks for giving your opinion!" :)
Please feel free to tell us your idea when there's better approaches.

@bpoweski
Copy link

bpoweski commented Sep 9, 2015

@HeartSaVioR, thank you for your work on this project.

christophstrobl added a commit to spring-projects/spring-data-redis that referenced this pull request Nov 24, 2015
Added ClusterConnection and started implementing required stuff for jedis as a start. Since there’s an open PR for jedis (redis/jedis#671) we should wait for that one to be fixed since it includes major stuff that’s currently missing to it still allowes to issue invalid commands like move that cannot be run in cluster mode….
@marcosnils marcosnils deleted the cluster-revised branch December 4, 2015 18:28
@lcy362
Copy link

lcy362 commented Mar 28, 2017

when will 3.0.0 release?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

9 participants