redis / redis/node-redis

Scripts execution always uses EVAL with multi.

Open
#2,084 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug
Dominant language
TypeScript
Stars
17.6k
Forks
2k
Avg merge
2d 3h
Merged PRs (30d)
40

Description

The implementation of the multi script execution seems to check a local map https://github.com/redis/node-redis/blob/b97d18b61071b2d615c4606ee6b5930854b9e4e4/packages/client/lib/multi-command.ts#L16 for whether to use the EVAL or EVALSHA for script execution.
However, multi is always re-initiated for every transaction or pipeline execution, thus this means the script executed in the multi always end up with a EVAL with the full script uploaded over and over again.
In v3, I used to run "SCRIPT LOAD" for all scripts and then all subsequent commands would use evalsha. And if evalsha fails with NOSCRIPT, then the script is reloaded to redis again. I think redis v4 can implement similar approach and only need to handle the corner case of NOSCRIPT when it arises.

Node.js Version: v16.14.2
Redis Server Version: 6.2.5
Node Redis Version: redis@4.0.6
Platform: Debian bullseye

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/client/lib/multi-command.ts around the local script map linked in the issue, then trace how multi is re-created for transaction and pipeline execution. Reproduce script execution with Redis 6.2.5 and verify that subsequent executions use EVALSHA after SCRIPT LOAD, while handling the reported NOSCRIPT case by reloading the script.

Written by the indexing model from the issue text.

Assessment

Tech stack
redis, typescript
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.