hanxi opened a new issue, #3291:
URL: https://github.com/apache/kvrocks/issues/3291

   ### Search before asking
   
   - [x] I had searched in the 
[issues](https://github.com/apache/kvrocks/issues) and found no similar issues.
   
   
   ### Motivation
   
   
   Hi Kvrocks Team,
   
   Kvrocks already supports authenticating namespaces using numeric dbid when 
users configure mappings like:
   
   ```
   namespace.ns0 0
   namespace.ns1 1
   ...
   namespace.ns15 15
   ```
   
   This allows:
   
   ```
   AUTH 3
   ```
   
   to switch the active namespace.
   
   šŸ’” Feature Request
   
   I propose that Kvrocks should support:
   
   ```
   SELECT <dbid>
   ```
   
   as a direct alias of:
   
   ```
   AUTH <dbid>
   ```
   
   when dbid → namespace mapping exists.
   
   Why?
   
   Unsupported command `SELECT` in Kvrocks, All db are some.
   
   
   But since Kvrocks already has a dbid → namespace mapping mechanism for AUTH, 
it is natural to reuse it for SELECT.
   
   Expected behavior
   
   If mapping exists:
   
   ```
   namespace.ns3 3
   ```
   
   Then:
   
   ```
   SELECT 3
   ```
   
   should internally behave exactly like:
   
   ```
   AUTH 3
   ```
   
   If the dbid is not configured → return an authentication error.
   
   šŸ“˜ Related Work
   
   I built a small proxy that implements this translation:
   
   SELECT dbid → AUTH dbid
   
   Proxy code:
   https://github.com/hanxi/kvrocks-proxy/blob/main/main.go
   
   But ideally this compatibility behavior should be built into Kvrocks 
directly.
   
   Related issue: https://github.com/apache/kvrocks/issues/492
   
   šŸ™ Request for Comments
   
   Before preparing a PR, I’d like feedback from the community:
   
   1. Is mapping SELECT <dbid> to AUTH <dbid> acceptable?
   
   
   2. Should this behavior be always enabled or require a config flag?
   
   
   3. Any concerns about side effects when supporting Redis clients?
   
   
   
   Thanks!
   
   
   
   ### Solution
   
   _No response_
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to