-
Notifications
You must be signed in to change notification settings - Fork 955
WIP: Build without Lua scripting via USE_LUA (#1204) #1245
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
Open
neomantra
wants to merge
9
commits into
valkey-io:unstable
Choose a base branch
from
neomantra:nm-1204
base: unstable
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
96a7bb5
Add evalScriptsDictSize function
neomantra 84b5269
Build without Lua scripting via USE_LUA (#1204)
neomantra 7f60c99
Update test coverage for non-Lua builds
neomantra 309a758
Add test-without-lua build to ci.yml
neomantra 536a63f
Fix test results from previous commit
neomantra ce8efa3
Fix test results for runtest-moduleapi
neomantra 489db63
Fix errors found in CI
neomantra dc246d9
More CI-discovered fixes
neomantra 51a4429
Update Lua-less EVAL error message per review
neomantra File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,11 @@ | |
| * 2. scriptingInit() - initServer() function from server.c invokes this to initialize LUA at startup. | ||
| * It is also invoked between 2 eval invocations to reset Lua. | ||
| */ | ||
|
|
||
| #include "server.h" | ||
|
|
||
| #ifdef USE_LUA | ||
|
|
||
| #include "sha1.h" | ||
| #include "rand.h" | ||
| #include "cluster.h" | ||
|
|
@@ -764,6 +768,10 @@ dict *evalScriptsDict(void) { | |
| return lctx.lua_scripts; | ||
| } | ||
|
|
||
| unsigned long evalScriptsDictSize(void) { | ||
| return dictSize(evalScriptsDict()); | ||
| } | ||
|
|
||
| unsigned long evalScriptsMemory(void) { | ||
| return lctx.lua_scripts_mem + dictMemUsage(lctx.lua_scripts) + dictSize(lctx.lua_scripts) * sizeof(luaScript) + | ||
| listLength(lctx.lua_scripts_lru_list) * sizeof(listNode); | ||
|
|
@@ -1756,3 +1764,64 @@ void luaLdbLineHook(lua_State *lua, lua_Debug *ar) { | |
| rctx->start_time = getMonotonicUs(); | ||
| } | ||
| } | ||
|
|
||
| #else /* USE_LUA is no */ | ||
|
|
||
| /* These stubs are used when Lua is disabled at compile time. | ||
| * They typically do nothing and report 0. */ | ||
|
|
||
| void scriptingInit(int setup) { | ||
| UNUSED(setup); | ||
| } | ||
|
|
||
| int ldbPendingChildren(void) { | ||
| return 0; | ||
| } | ||
|
|
||
| int ldbRemoveChild(pid_t pid) { | ||
| UNUSED(pid); | ||
| return 0; | ||
| } | ||
|
|
||
| unsigned long evalMemory(void) { | ||
| return 0; | ||
| } | ||
|
|
||
| unsigned long evalScriptsMemory(void) { | ||
| return 0; | ||
| } | ||
|
|
||
| uint64_t evalGetCommandFlags(client *c, uint64_t cmd_flags) { | ||
| UNUSED(c); | ||
| /* Pass through the cmd_flags */ | ||
| return cmd_flags; | ||
| } | ||
|
|
||
| unsigned long evalScriptsDictSize(void) { | ||
| return 0; | ||
| } | ||
|
|
||
| void ldbKillForkedSessions(void) { | ||
| } | ||
|
|
||
| void evalCommand(client *c) { | ||
| addReplyError(c, "No default engine loaded"); | ||
| } | ||
|
|
||
| void evalRoCommand(client *c) { | ||
| addReplyError(c, "No default engine loaded"); | ||
| } | ||
|
|
||
| void evalShaCommand(client *c) { | ||
| addReplyError(c, "No default engine loaded"); | ||
| } | ||
|
|
||
| void evalShaRoCommand(client *c) { | ||
| addReplyError(c, "No default engine loaded"); | ||
| } | ||
|
|
||
| void scriptCommand(client *c) { | ||
| addReplyError(c, "No default engine loaded"); | ||
| } | ||
|
Comment on lines
+1807
to
+1825
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We would need test to cover these scenarios. So, we might need separate test suite/tag for this particular flow. |
||
|
|
||
| #endif | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Might be just me. But
ifdefwithin the struct declaration gives a hit to the readability. We can consider refactoring this.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.
Maybe like?