Redis scripts: transaction guarantees in case of server crash

55 views
Skip to first unread message

Kian Karas

unread,
Oct 3, 2018, 8:53:02 AM10/3/18
to Redis DB
Hi

The documentation (https://redis.io/topics/transactions) describes how transactions (MULTI/EXEC) are handled in case of server crash: the transaction is applied fully or not at all. It also states that "A Redis script is transactional by definition".

1) Does this mean that Redis script "transactions" are written to persistent storage as transactions (e.g. with a begin/end marker) and a partial script execution (e.g. due to power loss) will be detected and cleaned up during server start?
2) Can partial transactions only be present in AOF files or in RDB too?

I'm working on a product that can loose power at any moment (we haven't used scripts until now). Hence, I need to be sure that power loss during script execution will never cause partial modifications.

Regards
Kian

hva...@gmail.com

unread,
Oct 3, 2018, 11:56:10 AM10/3/18
to Redis DB
Read further in that 2nd bullet point on the transactions documentation page:

However if the Redis server crashes or is killed by the system administrator in some hard way it is possible that only a partial number of operations are registered. Redis will detect this condition at restart, and will exit with an error. Using the redis-check-aof tool it is possible to fix the append only file that will remove the partial transaction so that the server can start again.

Redis calls these blocks of commands (between MULTI and EXEC) "transactions", but they do not work the same way as transactions in relational databases and other software products.

Kian Karas

unread,
Oct 3, 2018, 12:51:06 PM10/3/18
to redi...@googlegroups.com
I don't think I understand your point.

My questions, whether what you referenced also applies to "Redis scripts" or it only applies to MULTI/EXEC.

--
You received this message because you are subscribed to the Google Groups "Redis DB" group.
To unsubscribe from this group and stop receiving emails from it, send an email to redis-db+u...@googlegroups.com.
To post to this group, send email to redi...@googlegroups.com.
Visit this group at https://groups.google.com/group/redis-db.
For more options, visit https://groups.google.com/d/optout.

Nikita Belov

unread,
Mar 2, 2021, 1:41:23 PM3/2/21
to Redis DB
Hi! I have the same question. Did you get an answer for this?

среда, 3 октября 2018 г. в 19:51:06 UTC+3, Kian Karas:
Reply all
Reply to author
Forward
0 new messages