electric-sql / electric-sql/electric
Potential missing data on restore due to fsync not guaranteeing writes to disk
Open
- Dominant language
- TypeScript
- Stars
- 10.4k
- Forks
- 375
- Avg merge
- 3d 1h
- Merged PRs (30d)
- 18
Description
As mentioned by @alco in #2925 fsync (or `:file.datasync/1` in our code) does not guarantee that the data has been written to disk, only that the OS has been asked to. If power is lost the data may not be recoverable. #2974 acks on flush/fsync which is a big improvement on what we had before, but still allows a chance that data will be lost if we ack the flushed data and power is lost before the data is written to disk, the system restarts and resumes from a point after the missing data.
As @icehaunter has mentioned, we could look to see how other databases such as Postgres have closed this loophole.
Contributor guide
Assessment
This issue has not been assessed yet.