Snapchat / KeyDB

A Multithreaded Fork of Redis
https://keydb.dev
BSD 3-Clause "New" or "Revised" License
11.02k stars 564 forks source link

Flash multi exec on hard restart/crash #831

Open keithchew opened 1 month ago

keithchew commented 1 month ago

Stress testing KeyDB on v6.3.4, we encountered a scenario where we got partial data written within a multi/exec block. Looking at a comment from Redis:

When using the append-only file, Redis makes sure to use a single write(2) syscall 
to write the transaction on disk. 

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.

What happens in KeyDB when Flash is used? I am guessing there is no equivalent check for partial written records after a crash. Just wanted to confirm, so that we are aware of it when the scenario happens.