feat(jedis-compatibility:): add scripting commands to Jedis compatibility layer#5305
Open
prashanna-frsh wants to merge 11 commits intovalkey-io:mainfrom
Open
feat(jedis-compatibility:): add scripting commands to Jedis compatibility layer#5305prashanna-frsh wants to merge 11 commits intovalkey-io:mainfrom
prashanna-frsh wants to merge 11 commits intovalkey-io:mainfrom
Conversation
Collaborator
|
Hi @prashanna-frsh, it looks like your commits are not verified. We have a policy that all commits needs to have signing and signoff. We can help review your PR after these are being taken care of. |
2 tasks
Implement full support for Lua scripting and Valkey Functions in the Jedis compatibility layer, including EVAL, EVALSHA, SCRIPT management, FCALL, and FUNCTION commands. Changes: - Add EVAL/EVALSHA/evalReadonly/evalshaReadonly methods to Jedis.java - Add SCRIPT LOAD/EXISTS/FLUSH/KILL management commands - Add FCALL/FUNCTION LOAD/DELETE/DUMP/RESTORE/LIST/STATS commands - Create FlushMode and FunctionRestorePolicy enums with GLIDE conversions - Add 15 reflection-based unit tests in JedisMethodsTest - Add 23 integration tests in JedisScriptingIntegTest - Update compatibility-layer-migration-guide.md to reflect scripting support - Add scripting examples to README.md and create JedisScriptingExample.java - Document use of customCommand for SCRIPT LOAD and EVALSHA (not in GLIDE API) Implementation uses type-safe GLIDE APIs where available (scriptExists, scriptFlush, evalReadOnly, fcall, functionLoad) and customCommand for operations not yet exposed in GLIDE Java (SCRIPT LOAD, EVALSHA). All tests passing (15/15 unit, 23/23 integration). No regressions. Signed-off-by: prashanna-frsh <prashanna.rajendran@freshworks.com>
08870a2 to
a925875
Compare
Contributor
Author
added signing |
Signed-off-by: prashanna-frsh <prashanna.rajendran@freshworks.com>
7 tasks
jeremyprime
approved these changes
Feb 12, 2026
java/jedis-compatibility/src/main/java/redis/clients/jedis/Jedis.java
Outdated
Show resolved
Hide resolved
java/jedis-compatibility/src/main/java/redis/clients/jedis/args/FlushMode.java
Show resolved
Hide resolved
java/jedis-compatibility/src/main/java/redis/clients/jedis/args/FunctionRestorePolicy.java
Show resolved
Hide resolved
java/jedis-compatibility/src/main/java/redis/clients/jedis/args/FlushMode.java
Outdated
Show resolved
Hide resolved
java/jedis-compatibility/src/main/java/redis/clients/jedis/Jedis.java
Outdated
Show resolved
Hide resolved
java/jedis-compatibility/src/main/java/redis/clients/jedis/Jedis.java
Outdated
Show resolved
Hide resolved
java/jedis-compatibility/src/main/java/redis/clients/jedis/Jedis.java
Outdated
Show resolved
Hide resolved
java/jedis-compatibility/src/main/java/redis/clients/jedis/Jedis.java
Outdated
Show resolved
Hide resolved
java/jedis-compatibility/src/test/java/redis/clients/jedis/JedisMethodsTest.java
Outdated
Show resolved
Hide resolved
prateek-kumar-improving
approved these changes
Feb 13, 2026
Collaborator
|
@prashanna-frsh |
2e16f32 to
75495dd
Compare
f8a522a to
614fbce
Compare
Signed-off-by: prashanna-frsh <prashanna.rajendran@freshworks.com>
Signed-off-by: prashanna-frsh <prashanna.rajendran@freshworks.com>
Signed-off-by: prashanna-frsh <prashanna.rajendran@freshworks.com>
Signed-off-by: prashanna-frsh <prashanna.rajendran@freshworks.com>
614fbce to
e693c93
Compare
Signed-off-by: Prashanna <prashanna.rajendran@freshworks.com>
Contributor
Author
|
@xShinnRyuu can you merge this |
…hods Fixed compilation errors caused by missing closing braces in: - functionStats() method in Jedis.java - testFunctionListMethodSignatures() method in JedisMethodsTest.java Also removed duplicate method declaration and leftover test code. Signed-off-by: prashanna-frsh <prashanna.rajendran@freshworks.com> Co-authored-by: Cursor <cursoragent@cursor.com>
c1ea189 to
2e9b4c7
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Summary
This PR adds comprehensive scripting and function command support to the Jedis compatibility layer, enabling full Lua script execution and Valkey Functions capabilities. This includes 29 new methods covering EVAL, EVALSHA, SCRIPT management commands, FCALL, and all FUNCTION operations, making the compatibility layer feature-complete for server-side scripting.
Issue link
This Pull Request is linked to issue (URL): [https://github.com//issues/5304]
Features / Behaviour Changes
New Scripting Commands (29 methods)
Lua Script Execution (9 methods):
eval()- Execute Lua scripts with three overloads (simple, with key count, with lists)evalsha()- Execute scripts by SHA1 digest with three overloadsevalReadonly()- Execute read-only scripts (Valkey 7.0+)evalshaReadonly()- Execute read-only scripts by SHA1 (Valkey 7.0+)SCRIPT Management (5 methods):
scriptLoad()- Load scripts and return SHA1 digestscriptExists()- Check script existence in cachescriptFlush()- Flush script cache (with optional flush mode)scriptKill()- Kill currently executing scriptValkey Functions (15 methods):
functionLoad()/functionLoadReplace()- Load function librariesfunctionDelete()- Delete function librariesfunctionDump()/functionRestore()- Dump and restore functions (with policy support)functionFlush()- Flush all functions (with optional flush mode)functionKill()- Kill currently executing functionfcall()/fcallReadonly()- Invoke functionsfunctionList()- List functions (with optional pattern and code inclusion)functionStats()- Get function statisticsSupporting Types (2 enums)
FlushMode- SYNC/ASYNC modes for flush operations with GLIDE converterFunctionRestorePolicy- APPEND/FLUSH/REPLACE policies with GLIDE converterImplementation
Architecture Overview
The implementation follows a hybrid approach leveraging both type-safe GLIDE APIs and
customCommandwhere necessary:Type-Safe GLIDE APIs Used (18 methods):
scriptExists(),scriptFlush(),scriptKill()evalReadOnly(),evalshaReadOnly()fcall(),fcallReadOnly(),functionLoad(),functionList(),functionStats(), etc.CustomCommand Used (2 methods):
scriptLoad()- GLIDE'sScriptobject only stores scripts in Rust FFI layer; doesn't sendSCRIPT LOADto serverevalsha()- GLIDE only exposesevalshaReadOnly(); standardEVALSHArequirescustomCommandKey Implementation Details
Pattern Consistency: All methods use the existing
executeCommandWithGlide()helper pattern for unified error handling and connection management.Type Conversions: Transparent conversion between Jedis types and GLIDE types:
List<String>↔String[]FlushMode→glide.api.models.commands.FlushModeFunctionRestorePolicy→glide.api.models.commands.function.FunctionRestorePolicyJavaDoc Documentation: All methods include:
customCommandusage where applicableFiles Modified
Core Implementation:
java/jedis-compatibility/src/main/java/redis/clients/jedis/Jedis.java- Added 29 methods (~290 lines)java/jedis-compatibility/src/main/java/redis/clients/jedis/args/FlushMode.java- New enum (34 lines)java/jedis-compatibility/src/main/java/redis/clients/jedis/args/FunctionRestorePolicy.java- New enum (40 lines)Testing:
java/jedis-compatibility/src/test/java/redis/clients/jedis/JedisMethodsTest.java- Added 8 test methods (150 lines)java/integTest/src/test/java/compatibility/jedis/JedisScriptingIntegTest.java- New file with 23 tests (439 lines)Documentation:
java/jedis-compatibility/README.md- Added scripting examples sectionjava/jedis-compatibility/compatibility-layer-migration-guide.md- Updated scripting support statusexamples/java/JedisScriptingExample.java- New comprehensive example (197 lines)Areas Requiring Review Attention
CustomCommand Usage: Lines 7182-7195 (scriptLoad) and 7109-7130 (evalsha) - Verify this is the correct approach given GLIDE API limitations.
Lua Function Syntax: Line 428 in integration tests - Using table-based
redis.register_function{}syntax for Valkey 7.0+ compatibility.Type Safety: Enum conversion methods (FlushMode.java:28-32, FunctionRestorePolicy.java:24-34) - Ensure proper mapping to GLIDE enums.
Error Handling: All methods use
executeCommandWithGlide()- consistent with existing pattern but reviewers should verify exception wrapping is appropriate.Limitations
None - All standard Jedis scripting commands are fully implemented:
Note: Binary (
byte[]) overloads for scripts are not implemented but were not requested and are rarely used in practice.Testing
Unit Tests (15 total, all passing)
Test File:
JedisMethodsTest.javaCoverage:
Integration Tests (23 total, all passing)
Test File:
JedisScriptingIntegTest.javaTest Categories:
Basic EVAL operations (5 tests)
SCRIPT management (4 tests)
Read-only operations (2 tests)
Function operations (12 tests)
Test Results:
Manual Testing
Tested against:
Regression Testing
Checklist
Before submitting the PR make sure the following are checked:
make java-linttargets) and Prettier has been run (make prettier-fix).Additional Checks
customCommandusageImplementation Statistics: