Skip to content

Commit

Permalink
Fix deletion occuring during transfer with delay-updates
Browse files Browse the repository at this point in the history
The --delay-updates option in Rsync delays updates of files, however deletions
default to the "delete during" mode unless the "--delete-delay" option is given.
The lack of the delayed deletes mode currently is an oversight that means a
target filesystem can be in a partially changed state during a deployment, and
an aborted/parital deployment can cause the target filesystem to lose files
silently.

This issue hasn't caused any noticable issues in over two years of production
use, but it's a potential risk so needed fixing. Picked up while searching the
rsync man page for unrelated reasons.

> The --delete option may be combined with one of the --delete-WHEN options  without  conflict,
> as  well  as --delete-excluded.  However, if none of the --delete-WHEN options are specified,
> rsync will choose the --delete-during algorithm when talking to rsync 3.0.0 or newer, and the
> --delete-before  algorithm  when  talking  to  an  older  rsync.
  • Loading branch information
stecman committed Sep 19, 2015
1 parent a466b0d commit 09f385d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/DeploymentProvider/Rsync.php
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ protected function buildCommand($fromPath, $toPath, $dryrun = false)
}
if ($this->options['delay-updates']) {
$command[] = '--delay-updates';

if ($this->options['delete']) {
$command[] = '--delete-delay';
}
}

$command[] = array(
Expand Down

0 comments on commit 09f385d

Please sign in to comment.