Align Search APIs and behaviour with Redis 8.0+#4173
Conversation
85ff14f to
f85344a
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR aligns various Redis search APIs with Redis 8.0+ policies by introducing a new keyless command execution method, implementing round‑robin distribution for keyless commands in cluster mode, and replacing legacy search iteration APIs with a more robust AggregateIterator. Key changes include the introduction of executeKeylessCommand, removal of JedisBroadcastAndRoundRobinConfig, and the implementation of round‑robin scheduling in ClusterCommandExecutor.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/redis/clients/jedis/modules/search/AggregateIteratorTest.java | New tests for AggregateIterator covering basic use, cursor removal and error cases |
| src/main/java/redis/clients/jedis/search/aggr/AggregationBuilder.java | Adds cursorCount tracking when using cursor-based aggregation |
| src/main/java/redis/clients/jedis/search/aggr/AggregateIterator.java | Implements a new iterator for aggregation results with proper cursor management |
| src/main/java/redis/clients/jedis/executors/ClusterCommandExecutor.java | Introduces round‑robin distribution for keyless command execution |
| src/main/java/redis/clients/jedis/UnifiedJedis.java | Updates search commands to use the new executeKeylessCommand method and deprecates legacy APIs |
| src/main/java/redis/clients/jedis/CommandObjects.java | Adjusts round‑robin command routing logic and removes unused configuration |
Comments suppressed due to low confidence (1)
src/main/java/redis/clients/jedis/CommandObjects.java:3443
- [nitpick] Add a comment explaining why certain SearchCommands (SUGGET, SUGADD, SUGLEN, SUGDEL, CURSOR) are excluded from round-robin routing to aid future maintainers.
private boolean isRoundRobinSearchCommand(SearchCommand sc) {
b03ef67 to
3e38aa4
Compare
3e38aa4 to
12b7e92
Compare
12b7e92 to
57b101b
Compare
09f3333 to
666f77c
Compare
ggivo
left a comment
There was a problem hiding this comment.
Looks good.
Added some comments that can be addressed later.
And also sharing a concern around sticky connection management, which will lock the connection from the pool for the time of iteration.
666f77c to
b27d847
Compare
b27d847 to
3439e69
Compare
🛡️ Jit Security Scan Results✅ No security findings were detected in this PR
Security scan by Jit
|
ggivo
left a comment
There was a problem hiding this comment.
LGTM,
There are comments by cursor that seems ligitime
- Introduce AggregateIterator for proper Cluster support - Deprecate APIs that rely on legacy RediSeach behaviour
707287a to
5c40f91
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Based on #4411
Note
Medium Risk
Touches client-side cursor iteration and connection-provider behavior; correctness depends on proper node selection and cursor lifecycle handling in both standalone and cluster deployments.
Overview
Introduces
AggregateIterator, a new cursor-based iterator forFT.AGGREGATEthat keeps cursor reads/deletes on the same Redis node and borrows/returns pooled connections per batch to avoid pool exhaustion/leaks;UnifiedJedisandRediSearchCommandsgainftAggregateIterator(...)to expose it.Deprecates legacy iteration/cursor APIs (
FtAggregateIteration,FtSearchIterationandUnifiedJedis.ftSearchIteration(...), plusftCursorRead/ftCursorDelinRediSearchCommands) and extendsAggregationBuilderwith cursor batch size tracking plusAggregationResult.isEmpty()to support iterator semantics; adds standalone+cluster integration tests and unit tests, and fixesPooledConnectionProvider.getPrimaryNodesConnectionMap()to return the pool rather than borrowing a connection.Written by Cursor Bugbot for commit 464d231. This will update automatically on new commits. Configure here.