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

[cluster-mode] redis-cli show database number after using SELECT #1812

Closed
Grokzen opened this issue Jun 13, 2014 · 7 comments
Closed

[cluster-mode] redis-cli show database number after using SELECT #1812

Grokzen opened this issue Jun 13, 2014 · 7 comments

Comments

@Grokzen
Copy link

Grokzen commented Jun 13, 2014

When running in cluster mode, changing db is not supported but redis-cli still show the database number after SELECT is used.

This is a example output from redis-cli

redis 127.0.0.1:7000[2]> SELECT 0
OK
redis 127.0.0.1:7000> SELECT 1
(error) ERR SELECT is not allowed in cluster mode
redis 127.0.0.1:7000[1]> SELECT 2
(error) ERR SELECT is not allowed in cluster mode
redis 127.0.0.1:7000[2]> SELECT 3
(error) ERR SELECT is not allowed in cluster mode
@qwitwa
Copy link

qwitwa commented Jan 13, 2015

This happens regardless of clustering settings if you use a large enough database number: Redis-cli simply doesn't check that the select didn't error when changing the db number it displays.

127.0.0.1:6379> SELECT 4
OK
127.0.0.1:6379[4]> SET foo bar
OK
127.0.0.1:6379[4]> SELECT 1000
(error) ERR invalid DB index
27.0.0.1:6379[1000]> SET foo confusingly
OK
27.0.0.1:6379[1000]> get foo
"confusingly"
127.0.0.1:6379[1000]> select 4
OK
127.0.0.1:6379[4]> get foo
"confusingly"

@HeartSaVioR
Copy link
Contributor

Seems like it was fixed by unstable branch. Could you update & build and try again?

-- updated
@qwitwa's issue doesn't resolved. It seems resolved only display layer.

127.0.0.1:6379> del foo
(integer) 0
127.0.0.1:6379> select 4
OK
127.0.0.1:6379[4]> del foo
(integer) 1
127.0.0.1:6379[4]> set foo bar
OK
127.0.0.1:6379[4]> select 1000
(error) ERR invalid DB index
127.0.0.1:6379> get foo
"bar"
127.0.0.1:6379> select 0
OK
127.0.0.1:6379> get foo
(nil)

@HeartSaVioR
Copy link
Contributor

Maybe I've fixed this issue by #2283, could you please check and verify? Thanks!

@qwitwa
Copy link

qwitwa commented Jan 14, 2015

After building from the fix-redis-cli-select-db branch:

127.0.0.1:6379> get foo
(nil)
127.0.0.1:6379> select 2
OK
127.0.0.1:6379[2]> get foo
"baz"
127.0.0.1:6379[2]> select 1000
(error) ERR invalid DB index
127.0.0.1:6379[2]> get foo
"baz"
127.0.0.1:6379[2]>

Yup, looks good.

@qwitwa
Copy link

qwitwa commented Jan 14, 2015

\o/ All tests passed without errors!

Tests pass.

@HeartSaVioR
Copy link
Contributor

@qwitwa Thanks for verifying!

@mattsta
Copy link
Contributor

mattsta commented Jan 19, 2015

Closing because tracking in #2283

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

No branches or pull requests

4 participants