👋 I was debugging an issue today, a customer saw an abnormal number of SELECTS being sent to their Redis instance, which was pretty odd given they weren't passing any arguments into GetDatabase
. After a bit of digging, I found this bit of code from the libraries earliest days, which pointed me to the fact that whenever they execute a transaction, a SELECT
is called immediately afterward.
I then noticed that above that bit, the UNKNOWN
command also falls through to the same condition. This means that if you execute any Redis Command via the Execute
/ExecuteAsync
API (which is the pattern in NRediSearch, Redis.OM, NReJSON, etc. . .) that the multiplexer will immediately call SELECT
afterward.
I suppose my question is in 2 parts
1: What was the origination of this behavior for EXEC
? My guess would be that it's because if you call a SELECT
in the middle of a transaction that it will change the client's selected database. But I don't think there's a way in which you can call an arbitrary command on a transaction is there? My other guess would be that since you are loaning a copy of the database to the transaction you need to be double sure that you set the selected database is correct afterward, but for some reason that doesn't ring correctly to me.
2: Would it be possible to provide either a way to extend the RedisCommand
enum to allow expanded command sets, or alternatively perhaps provide a configuration item to prevent UNKNOWN
commands from encountering this?
I'd of course be happy to open any PRs required myself.
Thanks!
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4