feat(java): Implement missing eval & script commands - #5125
Merged
xShinnRyuu merged 11 commits intoJan 9, 2026
Merged
Conversation
Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com>
Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com>
Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com>
Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com>
Contributor
Author
|
@yipin-chen @alexr-bq Please review this. |
affonsov
reviewed
Jan 7, 2026
xShinnRyuu
reviewed
Jan 7, 2026
jduo
reviewed
Jan 7, 2026
affonsov
reviewed
Jan 7, 2026
affonsov
left a comment
Collaborator
There was a problem hiding this comment.
Update the CHANGELOG.md file
Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com>
Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com>
Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com>
Contributor
Author
|
@affonsov @jduo @xShinnRyuu Addressed all the comments. Please review again and Rust Tests/Lint failed which are not related to these changes. Please check that. Thanks. |
Signed-off-by: Sasidharan3094 <sasidharan.gopal94@gmail.com>
jduo
approved these changes
Jan 8, 2026
xShinnRyuu
approved these changes
Jan 8, 2026
tdschwarz
pushed a commit
to tdschwarz/valkey-glide
that referenced
this pull request
Jan 9, 2026
* Implement missing evalsha & script command for java client Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Applying splotlessapply changes Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Update test for script debug Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Fixing tests Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Addressing review comments Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Updating CHANGELOG Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Fixing spotlessApply changes Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> --------- Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> Signed-off-by: Sasidharan3094 <sasidharan.gopal94@gmail.com> Co-authored-by: Thomas Zhou <54688146+xShinnRyuu@users.noreply.github.com>
affonsov
pushed a commit
that referenced
this pull request
Aug 21, 2026
* Implement missing evalsha & script command for java client Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Applying splotlessapply changes Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Update test for script debug Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Fixing tests Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Addressing review comments Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Updating CHANGELOG Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> * Fixing spotlessApply changes Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> --------- Signed-off-by: Sasidharan Gopal <sasidharan.gopal94@gmail.com> Signed-off-by: Sasidharan3094 <sasidharan.gopal94@gmail.com> Co-authored-by: Thomas Zhou <54688146+xShinnRyuu@users.noreply.github.com>
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.
This PR fixes Issue
Implement EVAL_RO, EVALSHA_RO, and SCRIPT DEBUG Commands.
Summary
This PR adds support for 3 read-only Lua script execution and debugging commands to the Java client, enabling read-only script execution and script debugging capabilities for both standalone and cluster modes with full binary-safe support.
Commands Implemented
Base Commands (Standalone + Cluster)
✅ EVAL_RO - Execute read-only Lua scripts (Valkey 7.0+)
✅ EVALSHA_RO - Execute read-only scripts by SHA1 hash (Valkey 7.0+)
✅ SCRIPT DEBUG - Set Lua script debugging mode
Motivation
These commands provide essential capabilities for Lua script execution and debugging:
Changes Made
1. Enum Definition
ScriptDebugMode.java - Created new enum with 3 modes:
2. Interface Definitions
ScriptingAndFunctionsBaseCommands.java - Added 9 method signatures:
3. Client Implementations
GlideClient.java - Implemented 9 methods:
CompletableFuture<Object>for eval commands orCompletableFuture<String>for debugEvalReadOnly,EvalShaReadOnly,ScriptDebug)String[]andGlideString[]for binary safetyGlideClusterClient.java - Implemented 9 methods:
ScriptingAndFunctionsBaseCommands4. Rust Core Implementation
glide-core/src/request_type.rs - Added protobuf mappings and command implementations:
5. Integration Tests
SharedCommandTests.java - Added 3 comprehensive tests:
evalReadOnly_test - Tests all 4
evalReadOnlyoverloads:evalshaReadOnly_test - Tests all 4
evalshaReadOnlyoverloads:scriptDebug_test - Tests all 3 debug modes:
All tests run against 4 configurations:
6. Documentation
CHANGELOG.mdwith new commands@since Valkey 7.0annotations for version requirementsAPI Design
Async-First Pattern
All commands return
CompletableFuturefollowing GLIDE's async-first design:Binary-Safe Support
Each eval command has both
String[]andGlideString[]variants:Script Debugging Modes
Three debugging modes available via
ScriptDebugModeenum:Testing
Test Coverage
✅ All 12 tests passing (3 test methods × 4 configurations each)
✅ Standalone mode tests (RESP2 + RESP3)
✅ Cluster mode tests (RESP2 + RESP3)
✅ Binary-safe operations with
GlideString✅ Error handling for invalid SHA1
✅ Script execution after debug mode changes
✅ Keys and arguments passing
✅ All debug modes (YES, SYNC, NO)
Test Results
Key Features
Read-Only Script Execution
SHA1-Based Execution
SCRIPT LOADorScriptobjectDebugging Support
Version Requirements
Files Modified
Java Client
java/client/src/main/java/glide/api/models/commands/ScriptDebugMode.java(created)java/client/src/main/java/glide/api/commands/ScriptingAndFunctionsBaseCommands.javajava/client/src/main/java/glide/api/GlideClient.javajava/client/src/main/java/glide/api/GlideClusterClient.javajava/integTest/src/test/java/glide/SharedCommandTests.javaRust Core
glide-core/src/request_type.rsDocumentation
CHANGELOG.mdUsage Examples
Basic Read-Only Script Execution
SHA1-Based Execution
Script Debugging
Binary-Safe Operations