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

JedisConnection may fail to select database [DATAREDIS-10] #588

Closed
spring-projects-issues opened this issue Apr 13, 2011 · 2 comments
Closed
Labels
type: bug A general bug
Milestone

Comments

@spring-projects-issues
Copy link

spring-projects-issues commented Apr 13, 2011

Lasse opened DATAREDIS-10 and commented

In JedisConnection:103-105 the database is selected only if dbIndex > 0.

The problem is, if a connection pool is used and a database > 0 has been selected for a Jedis connection and it is later being requested from JedisConnectionFactory with dbIndex == 0, then it will not execute select(0) and thus still be connected to the other database.

Select(dbIndex) needs to be executed every time


Affects: 1.0.0.M3

Issue Links:

  • DATAREDIS-714 JedisConnection always executes SELECT via RedisTemplate

Referenced from: commits spring-projects/spring-data-keyvalue@aebcb56

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Apr 13, 2011

Lasse commented

Actually, what would be really great in terms of reducing calls to the redis server and ensuring the correct database is selected woul dbe to somehow get the connection pool to test connections on borrow using the adequate select command instead of ping. But that is probably not possible because connections rae borrowed from the pool before the databas eindex is set on them

@spring-projects-issues
Copy link
Author

spring-projects-issues commented Apr 14, 2011

Costin Leau commented

The ideal solution really is to handle this in the driver as it provides the pooling as well and handle the reuse.
However I've added some extra logic to reset the connections returned to the pool so any db selection made by Spring Redis, is reverted back.

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

No branches or pull requests

1 participant