spring-projects/spring-data-redis

`rangeWithScores()` resolves to `RedisCommand.UNKNOWN` inside transaction

Closed this issue · 2 comments

When using rangeWithScores(...) inside a transaction (i.e. with @Transactional and setEnableTransactionSupport(true)), it unexpectedly returns null instead of the set of values.

Internally, the command is correctly built as:

// RedisCommandBuilder#zrangeWithScores
Command<K, V, List<ScoredValue<V>>> zrangeWithScores(K key, long start, long stop) {
    notNullKey(key);
    CommandArgs<K, V> args = new CommandArgs(this.codec);
    args.addKey(key).add(start).add(stop).add(CommandKeyword.WITHSCORES);
    return this.createCommand(CommandType.ZRANGE, new ScoredValueListOutput(this.codec), args);
}

However, this command is ultimately resolved as RedisCommand.UNKNOWN because of:

RedisCommand commandToExecute = RedisCommand.failsafeCommandLookup(method.getName());

in ConnectionSplittingInterceptor#intercept();

Image

Hi @mp911de, @christophstrobl. Would it be okay if i give it a try on this issue?

Fix PR: #3225