Netflix / dynomite

A generic dynamo implementation for different k-v storage engines
Apache License 2.0
4.2k stars 532 forks source link

Dynomite, Support REDIS SELECT 0 command #670

Open maksimlikharev opened 5 years ago

maksimlikharev commented 5 years ago

In some cases Redis clients do SELECT 0, even if no db explicitly specified.

Purpose of this PR to support SELECT 0 and return error if other value is provided.

anujphadke commented 5 years ago

With the change - (env) anuj@anuj-VirtualBox:~/work/dynomite$ redis-cli -h 127.0.1.1 -p 8102 127.0.1.1:8102> SELECT 0 <<<<<<<< works now OK 127.0.1.1:8102> SELECT 1 Error: Server closed the connection 127.0.1.1:8102> SELECT 2 Error: Server closed the connection 127.0.1.1:8102> SELECT 200000 Error: Server closed the connection 127.0.1.1:8102>

Without the change it rejected "SELECT 0" (env) anuj@anuj-VirtualBox:~/work/dynomite$ redis-cli -h 127.0.1.1 -p 8102 127.0.1.1:8102> SELECT 0 Error: Server closed the connection 127.0.1.1:8102> SELECT 1 Error: Server closed the connection 127.0.1.1:8102> SELECT 3 Error: Server closed the connection 127.0.1.1:8102> quit; Error: Server closed the connection 127.0.1.1:8102> quit

The code change looks fine to me. @smukil - Can you take a final look at this change?