Server SD card failure leads to replacement with old versions of files

Hi,

last week, the SD card in my Raspberry Pi I am hosting a Seafile Community Server on went rogue—as I have learned now, most SD cards have a pre-failure mode where they do not allow any writes onto the card, but reading is still possible. This made the Raspberry main drive de facto read-only.
In this state, Seafile was seemingly able to write versions of synced files to the external disk where the Seafile data is stored, but likely wrote changes to the MySQL database on the SD card which were lost immediately after writing.
So far, so bad, but nothing dramatic. What WAS dramatic, however, was the following: At some point (before I noticed what was going on), all Seafile clients of all users (all Macs) decided to replace local files with old server versions of these files, presumably the last versions that were correctly recorded in the server MySQL database. Fortunately, I noticed this early enough to be able to restore the files from manually searching them in the storage directory of the Seafile data, where the server fortunately still stored the more recent versions of these files.
Why am I writing all this? In my opinion, the Seafile client should have a strict restriction to NEVER EVER replace local files by versions with older modified dates from the server to prevent local damage when the server misbehaves. It would be great if someone can check the sync logic to prevent such problems.
Unfortunately, due to the nature of the server-side problem there were no server-side logs, and I did not find anything related in the client-side logs, but I could try again if someone told me what exactly to look for.

Thank you very much!

2 Likes