EVALSHA readonly in Redis

89 views
Skip to first unread message

Prathik Rajendran M

unread,
Feb 22, 2021, 8:41:14 AM2/22/21
to Redis DB
Hi All,

Like there is a READONLY GeoRadius command in the form of GEORADIUS_RO can we add a read only eval / evalsha command?

The use case is that if we want to allow EVAL and EVALSHA to go to replica nodes we need a way to have redis say that it's a read only command.

Many redis libraries rely on the meta data that a command is readonly to execute on a replica, having this type of read only support enables us to do that. An example is go-redis/redis, a popular library for redis in Go.

Here is the proposal:

Objective: Support automated routing to replica nodes in redis cluster via EVAL_RO and EVALSHA_RO. These commands will send back a metadata that they are readonly and libraries can safely redirect them to replica.

Non-Goals: (Or something I'm not too aggressive about) Doing checks on the lua script that only readonly commands are run. If there are write commands they'll go to replica and fail.

Proposal: Have a command EVAL_RO and EVALSHA_RO that have the same underlying implementation as their namesakes but pass back a metadata that they are readonly.

Please let me know if this makes sense and I'll start working on the contribution.

Itamar Haber

unread,
Feb 25, 2021, 12:55:03 PM2/25/21
to Redis DB
Hello Prathik,

Thanks for taking the time to prepare the proposal and for sharing it with the world. Before diving into the code (i.e. working on the contribution), I recommend that you also open a new issue with this feature request at https://github.com/redis/redis for additional visibility and feedback.

Cheers,
Itamar

Prathik Rajendran M

unread,
Feb 25, 2021, 10:31:50 PM2/25/21
to Redis DB
Thank you Itamar.

I have already posted in github issues.

I read the group description after I posted the email and that's why didn't create the issue first.

I should have updated that here as well.

The current status is that it has gone to TODO for Redis 7.0 https://github.com/redis/redis/projects/4

Do let me know if I can help in anyway.

PS. Great talk on redis modules by you on Youtube. We are planning to do really cool stuff with them.
Reply all
Reply to author
Forward
0 new messages