Bug 6667 - proposal: --transaction
Summary: proposal: --transaction
Alias: None
Product: rsync
Classification: Unclassified
Component: core (show other bugs)
Version: 3.1.0
Hardware: All All
: P3 enhancement (vote)
Target Milestone: ---
Assignee: Wayne Davison
QA Contact: Rsync QA Contact
Depends on:
Reported: 2009-08-27 17:18 UTC by Dave Yost
Modified: 2009-08-27 18:06 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description Dave Yost 2009-08-27 17:18:29 UTC
someday, perhaps with zfs, file system APIs will offer transaction wrapper functions, something like fio_begn(), fio_cancel(), fio_commit().

In the meantime (another 10 years?) until that happy day arrives, rsync could fake an almost transactional update in the following manner: instead of creating hidden files as you go, create a hidden directory at the root of the tree containing all files being transferred. Populate this new tree with transferred files, then when all have been transferred, hard link all the rest of the files from the existing tree into the new tree. Finally, rename the existing tree to a backup name, rename the new tree into place, then rm -rf the renamed old tree.

--transaction and --partial would work well together.
Comment 1 Carson Gaspar 2009-08-27 17:50:11 UTC
Except that assumes rsync will never traverse a filesystem boundary. Be very careful about your assumptions...
Comment 2 Matt McCutchen 2009-08-27 18:06:58 UTC
The "atomic-rsync" script distributed with rsync in the "support" dir does what you propose.