GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Expose renewSlotCache on JedisCluster as public API by agarwalbharat · Pull Request #4555 · redis/jedis

Conversation

@agarwalbharat

@agarwalbharat agarwalbharat commented Jun 2, 2026 •
edited by ggivo
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

Jedis already supports refreshing the Redis Cluster slot cache internally through ClusterConnectionProvider.renewSlotCache(), but callers directly using do not have a public API to trigger that refresh directly.

This is useful for applications that detect stale or incomplete cluster topology state outside the normal command retry path, especially for direct slot/node workflows such as getConnectionFromSlot().

Add JedisCluster#refreshClusterTopology() as a public API that delegates to the existing ClusterConnectionProvider renewal path.
This gives applications an explicit way to refresh the in-memory cluster slot cache when they detect stale topology state outside the normal command retry flow.

Closes : #4154


Note

Low Risk
Thin public wrapper over existing renewal logic; no new topology algorithm, only broader caller access to a path already used internally.

Overview
Adds refreshClusterTopology() on JedisCluster and RedisClusterClient, exposing a way for apps to force an in-memory cluster topology refresh (nodes and slot map) by delegating to the existing ClusterConnectionProvider#renewSlotCache() path—intended when stale routing is noticed outside normal command retries, e.g. before getConnectionFromSlot(int).

Unit tests assert both clients call renewSlotCache() on the provider (mocked JedisCluster constructor and RedisClusterClient builder).

Reviewed by Cursor Bugbot for commit 1bcab78. Bugbot is set up for automated code reviews on this repo. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@agarwalbharat agarwalbharat mentioned this pull request Jun 2, 2026
Best way to "renewSlotCache" in JedisCluster? #4154
Closed
cursor[bot]
cursor Bot reviewed Jun 2, 2026
View reviewed changes

@cursor cursor Bot left a comment

Copy link
Copy Markdown

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.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Reviewed by Cursor Bugbot for commit ac634ee. Configure here.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/main/java/redis/clients/jedis/JedisCluster.java Resolved

Uh oh!

There was an error while loading. Please reload this page.

@agarwalbharat
agarwalbharat force-pushed the feature/jediscluster-public-renew-slot-cache branch from 491a718 to 80bfbf4 Compare June 2, 2026 19:07
@ggivo ggivo added the status: waiting-for-review label Jun 3, 2026
@ggivo ggivo mentioned this pull request Jun 3, 2026
Refresh slot cache when slot connection acquisition fails #4544
Closed
@ggivo

ggivo commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Thanks @agarwalbharat - One naming change before merge.

Rename the public renewSlotCache() → refreshClusterTopology().

It refreshes the full topology (nodes + primary/replica slots), not just a slot cache, and it matches the existing TopologyRefresh* naming already in the codebase. Since this is a permanent public API, worth getting the name right.

/**
 * Forces an immediate refresh of the in-memory Redis Cluster topology
 * (node map, primary and replica slot assignments).
 * <p>
 * Useful before {@link #getConnectionFromSlot(int)} when stale topology is
 * detected outside the command retry path. Best-effort; a no-op if a refresh
 * is already in progress.
 */
public void refreshClusterTopology() {
  ((ClusterConnectionProvider) provider).renewSlotCache();
}

Same on both JedisCluster and RedisClusterClient;

Thanks again!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ggivo ggivo mentioned this pull request Jun 3, 2026
Cluster topology refresh improvements: unified refresh policy #4556
Open
@agarwalbharat
Expose renewSlotCache on JedisCluster as refreshClusterTopology
1bcab78
Add JedisCluster#refreshClusterTopology() as a public API that delegates to the existing ClusterConnectionProvider renewal path. This gives applications an explicit way to refresh the in-memory cluster slot cache when they detect stale topology state outside the normal command retry flow.
@agarwalbharat
agarwalbharat force-pushed the feature/jediscluster-public-renew-slot-cache branch from 80bfbf4 to 1bcab78 Compare June 3, 2026 07:21
@agarwalbharat

agarwalbharat commented Jun 3, 2026

Copy link
Copy Markdown
Contributor Author

Thank you @ggivo for the review.
I have updated function as per suggestion.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ggivo ggivo removed the status: waiting-for-review label Jun 3, 2026
ggivo
ggivo approved these changes Jun 3, 2026
View reviewed changes

@ggivo ggivo left a comment

Copy link
Copy Markdown
Collaborator

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.

LGTM

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ggivo ggivo added this to the 8.0.0 milestone Jun 3, 2026
@ggivo ggivo added the enhancement label Jun 3, 2026
@ggivo
ggivo merged commit e6444fb into redis:master Jun 3, 2026
17 checks passed

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@ggivo ggivo ggivo approved these changes
+1 more reviewer
@cursor cursor[bot] cursor[bot] left review comments
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

enhancement

Projects

None yet

Milestone

8.0.0

Development

Successfully merging this pull request may close these issues.

Best way to "renewSlotCache" in JedisCluster?

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@agarwalbharat @ggivo
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.