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 — scanIteration on a cluster with replicas returns every key more than once · Issue #4797 · redis/jedis

scanIteration on a cluster with replicas returns every key more than once #4797

New issue
Copy link
New issue
Copy link
Closed
#4798
Closed
scanIteration on a cluster with replicas returns every key more than once#4797
#4798
Copy link
Labels
bug

Description

@RaphaelFakhri
RaphaelFakhri
opened on Oct 19, 2026
Issue body actions

Expected behavior

RedisClusterClient.scanIteration(...) returns each key in the cluster once.

Actual behavior

On a cluster with replicas, each key is returned once by its primary and once more by every replica of that primary. With one replica per shard, a cluster holding 100 keys yields 200 keys from scanIteration.

JedisCommandIterationBase builds its node list from ConnectionProvider.getConnectionMap(). For ClusterConnectionProvider that map holds every known node, replicas included, so SCAN runs on replicas as well as primaries. ftSearchIteration and ftAggregateIteration use the same base class.

The existing cluster tests do not catch this because they collect the result into a Set.

Steps to reproduce:

  1. Start a cluster with 3 primaries and 1 replica each (for example redis-cli --cluster create 127.0.0.1:37000 ... 127.0.0.1:37005 --cluster-replicas 1).

  2. Run:

    try (RedisClusterClient c = RedisClusterClient.builder()
        .nodes(Collections.singleton(new HostAndPort("127.0.0.1", 37000))).build()) {
      for (int i = 0; i < 100; i++) c.set("k" + i, "v");
      List<String> keys = new ArrayList<>();
      c.scanIteration(10, "*").collect(keys);
      System.out.println(keys.size() + " " + new HashSet<>(keys).size());
    }
  3. The output is 200 100. The expected output is 100 100.

Redis / Jedis Configuration

Jedis version:

8.1.0-SNAPSHOT (master at 57af871)

Redis version:

8.2

Java version:

Temurin 8

Activity

  1. ggivo
    added
    waiting-for-triageStill needs to be triaged
    bug
    and removed
    waiting-for-triageStill needs to be triaged
    on Oct 19, 2026
  2. Rainmemery commented on Oct 19, 2026

    @Rainmemery
    Rainmemery
    on Oct 19, 2026 · Hidden as outdated
    show commentMore actions
  3. Rainmemery
    added 2 commits that reference this issue on Oct 19, 2026

    Iterate SCAN-like commands over primary nodes only

    This issue will close once commit 6e07a6e is merged into the 'master' branch.
    6e07a6e

    Follow up the primary-nodes-only iteration fix for redis#4797

    This issue will close once commit d46895c is merged into the 'master' branch.
    d46895c
  4. ggivo
    closed this as completedin #4798on Oct 20, 2026
  5. ggivo commented on Oct 20, 2026

    @ggivo
    ggivo
    on Oct 20, 2026
    Collaborator
    More actions

    Fixed by #4798 (7106a66), shipping in 8.1: scanIteration, ftSearchIteration and ftAggregateIteration now visit primary nodes only, so each key is returned once. #4802 duplicates that fix and is closed.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402792 — 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.