-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Update lettuce to 3.x #104
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
Conversation
Update lettuce redis client to latest snapshot, adopt changed API and use API for commands which were emulated using LUA script Reference: DATAREDIS-348
Implement Sentinel support using lettuce library, adopt finer grained exceptions and aligned exception behavior to match other libraries. Added shutdown-timeout property in order to control shutdown duration of the netty framework which reduces test run duration. Documentation updated as well. Contains also a fix to use psetex instead of setex (typo). Reference: DATAREDIS-348
Please review this PR. It is in the first step a proposal how to adopt lettuce 3.x into spring-data-redis. |
private Object await(Command cmd) { | ||
if (isMulti && cmd.type != MULTI) { | ||
private Object await(com.lambdaworks.redis.protocol.RedisCommand cmd) { | ||
if (isMulti && cmd instanceof Command && ((Command)cmd).isMulti()) { |
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.
should have been && !((Command)cmd).isMulti()
right?
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.
right. It's a typo and I no test fails. This seems awkward to me. I'll add a test case for this behavior
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.
I took a look again since the code was confusing. await(...)
is called only in regular mode (pipeline=false
and queuing=false
). This means isMulti
is in await(...)
always false
.
Another issue that I noticed is:
Issuing MULTI
via exec on a regular connection (connection.execute("MULTI")
) with await(...)
will return an empty List
. All following commands will be triggered within the MULTI
on Redis but won't provide a result on the final EXEC
. This is because lettuce queues all MULTI
-related outputs in an internal
MultiOutput
. The MultiOutput
in case of a EXEC
using execute(...)
is empty and has no definition about the data structures that come back.
So coming back to await(...)
it means that the if
-clause can be removed safely.
Does it make sense?
thx @mp911de that looks pretty decent - as this is quite a big shift I'd ask you to give us a little time to think things through in detail. |
Sure. I'll provide the changes mentioned above. Take as long as you need. If you need any changes to lettuce, come back to me. |
f807f76
to
f6a7ec5
Compare
Hi Mark, would you mind rebasing this on the current master? I wanted to give it a spin - but I couldn't apply your patch. Cheers, Btw. I just read on your site that you're from Weinheim - I'm often near Viernheim - let me know if you want to grab a beer ;-) |
Hi Thomas, |
Hi, Great looking forward to meet you :) |
Conflicts: src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConnection.java src/test/java/org/springframework/data/redis/connection/lettuce/LettuceConnectionIntegrationTests.java
Merged master into DATAREDIS-348. I also created a rebased branch (https://github.com/mp911de/spring-data-redis/tree/issue/DATAREDIS-348b, see https://github.com/mp911de/spring-data-redis/compare/issue/DATAREDIS-348b for comparison) since I'm not quite sure wether the merge results in what we expect. |
@christophstrobl @thomasdarimont still interested in the lettuce 3.x upgrade or should I abandon this PR? |
Hi Mark, sorry for the radio silence - we worked on different projects for a while and Christoph currently is and I will be on holiday for the next 2 weeks. Although we focus on using the jedis driver in SD Redis internally, it would be helpful to have an updated lettuce alternative at hand, especially given that the lettuce driver we currently use was last updated in 2013... @christophstrobl @olivergierke thoughts? Cheers, |
I am not too much in the details but it worries me that this PR seems to introduce a lot of dependencies to the Lattice driver in types that didn't have driver dependencies before. Is that by purpose? |
I'm not quite sure which types you're talking about. Do you mean netty or the massive change within the import sections? I could not find types in which imports to |
Looks like the imports are ordered differently. They showed additions but the removals further below (which I oversaw). All good. |
…DATAREDIS-348c Conflicts: gradle.properties src/asciidoc/reference/redis.adoc src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java
…DATAREDIS-348c Conflicts: gradle.properties src/asciidoc/reference/redis.adoc src/main/java/org/springframework/data/redis/connection/lettuce/LettuceConverters.java
Rebased this PR to the most recent master. Added support for HLL and ZRANGEBYLEX |
thanks @mp911de! |
Updated lettuce redis client to latest snapshot, adopt changed API and use API for commands which were emulated using LUA script Implemente Sentinel support using lettuce library, adopt finer grained exceptions and aligned exception behavior to match other libraries. Added shutdown-timeout property in order to control shutdown duration of the netty framework which reduces test run duration. Documentation updated as well. Contains also a fix to use psetex instead of setex (typo). Switch to Jedis for Redis Version discovery in tests. Polished documentation. Use LettuceConverter and native time() method. Original pull request: #144. Related pull request: #104.
Fixed connection problems leaving sockets open. Added missing JUnit rules for Sentinels. Added missing author information update, license header and Javadoc. Upgraded test script to use Redis 3.0.2. Upgrade test script to shut down Redis in case of test errors. Added Redis 3.0 to TestProfileValueSource. Enabled ZRANGEBYLEX tests for lettuce. Original pull request: #144. Related pull request: #104.
This PR could be closed, lettuce 3.0 was merged to master with #144. WDYT? |
fixed in #144 |
MinimumRedisVersionRule
to Jedis since Jedis has a much faster shutdown behavior than lettuceReference: DATAREDIS-348