(error) ERR wrong number of arguments for 'set' command
127.0.0.1:6379> EXEC
(error) EXECABORT Transaction discarded because of previous errors.
复制代码
这时候,所有命令都不会执行。这符合我们对“事务”的预期。
2. 执行时的“运行时错误”(虽死犹进)
这才是真正的坑。假设语法没问题,但在执行期间,某条命令因为数据类型不匹配报错了:
[code]127.0.0.1:6379> MULTIOK127.0.0.1:6379> SET user:A:points 100QUEUED127.0.0.1:6379> LPUSH user:A:points "error_data" # INCR user:A:points # EXEC1) OK2) (error) WRONGTYPE Operation against a key holding the wrong kind of value