I wonder how bgsave can ensure the data consistency at the exactly snapshot timestamp ? when I read the source code , I found it use fork to dump the database into rdb files, but if there is redis client operations during the bgsave, the fork process just iterate the key-values pairs one by one, so that means it may dump the latest key values rather than the snapshot timestamp versions as fork function use copy-on-write mechanism of Linux OS

does that the original decision point to implement in this way regardless of data version of snapshot, or anything I am missing?

Thanks a lot

Comment From: trevor211

It's okey for redis to iterate the key-value pairs one by one in the child process. Child process won't see the updated new key values thanks to copy-on-write mechanism of Linux OS.

Comment From: itamarhaber

Thank you for answering @trevor211 🙇

@qingyuan18 it appears your question has been answered so this issue will now be closed. Please feel free to reopen or create a new issue if needed.