I am new to redis. I have an application in which i have multiple redis commands which makes a transaction. If one of them fails does redis rollback the transaction like relational databases ? Is it users responsibility to rollback the transaction ?
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. This time due to the syntax error the bad INCR command is not queued at all.
Redis transaction is also atomic. Atomic means either all of the commands or none are processed.
Using a single AWS EC2 instance, Redis was able to achieve 1,200,000 transactions per second at <1 msec (sub millisecond) latency. Redis is an open source in-memory NoSQL database that has taken the developer community by storm.
The watch command in Redis allows you to implement the check-and-set feature. The WATCH commands accept Redis keys as parameters and monitor them. If any of the specified keys are changed before the EXEC command is called, Redis automatically terminates the transaction and returns a Null reply.
Redis does not rollback transactions like the relational databases does.
If you have a relational databases background, the fact that Redis commands can fail during a transaction, but still Redis will execute the rest of the transaction instead of rolling back, may look odd to you.
However there are good opinions for this behavior:
Redis commands can fail only if called with a wrong syntax (and the problem is not detectable during the command queuing), or against keys holding the wrong data type: this means that in practical terms a failing command is the result of a programming errors, and a kind of error that is very likely to be detected during development, and not in production.
Redis is internally simplified and faster because it does not need the ability to roll back.
Check it out Why redis does not support rollback transactions
from the documentation and from here .
Documentaion here. Redis does not supports rollback.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With