Increase File integrity during file saving
Closed this issue · 3 comments
User Story
A user of Mastodon recently reported that his *.mastodon file was corrupted after/during a crash of Fiji/Mastodon that perhaps was related to #295. It is not exactly clear how *.mastodon could get corrupted and currently no reproducible workflow exists that would create such a corrupt file. However, the result for the user is annoying, since if no other backup strategy existed potentially many hours of tracking may be lost.
Potential solution
- When saving the mastodon project file, it is first saved to projectname_pending.mastodon
- When saving to this file was successful, projectname.mastodon get overwritten with projectname_pending.mastodon
- This would ensure that the actual project file is only overwritten, when the saving process was successful and not interrupted
Related to #298
I think it is a good solution. Are we sure that the crash happened during saving?
I think it is a good solution. Are we sure that the crash happened during saving?
No, we are not sure. It was not possible to reproduce the case that a corrupted mastodon file got created.
However, we assume the reason for a saved mastodon file getting corrupted, if something happens during the process of saving.
On my machine I can produce saving times ranging from ~0,2s to ~2s (depending on project size, attributes, etc.). Not very long, but long enough to kill mastodon during the saving process.
Resolved via #311