All operations that deal with primary data (article text and file content) should be atomic; is something fails, the original state should be restored. This is currently not the case for files, which can get lost on rename or delete/restore (which is all the more scary given that they are no image dumps so they often cannot be recovered). This should be improved.
Some examples of data loss:
- T17430: Uploads sometimes are incomplete: file is there, but image page is missing
- T37367: 404 for old file versions on Wikimedia Commons with empty archive name
- T41615: 404 error for all revisions of some files
- T71311: Swift outage caused a bunch of moved files to be "inconsistent" and "missing"
- T72416: "Original file" seems to be missing at Commons for an image
- T111838: Some files had disappeared from Commons after renaming
- T131020: File disappeared while attempting to move another file over it.
- T147040: Two recently uploaded files have disappeared (404)
- T179884: Files occasionally getting uploaded to Commons without file pages.
- T198177: Due to PHP fatal, a new version upload overwrote a file (the original is gone)