Lakin benim de pek sevdiğim Redis'de işler böyle yürümüyor.
Redis özelliklerinni listelendiği sayfada "Transaction" da yer alıyor :
Fakat redis transaction ile şunu kastediyor :
- Failsafe query
- Sorgularınızın ya tamamı çalışır ya da hiç biri çalışmaz.
Aklınızda olsun her transaction özelliği rollback özelliği var demek olmuyor. Redis'de kendiniz rollback yapacaksınız.
Redisin bu duruma mantıklı bir açıklaması var tabi
Why Redis does not support roll backs?
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 queueing), 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.
An argument against Redis point of view is that bugs happen, however it should be noted that in general the roll back does not save you from programming errors. For instance if a query increments a key by 2 instead of 1, or increments the wrong key, there is no way for a rollback mechanism to help. Given that no one can save the programmer from his errors, and that the kind of errors required for a Redis command to fail are unlikely to enter in production, we selected the simpler and faster approach of not supporting roll backs on errors.
- Redis is internally simplified and faster because it does not need the ability to roll back.
Konuyla ilgili diğer bağlantılar
- http://nosql.mypopescu.com/post/568248288/redis-multi-exec-discard-and-transactions
- http://stackoverflow.com/questions/7006268/redis-multi-inusring-atomicity/15321309#15321309
- http://redis.io/topics/transactions
[1] Transaction processing : http://en.wikipedia.org/wiki/Transaction_processing
No comments:
Post a Comment