spring-data-redis icon indicating copy to clipboard operation
spring-data-redis copied to clipboard

`SMISMEMBER` is a unknown command for `ConnectionSplittingInterceptor`

Open SunghyunKim9744 opened this issue 1 year ago • 8 comments

Spring-data-redis 2.7.12를 사용하고 있습니다. Transactional을 활성화 했을 때, SMISMEMBER가 RedisCommand에 등록되지 않아서, Read Command임에도 RedisCommand.UNKOWN을 반환해서 결과 값으로 null을 반환합니다. (RedisConnectionUtils > ConnectionSplittingInterceptor > intercept Method)

Image

SunghyunKim9744 avatar Aug 04 '25 05:08 SunghyunKim9744

RedisTemplate.opsForSet().isMember(K key, Object... objects) 호출 시, Issue와 같은 문제가 발생합니다.

SunghyunKim9744 avatar Aug 04 '25 05:08 SunghyunKim9744

Thanks for the report. Please note that this issue tracker communication is English. Below is the translated description:

I'm using Spring-data-redis 2.7.12. When Transactional is enabled, SMISMEMBER isn't registered with RedisCommand, so even though it's a read command, it returns RedisCommand.UNKOWN, which returns null as the result value. (RedisConnectionUtils > ConnectionSplittingInterceptor > intercept Method)

mp911de avatar Aug 04 '25 06:08 mp911de

Thank you @SunghyunKim9744. The SMISMEMBER command is recognized as such and executed returning the expected result. Unfortunately it seems the result is dismissed right after when adding conversion for future results for string based redis connections.

christophstrobl avatar Aug 06 '25 10:08 christophstrobl

Thank you @christophstrobl SMISMEMBER는 RedisCommand에 등록되지 않아서 queue로 들어가고 있습니다. SISMEMBER는 RedisCommand에 있어서 queue로 들어가지 않고, 별도의 Connection에서 즉시 조회가 가능한게 아닌가요?

SunghyunKim9744 avatar Aug 06 '25 11:08 SunghyunKim9744

@SunghyunKim9744 as @mp911de already mentioned please use English for communication. Below, one more time the translated comment:

SMISMEMBER is not registered in RedisCommand, so it is being queued. Since SISMEMBER is in RedisCommand, isn't it possible to retrieve it immediately through a separate connection without being queued?

SISMEMBER can be found in RedisCommand since its inception 11 years ago. If you see it not being treated correctly, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem (again, please translate eventual comments etc. to English).

christophstrobl avatar Aug 07 '25 10:08 christophstrobl

@christophstrobl I'm sorry I didn't write it in English. The query command I mentioned is a smismember command that originated in Redis 7, not a sismember. In Spring Redis, I understand that when Transaction is enabled, the write command executes the command in Multi~Exec, but I understand that the read command executes the command immediately through a separate connection. Read commands such as GET, HGET, SISMEMBER work as I expected even if Transaction is enabled. However, SMISMEMBER is not running immediately, even though it is a read command. As a result of debug, it seems that there is no SMISMEMBER in the process of checking the read command in Rediscommand.class, so it returns Rediscommand.UNKNOWN and is recognized as a write command.

I uploaded the log result and the code to test together.

Image

demo.zip

Please check the 2nd test, 'TX - sMIs Member' txSMIsMember() Method.

SunghyunKim9744 avatar Aug 08 '25 05:08 SunghyunKim9744

thanks for clarification :+1: - well update RedisCommands, there's a couple of other commands missing as well

christophstrobl avatar Aug 08 '25 06:08 christophstrobl

@christophstrobl Hello! I was wondering if it would be okay for me to contribute to this issue and open a PR for it?

Hyeri1ee avatar Aug 24 '25 13:08 Hyeri1ee