hackpar / redis

Automatically exported from code.google.com/p/redis
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

redis-cli losts selected database after reconnect #468

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What version of Redis you are using, in what kind of Operating System?
Redis 2.0.3 on Linux

What is the problem you are experiencing?
I have redis-cli console always open, and use one of many databases in each 
console. After the client reconnects I'm forced to default 0 database and 
should do "select X" again. Although I expect the same behavior as mysql client 
does, for example - it restores selected database

What steps will reproduce the problem?
open a console with redis-cli, select not default database, wait for timeout 
and execute any command

Thank you

Original issue reported on code.google.com by nike.gur...@gmail.com on 23 Feb 2011 at 10:21

GoogleCodeExporter commented 8 years ago
As a workaround, you may want to simply disable the idle timeout,
by setting it to 0 in the redis configuration.

Using the epoll device, Redis is able to support a large number
of connections anyway, so using intermittent connections to
decrease the number of connections is not so useful IMO.

However, you may want to use the idle timeout as a safety
mechanism to close connections associated to broken/stuck
clients. Please note you have an underlying keepalive
mechanism with TCP, supposed to take care of network issues.
So the only situation where a server-side idle timeout is
really useful is with stuck clients (i.e. clients still alive
but frozen). In my experience, this is not so frequent, so
I tend to deactivate idle timeouts on all my database systems.

Regards,
Didier.

Original comment by didier...@gmail.com on 23 Feb 2011 at 11:22

GoogleCodeExporter commented 8 years ago
See also https://github.com/antirez/redis/pull/37

It's a one line fix that I have implemented here: 
https://github.com/catwell/redis/commit/97e501a53367bf25e489dbe81ad9fedf5ff9f8ba

Original comment by catwell...@gmail.com on 23 Feb 2011 at 2:21

GoogleCodeExporter commented 8 years ago
Thanks, I've added this together with showing the database number in the prompt 
for interactive sessions. You don't want to call FLUSHDB against the wrong 
database ;-).

https://github.com/pietern/redis/compare/69bfdc%5E%5E...69bfdc

Original comment by pcnoordh...@gmail.com on 6 Mar 2011 at 8:13

GoogleCodeExporter commented 8 years ago
Issue 504 has been merged into this issue.

Original comment by pcnoordh...@gmail.com on 1 Apr 2011 at 12:24

GoogleCodeExporter commented 8 years ago
Issue 541 has been merged into this issue.

Original comment by pcnoordh...@gmail.com on 2 May 2011 at 9:15