Skip to content

JedisClusterHashCommands.hStrLen() should calls hstren on JedisCluster object #2392

@DonalEvans

Description

@DonalEvans

The JedisClusterHashCommands.hStrLen() method does not use the getCluster() method to allow the command to be executed correctly in Cluster mode:

	@Nullable
	@Override
	public Long hStrLen(byte[] key, byte[] field) {
		return Long.class.cast(connection.execute("HSTRLEN", key, Collections.singleton(field)));
	}

For comparison, all other methods in the class use connection.getCluster() e.g.:

	@Override
	public Map<byte[], byte[]> hGetAll(byte[] key) {

		Assert.notNull(key, "Key must not be null!");

		try {
			return connection.getCluster().hgetAll(key);
		} catch (Exception ex) {
			throw convertJedisAccessException(ex);
		}
	}

This can lead to exceptions in the client if servers are shutdown during execution of the command, instead of retying on a different server as is expected.

This bug appears to have been introduced with this commit and is still present in the latest unreleased version.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions