Optimize comparisons for selected files - #1180
EdwardBlair wants to merge 3 commits into
Conversation
Avoid constructing a complete snapshot-tree comparison when undochange is given explicit paths. Compare only those paths, while preserving status, ignore-filter, and undo semantics. Perform selected comparisons inside snapperd so unprivileged clients do not need direct snapshot access. Add a D-Bus method for the bounded comparison and fall back to the existing full comparison when a new client is connected to an older daemon. Balance comparison and snapshot lifetimes on success and failure, make unmount cleanup non-throwing, reject paths outside the configured subvolume, and cover comparison and undo behavior with focused tests.
|
Optional automated CLI/D-Bus regression coverage is available as a stacked draft PR against this PR’s head branch: EdwardBlair#2 It runs the real |
|
What I dislike about the PR is that need features are added to snapperd. In the end I cannot see a reason why this cannot be entirely be implemented in the client (with help of libsnapper). |
|
I see what you mean now this is the wrong layer. If I understand correctly the client should use the existing snapshot mount paths and libsnapper to compare only the explicitly requested files.. I hadn't realised this was possible because the surface-level/proxy API does not obviously expose the underlying snapshot path, which made it look as though the comparison had to stay behind the daemon boundary. I shall investigate this. It looks like it will be a much leaner change! |
Summary
undochange,diff, orxadiffis given explicit pathssnapperd, with compatibility fallback for older daemonsFixes #251.
Testing
make checkin a disposable openSUSE Tumbleweed Podman containerselected-files.testcoverage for modified, created, deleted, type-changed, permission-changed, ignored, duplicate, and rejected paths, plus undo executiontestsuite-real: all 16 tests passed against a loopback Btrfs filesystem in a privileged disposable Podman container, including permissions, ownership, error handling, xattrs, and ACL restorationsnapperCLI, system D-Bus,snapperd, and a loopback Btrfs filesystem:/homeconfiguration with real snapshot history:snapper diff 1732..0 ~/.codex/config.toml: 36.355 s with Arch'ssnapper 0.13.1/libsnapper 8.0.0, 0.011 s with this branch (~3,300x faster)snapper undochange 1732..0 ~/.codex/config.toml: 21.235 s with Arch'ssnapper 0.13.1/libsnapper 8.0.0, 0.011 s with this branch (~1,930x faster)create:0 modify:1 delete:0, confirming that it performed a real restorationsnapperd, comparison, and filesystem workI use Arch btw 😉