Skip to content

Cannot determine a partition for slot #2252

Closed as not planned
Closed as not planned

Description

@mandeepjain

Bug Report

Current Behavior

During certain redis operations, I am facing PartitionSelectorException.

Stack trace
Caused by: io.lettuce.core.cluster.PartitionSelectorException: Cannot determine a partition for slot 12004.
	at io.lettuce.core.cluster.PooledClusterConnectionProvider.getWriteConnection(PooledClusterConnectionProvider.java:164)
	at io.lettuce.core.cluster.PooledClusterConnectionProvider.getConnectionAsync(PooledClusterConnectionProvider.java:149)
	at io.lettuce.core.cluster.ClusterDistributionChannelWriter.doWrite(ClusterDistributionChannelWriter.java:170)
	at io.lettuce.core.cluster.ClusterDistributionChannelWriter.write(ClusterDistributionChannelWriter.java:103)
	at io.lettuce.core.RedisChannelHandler.dispatch(RedisChannelHandler.java:218)
	at io.lettuce.core.cluster.StatefulRedisClusterConnectionImpl.dispatch(StatefulRedisClusterConnectionImpl.java:216)
	at io.lettuce.core.AbstractRedisAsyncCommands.dispatch(AbstractRedisAsyncCommands.java:676)
	at io.lettuce.core.AbstractRedisAsyncCommands.get(AbstractRedisAsyncCommands.java:960)
	at sun.reflect.GeneratedMethodAccessor425.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at io.lettuce.core.cluster.ClusterFutureSyncInvocationHandler.handleInvocation(ClusterFutureSyncInvocationHandler.java:122)
	at io.lettuce.core.internal.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:80)
	at com.sun.proxy.$Proxy254.get(Unknown Source)
	at org.springframework.data.redis.connection.lettuce.LettuceStringCommands.get(LettuceStringCommands.java:68)

Input Code

Code Configuration
ClusterTopologyRefreshOptions topologyRefreshOptions = ClusterTopologyRefreshOptions.builder()
            .enablePeriodicRefresh(Duration.ofSeconds(30))
            .enableAllAdaptiveRefreshTriggers()
            .build();

  ClientOptions options = ClusterClientOptions.builder()
            .disconnectedBehavior(ClientOptions.DisconnectedBehavior.REJECT_COMMANDS)
            .autoReconnect(true)
            .topologyRefreshOptions(topologyRefreshOptions)
            .build();

   GenericObjectPoolConfig genericObjectPoolConfig = new GenericObjectPoolConfig();
    genericObjectPoolConfig.setMinIdle(8);
    genericObjectPoolConfig.setMaxIdle(16);
    genericObjectPoolConfig.setMaxTotal(16);
   LettucePoolingClientConfiguration.builder()
            .poolConfig(genericObjectPoolConfig)
            .clientOptions(options)
            .clientResources(clientResources)
            .build();

Expected behavior/code

Environment

  • Lettuce version(s): [6.1.5.RELEASE]
  • Redis version: [5.0.6]
  • Shards: 6
  • Number of nodes: 12

Analysis

Redis cluster is healthy, all the metrics are as expected.

So, could give me some suggestions. Thank you!

Activity

  1. mp911de commented on Nov 22, 2022

    @mp911de
    Collaborator

    This happens if CLUSTER NODES doesn't report a master node for the intended slot.

  2. mandeepjain commented on Nov 25, 2022

    @mandeepjain
    Author

    Found the issue fixed here:
    #2178

    @mp911de I guess it was a bug in older versions

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions