apache / apache/incubator-seata

ERR keys of command in MULTI calls must be in same slot

Open
#3,306 1 comment 0 reactions 0 assignees View on GitHub
task: help-wanted
Dominant language
Java
Stars
26k
Forks
8.8k
Avg merge
1d 8h
Merged PRs (30d)
4

Description

- [ ] I have searched the [issues](https://github.com/seata/seata/issues) of this repository and believe that this is not a duplicate.

### Ⅰ. Issue Description
seata-server使用Redis store模式下,连接的是的Redis集群时,会报错。

### Ⅱ. Describe what happened

If there is an exception, please attach the exception trace:

io.seata.common.exception.RedisException: ERR keys of command in MULTI calls must be in same slot
at io.seata.server.storage.redis.store.RedisTransactionStoreManager.updateGlobalTransactionDO(RedisTransactionStoreManager.java:295)
at io.seata.server.storage.redis.store.RedisTransactionStoreManager.writeSession(RedisTransactionStoreManager.java:99)
at io.seata.server.storage.redis.session.RedisSessionManager.updateGlobalSessionStatus(RedisSessionManager.java:98)
at io.seata.server.session.AbstractSessionManager.onStatusChange(AbstractSessionManager.java:122)
at io.seata.server.session.GlobalSession.changeStatus(GlobalSession.java:163)
at io.seata.server.coordinator.DefaultCoordinator.lambda$timeoutCheck$0(DefaultCoordinator.java:235)
at io.seata.server.storage.redis.session.RedisSessionManager.lockAndExecute(RedisSessionManager.java:191)
at io.seata.server.session.SessionHolder.lockAndExecute(SessionHolder.java:324)
at io.seata.server.coordinator.DefaultCoordinator.timeoutCheck(DefaultCoordinator.java:229)
at io.seata.server.coordinator.DefaultCoordinator.lambda$init$4(DefaultCoordinator.java:404)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.lang.Thread.run(Thread.java:748)
Caused by: redis.clients.jedis.exceptions.JedisDataException: ERR keys of command in MULTI calls must be in same slot
at redis.clients.jedis.Protocol.processError(Protocol.java:132)
at redis.clients.jedis.Protocol.process(Protocol.java:166)
at redis.clients.jedis.Protocol.read(Protocol.java:220)
at redis.clients.jedis.Connection.readProtocolWithCheckingBroken(Connection.java:318)
at redis.clients.jedis.Connection.getUnflushedObjectMultiBulkReply(Connection.java:280)
at redis.clients.jedis.Connection.getObjectMultiBulkReply(Connection.java:285)
at redis.clients.jedis.Transaction.exec(Transaction.java:46)
at io.seata.server.storage.redis.store.RedisTransactionStoreManager.updateGlobalTransactionDO(RedisTransactionStoreManager.java:265)
... 17 common frames omitted

### Ⅲ. Describe what you expected to happen

### Ⅳ. How to reproduce it (as minimally and precisely as possible)
store {
mode = "redis"

redis {
host = "r-xxxxxxxx.redis.rds.aliyuncs.com"
port = "6379"
password = ""
database = "11"
minConn = 1
maxConn = 10
maxTotal = 100
queryLimit = 100
}

}
### Ⅴ. Anything else we need to know?

### Ⅵ. Environment:

- JDK version :
- OS :
- Others:

Contributor guide

Open the contributing guide

Research direction

Start by reading RedisTransactionStoreManager.updateGlobalTransactionDO at lines 265 and 295, then trace the write through RedisSessionManager as shown in the stack trace. Reproduce with the Redis store configuration and a Redis cluster. Done means the reported MULTI same-slot exception no longer occurs in this scenario.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, redis
Domain
backend, databases, distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.