#84 Avoid file list updates when cleaning up interrupted run
Opened 3 years ago by tibbs. Modified 3 years ago

If a run is interrupted, the next run will try to restore things from .~tmp~ directories. This is a useful optimization in many cases, even though it does break the "semi-atomicity" of rsync's delayed updates. But when doing this, we really shouldn't update the file lists, because then downstream mirrors will try to pull content that doesn't exist.

Possible options:

  • Explicitly skip the file lists.
  • Don't update from .~tmp~ directories in the top level of the module.
  • Avoid attempting to recover files if a file of the same name already exists on the filesystem.

The latter conveniently avoids the problem of overwriting existing content before the mirror operation is finished, which is a much bigger problem than simply adding the new files early. It's also a deoptimization for the case of large files like install.img which change contents but not name. On balance it's probably worth it for mirror stability.

I know there is a weird rsync bug where rsync will simply always fail to copy some files with "failed verification" errors which is solved by cleaning up .~tmp~ directories, which might somehow be related. Unfortunately I haven't managed to trigger it on demand.


Turns out that we already avoid overwriting existing files during the recovery phase. So the only thing I can think of which causes file lists to get updated before the content is simply the order in which rsync moves things into place at the end of the transfer. This can take perhaps tens of minutes for a really big transfer, and if the file lists are moved first then downstream mirrors will see them before the content exists.

I see this fairly regularly because I have two full mirrors, one pulling from the other (which pulls directly from dl-tier1) every ten minutes. So a window of even a couple of minutes means I will see the problem fairly often.

A solution at this point is hinted at by the rsync manpage itself under "SORTED TRANSFER ORDER" which says to use a different rsync transaction. So that would mean just doing the file list update in a separate call, or update the file list manually using the one downloaded at the beginning of the process.

Login to comment on this ticket.

Metadata