Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Misleading documentation about the evaluation of server loaded Lua scripts #2443

Open
SonnyRR opened this issue Apr 25, 2023 · 0 comments · May be fixed by #2444
Open

Misleading documentation about the evaluation of server loaded Lua scripts #2443

SonnyRR opened this issue Apr 25, 2023 · 0 comments · May be fixed by #2444

Comments

@SonnyRR
Copy link
Contributor

SonnyRR commented Apr 25, 2023

Recently, I had to investigate an issue with server failovers which cleared the SHA-1 hash cache and prevented me from evaluating back-end cached lua scripts because the hashes themselves did not exist on the server. The StackExchange.Redis version was quite outdated and did not feature the improvements in v2.6.66 which change how loaded scripts were evaluated.

Instead of sending the SHA-1 hash value, now the script itself is evaluated which works for our use case. However, I was trying to replicate the issue we experienced in an isolated environment using a docker container. I was not able to reproduce the initial issue after I updated the library, whenever I rebooted the container. The XML documentation for the LoadedLuaScript::Evaluate() & LoadedLuaScript::EvaluateAsync() do not reference the new behavior and mislead me. Finally, I had to take a look at the source code in order to understand why after a SCRIPT FLUSH [SYNC|ASYNC] command, the loaded lua scripts were able to be evaluated even though the hashes were not present on the server.

ℹ️ Update: After looking through the command logs with MONITOR, seems like if a previously loaded script's hash is not found on the server - it will be reloaded with SCRIPT LOAD. However, I'm seeing that it's evaluated with the EVAL command on the first evaluation, after the reload operation. Any subsequent evaluation uses EVALSHA.

@SonnyRR SonnyRR linked a pull request Apr 25, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant