4 ms·
I'll admit that one reason I'm unusually grumpy about this is that I feel rather unhappy not knowing what I need to do to safeguard data that I care about. ...
by userbinator 11y ago
I'll admit that one reason I'm unusually grumpy about this is that I feel rather unhappy not knowing what I need to do to safeguard data that I care about.
...backups?
This issue is not unsolvable at a technical level, but it probably is at a political level. Someone would have to determine and write up what is good enough now (on sane setups), and then Unix kernel people would have to say 'enough, we are not accepting changes that break this de facto standard'. You might even get this into the Single Unix Specification in some form if you tried hard, because I really do think there's a need here.
Or we could just have everyone perform regular backups like they already are/should be doing, and decide that if systems are crashing so frequently as to lose data often enough, trying to "fix" this "problem" by adding what would likely be another mass of design-by-committee complexity to filesystems is not addressing the cause but only its symptoms.
Then again, with over two decades of experience using the FAT filesystem and never a single instance of unrecoverable data loss despite sudden crashes while hearing countless tales of others corrupting their data frequently even when using far more complex and "robust" filesystems, it makes me wonder why I don't seem to suffer quite the same problems...
- wanderr 11y agoBackups do not solve the problem of not knowing whether data you just wrote to disk will still be there in the event of a power outage or system crash. You know, before a backup has a chance to run. Sure, those events should be extremely rare but that doesn't mean that we can or should just ignore it, at a large enough scale even extremely improbable events are guaranteed to happen.
- userbinator 11y agoBackups do not solve the problem of not knowing whether data you just wrote to disk will still be there in the event of a power outage or system crash. It's not a "problem", it's just reality. You can't predict when exactly the crash will occur relative to the disk write or backups.
- colanderman 11y agoThe OP has nothing to do with backups. fsync(2) and friends are also necessary to ensure correct ordering of writes to disk, which in some ways is more important than ensuring that the data is actually committed. If certain writes aren't written in the order expected, then applications lose crash consistency and now you have corrupt data, not just missing data.
- yuubi 11y agoIn many applications, crashes are less of a problem than falsely believing a write happened persistently. Consider a mail server: if it can wait until the message is really saved before returning the final success response, then a crash means a retry later (and maybe a duplicated message if the crash happened in the small window between the write committing and the response going out) rather than a lost message.
- johnbender 11y agoBackups don't help if writes don't make it to disk in the order and manner expected by the application programmer. There's an emerging consensus that there are crash protocol bugs lurking everywhere due to I/O scheduler reordering. For example this bug in gzip: http://bugs.gnu.org/22768 http://bugs.gnu.org/22768
- EdiX 11y agoThis bug report is truly surreal. A filesystem could easily just write on disk directly skipping write buffers, the whole reason they don't is "because performance". In fact the "file system mathematically guaranteed to not lose data" is too slow to be used in practice and will implement fsync/fdatasync in the future to regain performance (and in the process it will stop being "mathematicall guaranteed not to lose data"). Clearly the solution is to add fsync/fdatasync calls to every single program so as to negate the performance gains of file system write buffers entirely. Clearly, the next step after that is for filesystem to start ignoring fsync/fdatasync entirely, because otherwise they would be too slow.
- Pyxl101 11y agoNot a good answer for application servers. You can lose data in between the application issuing the write and the disk persisting it, and in between persistence and backup. The absence of data corruption doesn't necessarily mean the presence of all data either. Imagine a fleet of application servers that write several times per second and there are hundreds of them. How would you know if one write had gotten lost in a power failure? The best available answer among folks who need one is to pass all writes through a distributed system that can commit the data durably: data replicated in real time as part of the process of committing a write, the metadata tracked with a quorum or lock managed by quorum.