-
Notifications
You must be signed in to change notification settings - Fork 703
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
Adds support for running EVAL
with different scripting engines
#1497
base: unstable
Are you sure you want to change the base?
Conversation
8ae2eb8
to
f0c2edc
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## unstable #1497 +/- ##
============================================
+ Coverage 70.98% 71.03% +0.05%
============================================
Files 120 123 +3
Lines 65095 65298 +203
============================================
+ Hits 46210 46387 +177
- Misses 18885 18911 +26
|
f0c2edc
to
b8e97eb
Compare
Signed-off-by: Ricardo Dias <ricardo.dias@percona.com>
Signed-off-by: Ricardo Dias <ricardo.dias@percona.com>
b8e97eb
to
7ebf8d9
Compare
@zuiderkwast this is ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a huge change.
The module API changes look good to me.
It's impossible to proof-read the logic but I guess we have pretty good test coverage. Breaking up eval.c into smaller units is good idea, just hard to review. Can you summarize which code was just moved unchanged and which code was written, so it's possible to tell what to review carefully and what not?
@@ -0,0 +1,992 @@ | |||
#include "debug_lua.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have some copyright/license comment at the top. I believe 3 lines are enough:
# Copyright xxxxxxxxxxxx
# All rights reserved.
# SPDX-License-Identifier: BSD-3-Clause
We use Copyright 2025- Valkey contributors for new files, but for moved code we should probably keep the old names and years too.
@@ -61,6 +61,7 @@ | |||
#include "hdr_histogram.h" | |||
#include "crc16_slottable.h" | |||
#include "valkeymodule.h" | |||
#include "module.h" | |||
#include "io_threads.h" | |||
#include "module.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
module.h is included twice here
In this PR we re-implement the
EVAL
commands (EVAL
,EVALSHA
,SCRIPT LOAD
, etc...) to use the scripting engine infrastructure introduced in 6adef8e. This allowsEVAL
to run scripts using different scripting engines.The Lua scripting engine implementation code was moved into its own subdirectory
src/lua
.This new implementation generalizes the module API for implementing scripting engines to work with both
FUNCTION
andEVAL
commands.Module API changes include:
ValkeyModuleScriptingEngineCreateFunctionsLibraryFunc
toValkeyModuleScriptingEngineCompileCodeFunc
.enum ValkeyModuleScriptingEngineSubsystemType
to specify the scripting engine subsystem (EVAL, or FUNCTION, or both).ValkeyModuleScriptingEngineSubsystemType
.ValkeyModuleScriptingEngineResetEvalEnvFunc
.ValkeyModuleScriptingEngineExecutionState (*ValkeyModule_GetFunctionExecutionState)(ValkeyModuleScriptingEngineServerRuntimeCtx *server_ctx)
that is used by scripting engines to query the server about the execution state of the script that is running.Fixes #1261
Follow-up of #1277