Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
DonalEvans opened this issue Aug 26, 2022 · 2 comments
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: bug A general bug

Comments

@DonalEvans
Copy link

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Aug 26, 2022
@mp911de mp911de added type: bug A general bug status: ideal-for-contribution An issue that a contributor can help us with and removed status: waiting-for-triage An issue we've not yet triaged labels Aug 29, 2022
@mp911de
Copy link
Member

mp911de commented Aug 29, 2022

Do you want to submit a pull request to fix the problem?

@DonalEvans
Copy link
Author

Do you want to submit a pull request to fix the problem?

I'm afraid I don't have a lot of spare time to work on this, and my familiarity with the Spring Data Redis codebase and testing is almost nonexistent, so I don't feel that I would be a good choice to implement this fix.

@mp911de mp911de added this to the 2.6.7 (2021.1.7) milestone Aug 31, 2022
@mp911de mp911de changed the title Cluster mode is not honoured in JedisClusterHashCommands.hStrLen() JedisClusterHashCommands.hStrLen() should calls hstren on JedisCluster object Aug 31, 2022
mp911de added a commit that referenced this issue Aug 31, 2022
We now call hstrlen on the Cluster client instead of using our execute(…) fallback and determining the correct cluster node ourselves.

Closes #2392
mp911de added a commit that referenced this issue Aug 31, 2022
We now call hstrlen on the Cluster client instead of using our execute(…) fallback and determining the correct cluster node ourselves.

Closes #2392
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: ideal-for-contribution An issue that a contributor can help us with type: bug A general bug
Projects
None yet
Development

No branches or pull requests

3 participants