search

Home  >  Q&A  >  body text

redis事务具有原子性和持久性吗?

redis事务具有原子性和持久性吗?

redis设计与实现 书中说:

Redis的事务总是具有ACID中的原子性、一致性和隔离性,当服务器运行在AOF
持久化模式下,并且appendfsync选项的值为always时,事务也具有耐久性。

可看网上资料,又说redis事务不满足原子性和持久性:

求解答~~

迷茫迷茫2773 days ago788

reply all(2)I'll reply

  • 迷茫

    迷茫2017-04-24 09:14:18

    This is mainly due to doubts about the atomicity of redis. Now it has been verified that redis does not ensure atomicity. When the command execution fails in the transaction, it will not be rolled back.

    It's important to note that even when a command fails, all the other commands in the queue are processed – Redis will not stop the processing of commands.

    reply
    0
  • PHPz

    PHPz2017-04-24 09:14:18

    First of all, redis is single-threaded, so there is actually no concept of transactions, unless you use mutil to manually encapsulate a set of commands together and execute them as a whole. Specifically, if one instruction in the whole fails, will it be rolled back? You can do it yourself Take a test.
    Single-threaded, so each command is atomic. Consistency and isolation are for transactions. Redis transactions are executed by encapsulating a group of commands together, so they are isolated because they block other commands. Execution, as for consistency, if the test you do above will roll back, then it is consistent, if it does not roll back, then it is not consistent.

    reply
    0
  • Cancelreply