From c8088839270c8994c0533d2fbfec7e5ade69cb57 Mon Sep 17 00:00:00 2001 From: tv Date: Mon, 30 Nov 2026 18:07:34 +0000 Subject: populate file: skip sources rsync would find nothing to do for Each rsync run costs several round trips to the target, and about 45 ms of rsync waiting for its own processes, also with nothing to transfer, so a run with many file sources and nothing to change took long: 25.5 s for the bench's 50 file, 30 symlink, and 20 git sources with 30 ms to the target, 20 s of that waiting for round trips. Right after taking the lock, one command lists the target paths of the file sources that are directories, compared by size and time, and whose lock file the flakes step doesn't rewrite, with find. At its turn, each such source lists what rsync would transfer: with find, if nothing excludes or filters anything, else with rsync --list-only, which is also the run checking the .rsync-filter files, instead of a dry run. If both listings have the same entries, with mode and path, and for files size and time in whole seconds, and for symlinks the target, which is what rsync's quick check compares, neither break_hard_links nor rsync runs. Entries populate can't compare (paths with control characters, devices), and sources that need --insecure-links, run rsync. The scenario file-skip checks that an unchanged source keeps another hard link of a file, which break_hard_links would break, and that a file too many, a file's time, a directory's mode, and an excluded file make the sources deliver again. --- pkgs/populate/docs/design.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'pkgs/populate/docs') diff --git a/pkgs/populate/docs/design.md b/pkgs/populate/docs/design.md index 4421942..abb85e7 100644 --- a/pkgs/populate/docs/design.md +++ b/pkgs/populate/docs/design.md @@ -107,6 +107,21 @@ via `sudo`. Populate runs rsync, Git, ssh, and Nix as programs, found in `PATH`. +Each rsync run costs several round trips to the target, and about 45 ms +of rsync waiting for its own processes, also when there's nothing to +transfer. So file sources that rsync would find nothing to do for get +skipped: right after taking the lock, one command lists the target paths +of the file sources that are directories, compared by size and time, and +whose lock file the flakes step doesn't rewrite, with find. Each such +source's turn lists what rsync would transfer, with find if nothing +excludes or filters anything, else with `rsync --list-only`, the same run +that checks the `.rsync-filter` files. If both listings have the same +entries, with mode and path, and for files size and time in whole seconds, +and for symlinks the target, as far as rsync's quick check goes, neither +`break_hard_links` nor rsync runs. Entries populate can't compare, e.g. +paths with control characters, devices, or a source that needs +`--insecure-links`, make it run rsync. + ## Development - `cargo test` in this directory runs the program's unit tests. -- cgit v1.3.1