Geo: Fix attachment sync failures due to file already existing on the secondary
I think Geo::FileTransfer fails on moving the downloaded temp file to the final location. I don’t know how we get into this state, but it’s so rare (10 occurrences found) and is easily recoverable so I think we should just put in an easy fix and move on.
Here are some options:
-
Compare the downloaded file and the existing file, and if same, exit with success, else fail. This is the most work but may be helpful for debugging problems.
-
Let
Geo::FileTransferoverwrite a blocking file. This is probably fine. The primary is the authority. I vote for this one. -
Check if file exists before attempting transfer, and mark as synced if so. This one feels less right.
-
Find the earliest GitLab version this fix needs to go into, and set Milestone and Pick labels